From a2f0f7754ddd1f3f73bfe7f739c87acba7e597bc Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 2 Oct 2020 19:30:01 +0200 Subject: [PATCH] Fix integer types. --- server/TracySourceView.cpp | 20 +++++++++++--------- server/TracySourceView.hpp | 16 ++++++++-------- server/TracyWorker.cpp | 4 ++-- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp index 2e089516..49a9c2bc 100644 --- a/server/TracySourceView.cpp +++ b/server/TracySourceView.cpp @@ -777,7 +777,7 @@ bool SourceView::Disassemble( uint64_t symAddr, const Worker& worker ) } #endif - const auto mLen = strlen( op.mnemonic ); + const auto mLen = (int)strlen( op.mnemonic ); if( mLen > mLenMax ) mLenMax = mLen; if( op.size > bytesMax ) bytesMax = op.size; @@ -821,7 +821,7 @@ bool SourceView::Disassemble( uint64_t symAddr, const Worker& worker ) { auto it = m_jumpTable.find( v.target ); assert( it != m_jumpTable.end() ); - int level = 0; + size_t level = 0; for(;;) { assert( levelRanges.size() >= level ); @@ -2063,7 +2063,7 @@ uint64_t SourceView::RenderSymbolAsmView( uint32_t iptotal, unordered_flat_mapnumVariants; i++ ) { const auto& var = *op->variant[i]; - if( var.descNum == line.params.size() ) + if( var.descNum == (int)line.params.size() ) { int penalty = 0; bool match = true; @@ -3542,7 +3542,7 @@ void SourceView::ResetAsm() for( auto& line : m_asm ) memset( line.regData, 0, sizeof( line.regData ) ); } -void SourceView::FollowRead( int line, RegsX86 reg, int limit ) +void SourceView::FollowRead( size_t line, RegsX86 reg, size_t limit ) { if( limit == 0 ) return; const auto& data = m_asm[line]; @@ -3562,7 +3562,7 @@ void SourceView::FollowRead( int line, RegsX86 reg, int limit ) } } -void SourceView::FollowWrite( int line, RegsX86 reg, int limit ) +void SourceView::FollowWrite( size_t line, RegsX86 reg, size_t limit ) { if( limit == 0 ) return; const auto& data = m_asm[line]; @@ -3577,14 +3577,15 @@ void SourceView::FollowWrite( int line, RegsX86 reg, int limit ) CheckWrite( fit - m_asm.begin(), reg, limit ); } } - if( line-1 >= 0 ) + if( line > 0 ) { CheckWrite( line-1, reg, limit ); } } -void SourceView::CheckRead( int line, RegsX86 reg, int limit ) +void SourceView::CheckRead( size_t line, RegsX86 reg, size_t limit ) { + assert( limit > 0 ); auto& data = m_asm[line]; int idx = 0; for(;;) @@ -3642,8 +3643,9 @@ void SourceView::CheckRead( int line, RegsX86 reg, int limit ) } } -void SourceView::CheckWrite( int line, RegsX86 reg, int limit ) +void SourceView::CheckWrite( size_t line, RegsX86 reg, size_t limit ) { + assert( limit > 0 ); auto& data = m_asm[line]; int idx = 0; for(;;) diff --git a/server/TracySourceView.hpp b/server/TracySourceView.hpp index a139818f..475211de 100644 --- a/server/TracySourceView.hpp +++ b/server/TracySourceView.hpp @@ -115,7 +115,7 @@ private: { uint64_t min; uint64_t max; - int level; + size_t level; std::vector source; }; @@ -169,10 +169,10 @@ private: std::vector Tokenize( const char* begin, const char* end ); void ResetAsm(); - void FollowRead( int line, RegsX86 reg, int limit ); - void FollowWrite( int line, RegsX86 reg, int limit ); - void CheckRead( int line, RegsX86 reg, int limit ); - void CheckWrite( int line, RegsX86 reg, int limit ); + void FollowRead( size_t line, RegsX86 reg, size_t limit ); + void FollowWrite( size_t line, RegsX86 reg, size_t limit ); + void CheckRead( size_t line, RegsX86 reg, size_t limit ); + void CheckWrite( size_t line, RegsX86 reg, size_t limit ); #ifndef TRACY_NO_FILESELECTOR void Save( const Worker& worker, size_t start = 0, size_t stop = std::numeric_limits::max() ); @@ -223,7 +223,7 @@ private: unordered_flat_map m_locMap; unordered_flat_map m_jumpTable; unordered_flat_set m_jumpOut; - int m_maxJumpLevel; + size_t m_maxJumpLevel; bool m_showJumps; unordered_flat_map m_sourceFiles; @@ -243,8 +243,8 @@ private: unordered_flat_set m_asmSampleSelect; unordered_flat_set m_srcSampleSelect; - uint32_t m_asmGroupSelect = -1; - uint32_t m_srcGroupSelect = -1; + int32_t m_asmGroupSelect = -1; + int32_t m_srcGroupSelect = -1; float m_srcWidth; float m_asmWidth; diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 7d432879..9bb8b3cb 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -3943,9 +3943,9 @@ int Worker::AddGhostZone( const VarArray& cs, Vectorempty() ? 0 : vec->back().end.Val(); + const int64_t refBackTime = vec->empty() ? 0 : vec->back().end.Val(); int gcnt = 0; - int idx = 0; + size_t idx = 0; while( !vec->empty() && idx < stack.size() ) { auto& back = vec->back();