Lines Matching refs:srcSize
352 const size_t srcSize)
357 if (srcSize <= maxBlockSize)
366 * Provides dstCapacity given a srcSize to guarantee operation success in worst case situations.
368 * @return is always the same for a srcSize and prefsPtr, so it can be relied upon to size reusable buffers.
369 * When srcSize==0, LZ4F_compressBound() provides an upper bound for LZ4F_flush() and LZ4F_compressEnd() operations.
371 static size_t LZ4F_compressBound_internal(size_t srcSize,
379 U32 const flush = prefsPtr->autoFlush | (srcSize==0);
384 size_t const maxSrcSize = srcSize + bufferedSize;
398 size_t LZ4F_compressFrameBound(size_t srcSize, const LZ4F_preferences_t* preferencesPtr)
407 return headerSize + LZ4F_compressBound_internal(srcSize, &prefs, 0);;
414 * dstBuffer MUST be >= LZ4F_compressFrameBound(srcSize, preferencesPtr).
422 const void* srcBuffer, size_t srcSize,
437 prefs.frameInfo.contentSize = (U64)srcSize; /* auto-correct content size if selected (!=0) */
439 prefs.frameInfo.blockSizeID = LZ4F_optimalBSID(prefs.frameInfo.blockSizeID, srcSize);
441 if (srcSize <= LZ4F_getBlockSize(prefs.frameInfo.blockSizeID))
447 RETURN_ERROR_IF(dstCapacity < LZ4F_compressFrameBound(srcSize, &prefs), dstMaxSize_tooSmall);
454 { size_t const cSize = LZ4F_compressUpdate(cctx, dstPtr, (size_t)(dstEnd-dstPtr), srcBuffer, srcSize, &options);
470 * dstBuffer MUST be >= LZ4F_compressFrameBound(srcSize, preferencesPtr).
476 const void* srcBuffer, size_t srcSize,
503 srcBuffer, srcSize,
805 * @return minimum capacity of dstBuffer for a given srcSize to handle worst case scenario.
809 size_t LZ4F_compressBound(size_t srcSize, const LZ4F_preferences_t* preferencesPtr)
812 return LZ4F_compressBound_internal(srcSize, preferencesPtr, 0);
814 return LZ4F_compressBound_internal(srcSize, preferencesPtr, (size_t)-1);
818 typedef int (*compressFunc_t)(void* ctx, const char* src, char* dst, int srcSize, int dstSize, int level, const LZ4F_CDict* cdict);
823 * assumption : dst buffer capacity is >= BHSize + srcSize + crcSize
826 const void* src, size_t srcSize,
835 (int)(srcSize), (int)(srcSize-1),
838 if (cSize == 0 || cSize >= srcSize) {
839 cSize = (U32)srcSize;
841 memcpy(cSizePtr+BHSize, src, srcSize);
853 static int LZ4F_compressBlock(void* ctx, const char* src, char* dst, int srcSize, int dstCapacity, int level, const LZ4F_CDict* cdict)
856 DEBUGLOG(5, "LZ4F_compressBlock (srcSize=%i)", srcSize);
859 return LZ4_compress_fast_continue((LZ4_stream_t*)ctx, src, dst, srcSize, dstCapacity, acceleration);
861 return LZ4_compress_fast_extState_fastReset(ctx, src, dst, srcSize, dstCapacity, acceleration);
865 static int LZ4F_compressBlock_continue(void* ctx, const char* src, char* dst, int srcSize, int dstCapacity, int level, const LZ4F_CDict* cdict)
869 DEBUGLOG(5, "LZ4F_compressBlock_continue (srcSize=%i)", srcSize);
870 return LZ4_compress_fast_continue((LZ4_stream_t*)ctx, src, dst, srcSize, dstCapacity, acceleration);
873 static int LZ4F_compressBlockHC(void* ctx, const char* src, char* dst, int srcSize, int dstCapacity, int level, const LZ4F_CDict* cdict)
877 return LZ4_compress_HC_continue((LZ4_streamHC_t*)ctx, src, dst, srcSize, dstCapacity);
879 return LZ4_compress_HC_extStateHC_fastReset(ctx, src, dst, srcSize, dstCapacity, level);
882 static int LZ4F_compressBlockHC_continue(void* ctx, const char* src, char* dst, int srcSize, int dstCapacity, int level, const LZ4F_CDict* cdict)
885 return LZ4_compress_HC_continue((LZ4_streamHC_t*)ctx, src, dst, srcSize, dstCapacity);
888 static int LZ4F_doNotCompressBlock(void* ctx, const char* src, char* dst, int srcSize, int dstCapacity, int level, const LZ4F_CDict* cdict)
890 (void)ctx; (void)src; (void)dst; (void)srcSize; (void)dstCapacity; (void)level; (void)cdict;
924 * @dstCapacity MUST be >= LZ4F_compressBound(srcSize, preferencesPtr) when block compression is turned on.
932 const void* srcBuffer, size_t srcSize,
938 const BYTE* const srcEnd = srcPtr + srcSize;
944 DEBUGLOG(4, "LZ4F_compressUpdate (srcSize=%zu)", srcSize);
947 if (dstCapacity < LZ4F_compressBound_internal(srcSize, &(cctxPtr->prefs), cctxPtr->tmpInSize))
950 if (blockCompression == LZ4B_UNCOMPRESSED && dstCapacity < srcSize)
966 if (sizeToCopy > srcSize) {
968 memcpy(cctxPtr->tmpIn + cctxPtr->tmpInSize, srcBuffer, srcSize);
970 cctxPtr->tmpInSize += srcSize;
1042 (void)XXH32_update(&(cctxPtr->xxh), srcBuffer, srcSize);
1044 cctxPtr->totalInSize += srcSize;
1054 * @dstCapacity MUST be >= LZ4F_compressBound(srcSize, preferencesPtr).
1062 const void* srcBuffer, size_t srcSize,
1067 srcBuffer, srcSize,
1078 * @dstCapacity MUST be >= LZ4F_compressBound(srcSize, preferencesPtr).
1086 const void* srcBuffer, size_t srcSize,
1091 srcBuffer, srcSize,
1288 * @return : nb Bytes read from src (necessarily <= srcSize)
1291 static size_t LZ4F_decodeHeader(LZ4F_dctx* dctx, const void* src, size_t srcSize)
1299 RETURN_ERROR_IF(srcSize < minFHSize, frameHeader_incomplete); /* minimal frame header size */
1306 dctx->tmpInSize = srcSize;
1309 return srcSize;
1340 if (srcSize < frameHeaderSize) {
1343 memcpy(dctx->header, srcPtr, srcSize);
1344 dctx->tmpInSize = srcSize;
1347 return srcSize;
1387 size_t LZ4F_headerSize(const void* src, size_t srcSize)
1391 /* minimal srcSize to determine header size */
1392 if (srcSize < LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTH)
1423 * @return : an hint about how many srcSize bytes LZ4F_decompress() expects for next call,
1549 * The function result is an hint of the better srcSize to use for next call to LZ4F_decompress.
1552 * Note that this is just a hint, and it's always possible to any srcSize value.