streaming compression example can handle situations where input buffer size is manually set to a small value.
This commit is contained in:
parent
88aa179347
commit
4ca3d4bc25
@ -81,6 +81,7 @@ static void compressFile_orDie(const char* fname, const char* outName, int cLeve
|
||||
while (input.pos < input.size) {
|
||||
ZSTD_outBuffer output = { buffOut, buffOutSize, 0 };
|
||||
toRead = ZSTD_compressStream(cstream, &output , &input); /* toRead is guaranteed to be <= ZSTD_CStreamInSize() */
|
||||
if (toRead > buffInSize) toRead = buffInSize; /* Safely handle when `buffInSize` is manually changed to a smaller value */
|
||||
fwrite_orDie(buffOut, output.pos, fout);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user