#ifdefined(ZSTD_DLL_EXPORT) && (ZSTD_DLL_EXPORT==1) # define ZSTDLIB_API __declspec(dllexport) ZSTDLIB_VISIBLE #elifdefined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1) # define ZSTDLIB_API __declspec(dllimport) ZSTDLIB_VISIBLE /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/ #else # define ZSTDLIB_API ZSTDLIB_VISIBLE #endif
/* All magic numbers are supposed read/written to/from files/memory using little-endian convention */ #define ZSTD_MAGICNUMBER 0xFD2FB528 /* valid since v0.8.0 */ #define ZSTD_MAGIC_DICTIONARY 0xEC30A437 /* valid since v0.7.0 */ #define ZSTD_MAGIC_SKIPPABLE_START 0x184D2A50 /* all 16 values, from 0x184D2A50 to 0x184D2A5F, signal the beginning of a skippable frame */ #define ZSTD_MAGIC_SKIPPABLE_MASK 0xFFFFFFF0
/*************************************** *SimpleCoreAPI
***************************************/ /*! ZSTD_compress() : *Compresses`src`contentasasinglezstdcompressedframeintoalreadyallocated`dst`. *NOTE:Providing`dstCapacity>=ZSTD_compressBound(srcSize)`guaranteesthatzstdwillhave *enoughspacetosuccessfullycompressthedata. *@return:compressedsizewritteninto`dst`(<=`dstCapacity),
* or an error code if it fails (which can be tested using ZSTD_isError()). */
ZSTDLIB_API size_t ZSTD_compress( void* dst, size_t dstCapacity, constvoid* src, size_t srcSize, int compressionLevel);
/*! ZSTD_decompress() : *`compressedSize`:mustbethe_exact_sizeofsomenumberofcompressedand/orskippableframes. *Multiplecompressedframescanbedecompressedatoncewiththismethod. *Theresultwillbetheconcatenationofalldecompressedframes,backtoback. *`dstCapacity`isanupperboundoforiginalSizetoregenerate. *Firstframe'sdecompressedsizecanbeextractedusingZSTD_getFrameContentSize(). *Ifmaximumupperboundisn'tknown,preferusingstreamingmodetodecompressdata. *@return:thenumberofbytesdecompressedinto`dst`(<=`dstCapacity`),
* or an errorCode if it fails (which can be tested using ZSTD_isError()). */
ZSTDLIB_API size_t ZSTD_decompress( void* dst, size_t dstCapacity, constvoid* src, size_t compressedSize);
/*! ZSTD_getDecompressedSize() (obsolete): *Thisfunctionisnowobsolete,infavorofZSTD_getFrameContentSize(). *Bothfunctionsworkthesameway,butZSTD_getDecompressedSize()blends *"empty","unknown"and"error"resultstothesamereturnvalue(0), *whileZSTD_getFrameContentSize()givesthemseparatereturnvalues.
* @return : decompressed size of `src` frame content _if known and not empty_, 0 otherwise. */
ZSTD_DEPRECATED("Replaced by ZSTD_getFrameContentSize")
ZSTDLIB_API unsignedlonglong ZSTD_getDecompressedSize(constvoid* src, size_t srcSize);
/*! ZSTD_findFrameCompressedSize() : Requires v1.4.0+ *`src`shouldpointtothestartofaZSTDframeorskippableframe. *`srcSize`mustbe>=firstframesize *@return:thecompressedsizeofthefirstframestartingat`src`, *suitabletopassas`srcSize`to`ZSTD_decompress`orsimilar, *oranerrorcodeifinputisinvalid *Note1:thismethodiscalled_find*()becauseit'snotenoughtoreadtheheader, *itmayhavetoscanthroughtheframe'scontent,toreachitsend. *Note2:thismethodalsoworkswithSkippableFrames.Inwhichcase, *itreturnsthesizeofthecompleteskippableframe,
* which is always equal to its content size + 8 bytes for headers. */
ZSTDLIB_API size_t ZSTD_findFrameCompressedSize(constvoid* src, size_t srcSize);
/*====== Compression helper functions ======*/
/*! ZSTD_compressBound() : *maximumcompressedsizeinworstcasesingle-passscenario. *Wheninvoking`ZSTD_compress()`,oranyotherone-passcompressionfunction, *it'srecommendedtoprovide@dstCapacity>=ZSTD_compressBound(srcSize) *asiteliminatesonepotentialfailurescenario, *akanotenoughroomindstbuffertowritethecompressedframe. *Note:ZSTD_compressBound()itselfcanfail,if@srcSize>=ZSTD_MAX_INPUT_SIZE. *Inwhichcase,ZSTD_compressBound()willreturnanerrorcode *whichcanbetestedusingZSTD_isError(). * *ZSTD_COMPRESSBOUND(): *sameasZSTD_compressBound(),butasamacro. *Itcanbeusedtoproduceconstants,whichcanbeusefulforstaticallocation, *forexampletosizeastaticarrayonstack. *Willproduceconstantvalue0ifsrcSizeistoolarge.
*/ #define ZSTD_MAX_INPUT_SIZE ((sizeof(size_t)==8) ? 0xFF00FF00FF00FF00ULL : 0xFF00FF00U) #define ZSTD_COMPRESSBOUND(srcSize) (((size_t)(srcSize) >= ZSTD_MAX_INPUT_SIZE) ? 0 : (srcSize) + ((srcSize)>>8) + (((srcSize) < (128<<10)) ? (((128<<10) - (srcSize)) >> 11) /* margin, from 64 to 0 */ : 0)) /* this formula ensures that bound(A) + bound(B) <= bound(A+B) as long as A and B >= 128 KB */
ZSTDLIB_API size_t ZSTD_compressBound(size_t srcSize); /*!< maximum compressed size in worst case single-pass scenario */
/*====== Error helper functions ======*/ /* ZSTD_isError() : *MostZSTD_*functionsreturningasize_tvaluecanbetestedforerror, *usingZSTD_isError(). *@return1iferror,0otherwise
*/
ZSTDLIB_API unsigned ZSTD_isError(size_t result); /*!< tells if a `size_t` function result is an error code */
ZSTDLIB_API ZSTD_ErrorCode ZSTD_getErrorCode(size_t functionResult); /* convert a result into an error code, which can be compared to error enum list */
ZSTDLIB_API constchar* ZSTD_getErrorName(size_t result); /*!< provides readable string from a function result */
ZSTDLIB_API int ZSTD_minCLevel(void); /*!< minimum negative compression level allowed, requires v1.4.0+ */
ZSTDLIB_API int ZSTD_maxCLevel(void); /*!< maximum compression level available */
ZSTDLIB_API int ZSTD_defaultCLevel(void); /*!< default compression level, specified by ZSTD_CLEVEL_DEFAULT, requires v1.5.0+ */
/* Compression strategies, listed from fastest to strongest */ typedefenum { ZSTD_fast=1,
ZSTD_dfast=2,
ZSTD_greedy=3,
ZSTD_lazy=4,
ZSTD_lazy2=5,
ZSTD_btlazy2=6,
ZSTD_btopt=7,
ZSTD_btultra=8,
ZSTD_btultra2=9 /* note : new strategies _might_ be added in the future.
Only the order (from fast to strong) is guaranteed */
} ZSTD_strategy;
typedefenum {
/* compression parameters *Note:WhencompressingwithaZSTD_CDicttheseparametersaresuperseded *bytheparametersusedtoconstructtheZSTD_CDict.
* See ZSTD_CCtx_refCDict() for more info (superseded-by-cdict). */
ZSTD_c_compressionLevel=100, /* Set compression parameters according to pre-defined cLevel table. *Notethatexactcompressionparametersaredynamicallydetermined, *dependingonbothcompressionlevelandsrcSize(whenknown). *DefaultlevelisZSTD_CLEVEL_DEFAULT==3. *Special:value0meansdefault,whichiscontrolledbyZSTD_CLEVEL_DEFAULT. *Note1:it'spossibletopassanegativecompressionlevel. *Note2:settingaleveldoesnotautomaticallysetallothercompressionparameters *todefault.Settingthiswillhowevereventuallydynamicallyimpactthecompression *parameterswhichhavenotbeenmanuallyset.Themanuallyset
* ones will 'stick'. */ /* Advanced compression parameters : *It'spossibletopindowncompressionparameterstosomespecificvalues.
* In which case, these values are no longer dynamically selected by the compressor */
ZSTD_c_windowLog=101, /* Maximum allowed back-reference distance, expressed as power of 2. *Thiswillsetamemorybudgetforstreamingdecompression, *withlargervaluesrequiringmorememory *andtypicallycompressingmore. *MustbeclampedbetweenZSTD_WINDOWLOG_MINandZSTD_WINDOWLOG_MAX. *Special:value0means"usedefaultwindowLog". *Note:UsingawindowLoggreaterthanZSTD_WINDOWLOG_LIMIT_DEFAULT
* requires explicitly allowing such size at streaming decompression stage. */
ZSTD_c_hashLog=102, /* Size of the initial probe table, as a power of 2. *Resultingmemoryusageis(1<<(hashLog+2)). *MustbeclampedbetweenZSTD_HASHLOG_MINandZSTD_HASHLOG_MAX. *Largertablesimprovecompressionratioofstrategies<=dFast, *andimprovespeedofstrategies>dFast.
* Special: value 0 means "use default hashLog". */
ZSTD_c_chainLog=103, /* Size of the multi-probe search table, as a power of 2. *Resultingmemoryusageis(1<<(chainLog+2)). *MustbeclampedbetweenZSTD_CHAINLOG_MINandZSTD_CHAINLOG_MAX. *Largertablesresultinbetterandslowercompression. *Thisparameterisuselessfor"fast"strategy. *It'sstillusefulwhenusing"dfast"strategy, *inwhichcaseitdefinesasecondaryprobetable.
* Special: value 0 means "use default chainLog". */
ZSTD_c_searchLog=104, /* Number of search attempts, as a power of 2. *Moreattemptsresultinbetterandslowercompression. *Thisparameterisuselessfor"fast"and"dFast"strategies.
* Special: value 0 means "use default searchLog". */
ZSTD_c_minMatch=105, /* Minimum size of searched matches. *NotethatZstandardcanstillfindmatchesofsmallersize, *itjusttweaksitssearchalgorithmtolookforthissizeandlarger. *Largervaluesincreasecompressionanddecompressionspeed,butdecreaseratio. *MustbeclampedbetweenZSTD_MINMATCH_MINandZSTD_MINMATCH_MAX. *Notethatcurrently,forallstrategies<btopt,effectiveminimumis4. *,forallstrategies>fast,effectivemaximumis6.
* Special: value 0 means "use default minMatchLength". */
ZSTD_c_targetLength=106, /* Impact of this field depends on strategy. *Forstrategiesbtopt,btultra&btultra2: *LengthofMatchconsidered"goodenough"tostopsearch. *Largervaluesmakecompressionstronger,andslower. *Forstrategyfast: *Distancebetweenmatchsampling. *Largervaluesmakecompressionfaster,andweaker.
* Special: value 0 means "use default targetLength". */
ZSTD_c_strategy=107, /* See ZSTD_strategy enum definition. *Thehigherthevalueofselectedstrategy,themorecomplexitis, *resultinginstrongerandslowercompression.
* Special: value 0 means "use default strategy". */
ZSTD_c_targetCBlockSize=130, /* v1.5.6+ *AttemptstofitcompressedblocksizeintoapproximatelytargetCBlockSize. *BoundbyZSTD_TARGETCBLOCKSIZE_MINandZSTD_TARGETCBLOCKSIZE_MAX. *Notethatit'snotaguarantee,justaconvergencetarget(default:0). *NotargetwhentargetCBlockSize==0. *Thisishelpfulinlowbandwidthstreamingenvironmentstoimproveend-to-endlatency, *whenaclientcanmakeuseofpartialdocuments(aprominentexamplebeingChrome). *Note:thisparameterisstablesincev1.5.6. *Itwaspresentasanexperimentalparameterinearlierversions, *butit'snotrecommendedusingitwithearlierlibraryversions *duetomassiveperformanceregressions.
*/ /* LDM mode parameters */
ZSTD_c_enableLongDistanceMatching=160, /* Enable long distance matching. *Thisparameterisdesignedtoimprovecompressionratio *forlargeinputs,byfindinglargematchesatlongdistance. *Itincreasesmemoryusageandwindowsize. *Note:enablingthisparameterincreasesdefaultZSTD_c_windowLogto128MB *exceptwhenexpresslysettoadifferentvalue. *Note:willbeenabledbydefaultifZSTD_c_windowLog>=128MBand
* compression strategy >= ZSTD_btopt (== compression level 16+) */
ZSTD_c_ldmHashLog=161, /* Size of the table for long distance matching, as a power of 2. *Largervaluesincreasememoryusageandcompressionratio, *butdecreasecompressionspeed. *MustbeclampedbetweenZSTD_HASHLOG_MINandZSTD_HASHLOG_MAX *default:windowlog-7.
* Special: value 0 means "automatically determine hashlog". */
ZSTD_c_ldmMinMatch=162, /* Minimum match size for long distance matcher. *Larger/toosmallvaluesusuallydecreasecompressionratio. *MustbeclampedbetweenZSTD_LDM_MINMATCH_MINandZSTD_LDM_MINMATCH_MAX.
* Special: value 0 means "use default value" (default: 64). */
ZSTD_c_ldmBucketSizeLog=163, /* Log size of each bucket in the LDM hash table for collision resolution. *Largervaluesimprovecollisionresolutionbutdecreasecompressionspeed. *ThemaximumvalueisZSTD_LDM_BUCKETSIZELOG_MAX.
* Special: value 0 means "use default value" (default: 3). */
ZSTD_c_ldmHashRateLog=164, /* Frequency of inserting/looking up entries into the LDM hash table. *Mustbeclampedbetween0and(ZSTD_WINDOWLOG_MAX-ZSTD_HASHLOG_MIN). *DefaultisMAX(0,(windowLog-ldmHashLog)),optimizinghashtableusage. *Largervaluesimprovecompressionspeed. *Deviatingfarfromdefaultvaluewilllikelyresultinacompressionratiodecrease.
* Special: value 0 means "automatically determine hashRateLog". */
/* frame parameters */
ZSTD_c_contentSizeFlag=200, /* Content size will be written into frame header _whenever known_ (default:1) *Contentsizemustbeknownatthebeginningofcompression. *ThisisautomaticallythecasewhenusingZSTD_compress2(),
* For streaming scenarios, content size must be provided with ZSTD_CCtx_setPledgedSrcSize() */
ZSTD_c_checksumFlag=201, /* A 32-bits checksum of content is written at end of frame (default:0) */
ZSTD_c_dictIDFlag=202, /* When applicable, dictionary's ID is written into frame header (default:1) */
/* multi-threading parameters */ /* These parameters are only active if multi-threading is enabled (compiled with build macro ZSTD_MULTITHREAD). *Otherwise,tryingtosetanyothervaluethandefault(0)willbeano-opandreturnanerror. *Inasituationwhereit'sunknownifthelinkedlibrarysupportsmulti-threadingornot, *settingZSTD_c_nbWorkerstoanyvalue>=1andconsultingthereturnvalueprovidesaquickwaytocheckthisproperty.
*/
ZSTD_c_nbWorkers=400, /* Select how many threads will be spawned to compress in parallel. *WhennbWorkers>=1,triggersasynchronousmodewheninvokingZSTD_compressStream*(): *ZSTD_compressStream*()consumesinputandflushoutputifpossible,butimmediatelygivesbackcontroltocaller, *whilecompressionisperformedinparallel,withinworkerthread(s). *(note:astrongexceptiontothisruleiswhenfirstinvocationofZSTD_compressStream2()setsZSTD_e_end: *inwhichcase,ZSTD_compressStream2()delegatestoZSTD_compress2(),whichisalwaysablockingcall). *Moreworkersimprovespeed,butalsoincreasememoryusage. *Defaultvalueis`0`,aka"single-threadedmode":noworkerisspawned,
* compression is performed inside Caller's thread, and all invocations are blocking */
ZSTD_c_jobSize=401, /* Size of a compression job. This value is enforced only when nbWorkers >= 1. *Eachcompressionjobiscompletedinparallel,sothisvaluecanindirectlyimpactthenbofactivethreads. *0meansdefault,whichisdynamicallydeterminedbasedoncompressionparameters. *Jobsizemustbeaminimumofoverlapsize,orZSTDMT_JOBSIZE_MIN(=512KB),whicheverislargest.
* The minimum size is automatically and transparently enforced. */
ZSTD_c_overlapLog=402, /* Control the overlap size, as a fraction of window size. *Theoverlapsizeisanamountofdatareloadedfrompreviousjobatthebeginningofanewjob. *Ithelpspreservecompressionratio,whileeachjobiscompressedinparallel. *ThisvalueisenforcedonlywhennbWorkers>=1. *Largervaluesincreasecompressionratio,butdecreasespeed. *Possiblevaluesrangefrom0to9: *-0means"default":valuewillbedeterminedbythelibrary,dependingonstrategy *-1means"nooverlap" *-9means"fulloverlap",usingafullwindowsize. *Eachintermediaterankincreases/decreasesloadsizebyafactor2: *9:fullwindow;8:w/2;7:w/4;6:w/8;5:w/16;4:w/32;3:w/64;2:w/128;1:nooverlap;0:default
* default value varies between 6 and 9, depending on strategy */
/* note : additional experimental parameters are also available *withintheexperimentalsectionoftheAPI. *Atthetimeofthiswriting,theyinclude: *ZSTD_c_rsyncable *ZSTD_c_format *ZSTD_c_forceMaxWindow *ZSTD_c_forceAttachDict *ZSTD_c_literalCompressionMode *ZSTD_c_srcSizeHint *ZSTD_c_enableDedicatedDictSearch *ZSTD_c_stableInBuffer *ZSTD_c_stableOutBuffer *ZSTD_c_blockDelimiters *ZSTD_c_validateSequences *ZSTD_c_blockSplitterLevel *ZSTD_c_splitAfterSequences *ZSTD_c_useRowMatchFinder *ZSTD_c_prefetchCDictTables *ZSTD_c_enableSeqProducerFallback *ZSTD_c_maxBlockSize *Becausetheyarenotstable,it'snecessarytodefineZSTD_STATIC_LINKING_ONLYtoaccessthem. *note:nevereveruseexperimentalParam?namesdirectly; *also,theenumsvaluesthemselvesareunstableandcanstillchange.
*/
ZSTD_c_experimentalParam1=500,
ZSTD_c_experimentalParam2=10,
ZSTD_c_experimentalParam3=1000,
ZSTD_c_experimentalParam4=1001,
ZSTD_c_experimentalParam5=1002, /* was ZSTD_c_experimentalParam6=1003; is now ZSTD_c_targetCBlockSize */
ZSTD_c_experimentalParam7=1004,
ZSTD_c_experimentalParam8=1005,
ZSTD_c_experimentalParam9=1006,
ZSTD_c_experimentalParam10=1007,
ZSTD_c_experimentalParam11=1008,
ZSTD_c_experimentalParam12=1009,
ZSTD_c_experimentalParam13=1010,
ZSTD_c_experimentalParam14=1011,
ZSTD_c_experimentalParam15=1012,
ZSTD_c_experimentalParam16=1013,
ZSTD_c_experimentalParam17=1014,
ZSTD_c_experimentalParam18=1015,
ZSTD_c_experimentalParam19=1016,
ZSTD_c_experimentalParam20=1017
} ZSTD_cParameter;
typedefstruct {
size_t error; int lowerBound; int upperBound;
} ZSTD_bounds;
/* The advanced API pushes parameters one by one into an existing DCtx context. *Parametersaresticky,andremainvalidforallfollowingframes *usingthesameDCtxcontext. *It'spossibletoresetparameterstodefaultvaluesusingZSTD_DCtx_reset(). *Note:ThisAPIiscompatiblewithexistingZSTD_decompressDCtx()andZSTD_decompressStream(). *Therefore,nonewdecompressionfunctionisnecessary.
*/
typedefenum {
ZSTD_d_windowLogMax=100, /* Select a size limit (in power of 2) beyond which *thestreamingAPIwillrefusetoallocatememorybuffer *inordertoprotectthehostfromunreasonablememoryrequirements. *Thisparameterisonlyusefulinstreamingmode,sincenointernalbufferisallocatedinsingle-passmode. *Bydefault,adecompressioncontextacceptswindowsizes<=(1<<ZSTD_WINDOWLOG_LIMIT_DEFAULT).
* Special: value 0 means "use default maximum windowLog". */
/* note : additional experimental parameters are also available *withintheexperimentalsectionoftheAPI. *Atthetimeofthiswriting,theyinclude: *ZSTD_d_format *ZSTD_d_stableOutBuffer *ZSTD_d_forceIgnoreChecksum *ZSTD_d_refMultipleDDicts *ZSTD_d_disableHuffmanAssembly *ZSTD_d_maxBlockSize *Becausetheyarenotstable,it'snecessarytodefineZSTD_STATIC_LINKING_ONLYtoaccessthem. *note:nevereveruseexperimentalParam?namesdirectly
*/
ZSTD_d_experimentalParam1=1000,
ZSTD_d_experimentalParam2=1001,
ZSTD_d_experimentalParam3=1002,
ZSTD_d_experimentalParam4=1003,
ZSTD_d_experimentalParam5=1004,
ZSTD_d_experimentalParam6=1005
typedef ZSTD_CCtx ZSTD_CStream; /**< CCtx and CStream are now effectively same object (>= v1.3.0) */ /* Continue to distinguish them for compatibility with older versions <= v1.2.0 */ /*===== ZSTD_CStream management functions =====*/
ZSTDLIB_API ZSTD_CStream* ZSTD_createCStream(void);
ZSTDLIB_API size_t ZSTD_freeCStream(ZSTD_CStream* zcs); /* accept NULL pointer */
/*===== Streaming compression functions =====*/ typedefenum {
ZSTD_e_continue=0, /* collect more data, encoder decides when to output compressed result, for optimal compression ratio */
ZSTD_e_flush=1, /* flush any data provided so far, *itcreates(atleast)onenewblock,thatcanbedecodedimmediatelyonreception; *framewillcontinue:anyfuturedatacanstillreferencepreviouslycompresseddata,improvingcompression.
* note : multithreaded compression will block to flush as much output as possible. */
ZSTD_e_end=2/* flush any remaining data _and_ close current frame. *notethatframeisonlyclosedaftercompresseddataisfullyflushed(returnvalue==0). *Afterthatpoint,anyadditionaldatastartsanewframe. *note:eachframeisindependent(doesnotreferenceanycontentfrompreviousframe).
: note : multithreaded compression will block to flush as much output as possible. */
} ZSTD_EndDirective;
ZSTDLIB_API size_t ZSTD_DStreamInSize(void); /*!< recommended size for input buffer */
ZSTDLIB_API size_t ZSTD_DStreamOutSize(void); /*!< recommended size for output buffer. Guarantee to successfully flush at least one complete block in all circumstances. */
/*! ZSTD_createCDict() : *Whencompressingmultiplemessagesorblocksusingthesamedictionary, *it'srecommendedtodigestthedictionaryonlyonce,sinceit'sacostlyoperation. *ZSTD_createCDict()willcreateastatefromdigestingadictionary. *Theresultingstatecanbeusedforfuturecompressionoperationswithverylimitedstartupcost. *ZSTD_CDictcanbecreatedonceandsharedbymultiplethreadsconcurrently,sinceitsusageisread-only. *@dictBuffercanbereleasedafterZSTD_CDictcreation,becauseitscontentiscopiedwithinCDict. *Note1:Considerexperimentalfunction`ZSTD_createCDict_byReference()`ifyouprefertonotduplicate@dictBuffercontent. *Note2:AZSTD_CDictcanbecreatedfromanempty@dictBuffer, *inwhichcasetheonlythingthatittransportsisthe@compressionLevel. *ThiscanbeusefulinapipelinefeaturingZSTD_compress_usingCDict()exclusively,
* expecting a ZSTD_CDict parameter with any data, including those without a known dictionary. */
ZSTDLIB_API ZSTD_CDict* ZSTD_createCDict(constvoid* dictBuffer, size_t dictSize, int compressionLevel);
/*! ZSTD_freeCDict() : *FunctionfreesmemoryallocatedbyZSTD_createCDict().
* If a NULL pointer is passed, no operation is performed. */
ZSTDLIB_API size_t ZSTD_freeCDict(ZSTD_CDict* CDict);
/*! ZSTD_createDDict() : *Createadigesteddictionary,readytostartdecompressionoperationwithoutstartupdelay.
* dictBuffer can be released after DDict creation, as its content is copied inside DDict. */
ZSTDLIB_API ZSTD_DDict* ZSTD_createDDict(constvoid* dictBuffer, size_t dictSize);
/*! ZSTD_freeDDict() : *FunctionfreesmemoryallocatedwithZSTD_createDDict()
* If a NULL pointer is passed, no operation is performed. */
ZSTDLIB_API size_t ZSTD_freeDDict(ZSTD_DDict* ddict);
/*! ZSTD_decompress_usingDDict() : *DecompressionusingadigestedDictionary.
* Recommended when same dictionary is used multiple times. */
ZSTDLIB_API size_t ZSTD_decompress_usingDDict(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, constvoid* src, size_t srcSize, const ZSTD_DDict* ddict);
/*! ZSTD_getDictID_fromDict() : Requires v1.4.0+ *ProvidesthedictIDstoredwithindictionary. *if@return==0,thedictionaryisnotconformantwithZstandardspecification.
* It can still be loaded, but as a content-only dictionary. */
ZSTDLIB_API unsigned ZSTD_getDictID_fromDict(constvoid* dict, size_t dictSize);
/*! ZSTD_getDictID_fromCDict() : Requires v1.5.0+ *ProvidesthedictIDofthedictionaryloadedinto`cdict`. *If@return==0,thedictionaryisnotconformanttoZstandardspecification,orempty.
* Non-conformant dictionaries can still be loaded, but as content-only dictionaries. */
ZSTDLIB_API unsigned ZSTD_getDictID_fromCDict(const ZSTD_CDict* cdict);
/*! ZSTD_getDictID_fromDDict() : Requires v1.4.0+ *ProvidesthedictIDofthedictionaryloadedinto`ddict`. *If@return==0,thedictionaryisnotconformanttoZstandardspecification,orempty.
* Non-conformant dictionaries can still be loaded, but as content-only dictionaries. */
ZSTDLIB_API unsigned ZSTD_getDictID_fromDDict(const ZSTD_DDict* ddict);
/*! ZSTD_getDictID_fromFrame() : Requires v1.4.0+ *ProvidesthedictIDrequiredtodecompressedtheframestoredwithin`src`. *If@return==0,thedictIDcouldnotbedecoded. *Thiscouldforoneofthefollowingreasons: *-Theframedoesnotrequireadictionarytobedecoded(mostcommoncase). *-TheframewasbuiltwithdictIDintentionallyremoved.Whateverdictionaryisnecessaryisahiddenpieceofinformation. *Note:thisusecasealsohappenswhenusinganon-conformantdictionary. *-`srcSize`istoosmall,andasaresult,theframeheadercouldnotbedecoded(onlypossibleif`srcSize<ZSTD_FRAMEHEADERSIZE_MAX`). *-ThisisnotaZstandardframe.
* When identifying the exact failure cause, it's possible to use ZSTD_getFrameHeader(), which will provide a more precise error code. */
ZSTDLIB_API unsigned ZSTD_getDictID_fromFrame(constvoid* src, size_t srcSize);
#define ZSTD_WINDOWLOG_LIMIT_DEFAULT 27/* by default, the streaming decoder will refuse any frame *requiringlargerthan(1<<ZSTD_WINDOWLOG_LIMIT_DEFAULT)windowsize, *topreservehost'smemoryfromunreasonablerequirements. *ThislimitcanbeoverriddenusingZSTD_DCtx_setParameter(,ZSTD_d_windowLogMax,).
* The limit does not apply for one-pass decoders (such as ZSTD_decompress()), since no additional memory is allocated */
typedefstruct { unsignedint offset; /* The offset of the match. (NOT the same as the offset code) *Ifoffset==0andmatchLength==0,thissequencerepresentsthelast *literalsintheblockoflitLengthsize.
*/
unsignedint litLength; /* Literal length of the sequence. */ unsignedint matchLength; /* Match length of the sequence. */
/* Note: Users of this API may provide a sequence with matchLength == litLength == offset == 0. *Inthiscase,wewilltreatthesequenceasamarkerforablockboundary.
*/
unsignedint rep; /* Represents which repeat offset is represented by the field 'offset'. *Rangesfrom[0,3]. * *Repeatoffsetsareessentiallypreviousoffsetsfromprevioussequencessortedin *recencyorder.Formoredetail,seedoc/zstd_compression_format.md * *Ifrep==0,then'offset'doesnotcontainarepeatoffset. *Ifrep>0: *IflitLength!=0: *rep==1-->offset==repeat_offset_1 *rep==2-->offset==repeat_offset_2 *rep==3-->offset==repeat_offset_3 *IflitLength==0: *rep==1-->offset==repeat_offset_2 *rep==2-->offset==repeat_offset_3 *rep==3-->offset==repeat_offset_1-1 * *Note:Thisfieldisoptional.ZSTD_generateSequences()willcalculatethevalueof *'rep',butrepeatoffsetsdonotnecessarilyneedtobecalculatedfromanexternal *sequenceproviderperspective.Forexample,ZSTD_compressSequences()doesnot *usethis'rep'fieldatall(asofnow).
*/
} ZSTD_Sequence;
typedefstruct { unsigned windowLog; /**< largest match distance : larger == more compression, more memory needed during decompression */ unsigned chainLog; /**< fully searched segment : larger == more compression, slower, more memory (useless for fast) */ unsigned hashLog; /**< dispatch table : larger == faster, more memory */ unsigned searchLog; /**< nb of searches : larger == more compression, slower */ unsigned minMatch; /**< match length searched : larger == faster decompression, sometimes less compression */ unsigned targetLength; /**< acceptable match size for optimal parser (only) : larger == more compression, slower */
ZSTD_strategy strategy; /**< see ZSTD_strategy definition above */
} ZSTD_compressionParameters;
typedefstruct { int contentSizeFlag; /**< 1: content size will be in frame header (when known) */ int checksumFlag; /**< 1: generate a 32-bits checksum using XXH64 algorithm at end of frame, for error detection */ int noDictIDFlag; /**< 1: no dictID will be saved into frame header (dictID is only useful for dictionary compression) */
} ZSTD_frameParameters;
typedefenum {
ZSTD_dct_auto = 0, /* dictionary is "full" when starting with ZSTD_MAGIC_DICTIONARY, otherwise it is "rawContent" */
ZSTD_dct_rawContent = 1, /* ensures dictionary is always loaded as rawContent, even if it starts with ZSTD_MAGIC_DICTIONARY */
ZSTD_dct_fullDict = 2/* refuses to load a dictionary if it does not respect Zstandard's specification, starting with ZSTD_MAGIC_DICTIONARY */
} ZSTD_dictContentType_e;
typedefenum {
ZSTD_dlm_byCopy = 0, /**< Copy dictionary content internally */
ZSTD_dlm_byRef = 1/**< Reference dictionary content -- the dictionary buffer must outlive its users. */
} ZSTD_dictLoadMethod_e;
typedefenum {
ZSTD_f_zstd1 = 0, /* zstd frame format, specified in zstd_compression_format.md (default) */
ZSTD_f_zstd1_magicless = 1/* Variant of zstd frame format, without initial 4-bytes magic number. *Usefultosave4bytespergeneratedframe.
* Decoder cannot recognise automatically this format, requiring this instruction. */
} ZSTD_format_e;
typedefenum { /* Note: this enum and the behavior it controls are effectively internal *implementationdetailsofthecompressor.Theyareexpectedtocontinue *toevolveandshouldbeconsideredonlyinthecontextofextremely *advancedperformancetuning. * *ZstdcurrentlysupportstheuseofaCDictinthreeways: * *-ThecontentsoftheCDictcanbecopiedintotheworkingcontext.This *meansthatthecompressioncansearchboththedictionaryandinput *whileoperatingonasinglesetofinternaltables.Thismakes *thecompressionfasterper-byteofinput.However,theinitialcopyof *theCDict'stablesincursafixedcostatthebeginningofthe *compression.Forsmallcompressions(<8KB),thatcopycandominate *thecostofthecompression. * *-TheCDict'stablescanbeusedin-place.Inthismodel,compressionis *slowerperinputbyte,becausethecompressorhastosearchtwosetsof *tables.However,thismodelincursnostart-upcost(aslongasthe *workingcontext'stablescanbereused).Forsmallinputs,thiscanbe *fasterthancopyingtheCDict'stables. * *-TheCDict'stablesarenotusedatall,andinsteadweusetheworking *contextalonetoreloadthedictionaryanduseparamsbasedonthesource *size.SeeZSTD_compress_insertDictionary()andZSTD_compress_usingDict(). *Thismethodiseffectivewhenthedictionarysizesareverysmallrelative *totheinputsize,andtheinputsizeisfairlylargetobeginwith. * *Zstdhasasimpleinternalheuristicthatselectswhichstrategytouse *atthebeginningofacompression.However,ifexperimentationshowsthat *Zstdismakingpoorchoices,itispossibletooverridethatchoicewith *thisenum.
*/
ZSTD_dictDefaultAttach = 0, /* Use the default heuristic. */
ZSTD_dictForceAttach = 1, /* Never copy the dictionary. */
ZSTD_dictForceCopy = 2, /* Always copy the dictionary. */
ZSTD_dictForceLoad = 3/* Always reload the dictionary */
} ZSTD_dictAttachPref_e;
typedefenum {
ZSTD_lcm_auto = 0, /**< Automatically determine the compression mode based on the compression level. *Negativecompressionlevelswillbeuncompressed,andpositivecompression
* levels will be compressed. */
ZSTD_lcm_huffman = 1, /**< Always attempt Huffman compression. Uncompressed literals will still be
* emitted if Huffman compression is not profitable. */
ZSTD_lcm_uncompressed = 2/**< Always emit uncompressed literals. */
} ZSTD_literalCompressionMode_e;
typedefenum { /* Note: This enum controls features which are conditionally beneficial. *Zstdcantakeadecisiononwhetherornottoenablethefeature(ZSTD_ps_auto), *butsettingtheswitchtoZSTD_ps_enableorZSTD_ps_disableforceenable/disablethefeature.
*/
ZSTD_ps_auto = 0, /* Let the library automatically determine whether the feature shall be enabled */
ZSTD_ps_enable = 1, /* Force-enable the feature */
ZSTD_ps_disable = 2/* Do not use the feature */
} ZSTD_ParamSwitch_e; #define ZSTD_paramSwitch_e ZSTD_ParamSwitch_e /* old name */
/*! ZSTD_findDecompressedSize() : *`src`shouldpointtothestartofaseriesofZSTDencodedand/orskippableframes *`srcSize`mustbethe_exact_sizeofthisseries *(i.e.thereshouldbeaframeboundaryat`src+srcSize`) *@return:-decompressedsizeofalldatainallsuccessiveframes *-ifthedecompressedsizecannotbedetermined:ZSTD_CONTENTSIZE_UNKNOWN *-ifanerroroccurred:ZSTD_CONTENTSIZE_ERROR * *note1:decompressedsizeisanoptionalfield,thatmaynotbepresent,especiallyinstreamingmode. *When`return==ZSTD_CONTENTSIZE_UNKNOWN`,datatodecompresscouldbeanysize. *Inwhichcase,it'snecessarytousestreamingmodetodecompressdata. *note2:decompressedsizeisalwayspresentwhencompressionisdonewithZSTD_compress() *note3:decompressedsizecanbeverylarge(64-bitsvalue), *potentiallylargerthanwhatlocalsystemcanhandleasasinglememorysegment. *Inwhichcase,it'snecessarytousestreamingmodetodecompressdata. *note4:Ifsourceisuntrusted,decompressedsizecouldbewrongorintentionallymodified. *Alwaysensureresultfitswithinapplication'sauthorizedlimits. *Eachapplicationcansetitsownlimits. *note5:ZSTD_findDecompressedSizehandlesmultipleframes,andsoitmusttraversetheinputto *readeachcontainedframeheader.Thisisfastasmostofthedataisskipped,
* however it does mean that all frame data must be present and valid. */
ZSTDLIB_STATIC_API unsignedlonglong ZSTD_findDecompressedSize(constvoid* src, size_t srcSize);
/*! ZSTD_frameHeaderSize() : *srcSizemustbelargeenough,aka>=ZSTD_FRAMEHEADERSIZE_PREFIX. *@return:sizeoftheFrameHeader,
* or an error code (if srcSize is too small) */
ZSTDLIB_STATIC_API size_t ZSTD_frameHeaderSize(constvoid* src, size_t srcSize);
typedefenum { ZSTD_frame, ZSTD_skippableFrame } ZSTD_FrameType_e; #define ZSTD_frameType_e ZSTD_FrameType_e /* old name */ typedefstruct { unsignedlonglong frameContentSize; /* if == ZSTD_CONTENTSIZE_UNKNOWN, it means this field is not available. 0 means "empty" */ unsignedlonglong windowSize; /* can be very large, up to <= frameContentSize */ unsigned blockSizeMax;
ZSTD_FrameType_e frameType; /* if == ZSTD_skippableFrame, frameContentSize is the size of skippable content */ unsigned headerSize; unsigned dictID; /* for ZSTD_skippableFrame, contains the skippable magic variant [0-15] */ unsigned checksumFlag; unsigned _reserved1; unsigned _reserved2;
} ZSTD_FrameHeader; #define ZSTD_frameHeader ZSTD_FrameHeader /* old name */
/*! ZSTD_getFrameHeader() : *decodeFrameHeaderinto`zfhPtr`,orrequireslarger`srcSize`. *@return:0=>headeriscomplete,`zfhPtr`iscorrectlyfilled, *>0=>`srcSize`istoosmall,@returnvalueisthewanted`srcSize`amount,`zfhPtr`isnotfilled,
* or an error code, which can be tested using ZSTD_isError() */
ZSTDLIB_STATIC_API size_t ZSTD_getFrameHeader(ZSTD_FrameHeader* zfhPtr, constvoid* src, size_t srcSize); /*! ZSTD_getFrameHeader_advanced() : *sameasZSTD_getFrameHeader(),
* with added capability to select a format (like ZSTD_f_zstd1_magicless) */
ZSTDLIB_STATIC_API size_t ZSTD_getFrameHeader_advanced(ZSTD_FrameHeader* zfhPtr, constvoid* src, size_t srcSize, ZSTD_format_e format);
/*! ZSTD_createCDict_byReference() : *Createadigesteddictionaryforcompression *Dictionarycontentisjustreferenced,notduplicated. *Asaconsequence,`dictBuffer`**must**outliveCDict, *anditscontentmustremainunmodifiedthroughoutthelifetimeofCDict.
* note: equivalent to ZSTD_createCDict_advanced(), with dictLoadMethod==ZSTD_dlm_byRef */
ZSTDLIB_STATIC_API ZSTD_CDict* ZSTD_createCDict_byReference(constvoid* dictBuffer, size_t dictSize, int compressionLevel);
/*! ZSTD_getCParams() : *@returnZSTD_compressionParametersstructureforaselectedcompressionlevelandestimatedsrcSize.
* `estimatedSrcSize` value is optional, select 0 if not known */
ZSTDLIB_STATIC_API ZSTD_compressionParameters ZSTD_getCParams(int compressionLevel, unsignedlonglong estimatedSrcSize, size_t dictSize);
/*! ZSTD_getParams() : *sameasZSTD_getCParams(),but@returnafull`ZSTD_parameters`objectinsteadofsub-component`ZSTD_compressionParameters`.
* All fields of `ZSTD_frameParameters` are set to default : contentSize=1, checksum=0, noDictID=0 */
ZSTDLIB_STATIC_API ZSTD_parameters ZSTD_getParams(int compressionLevel, unsignedlonglong estimatedSrcSize, size_t dictSize);
/*! ZSTD_checkCParams() : *Ensureparamvaluesremainwithinauthorizedrange.
* @return 0 on success, or an error code (can be checked with ZSTD_isError()) */
ZSTDLIB_STATIC_API size_t ZSTD_checkCParams(ZSTD_compressionParameters params);
/*! ZSTD_adjustCParams() : *optimizeparamsforagiven`srcSize`and`dictSize`. *`srcSize`canbeunknown,inwhichcaseuseZSTD_CONTENTSIZE_UNKNOWN. *`dictSize`mustbe`0`whenthereisnodictionary. *cParcanbeinvalid:allparameterswillbeclampedwithinvalidrangeinthe@returnstruct.
* This function never fails (wide contract) */
ZSTDLIB_STATIC_API ZSTD_compressionParameters ZSTD_adjustCParams(ZSTD_compressionParameters cPar, unsignedlonglong srcSize, size_t dictSize);
/*! ZSTD_CCtx_loadDictionary_byReference() : *SameasZSTD_CCtx_loadDictionary(),butdictionarycontentisreferenced,insteadofbeingcopiedintoCCtx.
* It saves some memory, but also requires that `dict` outlives its usage within `cctx` */
ZSTDLIB_STATIC_API size_t ZSTD_CCtx_loadDictionary_byReference(ZSTD_CCtx* cctx, constvoid* dict, size_t dictSize);
/*! ZSTD_CCtx_loadDictionary_advanced() : *SameasZSTD_CCtx_loadDictionary(),butgivesfinercontrolover *howtoloadthedictionary(bycopy?byreference?)
* and how to interpret it (automatic ? force raw mode ? full mode only ?) */
ZSTDLIB_STATIC_API size_t ZSTD_CCtx_loadDictionary_advanced(ZSTD_CCtx* cctx, constvoid* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType);
/*! ZSTD_CCtx_refPrefix_advanced() : *SameasZSTD_CCtx_refPrefix(),butgivesfinercontrolover
* how to interpret prefix content (automatic ? force raw mode (default) ? full mode only ?) */
ZSTDLIB_STATIC_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, constvoid* prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType);
/* === experimental parameters === */ /* these parameters can be used with ZSTD_setParameter()
* they are not guaranteed to remain supported in the future */
/* Select a compression format. *ThevaluemustbeoftypeZSTD_format_e.
* See ZSTD_format_e enum definition for details */ #define ZSTD_c_format ZSTD_c_experimentalParam2
/* Force back-reference distances to remain < windowSize,
* even when referencing into Dictionary content (default:0) */ #define ZSTD_c_forceMaxWindow ZSTD_c_experimentalParam3
/* Controls whether the contents of a CDict *areusedinplace,orcopiedintotheworkingcontext. *AcceptsvaluesfromtheZSTD_dictAttachPref_eenum.
* See the comments on that enum for an explanation of the feature. */ #define ZSTD_c_forceAttachDict ZSTD_c_experimentalParam4
/* User's best guess of source size. *HintisnotvalidwhensrcSizeHint==0. *Thereisnoguaranteethathintisclosetoactualsourcesize,
* but compression ratio may regress significantly if guess considerably underestimates */ #define ZSTD_c_srcSizeHint ZSTD_c_experimentalParam7
/*! ZSTD_createDDict_byReference() : *Createadigesteddictionary,readytostartdecompressionoperationwithoutstartupdelay. *Dictionarycontentisreferenced,andthereforestaysindictBuffer. *ItisimportantthatdictBufferoutlivesDDict,
* it must remain read accessible throughout the lifetime of DDict */
ZSTDLIB_STATIC_API ZSTD_DDict* ZSTD_createDDict_byReference(constvoid* dictBuffer, size_t dictSize);
/*! ZSTD_DCtx_loadDictionary_byReference() : *SameasZSTD_DCtx_loadDictionary(), *butreferences`dict`contentinsteadofcopyingitinto`dctx`. *Thissavesmemoryif`dict`remainsaround.,
* However, it's imperative that `dict` remains accessible (and unmodified) while being used, so it must outlive decompression. */
ZSTDLIB_STATIC_API size_t ZSTD_DCtx_loadDictionary_byReference(ZSTD_DCtx* dctx, constvoid* dict, size_t dictSize);
/*! ZSTD_DCtx_loadDictionary_advanced() : *SameasZSTD_DCtx_loadDictionary(), *butgivesdirectcontrolover *howtoloadthedictionary(bycopy?byreference?)
* and how to interpret it (automatic ? force raw mode ? full mode only ?). */
ZSTDLIB_STATIC_API size_t ZSTD_DCtx_loadDictionary_advanced(ZSTD_DCtx* dctx, constvoid* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType);
/*! ZSTD_DCtx_refPrefix_advanced() : *SameasZSTD_DCtx_refPrefix(),butgivesfinercontrolover
* how to interpret prefix content (automatic ? force raw mode (default) ? full mode only ?) */
ZSTDLIB_STATIC_API size_t ZSTD_DCtx_refPrefix_advanced(ZSTD_DCtx* dctx, constvoid* prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType);
typedefstruct { unsignedlonglong ingested; /* nb input bytes read and buffered */ unsignedlonglong consumed; /* nb input bytes actually compressed */ unsignedlonglong produced; /* nb of compressed bytes generated and buffered */ unsignedlonglong flushed; /* nb of compressed bytes flushed : not provided; can be tracked from caller side */ unsigned currentJobID; /* MT only : latest started job nb */ unsigned nbActiveWorkers; /* MT only : nb of workers actively compressing at probe time */
} ZSTD_frameProgression;
/*===== Buffer-less streaming compression functions =====*/
ZSTD_DEPRECATED("The buffer-less API is deprecated in favor of the normal streaming API. See docs.")
ZSTDLIB_STATIC_API size_t ZSTD_compressBegin(ZSTD_CCtx* cctx, int compressionLevel);
ZSTD_DEPRECATED("The buffer-less API is deprecated in favor of the normal streaming API. See docs.")
ZSTDLIB_STATIC_API size_t ZSTD_compressBegin_usingDict(ZSTD_CCtx* cctx, constvoid* dict, size_t dictSize, int compressionLevel);
ZSTD_DEPRECATED("The buffer-less API is deprecated in favor of the normal streaming API. See docs.")
ZSTDLIB_STATIC_API size_t ZSTD_compressBegin_usingCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict); /**< note: fails if cdict==NULL */
ZSTD_DEPRECATED("This function will likely be removed in a future release. It is misleading and has very limited utility.")
ZSTDLIB_STATIC_API
size_t ZSTD_copyCCtx(ZSTD_CCtx* cctx, const ZSTD_CCtx* preparedCCtx, unsignedlonglong pledgedSrcSize); /**< note: if pledgedSrcSize is not known, use ZSTD_CONTENTSIZE_UNKNOWN */
ZSTD_DEPRECATED("The buffer-less API is deprecated in favor of the normal streaming API. See docs.")
ZSTDLIB_STATIC_API size_t ZSTD_compressContinue(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, constvoid* src, size_t srcSize);
ZSTD_DEPRECATED("The buffer-less API is deprecated in favor of the normal streaming API. See docs.")
ZSTDLIB_STATIC_API size_t ZSTD_compressEnd(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, constvoid* src, size_t srcSize);
/* The ZSTD_compressBegin_advanced() and ZSTD_compressBegin_usingCDict_advanced() are now DEPRECATED and will generate a compiler warning */
ZSTD_DEPRECATED("use advanced API to access custom parameters")
ZSTDLIB_STATIC_API
size_t ZSTD_compressBegin_advanced(ZSTD_CCtx* cctx, constvoid* dict, size_t dictSize, ZSTD_parameters params, unsignedlonglong pledgedSrcSize); /**< pledgedSrcSize : If srcSize is not known at init time, use ZSTD_CONTENTSIZE_UNKNOWN */
ZSTD_DEPRECATED("use advanced API to access custom parameters")
ZSTDLIB_STATIC_API
size_t ZSTD_compressBegin_usingCDict_advanced(ZSTD_CCtx* const cctx, const ZSTD_CDict* const cdict, ZSTD_frameParameters const fParams, unsignedlonglongconst pledgedSrcSize); /* compression parameters are already set within cdict. pledgedSrcSize must be correct. If srcSize is not known, use macro ZSTD_CONTENTSIZE_UNKNOWN */ /** Buffer-lessstreamingdecompression(synchronousmode)
ZSTDLIB_STATIC_API size_t ZSTD_decodingBufferSize_min(unsignedlonglong windowSize, unsignedlonglong frameContentSize); /**< when frame content size is not known, pass in frameContentSize == ZSTD_CONTENTSIZE_UNKNOWN */
/* misc */
ZSTD_DEPRECATED("This function will likely be removed in the next minor release. It is misleading and has very limited utility.")
ZSTDLIB_STATIC_API void ZSTD_copyDCtx(ZSTD_DCtx* dctx, const ZSTD_DCtx* preparedDCtx); typedefenum { ZSTDnit_frameHeader, ZSTDnit_blockHeader, ZSTDnit_block, ZSTDnit_lastBlock, ZSTDnit_checksum, ZSTDnit_skippableFrame } ZSTD_nextInputType_e;
ZSTDLIB_STATIC_API ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx* dctx);
/*===== Raw zstd block functions =====*/
ZSTD_DEPRECATED("The block API is deprecated in favor of the normal compression API. See docs.")
ZSTDLIB_STATIC_API size_t ZSTD_getBlockSize (const ZSTD_CCtx* cctx);
ZSTD_DEPRECATED("The block API is deprecated in favor of the normal compression API. See docs.")
ZSTDLIB_STATIC_API size_t ZSTD_compressBlock (ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, constvoid* src, size_t srcSize);
ZSTD_DEPRECATED("The block API is deprecated in favor of the normal compression API. See docs.")
ZSTDLIB_STATIC_API size_t ZSTD_decompressBlock(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, constvoid* src, size_t srcSize);
ZSTD_DEPRECATED("The block API is deprecated in favor of the normal compression API. See docs.")
ZSTDLIB_STATIC_API size_t ZSTD_insertBlock (ZSTD_DCtx* dctx, constvoid* blockStart, size_t blockSize); /**< insert uncompressed block into `dctx` history. Useful for multi-blocks decompression. */
#ifdefined (__cplusplus)
} #endif
#endif/* ZSTD_H_ZSTD_STATIC_LINKING_ONLY */
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.279 Sekunden
(vorverarbeitet am 2026-08-24)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.