]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Remove ZSTD_setCCtxParameter()
authorStella Lau <laus@fb.com>
Fri, 25 Aug 2017 20:58:41 +0000 (13:58 -0700)
committerStella Lau <laus@fb.com>
Fri, 25 Aug 2017 20:58:41 +0000 (13:58 -0700)
lib/compress/zstd_compress.c
lib/compress/zstdmt_compress.c
lib/zstd.h
tests/fuzzer.c

index c8cfd6c9468b28143cb9a222298a4394e0349c50..74cbe53b0b16a031cca002c52507064cd2f1efae 100644 (file)
@@ -197,28 +197,6 @@ size_t ZSTD_sizeof_CStream(const ZSTD_CStream* zcs)
 /* private API call, for dictBuilder only */
 const seqStore_t* ZSTD_getSeqStore(const ZSTD_CCtx* ctx) { return &(ctx->seqStore); }
 
-/* older variant; will be deprecated */
-/* Both requested and applied params need to be set as this function can be
- * called before/after ZSTD_parameters have been applied. */
-size_t ZSTD_setCCtxParameter(ZSTD_CCtx* cctx, ZSTD_CCtxParameter param, unsigned value)
-{
-    switch(param)
-    {
-    case ZSTD_p_forceWindow :
-        cctx->requestedParams.forceWindow = value>0;
-        cctx->appliedParams.forceWindow = value>0;
-        cctx->loadedDictEnd = 0;
-        return 0;
-    ZSTD_STATIC_ASSERT(ZSTD_dm_auto==0);
-    ZSTD_STATIC_ASSERT(ZSTD_dm_rawContent==1);
-    case ZSTD_p_forceRawDict :
-        cctx->requestedParams.dictMode = (ZSTD_dictMode_e)(value>0);
-        cctx->appliedParams.dictMode = (ZSTD_dictMode_e)(value>0);
-        return 0;
-    default: return ERROR(parameter_unsupported);
-    }
-}
-
 
 #define ZSTD_CLEVEL_CUSTOM 999
 static void ZSTD_cLevelToCCtxParams_srcSize(ZSTD_CCtx_params* params, U64 srcSize)
index c93d784da70f86c656bc39b21594a62e604b12d8..5f0f254c2f12b51094bc4e5921a552a223c46abe 100644 (file)
@@ -347,9 +347,6 @@ void ZSTDMT_compressChunk(void* jobDescription)
               ZSTD_CCtxParam_setParameter(&jobParams, ZSTD_p_dictMode, (U32)ZSTD_dm_rawContent);
           size_t const forceWindowError =
               ZSTD_CCtxParam_setParameter(&jobParams, ZSTD_p_forceMaxWindow, !job->firstChunk);
-          /* Note: ZSTD_setCCtxParameter() should not be used here.
-           * ZSTD_compressBegin_advanced_internal() copies the ZSTD_CCtx_params
-           * directly to appliedParams. */
           size_t const initError = ZSTD_compressBegin_advanced_internal(cctx, job->srcStart, job->dictSize, jobParams, job->fullFrameSize);
             if (ZSTD_isError(initError) || ZSTD_isError(dictModeError) ||
                 ZSTD_isError(forceWindowError)) { job->cSize = initError; goto _endJob; }
index bfbe828492fec3b1b479176990724327c4ca86bf..0c970f3f9d8d4285e746a60a0c5147db99e2558f 100644 (file)
@@ -558,17 +558,6 @@ ZSTDLIB_API ZSTD_CCtx* ZSTD_createCCtx_advanced(ZSTD_customMem customMem);
 ZSTDLIB_API ZSTD_CCtx* ZSTD_initStaticCCtx(void* workspace, size_t workspaceSize);
 
 
