mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Handle frame image dictionary creation failures.
This commit is contained in:
parent
b4dab753e6
commit
8d65b190d6
@ -8077,13 +8077,23 @@ void Worker::Write( FileWrite& f, bool fiDict )
|
||||
params.zParams.compressionLevel = 3;
|
||||
|
||||
auto dict = new char[DictSize];
|
||||
const auto finalDictSize = (uint32_t)ZDICT_optimizeTrainFromBuffer_fastCover( dict, DictSize, sdata, ssize, sNum, ¶ms );
|
||||
auto zdict = ZSTD_createCDict( dict, finalDictSize, 3 );
|
||||
const auto dictret = ZDICT_optimizeTrainFromBuffer_fastCover( dict, DictSize, sdata, ssize, sNum, ¶ms );
|
||||
if( dictret <= DictSize )
|
||||
{
|
||||
const auto finalDictSize = uint32_t( dictret );
|
||||
auto zdict = ZSTD_createCDict( dict, finalDictSize, 3 );
|
||||
|
||||
f.Write( &finalDictSize, sizeof( finalDictSize ) );
|
||||
f.Write( dict, finalDictSize );
|
||||
f.Write( &finalDictSize, sizeof( finalDictSize ) );
|
||||
f.Write( dict, finalDictSize );
|
||||
|
||||
ZSTD_freeCDict( zdict );
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t zero = 0;
|
||||
f.Write( &zero, sizeof( zero ) );
|
||||
}
|
||||
|
||||
ZSTD_freeCDict( zdict );
|
||||
delete[] dict;
|
||||
delete[] ssize;
|
||||
delete[] sdata;
|
||||
|
Loading…
Reference in New Issue
Block a user