1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Don't depend on zero-termination of source code.

This commit is contained in:
Bartosz Taudul
2020-05-23 17:07:23 +02:00
parent d3b60f913d
commit 45a9878193
2 changed files with 4 additions and 6 deletions
+2 -3
View File
@@ -7404,11 +7404,10 @@ void Worker::CacheSource( const StringRef& str )
fseek( f, 0, SEEK_END );
const auto sz = ftell( f );
fseek( f, 0, SEEK_SET );
auto src = (char*)m_slab.AllocBig( sz+1 );
auto src = (char*)m_slab.AllocBig( sz );
fread( src, 1, sz, f );
src[sz] = '\0';
fclose( f );
m_data.sourceFileCache.emplace( file, MemoryBlock{ src, uint32_t( sz+1 ) } );
m_data.sourceFileCache.emplace( file, MemoryBlock{ src, uint32_t( sz ) } );
}
}
}