-/* !!! To be deprecated !!! */
-typedef enum {
-    ZSTD_p_forceWindow,   /* Force back-references to remain < windowSize, even when referencing Dictionary content (default:0) */
-    ZSTD_p_forceRawDict   /* Force loading dictionary in "content-only" mode (no header analysis) */
-} ZSTD_CCtxParameter;
-/*! ZSTD_setCCtxParameter() :
- *  Set advanced parameters, selected through enum ZSTD_CCtxParameter
- *  @result : 0, or an error code (which can be tested with ZSTD_isError()) */
-ZSTDLIB_API size_t ZSTD_setCCtxParameter(ZSTD_CCtx* cctx, ZSTD_CCtxParameter param, unsigned value);
-
-
 /*! ZSTD_createCDict_byReference() :
  *  Create a digested dictionary for compression
  *  Dictionary content is simply referenced, and therefore stays in dictBuffer.
@@ -1119,22 +1108,25 @@ size_t ZSTD_compress_generic_simpleArgs (
  *  - ZSTD_freeCCtxParams() : Free the memory.
  *
  *  This can be used with ZSTD_estimateCCtxSize_opaque() for static allocation
- *  for single-threaded compression. */
-
+ *  for single-threaded compression.
+ */
 ZSTDLIB_API ZSTD_CCtx_params* ZSTD_createCCtxParams(void);
 
 /*! ZSTD_resetCCtxParams() :
- *  Reset params to default, with the default compression level. */
+ *  Reset params to default, with the default compression level.
+ */
 ZSTDLIB_API size_t ZSTD_resetCCtxParams(ZSTD_CCtx_params* params);
 
 /*! ZSTD_initCCtxParams() :
  *  Initializes the compression parameters of cctxParams according to
- *  compression level. All other parameters are reset to their default values. */
+ *  compression level. All other parameters are reset to their default values.
+ */
 ZSTDLIB_API size_t ZSTD_initCCtxParams(ZSTD_CCtx_params* cctxParams, int compressionLevel);
 
 /*! ZSTD_initCCtxParams_advanced() :
  *  Initializes the compression and frame parameters of cctxParams according to
- *  params. All other parameters are reset to their default values. */
+ *  params. All other parameters are reset to their default values.
+ */
 ZSTDLIB_API size_t ZSTD_initCCtxParams_advanced(ZSTD_CCtx_params* cctxParams, ZSTD_parameters params);
 
 ZSTDLIB_API size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params);
@@ -1144,14 +1136,16 @@ ZSTDLIB_API size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params);
  *  Set one compression parameter, selected by enum ZSTD_cParameter.
  *  Parameters must be applied to a ZSTD_CCtx using ZSTD_CCtx_applyCCtxParams().
  *  Note : when `value` is an enum, cast it to unsigned for proper type checking.
- *  @result : 0, or an error code (which can be tested with ZSTD_isError()). */
+ *  @result : 0, or an error code (which can be tested with ZSTD_isError()).
+ */
 ZSTDLIB_API size_t ZSTD_CCtxParam_setParameter(ZSTD_CCtx_params* params, ZSTD_cParameter param, unsigned value);
 
 /*! ZSTD_CCtx_applyCCtxParams() :
  * Apply a set of ZSTD_CCtx_params to the compression context.
  * This must be done before the dictionary is loaded.
  * The pledgedSrcSize is treated as unknown.
- * Multithreading parameters are applied only if nbThreads > 1. */
+ * Multithreading parameters are applied only if nbThreads > 1.
+ */
 ZSTDLIB_API size_t ZSTD_CCtx_applyCCtxParams(ZSTD_CCtx* cctx, const ZSTD_CCtx_params* params);
 
 /**
index 046c67ea83fdda0b4d0e737e8e849c0e3990c276..3f7595e99c0b671cc3adf4d97dad7873db29ed25 100644 (file)
@@ -1334,7 +1334,6 @@ static int fuzzerTests(U32 seed, U32 nbTests, unsigned startTest, U32 const maxD
             }
             CHECK_Z( ZSTD_copyCCtx(ctx, refCtx, 0) );
         }
-        ZSTD_setCCtxParameter(ctx, ZSTD_p_forceWindow, FUZ_rand(&lseed) & 1);
 
         {   U32 const nbChunks = (FUZ_rand(&lseed) & 127) + 2;
             U32 n;