ZSTD_CCtx_setParameter : value argument is now int

for compatibility with compression level
This commit is contained in:
Yann Collet
2018-11-20 11:53:01 -08:00
parent 19e5f2a35b
commit 3b838abf97
5 changed files with 43 additions and 41 deletions
+13 -12
View File
@@ -352,11 +352,12 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB
<BR></pre>
<a name="Chapter12"></a><h2>Candidate API for promotion to stable status</h2><pre>
The following symbols and constants are currently considered
to join "stable API" status by v1.4.0.
The intention is that they should be able to become stable "as is", with no further modification.
It is also last chance to gather comments / suggestions on this API,
as the API is locked once reaching "stable" status.
The following symbols and constants are in "staging area" :
they are considered to join "stable API" status by v1.4.0.
The below proposal is created so that it's possible to make it stable "as is".
That being said, it's still possible to suggest modifications.
Staging is in fact last chance for changes,
because the API is locked once reaching "stable" status.
<BR></pre>
@@ -478,7 +479,7 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
* They return an error otherwise. */
ZSTD_p_nbWorkers=400, </b>/* Select how many threads will be spawned to compress in parallel.<b>
* When nbWorkers >= 1, triggers asynchronous mode :
* ZSTD_compress_generic() consumes some input, flush some output if possible, and immediately gives back control to caller,
* ZSTD_compress_generic() consumes input and flush output if possible, but immediately gives back control to caller,
* while compression work is performed in parallel, within worker threads.
* (note : a strong exception to this rule is when first invocation sets ZSTD_e_end : it becomes a blocking call).
* More workers improve speed, but also increase memory usage.
@@ -535,8 +536,8 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
*/
} ZSTD_cParameter;
</b></pre><BR>
<pre><b>unsigned ZSTD_cParam_lowerBound(ZSTD_cParameter cParam);
unsigned ZSTD_cParam_upperBound(ZSTD_cParameter cParam);
<pre><b>int ZSTD_cParam_lowerBound(ZSTD_cParameter cParam);
int ZSTD_cParam_upperBound(ZSTD_cParameter cParam);
</b><p> All parameters must respect lower/upper bounds,
otherwise they will either trigger an error
or be automatically clamped.
@@ -545,14 +546,15 @@ unsigned ZSTD_cParam_upperBound(ZSTD_cParameter cParam);
</p></pre><BR>
<pre><b>size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, unsigned value);
<pre><b>size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, int value);
</b><p> Set one compression parameter, selected by enum ZSTD_cParameter.
All parameters have valid bounds. Bounds can be queried using ZSTD_cParam_getBounds().
Providing a value beyond bound will either clamp it, or trigger an error (depending on parameter).
Setting a parameter is generally only possible during frame initialization (before starting compression).
Exception : when using multi-threading mode (nbWorkers >= 1),
the following parameters can be updated _during_ compression (within same frame):
=> compressionLevel, hashLog, chainLog, searchLog, minMatch, targetLength and strategy.
new parameters will be active for next job only (after a flush()).
Note : when original `value` type is not unsigned (like int, or enum), cast it to unsigned.
@result : informational value (typically, value being effectively set, after clamping),
or an error code (which can be tested with ZSTD_isError()).
</p></pre><BR>
@@ -1061,11 +1063,10 @@ size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params);
</p></pre><BR>
<pre><b>size_t ZSTD_CCtxParam_setParameter(ZSTD_CCtx_params* params, ZSTD_cParameter param, unsigned value);
<pre><b>size_t ZSTD_CCtxParam_setParameter(ZSTD_CCtx_params* params, ZSTD_cParameter param, int value);
</b><p> Similar to ZSTD_CCtx_setParameter.
Set one compression parameter, selected by enum ZSTD_cParameter.
Parameters must be applied to a ZSTD_CCtx using ZSTD_CCtx_setParametersUsingCCtxParams().
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()).
</p></pre><BR>