Lines Matching refs:dctx

213 size_t ZSTD_sizeof_DCtx (const ZSTD_DCtx* dctx)  in ZSTD_sizeof_DCtx()  argument
215 if (dctx==NULL) return 0; /* support sizeof NULL */ in ZSTD_sizeof_DCtx()
216 return sizeof(*dctx) in ZSTD_sizeof_DCtx()
217 + ZSTD_sizeof_DDict(dctx->ddictLocal) in ZSTD_sizeof_DCtx()
218 + dctx->inBuffSize + dctx->outBuffSize; in ZSTD_sizeof_DCtx()
232 static void ZSTD_DCtx_resetParameters(ZSTD_DCtx* dctx) in ZSTD_DCtx_resetParameters() argument
234 assert(dctx->streamStage == zdss_init); in ZSTD_DCtx_resetParameters()
235 dctx->format = ZSTD_f_zstd1; in ZSTD_DCtx_resetParameters()
236 dctx->maxWindowSize = ZSTD_MAXWINDOWSIZE_DEFAULT; in ZSTD_DCtx_resetParameters()
237 dctx->outBufferMode = ZSTD_bm_buffered; in ZSTD_DCtx_resetParameters()
238 dctx->forceIgnoreChecksum = ZSTD_d_validateChecksum; in ZSTD_DCtx_resetParameters()
239 dctx->refMultipleDDicts = ZSTD_rmd_refSingleDDict; in ZSTD_DCtx_resetParameters()
242 static void ZSTD_initDCtx_internal(ZSTD_DCtx* dctx) in ZSTD_initDCtx_internal() argument
244 dctx->staticSize = 0; in ZSTD_initDCtx_internal()
245 dctx->ddict = NULL; in ZSTD_initDCtx_internal()
246 dctx->ddictLocal = NULL; in ZSTD_initDCtx_internal()
247 dctx->dictEnd = NULL; in ZSTD_initDCtx_internal()
248 dctx->ddictIsCold = 0; in ZSTD_initDCtx_internal()
249 dctx->dictUses = ZSTD_dont_use; in ZSTD_initDCtx_internal()
250 dctx->inBuff = NULL; in ZSTD_initDCtx_internal()
251 dctx->inBuffSize = 0; in ZSTD_initDCtx_internal()
252 dctx->outBuffSize = 0; in ZSTD_initDCtx_internal()
253 dctx->streamStage = zdss_init; in ZSTD_initDCtx_internal()
254 dctx->noForwardProgress = 0; in ZSTD_initDCtx_internal()
255 dctx->oversizedDuration = 0; in ZSTD_initDCtx_internal()
257 dctx->bmi2 = ZSTD_cpuSupportsBmi2(); in ZSTD_initDCtx_internal()
259 dctx->ddictSet = NULL; in ZSTD_initDCtx_internal()
260 ZSTD_DCtx_resetParameters(dctx); in ZSTD_initDCtx_internal()
262 dctx->dictContentEndForFuzzing = NULL; in ZSTD_initDCtx_internal()
268 ZSTD_DCtx* const dctx = (ZSTD_DCtx*) workspace; in ZSTD_initStaticDCtx() local
273 ZSTD_initDCtx_internal(dctx); in ZSTD_initStaticDCtx()
274 dctx->staticSize = workspaceSize; in ZSTD_initStaticDCtx()
275 dctx->inBuff = (char*)(dctx+1); in ZSTD_initStaticDCtx()
276 return dctx; in ZSTD_initStaticDCtx()
282 { ZSTD_DCtx* const dctx = (ZSTD_DCtx*)ZSTD_customMalloc(sizeof(*dctx), customMem); in ZSTD_createDCtx_internal() local
283 if (!dctx) return NULL; in ZSTD_createDCtx_internal()
284 dctx->customMem = customMem; in ZSTD_createDCtx_internal()
285 ZSTD_initDCtx_internal(dctx); in ZSTD_createDCtx_internal()
286 return dctx; in ZSTD_createDCtx_internal()
301 static void ZSTD_clearDict(ZSTD_DCtx* dctx) in ZSTD_clearDict() argument
303 ZSTD_freeDDict(dctx->ddictLocal); in ZSTD_clearDict()
304 dctx->ddictLocal = NULL; in ZSTD_clearDict()
305 dctx->ddict = NULL; in ZSTD_clearDict()
306 dctx->dictUses = ZSTD_dont_use; in ZSTD_clearDict()
309 size_t ZSTD_freeDCtx(ZSTD_DCtx* dctx) in ZSTD_freeDCtx() argument
311 if (dctx==NULL) return 0; /* support free on NULL */ in ZSTD_freeDCtx()
312 RETURN_ERROR_IF(dctx->staticSize, memory_allocation, "not compatible with static DCtx"); in ZSTD_freeDCtx()
313 { ZSTD_customMem const cMem = dctx->customMem; in ZSTD_freeDCtx()
314 ZSTD_clearDict(dctx); in ZSTD_freeDCtx()
315 ZSTD_customFree(dctx->inBuff, cMem); in ZSTD_freeDCtx()
316 dctx->inBuff = NULL; in ZSTD_freeDCtx()
317 if (dctx->ddictSet) { in ZSTD_freeDCtx()
318 ZSTD_freeDDictHashSet(dctx->ddictSet, cMem); in ZSTD_freeDCtx()
319 dctx->ddictSet = NULL; in ZSTD_freeDCtx()
321 ZSTD_customFree(dctx, cMem); in ZSTD_freeDCtx()
341 static void ZSTD_DCtx_selectFrameDDict(ZSTD_DCtx* dctx) { in ZSTD_DCtx_selectFrameDDict() argument
342 assert(dctx->refMultipleDDicts && dctx->ddictSet); in ZSTD_DCtx_selectFrameDDict()
344 if (dctx->ddict) { in ZSTD_DCtx_selectFrameDDict()
345 … const ZSTD_DDict* frameDDict = ZSTD_DDictHashSet_getDDict(dctx->ddictSet, dctx->fParams.dictID); in ZSTD_DCtx_selectFrameDDict()
348 ZSTD_clearDict(dctx); in ZSTD_DCtx_selectFrameDDict()
349 dctx->dictID = dctx->fParams.dictID; in ZSTD_DCtx_selectFrameDDict()
350 dctx->ddict = frameDDict; in ZSTD_DCtx_selectFrameDDict()
351 dctx->dictUses = ZSTD_use_indefinitely; in ZSTD_DCtx_selectFrameDDict()
647 static size_t ZSTD_decodeFrameHeader(ZSTD_DCtx* dctx, const void* src, size_t headerSize) in ZSTD_decodeFrameHeader() argument
649 …size_t const result = ZSTD_getFrameHeader_advanced(&(dctx->fParams), src, headerSize, dctx->format… in ZSTD_decodeFrameHeader()
654 if (dctx->refMultipleDDicts == ZSTD_rmd_refMultipleDDicts && dctx->ddictSet) { in ZSTD_decodeFrameHeader()
655 ZSTD_DCtx_selectFrameDDict(dctx); in ZSTD_decodeFrameHeader()
662 RETURN_ERROR_IF(dctx->fParams.dictID && (dctx->dictID != dctx->fParams.dictID), in ZSTD_decodeFrameHeader()
665 dctx->validateChecksum = (dctx->fParams.checksumFlag && !dctx->forceIgnoreChecksum) ? 1 : 0; in ZSTD_decodeFrameHeader()
666 if (dctx->validateChecksum) xxh64_reset(&dctx->xxhState, 0); in ZSTD_decodeFrameHeader()
667 dctx->processedCSize += headerSize; in ZSTD_decodeFrameHeader()
783 size_t ZSTD_insertBlock(ZSTD_DCtx* dctx, const void* blockStart, size_t blockSize) in ZSTD_insertBlock() argument
786 ZSTD_checkContinuity(dctx, blockStart, blockSize); in ZSTD_insertBlock()
787 dctx->previousDstEnd = (const char*)blockStart + blockSize; in ZSTD_insertBlock()
818 static void ZSTD_DCtx_trace_end(ZSTD_DCtx const* dctx, U64 uncompressedSize, U64 compressedSize, un… in ZSTD_DCtx_trace_end() argument
820 (void)dctx; in ZSTD_DCtx_trace_end()
831 static size_t ZSTD_decompressFrame(ZSTD_DCtx* dctx, in ZSTD_decompressFrame() argument
846 remainingSrcSize < ZSTD_FRAMEHEADERSIZE_MIN(dctx->format)+ZSTD_blockHeaderSize, in ZSTD_decompressFrame()
851 ip, ZSTD_FRAMEHEADERSIZE_PREFIX(dctx->format), dctx->format); in ZSTD_decompressFrame()
855 FORWARD_IF_ERROR( ZSTD_decodeFrameHeader(dctx, ip, frameHeaderSize) , ""); in ZSTD_decompressFrame()
891 …decodedSize = ZSTD_decompressBlock_internal(dctx, op, (size_t)(oBlockEnd-op), ip, cBlockSize, /* f… in ZSTD_decompressFrame()
906 if (dctx->validateChecksum) in ZSTD_decompressFrame()
907 xxh64_update(&dctx->xxhState, op, decodedSize); in ZSTD_decompressFrame()
916 if (dctx->fParams.frameContentSize != ZSTD_CONTENTSIZE_UNKNOWN) { in ZSTD_decompressFrame()
917 RETURN_ERROR_IF((U64)(op-ostart) != dctx->fParams.frameContentSize, in ZSTD_decompressFrame()
920 if (dctx->fParams.checksumFlag) { /* Frame content checksum verification */ in ZSTD_decompressFrame()
922 if (!dctx->forceIgnoreChecksum) { in ZSTD_decompressFrame()
923 U32 const checkCalc = (U32)xxh64_digest(&dctx->xxhState); in ZSTD_decompressFrame()
931 ZSTD_DCtx_trace_end(dctx, (U64)(op-ostart), (U64)(ip-istart), /* streaming */ 0); in ZSTD_decompressFrame()
938 static size_t ZSTD_decompressMultiFrame(ZSTD_DCtx* dctx, in ZSTD_decompressMultiFrame() argument
955 while (srcSize >= ZSTD_startingInputLength(dctx->format)) { in ZSTD_decompressMultiFrame()
973 FORWARD_IF_ERROR(ZSTD_decompressBegin_usingDDict(dctx, ddict), ""); in ZSTD_decompressMultiFrame()
977 FORWARD_IF_ERROR(ZSTD_decompressBegin_usingDict(dctx, dict, dictSize), ""); in ZSTD_decompressMultiFrame()
979 ZSTD_checkContinuity(dctx, dst, dstCapacity); in ZSTD_decompressMultiFrame()
981 { const size_t res = ZSTD_decompressFrame(dctx, dst, dstCapacity, in ZSTD_decompressMultiFrame()
1008 size_t ZSTD_decompress_usingDict(ZSTD_DCtx* dctx, in ZSTD_decompress_usingDict() argument
1013 return ZSTD_decompressMultiFrame(dctx, dst, dstCapacity, src, srcSize, dict, dictSize, NULL); in ZSTD_decompress_usingDict()
1017 static ZSTD_DDict const* ZSTD_getDDict(ZSTD_DCtx* dctx) in ZSTD_getDDict() argument
1019 switch (dctx->dictUses) { in ZSTD_getDDict()
1024 ZSTD_clearDict(dctx); in ZSTD_getDDict()
1027 return dctx->ddict; in ZSTD_getDDict()
1029 dctx->dictUses = ZSTD_dont_use; in ZSTD_getDDict()
1030 return dctx->ddict; in ZSTD_getDDict()
1034 size_t ZSTD_decompressDCtx(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t … in ZSTD_decompressDCtx() argument
1036 return ZSTD_decompress_usingDDict(dctx, dst, dstCapacity, src, srcSize, ZSTD_getDDict(dctx)); in ZSTD_decompressDCtx()
1044 ZSTD_DCtx* const dctx = ZSTD_createDCtx_internal(ZSTD_defaultCMem); in ZSTD_decompress() local
1045 RETURN_ERROR_IF(dctx==NULL, memory_allocation, "NULL pointer!"); in ZSTD_decompress()
1046 regenSize = ZSTD_decompressDCtx(dctx, dst, dstCapacity, src, srcSize); in ZSTD_decompress()
1047 ZSTD_freeDCtx(dctx); in ZSTD_decompress()
1050 ZSTD_DCtx dctx; in ZSTD_decompress()
1051 ZSTD_initDCtx_internal(&dctx); in ZSTD_decompress()
1052 return ZSTD_decompressDCtx(&dctx, dst, dstCapacity, src, srcSize); in ZSTD_decompress()
1061 size_t ZSTD_nextSrcSizeToDecompress(ZSTD_DCtx* dctx) { return dctx->expected; } in ZSTD_nextSrcSizeToDecompress() argument
1073 static size_t ZSTD_nextSrcSizeToDecompressWithInputSize(ZSTD_DCtx* dctx, size_t inputSize) { in ZSTD_nextSrcSizeToDecompressWithInputSize() argument
1074 if (!(dctx->stage == ZSTDds_decompressBlock || dctx->stage == ZSTDds_decompressLastBlock)) in ZSTD_nextSrcSizeToDecompressWithInputSize()
1075 return dctx->expected; in ZSTD_nextSrcSizeToDecompressWithInputSize()
1076 if (dctx->bType != bt_raw) in ZSTD_nextSrcSizeToDecompressWithInputSize()
1077 return dctx->expected; in ZSTD_nextSrcSizeToDecompressWithInputSize()
1078 return BOUNDED(1, inputSize, dctx->expected); in ZSTD_nextSrcSizeToDecompressWithInputSize()
1081 ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx* dctx) { in ZSTD_nextInputType() argument
1082 switch(dctx->stage) in ZSTD_nextInputType()
1106 static int ZSTD_isSkipFrame(ZSTD_DCtx* dctx) { return dctx->stage == ZSTDds_skipFrame; } in ZSTD_isSkipFrame() argument
1112 size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, siz… in ZSTD_decompressContinue() argument
1116 …RETURN_ERROR_IF(srcSize != ZSTD_nextSrcSizeToDecompressWithInputSize(dctx, srcSize), srcSize_wrong… in ZSTD_decompressContinue()
1117 ZSTD_checkContinuity(dctx, dst, dstCapacity); in ZSTD_decompressContinue()
1119 dctx->processedCSize += srcSize; in ZSTD_decompressContinue()
1121 switch (dctx->stage) in ZSTD_decompressContinue()
1125 if (dctx->format == ZSTD_f_zstd1) { /* allows header */ in ZSTD_decompressContinue()
1128 ZSTD_memcpy(dctx->headerBuffer, src, srcSize); in ZSTD_decompressContinue()
1129dctx->expected = ZSTD_SKIPPABLEHEADERSIZE - srcSize; /* remaining to load to get full skippable f… in ZSTD_decompressContinue()
1130 dctx->stage = ZSTDds_decodeSkippableHeader; in ZSTD_decompressContinue()
1133 dctx->headerSize = ZSTD_frameHeaderSize_internal(src, srcSize, dctx->format); in ZSTD_decompressContinue()
1134 if (ZSTD_isError(dctx->headerSize)) return dctx->headerSize; in ZSTD_decompressContinue()
1135 ZSTD_memcpy(dctx->headerBuffer, src, srcSize); in ZSTD_decompressContinue()
1136 dctx->expected = dctx->headerSize - srcSize; in ZSTD_decompressContinue()
1137 dctx->stage = ZSTDds_decodeFrameHeader; in ZSTD_decompressContinue()
1142 ZSTD_memcpy(dctx->headerBuffer + (dctx->headerSize - srcSize), src, srcSize); in ZSTD_decompressContinue()
1143 FORWARD_IF_ERROR(ZSTD_decodeFrameHeader(dctx, dctx->headerBuffer, dctx->headerSize), ""); in ZSTD_decompressContinue()
1144 dctx->expected = ZSTD_blockHeaderSize; in ZSTD_decompressContinue()
1145 dctx->stage = ZSTDds_decodeBlockHeader; in ZSTD_decompressContinue()
1152 …RETURN_ERROR_IF(cBlockSize > dctx->fParams.blockSizeMax, corruption_detected, "Block Size Exceeds … in ZSTD_decompressContinue()
1153 dctx->expected = cBlockSize; in ZSTD_decompressContinue()
1154 dctx->bType = bp.blockType; in ZSTD_decompressContinue()
1155 dctx->rleSize = bp.origSize; in ZSTD_decompressContinue()
1157 dctx->stage = bp.lastBlock ? ZSTDds_decompressLastBlock : ZSTDds_decompressBlock; in ZSTD_decompressContinue()
1162 if (dctx->fParams.checksumFlag) { in ZSTD_decompressContinue()
1163 dctx->expected = 4; in ZSTD_decompressContinue()
1164 dctx->stage = ZSTDds_checkChecksum; in ZSTD_decompressContinue()
1166 dctx->expected = 0; /* end of frame */ in ZSTD_decompressContinue()
1167 dctx->stage = ZSTDds_getFrameHeaderSize; in ZSTD_decompressContinue()
1170 dctx->expected = ZSTD_blockHeaderSize; /* jump to next header */ in ZSTD_decompressContinue()
1171 dctx->stage = ZSTDds_decodeBlockHeader; in ZSTD_decompressContinue()
1180 switch(dctx->bType) in ZSTD_decompressContinue()
1184 …rSize = ZSTD_decompressBlock_internal(dctx, dst, dstCapacity, src, srcSize, /* frame */ 1, is_stre… in ZSTD_decompressContinue()
1185 dctx->expected = 0; /* Streaming not supported */ in ZSTD_decompressContinue()
1188 assert(srcSize <= dctx->expected); in ZSTD_decompressContinue()
1192 dctx->expected -= rSize; in ZSTD_decompressContinue()
1195 rSize = ZSTD_setRleBlock(dst, dstCapacity, *(const BYTE*)src, dctx->rleSize); in ZSTD_decompressContinue()
1196 dctx->expected = 0; /* Streaming not supported */ in ZSTD_decompressContinue()
1203 …RETURN_ERROR_IF(rSize > dctx->fParams.blockSizeMax, corruption_detected, "Decompressed Block Size … in ZSTD_decompressContinue()
1205 dctx->decodedSize += rSize; in ZSTD_decompressContinue()
1206 if (dctx->validateChecksum) xxh64_update(&dctx->xxhState, dst, rSize); in ZSTD_decompressContinue()
1207 dctx->previousDstEnd = (char*)dst + rSize; in ZSTD_decompressContinue()
1210 if (dctx->expected > 0) { in ZSTD_decompressContinue()
1214 if (dctx->stage == ZSTDds_decompressLastBlock) { /* end of frame */ in ZSTD_decompressContinue()
1215 … DEBUGLOG(4, "ZSTD_decompressContinue: decoded size from frame : %u", (unsigned)dctx->decodedSize); in ZSTD_decompressContinue()
1217 dctx->fParams.frameContentSize != ZSTD_CONTENTSIZE_UNKNOWN in ZSTD_decompressContinue()
1218 && dctx->decodedSize != dctx->fParams.frameContentSize, in ZSTD_decompressContinue()
1220 if (dctx->fParams.checksumFlag) { /* another round for frame checksum */ in ZSTD_decompressContinue()
1221 dctx->expected = 4; in ZSTD_decompressContinue()
1222 dctx->stage = ZSTDds_checkChecksum; in ZSTD_decompressContinue()
1224 … ZSTD_DCtx_trace_end(dctx, dctx->decodedSize, dctx->processedCSize, /* streaming */ 1); in ZSTD_decompressContinue()
1225 dctx->expected = 0; /* ends here */ in ZSTD_decompressContinue()
1226 dctx->stage = ZSTDds_getFrameHeaderSize; in ZSTD_decompressContinue()
1229 dctx->stage = ZSTDds_decodeBlockHeader; in ZSTD_decompressContinue()
1230 dctx->expected = ZSTD_blockHeaderSize; in ZSTD_decompressContinue()
1238 if (dctx->validateChecksum) { in ZSTD_decompressContinue()
1239 U32 const h32 = (U32)xxh64_digest(&dctx->xxhState); in ZSTD_decompressContinue()
1244 ZSTD_DCtx_trace_end(dctx, dctx->decodedSize, dctx->processedCSize, /* streaming */ 1); in ZSTD_decompressContinue()
1245 dctx->expected = 0; in ZSTD_decompressContinue()
1246 dctx->stage = ZSTDds_getFrameHeaderSize; in ZSTD_decompressContinue()
1253 …ZSTD_memcpy(dctx->headerBuffer + (ZSTD_SKIPPABLEHEADERSIZE - srcSize), src, srcSize); /* complet… in ZSTD_decompressContinue()
1254dctx->expected = MEM_readLE32(dctx->headerBuffer + ZSTD_FRAMEIDSIZE); /* note : dctx->expected c… in ZSTD_decompressContinue()
1255 dctx->stage = ZSTDds_skipFrame; in ZSTD_decompressContinue()
1259 dctx->expected = 0; in ZSTD_decompressContinue()
1260 dctx->stage = ZSTDds_getFrameHeaderSize; in ZSTD_decompressContinue()
1270 static size_t ZSTD_refDictContent(ZSTD_DCtx* dctx, const void* dict, size_t dictSize) in ZSTD_refDictContent() argument
1272 dctx->dictEnd = dctx->previousDstEnd; in ZSTD_refDictContent()
1273dctx->virtualStart = (const char*)dict - ((const char*)(dctx->previousDstEnd) - (const char*)(dctx in ZSTD_refDictContent()
1274 dctx->prefixStart = dict; in ZSTD_refDictContent()
1275 dctx->previousDstEnd = (const char*)dict + dictSize; in ZSTD_refDictContent()
1277 dctx->dictContentBeginForFuzzing = dctx->prefixStart; in ZSTD_refDictContent()
1278 dctx->dictContentEndForFuzzing = dctx->previousDstEnd; in ZSTD_refDictContent()
1374 static size_t ZSTD_decompress_insertDictionary(ZSTD_DCtx* dctx, const void* dict, size_t dictSize) in ZSTD_decompress_insertDictionary() argument
1376 if (dictSize < 8) return ZSTD_refDictContent(dctx, dict, dictSize); in ZSTD_decompress_insertDictionary()
1379 return ZSTD_refDictContent(dctx, dict, dictSize); /* pure content mode */ in ZSTD_decompress_insertDictionary()
1381 dctx->dictID = MEM_readLE32((const char*)dict + ZSTD_FRAMEIDSIZE); in ZSTD_decompress_insertDictionary()
1384 { size_t const eSize = ZSTD_loadDEntropy(&dctx->entropy, dict, dictSize); in ZSTD_decompress_insertDictionary()
1389 dctx->litEntropy = dctx->fseEntropy = 1; in ZSTD_decompress_insertDictionary()
1392 return ZSTD_refDictContent(dctx, dict, dictSize); in ZSTD_decompress_insertDictionary()
1395 size_t ZSTD_decompressBegin(ZSTD_DCtx* dctx) in ZSTD_decompressBegin() argument
1397 assert(dctx != NULL); in ZSTD_decompressBegin()
1398dctx->expected = ZSTD_startingInputLength(dctx->format); /* dctx->format must be properly set */ in ZSTD_decompressBegin()
1399 dctx->stage = ZSTDds_getFrameHeaderSize; in ZSTD_decompressBegin()
1400 dctx->processedCSize = 0; in ZSTD_decompressBegin()
1401 dctx->decodedSize = 0; in ZSTD_decompressBegin()
1402 dctx->previousDstEnd = NULL; in ZSTD_decompressBegin()
1403 dctx->prefixStart = NULL; in ZSTD_decompressBegin()
1404 dctx->virtualStart = NULL; in ZSTD_decompressBegin()
1405 dctx->dictEnd = NULL; in ZSTD_decompressBegin()
1406dctx->entropy.hufTable[0] = (HUF_DTable)((HufLog)*0x1000001); /* cover both little and big endian… in ZSTD_decompressBegin()
1407 dctx->litEntropy = dctx->fseEntropy = 0; in ZSTD_decompressBegin()
1408 dctx->dictID = 0; in ZSTD_decompressBegin()
1409 dctx->bType = bt_reserved; in ZSTD_decompressBegin()
1410 ZSTD_STATIC_ASSERT(sizeof(dctx->entropy.rep) == sizeof(repStartValue)); in ZSTD_decompressBegin()
1411 ZSTD_memcpy(dctx->entropy.rep, repStartValue, sizeof(repStartValue)); /* initial repcodes */ in ZSTD_decompressBegin()
1412 dctx->LLTptr = dctx->entropy.LLTable; in ZSTD_decompressBegin()
1413 dctx->MLTptr = dctx->entropy.MLTable; in ZSTD_decompressBegin()
1414 dctx->OFTptr = dctx->entropy.OFTable; in ZSTD_decompressBegin()
1415 dctx->HUFptr = dctx->entropy.hufTable; in ZSTD_decompressBegin()
1419 size_t ZSTD_decompressBegin_usingDict(ZSTD_DCtx* dctx, const void* dict, size_t dictSize) in ZSTD_decompressBegin_usingDict() argument
1421 FORWARD_IF_ERROR( ZSTD_decompressBegin(dctx) , ""); in ZSTD_decompressBegin_usingDict()
1424 ZSTD_isError(ZSTD_decompress_insertDictionary(dctx, dict, dictSize)), in ZSTD_decompressBegin_usingDict()
1432 size_t ZSTD_decompressBegin_usingDDict(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict) in ZSTD_decompressBegin_usingDDict() argument
1435 assert(dctx != NULL); in ZSTD_decompressBegin_usingDDict()
1440 dctx->ddictIsCold = (dctx->dictEnd != dictEnd); in ZSTD_decompressBegin_usingDDict()
1442 dctx->ddictIsCold ? "~cold~" : "hot!"); in ZSTD_decompressBegin_usingDDict()
1444 FORWARD_IF_ERROR( ZSTD_decompressBegin(dctx) , ""); in ZSTD_decompressBegin_usingDDict()
1446 ZSTD_copyDDictParameters(dctx, ddict); in ZSTD_decompressBegin_usingDDict()
1487 size_t ZSTD_decompress_usingDDict(ZSTD_DCtx* dctx, in ZSTD_decompress_usingDDict() argument
1493 return ZSTD_decompressMultiFrame(dctx, dst, dstCapacity, src, srcSize, in ZSTD_decompress_usingDDict()
1530 size_t ZSTD_DCtx_loadDictionary_advanced(ZSTD_DCtx* dctx, in ZSTD_DCtx_loadDictionary_advanced() argument
1535 RETURN_ERROR_IF(dctx->streamStage != zdss_init, stage_wrong, ""); in ZSTD_DCtx_loadDictionary_advanced()
1536 ZSTD_clearDict(dctx); in ZSTD_DCtx_loadDictionary_advanced()
1538dctx->ddictLocal = ZSTD_createDDict_advanced(dict, dictSize, dictLoadMethod, dictContentType, dctx in ZSTD_DCtx_loadDictionary_advanced()
1539 RETURN_ERROR_IF(dctx->ddictLocal == NULL, memory_allocation, "NULL pointer!"); in ZSTD_DCtx_loadDictionary_advanced()
1540 dctx->ddict = dctx->ddictLocal; in ZSTD_DCtx_loadDictionary_advanced()
1541 dctx->dictUses = ZSTD_use_indefinitely; in ZSTD_DCtx_loadDictionary_advanced()
1546 size_t ZSTD_DCtx_loadDictionary_byReference(ZSTD_DCtx* dctx, const void* dict, size_t dictSize) in ZSTD_DCtx_loadDictionary_byReference() argument
1548 return ZSTD_DCtx_loadDictionary_advanced(dctx, dict, dictSize, ZSTD_dlm_byRef, ZSTD_dct_auto); in ZSTD_DCtx_loadDictionary_byReference()
1551 size_t ZSTD_DCtx_loadDictionary(ZSTD_DCtx* dctx, const void* dict, size_t dictSize) in ZSTD_DCtx_loadDictionary() argument
1553 return ZSTD_DCtx_loadDictionary_advanced(dctx, dict, dictSize, ZSTD_dlm_byCopy, ZSTD_dct_auto); in ZSTD_DCtx_loadDictionary()
1556 size_t ZSTD_DCtx_refPrefix_advanced(ZSTD_DCtx* dctx, const void* prefix, size_t prefixSize, ZSTD_di… in ZSTD_DCtx_refPrefix_advanced() argument
1558 …FORWARD_IF_ERROR(ZSTD_DCtx_loadDictionary_advanced(dctx, prefix, prefixSize, ZSTD_dlm_byRef, dictC… in ZSTD_DCtx_refPrefix_advanced()
1559 dctx->dictUses = ZSTD_use_once; in ZSTD_DCtx_refPrefix_advanced()
1563 size_t ZSTD_DCtx_refPrefix(ZSTD_DCtx* dctx, const void* prefix, size_t prefixSize) in ZSTD_DCtx_refPrefix() argument
1565 return ZSTD_DCtx_refPrefix_advanced(dctx, prefix, prefixSize, ZSTD_dct_rawContent); in ZSTD_DCtx_refPrefix()
1590 size_t ZSTD_initDStream_usingDDict(ZSTD_DStream* dctx, const ZSTD_DDict* ddict) in ZSTD_initDStream_usingDDict() argument
1592 FORWARD_IF_ERROR( ZSTD_DCtx_reset(dctx, ZSTD_reset_session_only) , ""); in ZSTD_initDStream_usingDDict()
1593 FORWARD_IF_ERROR( ZSTD_DCtx_refDDict(dctx, ddict) , ""); in ZSTD_initDStream_usingDDict()
1594 return ZSTD_startingInputLength(dctx->format); in ZSTD_initDStream_usingDDict()
1600 size_t ZSTD_resetDStream(ZSTD_DStream* dctx) in ZSTD_resetDStream() argument
1602 FORWARD_IF_ERROR(ZSTD_DCtx_reset(dctx, ZSTD_reset_session_only), ""); in ZSTD_resetDStream()
1603 return ZSTD_startingInputLength(dctx->format); in ZSTD_resetDStream()
1607 size_t ZSTD_DCtx_refDDict(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict) in ZSTD_DCtx_refDDict() argument
1609 RETURN_ERROR_IF(dctx->streamStage != zdss_init, stage_wrong, ""); in ZSTD_DCtx_refDDict()
1610 ZSTD_clearDict(dctx); in ZSTD_DCtx_refDDict()
1612 dctx->ddict = ddict; in ZSTD_DCtx_refDDict()
1613 dctx->dictUses = ZSTD_use_indefinitely; in ZSTD_DCtx_refDDict()
1614 if (dctx->refMultipleDDicts == ZSTD_rmd_refMultipleDDicts) { in ZSTD_DCtx_refDDict()
1615 if (dctx->ddictSet == NULL) { in ZSTD_DCtx_refDDict()
1616 dctx->ddictSet = ZSTD_createDDictHashSet(dctx->customMem); in ZSTD_DCtx_refDDict()
1617 if (!dctx->ddictSet) { in ZSTD_DCtx_refDDict()
1621 … assert(!dctx->staticSize); /* Impossible: ddictSet cannot have been allocated if static dctx */ in ZSTD_DCtx_refDDict()
1622 … FORWARD_IF_ERROR(ZSTD_DDictHashSet_addDDict(dctx->ddictSet, ddict, dctx->customMem), ""); in ZSTD_DCtx_refDDict()
1631 size_t ZSTD_DCtx_setMaxWindowSize(ZSTD_DCtx* dctx, size_t maxWindowSize) in ZSTD_DCtx_setMaxWindowSize() argument
1636 RETURN_ERROR_IF(dctx->streamStage != zdss_init, stage_wrong, ""); in ZSTD_DCtx_setMaxWindowSize()
1639 dctx->maxWindowSize = maxWindowSize; in ZSTD_DCtx_setMaxWindowSize()
1643 size_t ZSTD_DCtx_setFormat(ZSTD_DCtx* dctx, ZSTD_format_e format) in ZSTD_DCtx_setFormat() argument
1645 return ZSTD_DCtx_setParameter(dctx, ZSTD_d_format, (int)format); in ZSTD_DCtx_setFormat()
1695 size_t ZSTD_DCtx_getParameter(ZSTD_DCtx* dctx, ZSTD_dParameter param, int* value) in ZSTD_DCtx_getParameter() argument
1699 *value = (int)ZSTD_highbit32((U32)dctx->maxWindowSize); in ZSTD_DCtx_getParameter()
1702 *value = (int)dctx->format; in ZSTD_DCtx_getParameter()
1705 *value = (int)dctx->outBufferMode; in ZSTD_DCtx_getParameter()
1708 *value = (int)dctx->forceIgnoreChecksum; in ZSTD_DCtx_getParameter()
1711 *value = (int)dctx->refMultipleDDicts; in ZSTD_DCtx_getParameter()
1718 size_t ZSTD_DCtx_setParameter(ZSTD_DCtx* dctx, ZSTD_dParameter dParam, int value) in ZSTD_DCtx_setParameter() argument
1720 RETURN_ERROR_IF(dctx->streamStage != zdss_init, stage_wrong, ""); in ZSTD_DCtx_setParameter()
1725 dctx->maxWindowSize = ((size_t)1) << value; in ZSTD_DCtx_setParameter()
1729 dctx->format = (ZSTD_format_e)value; in ZSTD_DCtx_setParameter()
1733 dctx->outBufferMode = (ZSTD_bufferMode_e)value; in ZSTD_DCtx_setParameter()
1737 dctx->forceIgnoreChecksum = (ZSTD_forceIgnoreChecksum_e)value; in ZSTD_DCtx_setParameter()
1741 if (dctx->staticSize != 0) { in ZSTD_DCtx_setParameter()
1744 dctx->refMultipleDDicts = (ZSTD_refMultipleDDicts_e)value; in ZSTD_DCtx_setParameter()
1751 size_t ZSTD_DCtx_reset(ZSTD_DCtx* dctx, ZSTD_ResetDirective reset) in ZSTD_DCtx_reset() argument
1755 dctx->streamStage = zdss_init; in ZSTD_DCtx_reset()
1756 dctx->noForwardProgress = 0; in ZSTD_DCtx_reset()
1760 RETURN_ERROR_IF(dctx->streamStage != zdss_init, stage_wrong, ""); in ZSTD_DCtx_reset()
1761 ZSTD_clearDict(dctx); in ZSTD_DCtx_reset()
1762 ZSTD_DCtx_resetParameters(dctx); in ZSTD_DCtx_reset()
1768 size_t ZSTD_sizeof_DStream(const ZSTD_DStream* dctx) in ZSTD_sizeof_DStream() argument
1770 return ZSTD_sizeof_DCtx(dctx); in ZSTD_sizeof_DStream()
2139 ZSTD_DCtx* dctx, in ZSTD_decompressStream_simpleArgs() argument
2146 size_t const cErr = ZSTD_decompressStream(dctx, &output, &input); in ZSTD_decompressStream_simpleArgs()