Lines Matching full:if

28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
103 #if defined(LZ4_DEBUG) && (LZ4_DEBUG>=1)
113 #if defined(LZ4_DEBUG) && (LZ4_DEBUG>=2) && !defined(DEBUGLOG)
117 if ((g_debuglog_enable) && (l<=LZ4_DEBUG)) { \
130 #if !defined (__VMS) && (defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ …
257 if (LZ4F_isError(code)) return LZ4F_errorStrings[-(int)(code)]; in LZ4F_getErrorName()
263 if (!LZ4F_isError(functionResult)) return LZ4F_OK_NoError; in LZ4F_getErrorCode()
282 if (blockSizeID == 0) blockSizeID = LZ4F_BLOCKSIZEID_DEFAULT; in LZ4F_getBlockSize()
283 if (blockSizeID < LZ4F_max64KB || blockSizeID > LZ4F_max4MB) in LZ4F_getBlockSize()
310 if (srcSize <= maxBlockSize) in LZ4F_optimalBSID()
320 …* prefsPtr is optional : if NULL is provided, preferences will be set to cover worst case scenari…
356 if (preferencesPtr!=NULL) prefs = *preferencesPtr; in LZ4F_compressFrameBound()
371 * or an error code if it fails (can be tested using LZ4F_isError())
385 if (preferencesPtr!=NULL) in LZ4F_compressFrame_usingCDict()
389 if (prefs.frameInfo.contentSize != 0) in LZ4F_compressFrame_usingCDict()
390 … prefs.frameInfo.contentSize = (U64)srcSize; /* auto-correct content size if selected (!=0) */ in LZ4F_compressFrame_usingCDict()
394 if (srcSize <= LZ4F_getBlockSize(prefs.frameInfo.blockSizeID)) in LZ4F_compressFrame_usingCDict()
400if (dstCapacity < LZ4F_compressFrameBound(srcSize, &prefs)) /* condition to guarantee success */ in LZ4F_compressFrame_usingCDict()
404 if (LZ4F_isError(headerSize)) return headerSize; in LZ4F_compressFrame_usingCDict()
409 if (LZ4F_isError(cSize)) return cSize; in LZ4F_compressFrame_usingCDict()
414 if (LZ4F_isError(tailSize)) return tailSize; in LZ4F_compressFrame_usingCDict()
427 * or an error code if it fails (can be tested using LZ4F_isError())
434 #if (LZ4F_HEAPMODE) in LZ4F_compressFrame()
437 if (LZ4F_isError(result)) return result; in LZ4F_compressFrame()
447 if (preferencesPtr == NULL || in LZ4F_compressFrame()
461 #if (LZ4F_HEAPMODE) in LZ4F_compressFrame()
464 if (preferencesPtr != NULL && in LZ4F_compressFrame()
489 * @return : digested dictionary for compression, or NULL if failed */
495 if (!cdict) return NULL; in LZ4F_createCDict()
496 if (dictSize > 64 KB) { in LZ4F_createCDict()
503 if (!cdict->dictContent || !cdict->fastCtx || !cdict->HCCtx) { in LZ4F_createCDict()
516 if (cdict==NULL) return; /* support free on NULL */ in LZ4F_freeCDict()
533 * If the result LZ4F_errorCode_t is not OK_NoError, there was an error during context creation.
539 if (cctxPtr==NULL) return err0r(LZ4F_ERROR_allocation_failed); in LZ4F_createCompressionContext()
552 if (cctxPtr != NULL) { /* support free on NULL */ in LZ4F_freeCompressionContext()
564 * resetting the context and attaching the dictionary, if there is one.
574 if (level < LZ4HC_CLEVEL_MIN) { in LZ4F_initStream()
575 if (cdict != NULL || blockMode == LZ4F_blockLinked) { in LZ4F_initStream()
608 if (dstCapacity < maxFHSize) return err0r(LZ4F_ERROR_dstMaxSize_tooSmall); in LZ4F_compressBegin_usingCDict()
610 if (preferencesPtr == NULL) preferencesPtr = &prefNull; in LZ4F_compressBegin_usingCDict()
615 if (cctxPtr->lz4CtxAlloc < ctxTypeID) { in LZ4F_compressBegin_usingCDict()
617 if (cctxPtr->prefs.compressionLevel < LZ4HC_CLEVEL_MIN) { in LZ4F_compressBegin_usingCDict()
622 if (cctxPtr->lz4CtxPtr == NULL) in LZ4F_compressBegin_usingCDict()
626 } else if (cctxPtr->lz4CtxState != ctxTypeID) { in LZ4F_compressBegin_usingCDict()
629 if (cctxPtr->prefs.compressionLevel < LZ4HC_CLEVEL_MIN) { in LZ4F_compressBegin_usingCDict()
640 if (cctxPtr->prefs.frameInfo.blockSizeID == 0) in LZ4F_compressBegin_usingCDict()
648 if (cctxPtr->maxBufferSize < requiredBuffSize) { in LZ4F_compressBegin_usingCDict()
652 if (cctxPtr->tmpBuff == NULL) return err0r(LZ4F_ERROR_allocation_failed); in LZ4F_compressBegin_usingCDict()
661 if (cctxPtr->prefs.frameInfo.blockMode == LZ4F_blockLinked) { in LZ4F_compressBegin_usingCDict()
665 if (preferencesPtr->compressionLevel >= LZ4HC_CLEVEL_MIN) { in LZ4F_compressBegin_usingCDict()
684 if (cctxPtr->prefs.frameInfo.contentSize) { in LZ4F_compressBegin_usingCDict()
690 if (cctxPtr->prefs.frameInfo.dictID) { in LZ4F_compressBegin_usingCDict()
721 …* LZ4F_preferences_t structure is optional : if NULL, preferences will be set to cover worst case…
726 if (preferencesPtr && preferencesPtr->autoFlush) { in LZ4F_compressBound()
750 if (cSize == 0) { /* compression failed */ in LZ4F_makeBlock()
758 if (crcFlag) { in LZ4F_makeBlock()
770 if (cdict) { in LZ4F_compressBlock()
787 if (cdict) { in LZ4F_compressBlockHC()
801 if (level < LZ4HC_CLEVEL_MIN) { in LZ4F_selectCompression()
802 if (blockMode == LZ4F_blockIndependent) return LZ4F_compressBlock; in LZ4F_selectCompression()
805 if (blockMode == LZ4F_blockIndependent) return LZ4F_compressBlockHC; in LZ4F_selectCompression()
811 if (cctxPtr->prefs.compressionLevel < LZ4HC_CLEVEL_MIN) in LZ4F_localSaveDict()
823 * or an error code if it fails (which can be tested using LZ4F_isError())
841 if (cctxPtr->cStage != 1) return err0r(LZ4F_ERROR_GENERIC); in LZ4F_compressUpdate()
842 if (dstCapacity < LZ4F_compressBound_internal(srcSize, &(cctxPtr->prefs), cctxPtr->tmpInSize)) in LZ4F_compressUpdate()
845 if (compressOptionsPtr == NULL) compressOptionsPtr = &cOptionsNull; in LZ4F_compressUpdate()
848 if (cctxPtr->tmpInSize > 0) { /* some data already within tmp buffer */ in LZ4F_compressUpdate()
850 if (sizeToCopy > srcSize) { in LZ4F_compressUpdate()
868 if (cctxPtr->prefs.frameInfo.blockMode==LZ4F_blockLinked) cctxPtr->tmpIn += blockSize; in LZ4F_compressUpdate()
884 if ((cctxPtr->prefs.autoFlush) && (srcPtr < srcEnd)) { in LZ4F_compressUpdate()
895 /* preserve dictionary if necessary */ in LZ4F_compressUpdate()
896if ((cctxPtr->prefs.frameInfo.blockMode==LZ4F_blockLinked) && (lastBlockCompressed==fromSrcBuffer)… in LZ4F_compressUpdate()
897 if (compressOptionsPtr->stableSrc) { in LZ4F_compressUpdate()
901 if (realDictSize==0) return err0r(LZ4F_ERROR_GENERIC); in LZ4F_compressUpdate()
907if ((cctxPtr->tmpIn + blockSize) > (cctxPtr->tmpBuff + cctxPtr->maxBufferSize) /* necessarily LZ… in LZ4F_compressUpdate()
915 if (srcPtr < srcEnd) { in LZ4F_compressUpdate()
922 if (cctxPtr->prefs.frameInfo.contentChecksumFlag == LZ4F_contentChecksumEnabled) in LZ4F_compressUpdate()
935 * The function outputs an error code if it fails (can be tested using LZ4F_isError())
946 if (cctxPtr->tmpInSize == 0) return 0; /* nothing to flush */ in LZ4F_flush()
947 if (cctxPtr->cStage != 1) return err0r(LZ4F_ERROR_GENERIC); in LZ4F_flush()
948 if (dstCapacity < (cctxPtr->tmpInSize + BHSize + BFSize)) in LZ4F_flush()
963 if (cctxPtr->prefs.frameInfo.blockMode == LZ4F_blockLinked) in LZ4F_flush()
968if ((cctxPtr->tmpIn + cctxPtr->maxBlockSize) > (cctxPtr->tmpBuff + cctxPtr->maxBufferSize)) { /* … in LZ4F_flush()
983 * or an error code if it fails (can be tested using LZ4F_isError())
995 if (LZ4F_isError(flushSize)) return flushSize; in LZ4F_compressEnd()
1001 if (dstCapacity < 4) return err0r(LZ4F_ERROR_dstMaxSize_tooSmall); in LZ4F_compressEnd()
1005 if (cctxPtr->prefs.frameInfo.contentChecksumFlag == LZ4F_contentChecksumEnabled) { in LZ4F_compressEnd()
1007 if (dstCapacity < 8) return err0r(LZ4F_ERROR_dstMaxSize_tooSmall); in LZ4F_compressEnd()
1016 if (cctxPtr->prefs.frameInfo.contentSize) { in LZ4F_compressEnd()
1017 if (cctxPtr->prefs.frameInfo.contentSize != cctxPtr->totalInSize) in LZ4F_compressEnd()
1067 * @return : if != 0, there was an error during context creation.
1072 if (dctx == NULL) { /* failed allocation */ in LZ4F_createDecompressionContext()
1085 if (dctx != NULL) { /* can accept NULL input, like free() */ in LZ4F_freeDecompressionContext()
1121if (srcSize < minFHSize) return err0r(LZ4F_ERROR_frameHeader_incomplete); /* minimal frame heade… in LZ4F_decodeHeader()
1125 if ((LZ4F_readLE32(srcPtr) & 0xFFFFFFF0U) == LZ4F_MAGIC_SKIPPABLE_START) { in LZ4F_decodeHeader()
1127 if (src == (void*)(dctx->header)) { in LZ4F_decodeHeader()
1140 if (LZ4F_readLE32(srcPtr) != LZ4F_MAGICNUMBER) { in LZ4F_decodeHeader()
1156 if (((FLG>>1)&_1BIT) != 0) return err0r(LZ4F_ERROR_reservedFlag_set); /* Reserved bit */ in LZ4F_decodeHeader()
1157if (version != 1) return err0r(LZ4F_ERROR_headerVersion_wrong); /* Version Number, only sup… in LZ4F_decodeHeader()
1163 if (srcSize < frameHeaderSize) { in LZ4F_decodeHeader()
1165 if (srcPtr != dctx->header) in LZ4F_decodeHeader()
1176 if (((BD>>7)&_1BIT) != 0) return err0r(LZ4F_ERROR_reservedFlag_set); /* Reserved bit */ in LZ4F_decodeHeader()
1177if (blockSizeID < 4) return err0r(LZ4F_ERROR_maxBlockSize_invalid); /* 4-7 only supported value… in LZ4F_decodeHeader()
1178 if (((BD>>0)&_4BITS) != 0) return err0r(LZ4F_ERROR_reservedFlag_set); /* Reserved bits */ in LZ4F_decodeHeader()
1185 if (HC != srcPtr[frameHeaderSize-1]) in LZ4F_decodeHeader()
1196 if (contentSizeFlag) in LZ4F_decodeHeader()
1199 if (dictIDFlag) in LZ4F_decodeHeader()
1214 if (src == NULL) return err0r(LZ4F_ERROR_srcPtr_wrong); in LZ4F_headerSize()
1217 if (srcSize < LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTH) in LZ4F_headerSize()
1221 if ((LZ4F_readLE32(src) & 0xFFFFFFF0U) == LZ4F_MAGIC_SKIPPABLE_START) in LZ4F_headerSize()
1226 if (LZ4F_readLE32(src) != LZ4F_MAGICNUMBER) in LZ4F_headerSize()
1258 if (dctx->dStage > dstage_storeFrameHeader) { in LZ4F_getFrameInfo()
1266 if (dctx->dStage == dstage_storeFrameHeader) { in LZ4F_getFrameInfo()
1272 if (LZ4F_isError(hSize)) { *srcSizePtr=0; return hSize; } in LZ4F_getFrameInfo()
1273 if (*srcSizePtr < hSize) { in LZ4F_getFrameInfo()
1279 if (LZ4F_isError(decodeResult)) { in LZ4F_getFrameInfo()
1300 if (dctx->dictSize==0) { in LZ4F_updateDict()
1305 if (dctx->dict + dctx->dictSize == dstPtr) { /* prefix mode, everything within dstBuffer */ in LZ4F_updateDict()
1311if ((size_t)(dstPtr - dstBufferStart) + dstSize >= 64 KB) { /* history in dstBuffer becomes large… in LZ4F_updateDict()
1317 …assert(dstSize < 64 KB); /* if dstSize >= 64 KB, dictionary would be set into dstBuffer directly… in LZ4F_updateDict()
1322if (withinTmp && (dctx->dict == dctx->tmpOutBuffer)) { /* continue history within tmpOutBuffer */ in LZ4F_updateDict()
1329 if (withinTmp) { /* copy relevant dict portion in front of tmpOut within tmpOutBuffer */ in LZ4F_updateDict()
1333 if (dctx->tmpOutSize > 64 KB) copySize = 0; in LZ4F_updateDict()
1334 if (copySize > preserveSize) copySize = preserveSize; in LZ4F_updateDict()
1343 if (dctx->dict == dctx->tmpOutBuffer) { /* copy dst into tmp to complete dict */ in LZ4F_updateDict()
1344 if (dctx->dictSize + dstSize > dctx->maxBufferSize) { /* tmp buffer not large enough */ in LZ4F_updateDict()
1356 if (preserveSize > dctx->dictSize) preserveSize = dctx->dictSize; in LZ4F_updateDict()
1374 …* If number of bytes read is < number of bytes provided, then decompression operation is not comp…
1382 * If decompression failed, @return is an error code which can be tested using LZ4F_isError().
1403 if (dstBuffer == NULL) assert(*dstSizePtr == 0); in LZ4F_decompress()
1405 if (decompressOptionsPtr==NULL) decompressOptionsPtr = &optionsNull; in LZ4F_decompress()
1419 if ((size_t)(srcEnd-srcPtr) >= maxFHSize) { /* enough to decode - shortcut */ in LZ4F_decompress()
1421 if (LZ4F_isError(hSize)) return hSize; in LZ4F_decompress()
1426 if (srcEnd-srcPtr == 0) return minFHSize; /* 0-size input */ in LZ4F_decompress()
1438 if (dctx->tmpInSize < dctx->tmpInTarget) { in LZ4F_decompress()
1444 if (LZ4F_isError(hSize)) return hSize; in LZ4F_decompress()
1450 if (dctx->frameInfo.contentChecksumFlag) (void)XXH32_reset(&(dctx->xxh), 0); in LZ4F_decompress()
1454 if (bufferNeeded > dctx->maxBufferSize) { /* tmp buffers too small */ in LZ4F_decompress()
1458 if (dctx->tmpIn == NULL) in LZ4F_decompress()
1462 if (dctx->tmpOutBuffer== NULL) in LZ4F_decompress()
1476 if ((size_t)(srcEnd - srcPtr) >= BHSize) { in LZ4F_decompress()
1485 if (dctx->dStage == dstage_storeBlockHeader) /* can be skipped */ in LZ4F_decompress()
1494 if (dctx->tmpInSize < BHSize) { /* not enough input for cBlockSize */ in LZ4F_decompress()
1500 } /* if (dctx->dStage == dstage_storeBlockHeader) */ in LZ4F_decompress()
1506 if (blockHeader==0) { /* frameEnd signal, no more block */ in LZ4F_decompress()
1511 if (nextCBlockSize > dctx->maxBlockSize) { in LZ4F_decompress()
1514 if (blockHeader & LZ4F_BLOCKUNCOMPRESSED_FLAG) { in LZ4F_decompress()
1518 if (dctx->frameInfo.blockChecksumFlag) { in LZ4F_decompress()
1527 if (dstPtr==dstEnd || srcPtr==srcEnd) { in LZ4F_decompress()
1537 if (dstPtr == NULL) { in LZ4F_decompress()
1543 if (dctx->frameInfo.blockChecksumFlag) { in LZ4F_decompress()
1546 if (dctx->frameInfo.contentChecksumFlag) in LZ4F_decompress()
1548 if (dctx->frameInfo.contentSize) in LZ4F_decompress()
1552 if (dctx->frameInfo.blockMode == LZ4F_blockLinked) { in LZ4F_decompress()
1558 if (sizeToCopy == dctx->tmpInTarget) { /* all done */ in LZ4F_decompress()
1559 if (dctx->frameInfo.blockChecksumFlag) { in LZ4F_decompress()
1578 if ((srcEnd-srcPtr >= 4) && (dctx->tmpInSize==0)) { in LZ4F_decompress()
1587 if (dctx->tmpInSize < 4) { /* all input consumed */ in LZ4F_decompress()
1597 if (readCRC != calcCRC) { in LZ4F_decompress()
1612 if ((size_t)(srcEnd-srcPtr) < dctx->tmpInTarget) { in LZ4F_decompress()
1621 if (0) /* always jump over next block */ in LZ4F_decompress()
1629 if (dctx->tmpInSize < dctx->tmpInTarget) { /* need more input */ in LZ4F_decompress()
1640 if (dctx->frameInfo.blockChecksumFlag) { in LZ4F_decompress()
1646 if (readBlockCrc != calcBlockCrc) in LZ4F_decompress()
1654 if ((size_t)(dstEnd-dstPtr) >= dctx->maxBlockSize) { in LZ4F_decompress()
1659 if (dict && dictSize > 1 GB) { in LZ4F_decompress()
1669 if (decodedSize < 0) return err0r(LZ4F_ERROR_GENERIC); /* decompression failed */ in LZ4F_decompress()
1670 if (dctx->frameInfo.contentChecksumFlag) in LZ4F_decompress()
1672 if (dctx->frameInfo.contentSize) in LZ4F_decompress()
1676 if (dctx->frameInfo.blockMode==LZ4F_blockLinked) { in LZ4F_decompress()
1687 if (dctx->frameInfo.blockMode == LZ4F_blockLinked) { in LZ4F_decompress()
1688 if (dctx->dict == dctx->tmpOutBuffer) { in LZ4F_decompress()
1689 if (dctx->dictSize > 128 KB) { in LZ4F_decompress()
1703 if (dict && dictSize > 1 GB) { in LZ4F_decompress()
1712 if (decodedSize < 0) /* decompression failed */ in LZ4F_decompress()
1714 if (dctx->frameInfo.contentChecksumFlag) in LZ4F_decompress()
1716 if (dctx->frameInfo.contentSize) in LZ4F_decompress()
1726 if (dstPtr != NULL) { in LZ4F_decompress()
1731 if (dctx->frameInfo.blockMode == LZ4F_blockLinked) in LZ4F_decompress()
1737 if (dctx->tmpOutStart == dctx->tmpOutSize) { /* all flushed */ in LZ4F_decompress()
1747 if (dctx->frameRemainingSize) in LZ4F_decompress()
1749 if (!dctx->frameInfo.contentChecksumFlag) { /* no checksum, frame is completed */ in LZ4F_decompress()
1755 if ((srcEnd - srcPtr) < 4) { /* not enough size for entire CRC */ in LZ4F_decompress()
1763 if (dctx->dStage == dstage_storeSuffix) /* can be skipped */ in LZ4F_decompress()
1771 if (dctx->tmpInSize < 4) { /* not enough input to read complete suffix */ in LZ4F_decompress()
1777 } /* if (dctx->dStage == dstage_storeSuffix) */ in LZ4F_decompress()
1783 if (readCRC != resultCRC) in LZ4F_decompress()
1796 if ((srcEnd - srcPtr) >= 4) { in LZ4F_decompress()
1806 if (dctx->dStage == dstage_storeSFrameSize) in LZ4F_decompress()
1813 if (dctx->tmpInSize < dctx->tmpInTarget) { in LZ4F_decompress()
1820 } /* if (dctx->dStage == dstage_storeSFrameSize) */ in LZ4F_decompress()
1836 if (nextSrcSizeHint) break; /* still more to skip */ in LZ4F_decompress()
1846if ( (dctx->frameInfo.blockMode==LZ4F_blockLinked) /* next block will use up to 64KB from previou… in LZ4F_decompress()
1852 if (dctx->dStage == dstage_flushOut) { in LZ4F_decompress()
1856 if (dctx->tmpOutSize > 64 KB) copySize = 0; in LZ4F_decompress()
1857 if (copySize > preserveSize) copySize = preserveSize; in LZ4F_decompress()
1892 if (dctx->dStage <= dstage_init) { in LZ4F_decompress_usingDict()