commit
8ef649f3a8
@ -725,6 +725,9 @@ size_t LZ4F_compressBegin(LZ4F_cctx* cctxPtr,
|
||||
*/
|
||||
size_t LZ4F_compressBound(size_t srcSize, const LZ4F_preferences_t* preferencesPtr)
|
||||
{
|
||||
if (preferencesPtr && preferencesPtr->autoFlush) {
|
||||
return LZ4F_compressBound_internal(srcSize, preferencesPtr, 0);
|
||||
}
|
||||
return LZ4F_compressBound_internal(srcSize, preferencesPtr, (size_t)-1);
|
||||
}
|
||||
|
||||
|
@ -284,7 +284,7 @@ LZ4FLIB_API size_t LZ4F_compressBegin(LZ4F_cctx* cctx,
|
||||
* @return is always the same for a srcSize and prefsPtr.
|
||||
* prefsPtr is optional : when NULL is provided, preferences will be set to cover worst case scenario.
|
||||
* tech details :
|
||||
* @return includes the possibility that internal buffer might already be filled by up to (blockSize-1) bytes.
|
||||
* @return if automatic flushing is not enabled, includes the possibility that internal buffer might already be filled by up to (blockSize-1) bytes.
|
||||
* It also includes frame footer (ending + checksum), since it might be generated by LZ4F_compressEnd().
|
||||
* @return doesn't include frame header, as it was already generated by LZ4F_compressBegin().
|
||||
*/
|
||||
|
@ -200,6 +200,24 @@ int basicTests(U32 seed, double compressibility)
|
||||
DISPLAYLEVEL(3, " %u \n", (U32)cBound);
|
||||
}
|
||||
|
||||
/* LZ4F_compressBound() : special case : automatic flushing enabled */
|
||||
DISPLAYLEVEL(3, "LZ4F_compressBound(1 KB, autoFlush=1) = ");
|
||||
{ size_t cBound;
|
||||
LZ4F_preferences_t autoFlushPrefs;
|
||||
memset(&autoFlushPrefs, 0, sizeof(autoFlushPrefs));
|
||||
autoFlushPrefs.autoFlush = 1;
|
||||
cBound = LZ4F_compressBound(1 KB, &autoFlushPrefs);
|
||||
if (cBound > 64 KB) goto _output_error;
|
||||
DISPLAYLEVEL(3, " %u \n", (U32)cBound);
|
||||
}
|
||||
|
||||
/* LZ4F_compressBound() : special case : automatic flushing disabled */
|
||||
DISPLAYLEVEL(3, "LZ4F_compressBound(1 KB, autoFlush=0) = ");
|
||||
{ size_t const cBound = LZ4F_compressBound(1 KB, &prefs);
|
||||
if (cBound < 64 KB) goto _output_error;
|
||||
DISPLAYLEVEL(3, " %u \n", (U32)cBound);
|
||||
}
|
||||
|
||||
/* Special case : null-content frame */
|
||||
testSize = 0;
|
||||
DISPLAYLEVEL(3, "LZ4F_compressFrame, compress null content : ");
|
||||
|
Loading…
Reference in New Issue
Block a user