Lines Matching refs:zds
1569 size_t ZSTD_freeDStream(ZSTD_DStream* zds) in ZSTD_freeDStream() argument
1571 return ZSTD_freeDCtx(zds); in ZSTD_freeDStream()
1622 size_t ZSTD_initDStream_usingDict(ZSTD_DStream* zds, const void* dict, size_t dictSize) in ZSTD_initDStream_usingDict() argument
1625 FORWARD_IF_ERROR( ZSTD_DCtx_reset(zds, ZSTD_reset_session_only) , ""); in ZSTD_initDStream_usingDict()
1626 FORWARD_IF_ERROR( ZSTD_DCtx_loadDictionary(zds, dict, dictSize) , ""); in ZSTD_initDStream_usingDict()
1627 return ZSTD_startingInputLength(zds->format); in ZSTD_initDStream_usingDict()
1631 size_t ZSTD_initDStream(ZSTD_DStream* zds) in ZSTD_initDStream() argument
1634 return ZSTD_initDStream_usingDDict(zds, NULL); in ZSTD_initDStream()
1858 static int ZSTD_DCtx_isOverflow(ZSTD_DStream* zds, size_t const neededInBuffSize, size_t const need… in ZSTD_DCtx_isOverflow() argument
1860 …return (zds->inBuffSize + zds->outBuffSize) >= (neededInBuffSize + neededOutBuffSize) * ZSTD_WORKS… in ZSTD_DCtx_isOverflow()
1863 static void ZSTD_DCtx_updateOversizedDuration(ZSTD_DStream* zds, size_t const neededInBuffSize, siz… in ZSTD_DCtx_updateOversizedDuration() argument
1865 if (ZSTD_DCtx_isOverflow(zds, neededInBuffSize, neededOutBuffSize)) in ZSTD_DCtx_updateOversizedDuration()
1866 zds->oversizedDuration++; in ZSTD_DCtx_updateOversizedDuration()
1868 zds->oversizedDuration = 0; in ZSTD_DCtx_updateOversizedDuration()
1871 static int ZSTD_DCtx_isOversizedTooLong(ZSTD_DStream* zds) in ZSTD_DCtx_isOversizedTooLong() argument
1873 return zds->oversizedDuration >= ZSTD_WORKSPACETOOLARGE_MAXDURATION; in ZSTD_DCtx_isOversizedTooLong()
1877 static size_t ZSTD_checkOutBuffer(ZSTD_DStream const* zds, ZSTD_outBuffer const* output) in ZSTD_checkOutBuffer() argument
1879 ZSTD_outBuffer const expect = zds->expectedOutBuffer; in ZSTD_checkOutBuffer()
1881 if (zds->outBufferMode != ZSTD_bm_stable) in ZSTD_checkOutBuffer()
1886 if (zds->streamStage == zdss_init) in ZSTD_checkOutBuffer()
1900 ZSTD_DStream* zds, char** op, char* oend, in ZSTD_decompressContinueStream() argument
1902 int const isSkipFrame = ZSTD_isSkipFrame(zds); in ZSTD_decompressContinueStream()
1903 if (zds->outBufferMode == ZSTD_bm_buffered) { in ZSTD_decompressContinueStream()
1904 size_t const dstSize = isSkipFrame ? 0 : zds->outBuffSize - zds->outStart; in ZSTD_decompressContinueStream()
1905 size_t const decodedSize = ZSTD_decompressContinue(zds, in ZSTD_decompressContinueStream()
1906 zds->outBuff + zds->outStart, dstSize, src, srcSize); in ZSTD_decompressContinueStream()
1909 zds->streamStage = zdss_read; in ZSTD_decompressContinueStream()
1911 zds->outEnd = zds->outStart + decodedSize; in ZSTD_decompressContinueStream()
1912 zds->streamStage = zdss_flush; in ZSTD_decompressContinueStream()
1917 size_t const decodedSize = ZSTD_decompressContinue(zds, *op, dstSize, src, srcSize); in ZSTD_decompressContinueStream()
1921 zds->streamStage = zdss_read; in ZSTD_decompressContinueStream()
1923 assert(zds->outBufferMode == ZSTD_bm_stable); in ZSTD_decompressContinueStream()
1928 size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inBuffer* input) in ZSTD_decompressStream() argument
1952 FORWARD_IF_ERROR(ZSTD_checkOutBuffer(zds, output), ""); in ZSTD_decompressStream()
1955 switch(zds->streamStage) in ZSTD_decompressStream()
1959 zds->streamStage = zdss_loadHeader; in ZSTD_decompressStream()
1960 zds->lhSize = zds->inPos = zds->outStart = zds->outEnd = 0; in ZSTD_decompressStream()
1962 zds->legacyVersion = 0; in ZSTD_decompressStream()
1964 zds->hostageByte = 0; in ZSTD_decompressStream()
1965 zds->expectedOutBuffer = *output; in ZSTD_decompressStream()
1971 if (zds->legacyVersion) { in ZSTD_decompressStream()
1972 RETURN_ERROR_IF(zds->staticSize, memory_allocation, in ZSTD_decompressStream()
1974 …{ size_t const hint = ZSTD_decompressLegacyStream(zds->legacyContext, zds->legacyVersion, output… in ZSTD_decompressStream()
1975 if (hint==0) zds->streamStage = zdss_init; in ZSTD_decompressStream()
1979 … size_t const hSize = ZSTD_getFrameHeader_advanced(&zds->fParams, zds->headerBuffer, zds->lhSize, … in ZSTD_decompressStream()
1980 if (zds->refMultipleDDicts && zds->ddictSet) { in ZSTD_decompressStream()
1981 ZSTD_DCtx_selectFrameDDict(zds); in ZSTD_decompressStream()
1988 ZSTD_DDict const* const ddict = ZSTD_getDDict(zds); in ZSTD_decompressStream()
1992 RETURN_ERROR_IF(zds->staticSize, memory_allocation, in ZSTD_decompressStream()
1994 FORWARD_IF_ERROR(ZSTD_initLegacyStream(&zds->legacyContext, in ZSTD_decompressStream()
1995 zds->previousLegacyVersion, legacyVersion, in ZSTD_decompressStream()
1997 zds->legacyVersion = zds->previousLegacyVersion = legacyVersion; in ZSTD_decompressStream()
1998 …{ size_t const hint = ZSTD_decompressLegacyStream(zds->legacyContext, legacyVersion, output, inp… in ZSTD_decompressStream()
1999 … if (hint==0) zds->streamStage = zdss_init; /* or stay in stage zdss_loadHeader */ in ZSTD_decompressStream()
2006 … size_t const toLoad = hSize - zds->lhSize; /* if hSize!=0, hSize > zds->lhSize */ in ZSTD_decompressStream()
2011 ZSTD_memcpy(zds->headerBuffer + zds->lhSize, ip, remainingInput); in ZSTD_decompressStream()
2012 zds->lhSize += remainingInput; in ZSTD_decompressStream()
2015 …return (MAX((size_t)ZSTD_FRAMEHEADERSIZE_MIN(zds->format), hSize) - zds->lhSize) + ZSTD_blockHeade… in ZSTD_decompressStream()
2018 … ZSTD_memcpy(zds->headerBuffer + zds->lhSize, ip, toLoad); zds->lhSize = hSize; ip += toLoad; in ZSTD_decompressStream()
2023 if (zds->fParams.frameContentSize != ZSTD_CONTENTSIZE_UNKNOWN in ZSTD_decompressStream()
2024 && zds->fParams.frameType != ZSTD_skippableFrame in ZSTD_decompressStream()
2025 && (U64)(size_t)(oend-op) >= zds->fParams.frameContentSize) { in ZSTD_decompressStream()
2029 …decompressedSize = ZSTD_decompress_usingDDict(zds, op, (size_t)(oend-op), istart, cSize, ZSTD_getD… in ZSTD_decompressStream()
2034 zds->expected = 0; in ZSTD_decompressStream()
2035 zds->streamStage = zdss_init; in ZSTD_decompressStream()
2041 if (zds->outBufferMode == ZSTD_bm_stable in ZSTD_decompressStream()
2042 && zds->fParams.frameType != ZSTD_skippableFrame in ZSTD_decompressStream()
2043 && zds->fParams.frameContentSize != ZSTD_CONTENTSIZE_UNKNOWN in ZSTD_decompressStream()
2044 && (U64)(size_t)(oend-op) < zds->fParams.frameContentSize) { in ZSTD_decompressStream()
2050 FORWARD_IF_ERROR(ZSTD_decompressBegin_usingDDict(zds, ZSTD_getDDict(zds)), ""); in ZSTD_decompressStream()
2052 …if ((MEM_readLE32(zds->headerBuffer) & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) {… in ZSTD_decompressStream()
2053 zds->expected = MEM_readLE32(zds->headerBuffer + ZSTD_FRAMEIDSIZE); in ZSTD_decompressStream()
2054 zds->stage = ZSTDds_skipFrame; in ZSTD_decompressStream()
2056 FORWARD_IF_ERROR(ZSTD_decodeFrameHeader(zds, zds->headerBuffer, zds->lhSize), ""); in ZSTD_decompressStream()
2057 zds->expected = ZSTD_blockHeaderSize; in ZSTD_decompressStream()
2058 zds->stage = ZSTDds_decodeBlockHeader; in ZSTD_decompressStream()
2063 (U32)(zds->fParams.windowSize >>10), in ZSTD_decompressStream()
2064 (U32)(zds->maxWindowSize >> 10) ); in ZSTD_decompressStream()
2065 … zds->fParams.windowSize = MAX(zds->fParams.windowSize, 1U << ZSTD_WINDOWLOG_ABSOLUTEMIN); in ZSTD_decompressStream()
2066 RETURN_ERROR_IF(zds->fParams.windowSize > zds->maxWindowSize, in ZSTD_decompressStream()
2070 … { size_t const neededInBuffSize = MAX(zds->fParams.blockSizeMax, 4 /* frame checksum */); in ZSTD_decompressStream()
2071 size_t const neededOutBuffSize = zds->outBufferMode == ZSTD_bm_buffered in ZSTD_decompressStream()
2072 … ? ZSTD_decodingBufferSize_min(zds->fParams.windowSize, zds->fParams.frameContentSize) in ZSTD_decompressStream()
2075 ZSTD_DCtx_updateOversizedDuration(zds, neededInBuffSize, neededOutBuffSize); in ZSTD_decompressStream()
2077 …{ int const tooSmall = (zds->inBuffSize < neededInBuffSize) || (zds->outBuffSize < neededOutBuff… in ZSTD_decompressStream()
2078 int const tooLarge = ZSTD_DCtx_isOversizedTooLong(zds); in ZSTD_decompressStream()
2083 (U32)zds->inBuffSize, (U32)neededInBuffSize); in ZSTD_decompressStream()
2085 (U32)zds->outBuffSize, (U32)neededOutBuffSize); in ZSTD_decompressStream()
2086 if (zds->staticSize) { /* static DCtx */ in ZSTD_decompressStream()
2087 DEBUGLOG(4, "staticSize : %u", (U32)zds->staticSize); in ZSTD_decompressStream()
2088 assert(zds->staticSize >= sizeof(ZSTD_DCtx)); /* controlled at init */ in ZSTD_decompressStream()
2090 bufferSize > zds->staticSize - sizeof(ZSTD_DCtx), in ZSTD_decompressStream()
2093 ZSTD_customFree(zds->inBuff, zds->customMem); in ZSTD_decompressStream()
2094 zds->inBuffSize = 0; in ZSTD_decompressStream()
2095 zds->outBuffSize = 0; in ZSTD_decompressStream()
2096 zds->inBuff = (char*)ZSTD_customMalloc(bufferSize, zds->customMem); in ZSTD_decompressStream()
2097 RETURN_ERROR_IF(zds->inBuff == NULL, memory_allocation, ""); in ZSTD_decompressStream()
2099 zds->inBuffSize = neededInBuffSize; in ZSTD_decompressStream()
2100 zds->outBuff = zds->inBuff + zds->inBuffSize; in ZSTD_decompressStream()
2101 zds->outBuffSize = neededOutBuffSize; in ZSTD_decompressStream()
2103 zds->streamStage = zdss_read; in ZSTD_decompressStream()
2108 …{ size_t const neededInSize = ZSTD_nextSrcSizeToDecompressWithInputSize(zds, (size_t)(iend - ip)… in ZSTD_decompressStream()
2111 zds->streamStage = zdss_init; in ZSTD_decompressStream()
2116 … FORWARD_IF_ERROR(ZSTD_decompressContinueStream(zds, &op, oend, ip, neededInSize), ""); in ZSTD_decompressStream()
2122 zds->streamStage = zdss_load; in ZSTD_decompressStream()
2126 { size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds); in ZSTD_decompressStream()
2127 size_t const toLoad = neededInSize - zds->inPos; in ZSTD_decompressStream()
2128 int const isSkipFrame = ZSTD_isSkipFrame(zds); in ZSTD_decompressStream()
2131 assert(neededInSize == ZSTD_nextSrcSizeToDecompressWithInputSize(zds, iend - ip)); in ZSTD_decompressStream()
2135 RETURN_ERROR_IF(toLoad > zds->inBuffSize - zds->inPos, in ZSTD_decompressStream()
2138 … loadedSize = ZSTD_limitCopy(zds->inBuff + zds->inPos, toLoad, ip, (size_t)(iend-ip)); in ZSTD_decompressStream()
2141 zds->inPos += loadedSize; in ZSTD_decompressStream()
2145 zds->inPos = 0; /* input is consumed */ in ZSTD_decompressStream()
2146 … FORWARD_IF_ERROR(ZSTD_decompressContinueStream(zds, &op, oend, zds->inBuff, neededInSize), ""); in ZSTD_decompressStream()
2151 { size_t const toFlushSize = zds->outEnd - zds->outStart; in ZSTD_decompressStream()
2152 …size_t const flushedSize = ZSTD_limitCopy(op, (size_t)(oend-op), zds->outBuff + zds->outStart, toF… in ZSTD_decompressStream()
2154 zds->outStart += flushedSize; in ZSTD_decompressStream()
2156 zds->streamStage = zdss_read; in ZSTD_decompressStream()
2157 if ( (zds->outBuffSize < zds->fParams.frameContentSize) in ZSTD_decompressStream()
2158 && (zds->outStart + zds->fParams.blockSizeMax > zds->outBuffSize) ) { in ZSTD_decompressStream()
2160 (int)(zds->outBuffSize - zds->outStart), in ZSTD_decompressStream()
2161 (U32)zds->fParams.blockSizeMax); in ZSTD_decompressStream()
2162 zds->outStart = zds->outEnd = 0; in ZSTD_decompressStream()
2180 zds->expectedOutBuffer = *output; in ZSTD_decompressStream()
2183 zds->noForwardProgress ++; in ZSTD_decompressStream()
2184 if (zds->noForwardProgress >= ZSTD_NO_FORWARD_PROGRESS_MAX) { in ZSTD_decompressStream()
2190 zds->noForwardProgress = 0; in ZSTD_decompressStream()
2192 { size_t nextSrcSizeHint = ZSTD_nextSrcSizeToDecompress(zds); in ZSTD_decompressStream()
2194 if (zds->outEnd == zds->outStart) { /* output fully flushed */ in ZSTD_decompressStream()
2195 if (zds->hostageByte) { in ZSTD_decompressStream()
2198 zds->streamStage = zdss_read; in ZSTD_decompressStream()
2205 …if (!zds->hostageByte) { /* output not fully flushed; keep last byte as hostage; will be released … in ZSTD_decompressStream()
2207 zds->hostageByte=1; in ZSTD_decompressStream()
2211 …nextSrcSizeHint += ZSTD_blockHeaderSize * (ZSTD_nextInputType(zds) == ZSTDnit_block); /* preload… in ZSTD_decompressStream()
2212 assert(zds->inPos <= nextSrcSizeHint); in ZSTD_decompressStream()
2213 nextSrcSizeHint -= zds->inPos; /* part already loaded*/ in ZSTD_decompressStream()