From e4fbf6066865143da071e1cd3a3ee99368002204 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 21 Jul 2020 02:19:22 +0200 Subject: [PATCH] Add SendString() with length parameter. --- client/TracyProfiler.cpp | 3 +-- client/TracyProfiler.hpp | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 873b4e28..67685dab 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -2212,7 +2212,7 @@ bool Profiler::SendData( const char* data, size_t len ) return m_sock->Send( m_lz4Buf, lz4sz + sizeof( lz4sz_t ) ) != -1; } -void Profiler::SendString( uint64_t str, const char* ptr, QueueType type ) +void Profiler::SendString( uint64_t str, const char* ptr, size_t len, QueueType type ) { assert( type == QueueType::StringData || type == QueueType::ThreadName || @@ -2226,7 +2226,6 @@ void Profiler::SendString( uint64_t str, const char* ptr, QueueType type ) MemWrite( &item.hdr.type, type ); MemWrite( &item.stringTransfer.ptr, str ); - auto len = strlen( ptr ); assert( len <= std::numeric_limits::max() ); auto l16 = uint16_t( len ); diff --git a/client/TracyProfiler.hpp b/client/TracyProfiler.hpp index 55d53015..07b693c9 100644 --- a/client/TracyProfiler.hpp +++ b/client/TracyProfiler.hpp @@ -480,7 +480,8 @@ public: void RequestShutdown() { m_shutdown.store( true, std::memory_order_relaxed ); m_shutdownManual.store( true, std::memory_order_relaxed ); } bool HasShutdownFinished() const { return m_shutdownFinished.load( std::memory_order_relaxed ); } - void SendString( uint64_t ptr, const char* str, QueueType type ); + void SendString( uint64_t str, const char* ptr, QueueType type ) { SendString( str, ptr, strlen( ptr ), type ); } + void SendString( uint64_t str, const char* ptr, size_t len, QueueType type ); // Allocated source location data layout: