1
0
mirror of https://github.com/facebook/zstd.git synced 2025-07-29 11:21:22 +03:00

break loadFile_orDie() into 2: loadFile_orDie() loads file into a pre-allocated memory buffer, mallocAndLoadFile_orDie() allocates memory first, then calls loadFile_orDie()

This commit is contained in:
Yi Jin
2018-12-17 16:54:55 -08:00
parent 452689678b
commit bc4dc606de
6 changed files with 41 additions and 28 deletions

View File

@ -20,7 +20,7 @@
static void decompress(const char* fname)
{
size_t cSize;
void* const cBuff = loadFile_orDie(fname, &cSize, 0, 0);
void* const cBuff = mallocAndLoadFile_orDie(fname, &cSize);
unsigned long long const rSize = ZSTD_findDecompressedSize(cBuff, cSize);
if (rSize==ZSTD_CONTENTSIZE_ERROR) {
fprintf(stderr, "%s : it was not compressed by zstd.\n", fname);