mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Move block decompression to a separate function.
This commit is contained in:
parent
7d32ef8c8b
commit
3d13ea09e8
@ -129,18 +129,13 @@ private:
|
|||||||
|
|
||||||
void ReadBig( void* ptr, size_t size )
|
void ReadBig( void* ptr, size_t size )
|
||||||
{
|
{
|
||||||
char m_lz4buf[LZ4Size];
|
|
||||||
auto dst = (char*)ptr;
|
auto dst = (char*)ptr;
|
||||||
while( size > 0 )
|
while( size > 0 )
|
||||||
{
|
{
|
||||||
if( m_offset == BufSize )
|
if( m_offset == BufSize )
|
||||||
{
|
{
|
||||||
std::swap( m_buf, m_second );
|
std::swap( m_buf, m_second );
|
||||||
m_offset = 0;
|
ReadBlock();
|
||||||
uint32_t sz;
|
|
||||||
fread( &sz, 1, sizeof( sz ), m_file );
|
|
||||||
fread( m_lz4buf, 1, sz, m_file );
|
|
||||||
m_lastBlock = LZ4_decompress_safe_continue( m_stream, m_lz4buf, m_buf, sz, BufSize );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto sz = std::min( size, BufSize - m_offset );
|
const auto sz = std::min( size, BufSize - m_offset );
|
||||||
@ -153,17 +148,12 @@ private:
|
|||||||
|
|
||||||
void SkipBig( size_t size )
|
void SkipBig( size_t size )
|
||||||
{
|
{
|
||||||
char m_lz4buf[LZ4Size];
|
|
||||||
while( size > 0 )
|
while( size > 0 )
|
||||||
{
|
{
|
||||||
if( m_offset == BufSize )
|
if( m_offset == BufSize )
|
||||||
{
|
{
|
||||||
std::swap( m_buf, m_second );
|
std::swap( m_buf, m_second );
|
||||||
m_offset = 0;
|
ReadBlock();
|
||||||
uint32_t sz;
|
|
||||||
fread( &sz, 1, sizeof( sz ), m_file );
|
|
||||||
fread( m_lz4buf, 1, sz, m_file );
|
|
||||||
m_lastBlock = LZ4_decompress_safe_continue( m_stream, m_lz4buf, m_buf, sz, BufSize );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto sz = std::min( size, BufSize - m_offset );
|
const auto sz = std::min( size, BufSize - m_offset );
|
||||||
@ -172,6 +162,16 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ReadBlock()
|
||||||
|
{
|
||||||
|
char m_lz4buf[LZ4Size];
|
||||||
|
m_offset = 0;
|
||||||
|
uint32_t sz;
|
||||||
|
fread( &sz, 1, sizeof( sz ), m_file );
|
||||||
|
fread( m_lz4buf, 1, sz, m_file );
|
||||||
|
m_lastBlock = LZ4_decompress_safe_continue( m_stream, m_lz4buf, m_buf, sz, BufSize );
|
||||||
|
}
|
||||||
|
|
||||||
enum { BufSize = 64 * 1024 };
|
enum { BufSize = 64 * 1024 };
|
||||||
enum { LZ4Size = LZ4_COMPRESSBOUND( BufSize ) };
|
enum { LZ4Size = LZ4_COMPRESSBOUND( BufSize ) };
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user