1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 12:23:53 +00:00

Fix integer type warnings

This is necessary to compile Tracy-instrumented code in
codebases built with -Werror.
This commit is contained in:
Felipe Oliveira Carvalho 2020-11-19 16:36:01 +01:00
parent e580dfeed3
commit c9865c5f95
3 changed files with 6 additions and 6 deletions

View File

@ -100,8 +100,8 @@ static tracy_force_inline void* Callstack( int depth )
{ {
assert( depth >= 1 ); assert( depth >= 1 );
auto trace = (uintptr_t*)tracy_malloc( ( 1 + depth ) * sizeof( uintptr_t ) ); auto trace = (uintptr_t*)tracy_malloc( ( 1 + (size_t)depth ) * sizeof( uintptr_t ) );
const auto num = backtrace( (void**)(trace+1), depth ); const auto num = (size_t)backtrace( (void**)(trace+1), depth );
*trace = num; *trace = num;
return trace; return trace;

View File

@ -98,8 +98,8 @@ public:
private: private:
tracy_no_inline void AllocMore() tracy_no_inline void AllocMore()
{ {
const auto cap = ( m_end - m_ptr ) * 2; const auto cap = size_t( m_end - m_ptr ) * 2;
const auto size = m_write - m_ptr; const auto size = size_t( m_write - m_ptr );
T* ptr = (T*)tracy_malloc( sizeof( T ) * cap ); T* ptr = (T*)tracy_malloc( sizeof( T ) * cap );
memcpy( ptr, m_ptr, size * sizeof( T ) ); memcpy( ptr, m_ptr, size * sizeof( T ) );
tracy_free( m_ptr ); tracy_free( m_ptr );

View File

@ -144,7 +144,7 @@ public:
# elif defined __x86_64__ || defined _M_X64 # elif defined __x86_64__ || defined _M_X64
uint64_t rax, rdx; uint64_t rax, rdx;
asm volatile ( "rdtsc" : "=a" (rax), "=d" (rdx) ); asm volatile ( "rdtsc" : "=a" (rax), "=d" (rdx) );
return ( rdx << 32 ) + rax; return (int64_t)(( rdx << 32 ) + rax);
# else # else
# error "TRACY_HW_TIMER detection logic needs fixing" # error "TRACY_HW_TIMER detection logic needs fixing"
# endif # endif
@ -639,7 +639,7 @@ private:
{ {
assert( len <= TargetFrameSize ); assert( len <= TargetFrameSize );
bool ret = true; bool ret = true;
if( m_bufferOffset - m_bufferStart + len > TargetFrameSize ) if( m_bufferOffset - m_bufferStart + (int)len > TargetFrameSize )
{ {
ret = CommitData(); ret = CommitData();
} }