Change to heap allocation, remove implicit type conversion
This commit is contained in:
parent
e1edc554a3
commit
97b7f712f3
@ -104,10 +104,11 @@ size_t ZDICT_getDictHeaderSize(const void* dictBuffer, size_t dictSize)
|
||||
{
|
||||
if (dictSize <= 8 || MEM_readLE32(dictBuffer) != ZSTD_MAGIC_DICTIONARY) return 0;
|
||||
|
||||
{ ZSTD_entropyDTables_t dummyEntropyTables;
|
||||
size_t headerSize;
|
||||
dummyEntropyTables.hufTable[0] = (HUF_DTable)((HufLog)*0x1000001);
|
||||
headerSize = ZSTD_loadDEntropy(&dummyEntropyTables, dictBuffer, dictSize);
|
||||
{ size_t headerSize;
|
||||
ZSTD_entropyDTables_t* dummyEntropyTables = (ZSTD_entropyDTables_t*)malloc(sizeof(ZSTD_entropyDTables_t));
|
||||
dummyEntropyTables->hufTable[0] = (HUF_DTable)((HufLog)*0x1000001);
|
||||
headerSize = ZSTD_loadDEntropy(dummyEntropyTables, dictBuffer, dictSize);
|
||||
free(dummyEntropyTables);
|
||||
return ZSTD_isError(headerSize) ? 0 : headerSize;
|
||||
}
|
||||
}
|
||||
|
@ -1137,7 +1137,7 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
size_t* const samplesSizes = (size_t*) malloc(nbSamples * sizeof(size_t));
|
||||
size_t dictSize;
|
||||
U32 dictID;
|
||||
U32 dictHeaderSize;
|
||||
size_t dictHeaderSize;
|
||||
|
||||
if (dictBuffer==NULL || samplesSizes==NULL) {
|
||||
free(dictBuffer);
|
||||
|
Loading…
Reference in New Issue
Block a user