diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 99527745..315e3c25 100755 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -120,10 +120,10 @@ void Profiler::Worker() #ifdef _DEBUG if( sock->Send( buf, ptr - buf ) == -1 ) break; #else - char lz4[LZ4Size + sizeof( uint16_t )]; - const uint16_t lz4sz = LZ4_compress_default( buf, lz4+2, ptr - buf, LZ4Size ); - memcpy( lz4, &lz4sz, sizeof( uint16_t ) ); - if( sock->Send( lz4, lz4sz ) == -1 ) break; + char lz4[LZ4Size + sizeof( lz4sz_t )]; + const lz4sz_t lz4sz = LZ4_compress_default( buf, lz4 + sizeof( lz4sz_t ), ptr - buf, LZ4Size ); + memcpy( lz4, &lz4sz, sizeof( lz4sz ) ); + if( sock->Send( lz4, lz4sz + sizeof( lz4sz_t ) ) == -1 ) break; #endif } else diff --git a/common/TracyProtocol.hpp b/common/TracyProtocol.hpp index 80834960..cf113a7a 100755 --- a/common/TracyProtocol.hpp +++ b/common/TracyProtocol.hpp @@ -9,9 +9,11 @@ namespace tracy { +using lz4sz_t = uint16_t; + enum { TargetFrameSize = 64000 }; enum { LZ4Size = LZ4_COMPRESSBOUND( TargetFrameSize ) }; -static_assert( LZ4Size <= std::numeric_limits::max(), "LZ4Size greater than uint16_t" ); +static_assert( LZ4Size <= std::numeric_limits::max(), "LZ4Size greater than lz4sz_t" ); }