From: inikep Date: Wed, 3 Feb 2016 16:29:40 +0000 (+0100) Subject: Merge remote-tracking branch 'refs/remotes/Cyan4973/v05x' into v05x X-Git-Tag: v0.5.1^2~3^2~58^2~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=53721f134c2026248bb0cd01da155ef55032efa5;p=thirdparty%2Fzstd.git Merge remote-tracking branch 'refs/remotes/Cyan4973/v05x' into v05x # Conflicts: # lib/zstd_compress.c # lib/zstd_static.h --- 53721f134c2026248bb0cd01da155ef55032efa5 diff --cc lib/zstd_compress.c index 71ff02e7b,f4ddb910f..d88bac8ca --- a/lib/zstd_compress.c +++ b/lib/zstd_compress.c @@@ -1997,9 -1980,8 +2002,8 @@@ static size_t ZSTD_compressContinue_int } /* preemptive overflow correction */ - if (zc->lowLimit > (1<<30)) - { + if (zc->lowLimit > (1<<30)) { - U32 btplus = (zc->params.strategy == ZSTD_btlazy2); + U32 btplus = (zc->params.strategy == ZSTD_btlazy2) || (zc->params.strategy == ZSTD_opt_bt); U32 contentMask = (1 << (zc->params.contentLog - btplus)) - 1; U32 newLowLimit = zc->lowLimit & contentMask; /* preserve position % contentSize */ U32 correction = zc->lowLimit - newLowLimit; diff --cc lib/zstd_static.h index 9997d67d9,4a36f1e8a..ad52b5819 --- a/lib/zstd_static.h +++ b/lib/zstd_static.h @@@ -82,6 -82,9 +82,9 @@@ typedef struc /* ************************************* * Advanced functions ***************************************/ -#define ZSTD_MAX_CLEVEL 20 ++#define ZSTD_MAX_CLEVEL 24 + ZSTDLIB_API unsigned ZSTD_maxCLevel (void); + /*! ZSTD_getParams * @return ZSTD_parameters structure for a selected compression level and srcSize. * @srcSizeHint value is optional, select 0 if not known */ @@@ -217,34 -203,26 +203,27 @@@ ZSTDLIB_API size_t ZSTD_decompressConti /* ************************************** * Block functions ****************************************/ - /*!Block functions produce and decode raw zstd blocks, without frame metadata. - Frame headers won't be generated. - User will have to save and regenerate fields required to regenerate data, such as block sizes. - - A few rules to respect : - - Uncompressed block size must be <= 128 KB - - Compressing or decompressing requires a context structure - + Use ZSTD_createXCtx() to create them - - It is necessary to init context before starting - + compression : ZSTD_compressBegin() - + decompression : ZSTD_decompressBegin() - + variants _usingDict() are also allowed - + copyXCtx() works too - - When a block is considered not compressible enough, ZSTD_compressBlock() result will be zero. - In which case, nothing is produced into `dst`. - + User must test for such outcome and deal directly with uncompressed data - + ZSTD_decompressBlock() doesn't accept uncompressed data as input !! + /*! Block functions produce and decode raw zstd blocks, without frame metadata. + User will have to save and regenerate necessary information to regenerate data, such as block sizes. + + A few rules to respect : + - Uncompressed block size must be <= 128 KB + - Compressing or decompressing requires a context structure + + Use ZSTD_createCCtx() and ZSTD_createDCtx() + - It is necessary to init context before starting + + compression : ZSTD_compressBegin() + + decompression : ZSTD_decompressBegin() + + variants _usingDict() are also allowed + + copyCCtx() and copyDCtx() work too + - When a block is considered not compressible enough, ZSTD_compressBlock() result will be zero. + In which case, nothing is produced into @dst. + + User must test for such outcome and deal directly with uncompressed data + + ZSTD_decompressBlock() doesn't accept uncompressed data as input !! */ - size_t ZSTD_compressBlock (ZSTD_CCtx* cctx, void* dst, size_t maxDstSize, const void* src, size_t srcSize); - size_t ZSTD_decompressBlock(ZSTD_DCtx* dctx, void* dst, size_t maxDstSize, const void* src, size_t srcSize); - + - /* ************************************* - * Pre-defined compression levels - ***************************************/ - #define ZSTD_MAX_CLEVEL 24 - ZSTDLIB_API unsigned ZSTD_maxCLevel (void); + size_t ZSTD_compressBlock (ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize); + size_t ZSTD_decompressBlock(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize); /* *************************************