extzstd 0.3.3 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -3
  3. data/contrib/zstd/CHANGELOG +39 -2
  4. data/contrib/zstd/CONTRIBUTING.md +3 -3
  5. data/contrib/zstd/Makefile +34 -20
  6. data/contrib/zstd/README.md +6 -2
  7. data/contrib/zstd/SECURITY.md +15 -0
  8. data/contrib/zstd/lib/Makefile +40 -28
  9. data/contrib/zstd/lib/README.md +14 -1
  10. data/contrib/zstd/lib/common/allocations.h +1 -1
  11. data/contrib/zstd/lib/common/bitstream.h +49 -29
  12. data/contrib/zstd/lib/common/compiler.h +114 -22
  13. data/contrib/zstd/lib/common/cpu.h +36 -0
  14. data/contrib/zstd/lib/common/debug.c +6 -0
  15. data/contrib/zstd/lib/common/debug.h +20 -11
  16. data/contrib/zstd/lib/common/error_private.h +45 -36
  17. data/contrib/zstd/lib/common/fse.h +3 -2
  18. data/contrib/zstd/lib/common/fse_decompress.c +19 -17
  19. data/contrib/zstd/lib/common/huf.h +14 -1
  20. data/contrib/zstd/lib/common/mem.h +0 -9
  21. data/contrib/zstd/lib/common/pool.c +1 -1
  22. data/contrib/zstd/lib/common/pool.h +1 -1
  23. data/contrib/zstd/lib/common/portability_macros.h +2 -0
  24. data/contrib/zstd/lib/common/threading.c +8 -2
  25. data/contrib/zstd/lib/common/xxhash.c +5 -11
  26. data/contrib/zstd/lib/common/xxhash.h +2341 -1007
  27. data/contrib/zstd/lib/common/zstd_internal.h +5 -5
  28. data/contrib/zstd/lib/compress/fse_compress.c +8 -7
  29. data/contrib/zstd/lib/compress/huf_compress.c +54 -25
  30. data/contrib/zstd/lib/compress/zstd_compress.c +282 -161
  31. data/contrib/zstd/lib/compress/zstd_compress_internal.h +29 -27
  32. data/contrib/zstd/lib/compress/zstd_compress_superblock.c +224 -113
  33. data/contrib/zstd/lib/compress/zstd_cwksp.h +19 -13
  34. data/contrib/zstd/lib/compress/zstd_double_fast.c +17 -5
  35. data/contrib/zstd/lib/compress/zstd_double_fast.h +11 -0
  36. data/contrib/zstd/lib/compress/zstd_fast.c +14 -6
  37. data/contrib/zstd/lib/compress/zstd_lazy.c +129 -87
  38. data/contrib/zstd/lib/compress/zstd_lazy.h +103 -28
  39. data/contrib/zstd/lib/compress/zstd_ldm.c +8 -2
  40. data/contrib/zstd/lib/compress/zstd_opt.c +216 -112
  41. data/contrib/zstd/lib/compress/zstd_opt.h +31 -7
  42. data/contrib/zstd/lib/compress/zstdmt_compress.c +94 -79
  43. data/contrib/zstd/lib/decompress/huf_decompress.c +188 -126
  44. data/contrib/zstd/lib/decompress/huf_decompress_amd64.S +38 -19
  45. data/contrib/zstd/lib/decompress/zstd_decompress.c +84 -32
  46. data/contrib/zstd/lib/decompress/zstd_decompress_block.c +231 -208
  47. data/contrib/zstd/lib/decompress/zstd_decompress_block.h +1 -1
  48. data/contrib/zstd/lib/decompress/zstd_decompress_internal.h +2 -0
  49. data/contrib/zstd/lib/dictBuilder/cover.c +16 -12
  50. data/contrib/zstd/lib/dictBuilder/cover.h +2 -8
  51. data/contrib/zstd/lib/dictBuilder/fastcover.c +2 -2
  52. data/contrib/zstd/lib/dictBuilder/zdict.c +12 -6
  53. data/contrib/zstd/lib/legacy/zstd_legacy.h +30 -0
  54. data/contrib/zstd/lib/legacy/zstd_v01.c +2 -0
  55. data/contrib/zstd/lib/legacy/zstd_v02.c +4 -16
  56. data/contrib/zstd/lib/legacy/zstd_v03.c +4 -16
  57. data/contrib/zstd/lib/legacy/zstd_v04.c +4 -11
  58. data/contrib/zstd/lib/legacy/zstd_v05.c +1 -0
  59. data/contrib/zstd/lib/legacy/zstd_v06.c +2 -9
  60. data/contrib/zstd/lib/legacy/zstd_v07.c +2 -10
  61. data/contrib/zstd/lib/libzstd.mk +34 -11
  62. data/contrib/zstd/lib/zstd.h +129 -60
  63. data/ext/extconf.rb +19 -1
  64. data/ext/extzstd.c +38 -14
  65. data/ext/extzstd.h +33 -6
  66. data/ext/extzstd_stream.c +74 -31
  67. metadata +4 -5
  68. data/contrib/zstd/appveyor.yml +0 -205
  69. data/ext/depend +0 -2
@@ -106,7 +106,7 @@ extern "C" {
106
106
  /*------ Version ------*/
107
107
  #define ZSTD_VERSION_MAJOR 1
108
108
  #define ZSTD_VERSION_MINOR 5
109
- #define ZSTD_VERSION_RELEASE 5
109
+ #define ZSTD_VERSION_RELEASE 6
110
110
  #define ZSTD_VERSION_NUMBER (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE)
111
111
 
112
112
  /*! ZSTD_versionNumber() :
@@ -228,7 +228,7 @@ ZSTDLIB_API size_t ZSTD_findFrameCompressedSize(const void* src, size_t srcSize)
228
228
  * for example to size a static array on stack.
229
229
  * Will produce constant value 0 if srcSize too large.
230
230
  */
231
- #define ZSTD_MAX_INPUT_SIZE ((sizeof(size_t)==8) ? 0xFF00FF00FF00FF00LLU : 0xFF00FF00U)
231
+ #define ZSTD_MAX_INPUT_SIZE ((sizeof(size_t)==8) ? 0xFF00FF00FF00FF00ULL : 0xFF00FF00U)
232
232
  #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 */
233
233
  ZSTDLIB_API size_t ZSTD_compressBound(size_t srcSize); /*!< maximum compressed size in worst case single-pass scenario */
234
234
  /* ZSTD_isError() :
@@ -249,7 +249,7 @@ ZSTDLIB_API int ZSTD_defaultCLevel(void); /*!< default compres
249
249
  /*= Compression context
250
250
  * When compressing many times,
251
251
  * it is recommended to allocate a context just once,
252
- * and re-use it for each successive compression operation.
252
+ * and reuse it for each successive compression operation.
253
253
  * This will make workload friendlier for system's memory.
254
254
  * Note : re-using context is just a speed / resource optimization.
255
255
  * It doesn't change the compression ratio, which remains identical.
@@ -262,9 +262,9 @@ ZSTDLIB_API size_t ZSTD_freeCCtx(ZSTD_CCtx* cctx); /* accept NULL pointer *
262
262
 
263
263
  /*! ZSTD_compressCCtx() :
264
264
  * Same as ZSTD_compress(), using an explicit ZSTD_CCtx.
265
- * Important : in order to behave similarly to `ZSTD_compress()`,
266
- * this function compresses at requested compression level,
267
- * __ignoring any other parameter__ .
265
+ * Important : in order to mirror `ZSTD_compress()` behavior,
266
+ * this function compresses at the requested compression level,
267
+ * __ignoring any other advanced parameter__ .
268
268
  * If any advanced parameter was set using the advanced API,
269
269
  * they will all be reset. Only `compressionLevel` remains.
270
270
  */
@@ -276,7 +276,7 @@ ZSTDLIB_API size_t ZSTD_compressCCtx(ZSTD_CCtx* cctx,
276
276
  /*= Decompression context
277
277
  * When decompressing many times,
278
278
  * it is recommended to allocate a context only once,
279
- * and re-use it for each successive compression operation.
279
+ * and reuse it for each successive compression operation.
280
280
  * This will make workload friendlier for system's memory.
281
281
  * Use one context per thread for parallel execution. */
282
282
  typedef struct ZSTD_DCtx_s ZSTD_DCtx;
@@ -286,7 +286,7 @@ ZSTDLIB_API size_t ZSTD_freeDCtx(ZSTD_DCtx* dctx); /* accept NULL pointer *
286
286
  /*! ZSTD_decompressDCtx() :
287
287
  * Same as ZSTD_decompress(),
288
288
  * requires an allocated ZSTD_DCtx.
289
- * Compatible with sticky parameters.
289
+ * Compatible with sticky parameters (see below).
290
290
  */
291
291
  ZSTDLIB_API size_t ZSTD_decompressDCtx(ZSTD_DCtx* dctx,
292
292
  void* dst, size_t dstCapacity,
@@ -302,12 +302,12 @@ ZSTDLIB_API size_t ZSTD_decompressDCtx(ZSTD_DCtx* dctx,
302
302
  * using ZSTD_CCtx_set*() functions.
303
303
  * Pushed parameters are sticky : they are valid for next compressed frame, and any subsequent frame.
304
304
  * "sticky" parameters are applicable to `ZSTD_compress2()` and `ZSTD_compressStream*()` !
305
- * __They do not apply to "simple" one-shot variants such as ZSTD_compressCCtx()__ .
305
+ * __They do not apply to one-shot variants such as ZSTD_compressCCtx()__ .
306
306
  *
307
307
  * It's possible to reset all parameters to "default" using ZSTD_CCtx_reset().
308
308
  *
309
309
  * This API supersedes all other "advanced" API entry points in the experimental section.
310
- * In the future, we expect to remove from experimental API entry points which are redundant with this API.
310
+ * In the future, we expect to remove API entry points from experimental which are redundant with this API.
311
311
  */
312
312
 
313
313
 
@@ -390,6 +390,19 @@ typedef enum {
390
390
  * The higher the value of selected strategy, the more complex it is,
391
391
  * resulting in stronger and slower compression.
392
392
  * Special: value 0 means "use default strategy". */
393
+
394
+ ZSTD_c_targetCBlockSize=130, /* v1.5.6+
395
+ * Attempts to fit compressed block size into approximatively targetCBlockSize.
396
+ * Bound by ZSTD_TARGETCBLOCKSIZE_MIN and ZSTD_TARGETCBLOCKSIZE_MAX.
397
+ * Note that it's not a guarantee, just a convergence target (default:0).
398
+ * No target when targetCBlockSize == 0.
399
+ * This is helpful in low bandwidth streaming environments to improve end-to-end latency,
400
+ * when a client can make use of partial documents (a prominent example being Chrome).
401
+ * Note: this parameter is stable since v1.5.6.
402
+ * It was present as an experimental parameter in earlier versions,
403
+ * but it's not recommended using it with earlier library versions
404
+ * due to massive performance regressions.
405
+ */
393
406
  /* LDM mode parameters */
394
407
  ZSTD_c_enableLongDistanceMatching=160, /* Enable long distance matching.
395
408
  * This parameter is designed to improve compression ratio
@@ -469,7 +482,6 @@ typedef enum {
469
482
  * ZSTD_c_forceMaxWindow
470
483
  * ZSTD_c_forceAttachDict
471
484
  * ZSTD_c_literalCompressionMode
472
- * ZSTD_c_targetCBlockSize
473
485
  * ZSTD_c_srcSizeHint
474
486
  * ZSTD_c_enableDedicatedDictSearch
475
487
  * ZSTD_c_stableInBuffer
@@ -490,7 +502,7 @@ typedef enum {
490
502
  ZSTD_c_experimentalParam3=1000,
491
503
  ZSTD_c_experimentalParam4=1001,
492
504
  ZSTD_c_experimentalParam5=1002,
493
- ZSTD_c_experimentalParam6=1003,
505
+ /* was ZSTD_c_experimentalParam6=1003; is now ZSTD_c_targetCBlockSize */
494
506
  ZSTD_c_experimentalParam7=1004,
495
507
  ZSTD_c_experimentalParam8=1005,
496
508
  ZSTD_c_experimentalParam9=1006,
@@ -575,6 +587,7 @@ ZSTDLIB_API size_t ZSTD_CCtx_reset(ZSTD_CCtx* cctx, ZSTD_ResetDirective reset);
575
587
 
576
588
  /*! ZSTD_compress2() :
577
589
  * Behave the same as ZSTD_compressCCtx(), but compression parameters are set using the advanced API.
590
+ * (note that this entry point doesn't even expose a compression level parameter).
578
591
  * ZSTD_compress2() always starts a new frame.
579
592
  * Should cctx hold data from a previously unfinished frame, everything about it is forgotten.
580
593
  * - Compression parameters are pushed into CCtx before starting compression, using ZSTD_CCtx_set*()
@@ -618,6 +631,7 @@ typedef enum {
618
631
  * ZSTD_d_forceIgnoreChecksum
619
632
  * ZSTD_d_refMultipleDDicts
620
633
  * ZSTD_d_disableHuffmanAssembly
634
+ * ZSTD_d_maxBlockSize
621
635
  * Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them.
622
636
  * note : never ever use experimentalParam? names directly
623
637
  */
@@ -625,7 +639,8 @@ typedef enum {
625
639
  ZSTD_d_experimentalParam2=1001,
626
640
  ZSTD_d_experimentalParam3=1002,
627
641
  ZSTD_d_experimentalParam4=1003,
628
- ZSTD_d_experimentalParam5=1004
642
+ ZSTD_d_experimentalParam5=1004,
643
+ ZSTD_d_experimentalParam6=1005
629
644
 
630
645
  } ZSTD_dParameter;
631
646
 
@@ -680,14 +695,14 @@ typedef struct ZSTD_outBuffer_s {
680
695
  * A ZSTD_CStream object is required to track streaming operation.
681
696
  * Use ZSTD_createCStream() and ZSTD_freeCStream() to create/release resources.
682
697
  * ZSTD_CStream objects can be reused multiple times on consecutive compression operations.
683
- * It is recommended to re-use ZSTD_CStream since it will play nicer with system's memory, by re-using already allocated memory.
698
+ * It is recommended to reuse ZSTD_CStream since it will play nicer with system's memory, by re-using already allocated memory.
684
699
  *
685
700
  * For parallel execution, use one separate ZSTD_CStream per thread.
686
701
  *
687
702
  * note : since v1.3.0, ZSTD_CStream and ZSTD_CCtx are the same thing.
688
703
  *
689
704
  * Parameters are sticky : when starting a new compression on the same context,
690
- * it will re-use the same sticky parameters as previous compression session.
705
+ * it will reuse the same sticky parameters as previous compression session.
691
706
  * When in doubt, it's recommended to fully initialize the context before usage.
692
707
  * Use ZSTD_CCtx_reset() to reset the context and ZSTD_CCtx_setParameter(),
693
708
  * ZSTD_CCtx_setPledgedSrcSize(), or ZSTD_CCtx_loadDictionary() and friends to
@@ -776,6 +791,11 @@ typedef enum {
776
791
  * only ZSTD_e_end or ZSTD_e_flush operations are allowed.
777
792
  * Before starting a new compression job, or changing compression parameters,
778
793
  * it is required to fully flush internal buffers.
794
+ * - note: if an operation ends with an error, it may leave @cctx in an undefined state.
795
+ * Therefore, it's UB to invoke ZSTD_compressStream2() of ZSTD_compressStream() on such a state.
796
+ * In order to be re-employed after an error, a state must be reset,
797
+ * which can be done explicitly (ZSTD_CCtx_reset()),
798
+ * or is sometimes implied by methods starting a new compression job (ZSTD_initCStream(), ZSTD_compressCCtx())
779
799
  */
780
800
  ZSTDLIB_API size_t ZSTD_compressStream2( ZSTD_CCtx* cctx,
781
801
  ZSTD_outBuffer* output,
@@ -835,7 +855,7 @@ ZSTDLIB_API size_t ZSTD_endStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output);
835
855
  *
836
856
  * A ZSTD_DStream object is required to track streaming operations.
837
857
  * Use ZSTD_createDStream() and ZSTD_freeDStream() to create/release resources.
838
- * ZSTD_DStream objects can be re-used multiple times.
858
+ * ZSTD_DStream objects can be reused multiple times.
839
859
  *
840
860
  * Use ZSTD_initDStream() to start a new decompression operation.
841
861
  * @return : recommended first input size
@@ -889,6 +909,12 @@ ZSTDLIB_API size_t ZSTD_initDStream(ZSTD_DStream* zds);
889
909
  * @return : 0 when a frame is completely decoded and fully flushed,
890
910
  * or an error code, which can be tested using ZSTD_isError(),
891
911
  * or any other value > 0, which means there is some decoding or flushing to do to complete current frame.
912
+ *
913
+ * Note: when an operation returns with an error code, the @zds state may be left in undefined state.
914
+ * It's UB to invoke `ZSTD_decompressStream()` on such a state.
915
+ * In order to re-use such a state, it must be first reset,
916
+ * which can be done explicitly (`ZSTD_DCtx_reset()`),
917
+ * or is implied for operations starting some new decompression job (`ZSTD_initDStream`, `ZSTD_decompressDCtx()`, `ZSTD_decompress_usingDict()`)
892
918
  */
893
919
  ZSTDLIB_API size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inBuffer* input);
894
920
 
@@ -1021,7 +1047,7 @@ ZSTDLIB_API unsigned ZSTD_getDictID_fromFrame(const void* src, size_t srcSize);
1021
1047
  *
1022
1048
  * This API allows dictionaries to be used with ZSTD_compress2(),
1023
1049
  * ZSTD_compressStream2(), and ZSTD_decompressDCtx().
1024
- * Dictionaries are sticky, they remain valid when same context is re-used,
1050
+ * Dictionaries are sticky, they remain valid when same context is reused,
1025
1051
  * they only reset when the context is reset
1026
1052
  * with ZSTD_reset_parameters or ZSTD_reset_session_and_parameters.
1027
1053
  * In contrast, Prefixes are single-use.
@@ -1239,7 +1265,7 @@ ZSTDLIB_API size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
1239
1265
  #define ZSTD_LDM_HASHRATELOG_MAX (ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN)
1240
1266
 
1241
1267
  /* Advanced parameter bounds */
1242
- #define ZSTD_TARGETCBLOCKSIZE_MIN 64
1268
+ #define ZSTD_TARGETCBLOCKSIZE_MIN 1340 /* suitable to fit into an ethernet / wifi / 4G transport frame */
1243
1269
  #define ZSTD_TARGETCBLOCKSIZE_MAX ZSTD_BLOCKSIZE_MAX
1244
1270
  #define ZSTD_SRCSIZEHINT_MIN 0
1245
1271
  #define ZSTD_SRCSIZEHINT_MAX INT_MAX
@@ -1527,25 +1553,38 @@ typedef enum {
1527
1553
  ZSTDLIB_STATIC_API size_t ZSTD_sequenceBound(size_t srcSize);
1528
1554
 
1529
1555
  /*! ZSTD_generateSequences() :
1556
+ * WARNING: This function is meant for debugging and informational purposes ONLY!
1557
+ * Its implementation is flawed, and it will be deleted in a future version.
1558
+ * It is not guaranteed to succeed, as there are several cases where it will give
1559
+ * up and fail. You should NOT use this function in production code.
1560
+ *
1561
+ * This function is deprecated, and will be removed in a future version.
1562
+ *
1530
1563
  * Generate sequences using ZSTD_compress2(), given a source buffer.
1531
1564
  *
1565
+ * @param zc The compression context to be used for ZSTD_compress2(). Set any
1566
+ * compression parameters you need on this context.
1567
+ * @param outSeqs The output sequences buffer of size @p outSeqsSize
1568
+ * @param outSeqsSize The size of the output sequences buffer.
1569
+ * ZSTD_sequenceBound(srcSize) is an upper bound on the number
1570
+ * of sequences that can be generated.
1571
+ * @param src The source buffer to generate sequences from of size @p srcSize.
1572
+ * @param srcSize The size of the source buffer.
1573
+ *
1532
1574
  * Each block will end with a dummy sequence
1533
1575
  * with offset == 0, matchLength == 0, and litLength == length of last literals.
1534
1576
  * litLength may be == 0, and if so, then the sequence of (of: 0 ml: 0 ll: 0)
1535
1577
  * simply acts as a block delimiter.
1536
1578
  *
1537
- * @zc can be used to insert custom compression params.
1538
- * This function invokes ZSTD_compress2().
1539
- *
1540
- * The output of this function can be fed into ZSTD_compressSequences() with CCtx
1541
- * setting of ZSTD_c_blockDelimiters as ZSTD_sf_explicitBlockDelimiters
1542
- * @return : number of sequences generated
1579
+ * @returns The number of sequences generated, necessarily less than
1580
+ * ZSTD_sequenceBound(srcSize), or an error code that can be checked
1581
+ * with ZSTD_isError().
1543
1582
  */
1544
-
1583
+ ZSTD_DEPRECATED("For debugging only, will be replaced by ZSTD_extractSequences()")
1545
1584
  ZSTDLIB_STATIC_API size_t
1546
- ZSTD_generateSequences( ZSTD_CCtx* zc,
1547
- ZSTD_Sequence* outSeqs, size_t outSeqsSize,
1548
- const void* src, size_t srcSize);
1585
+ ZSTD_generateSequences(ZSTD_CCtx* zc,
1586
+ ZSTD_Sequence* outSeqs, size_t outSeqsSize,
1587
+ const void* src, size_t srcSize);
1549
1588
 
1550
1589
  /*! ZSTD_mergeBlockDelimiters() :
1551
1590
  * Given an array of ZSTD_Sequence, remove all sequences that represent block delimiters/last literals
@@ -1640,56 +1679,59 @@ ZSTDLIB_API unsigned ZSTD_isSkippableFrame(const void* buffer, size_t size);
1640
1679
  /*! ZSTD_estimate*() :
1641
1680
  * These functions make it possible to estimate memory usage
1642
1681
  * of a future {D,C}Ctx, before its creation.
1682
+ * This is useful in combination with ZSTD_initStatic(),
1683
+ * which makes it possible to employ a static buffer for ZSTD_CCtx* state.
1643
1684
  *
1644
1685
  * ZSTD_estimateCCtxSize() will provide a memory budget large enough
1645
- * for any compression level up to selected one.
1646
- * Note : Unlike ZSTD_estimateCStreamSize*(), this estimate
1647
- * does not include space for a window buffer.
1648
- * Therefore, the estimation is only guaranteed for single-shot compressions, not streaming.
1686
+ * to compress data of any size using one-shot compression ZSTD_compressCCtx() or ZSTD_compress2()
1687
+ * associated with any compression level up to max specified one.
1649
1688
  * The estimate will assume the input may be arbitrarily large,
1650
1689
  * which is the worst case.
1651
1690
  *
1691
+ * Note that the size estimation is specific for one-shot compression,
1692
+ * it is not valid for streaming (see ZSTD_estimateCStreamSize*())
1693
+ * nor other potential ways of using a ZSTD_CCtx* state.
1694
+ *
1652
1695
  * When srcSize can be bound by a known and rather "small" value,
1653
- * this fact can be used to provide a tighter estimation
1654
- * because the CCtx compression context will need less memory.
1655
- * This tighter estimation can be provided by more advanced functions
1696
+ * this knowledge can be used to provide a tighter budget estimation
1697
+ * because the ZSTD_CCtx* state will need less memory for small inputs.
1698
+ * This tighter estimation can be provided by employing more advanced functions
1656
1699
  * ZSTD_estimateCCtxSize_usingCParams(), which can be used in tandem with ZSTD_getCParams(),
1657
1700
  * and ZSTD_estimateCCtxSize_usingCCtxParams(), which can be used in tandem with ZSTD_CCtxParams_setParameter().
1658
1701
  * Both can be used to estimate memory using custom compression parameters and arbitrary srcSize limits.
1659
1702
  *
1660
1703
  * Note : only single-threaded compression is supported.
1661
1704
  * ZSTD_estimateCCtxSize_usingCCtxParams() will return an error code if ZSTD_c_nbWorkers is >= 1.
1662
- *
1663
- * Note 2 : ZSTD_estimateCCtxSize* functions are not compatible with the Block-Level Sequence Producer API at this time.
1664
- * Size estimates assume that no external sequence producer is registered.
1665
1705
  */
1666
- ZSTDLIB_STATIC_API size_t ZSTD_estimateCCtxSize(int compressionLevel);
1706
+ ZSTDLIB_STATIC_API size_t ZSTD_estimateCCtxSize(int maxCompressionLevel);
1667
1707
  ZSTDLIB_STATIC_API size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams);
1668
1708
  ZSTDLIB_STATIC_API size_t ZSTD_estimateCCtxSize_usingCCtxParams(const ZSTD_CCtx_params* params);
1669
1709
  ZSTDLIB_STATIC_API size_t ZSTD_estimateDCtxSize(void);
1670
1710
 
1671
1711
  /*! ZSTD_estimateCStreamSize() :
1672
- * ZSTD_estimateCStreamSize() will provide a budget large enough for any compression level up to selected one.
1673
- * It will also consider src size to be arbitrarily "large", which is worst case.
1712
+ * ZSTD_estimateCStreamSize() will provide a memory budget large enough for streaming compression
1713
+ * using any compression level up to the max specified one.
1714
+ * It will also consider src size to be arbitrarily "large", which is a worst case scenario.
1674
1715
  * If srcSize is known to always be small, ZSTD_estimateCStreamSize_usingCParams() can provide a tighter estimation.
1675
1716
  * ZSTD_estimateCStreamSize_usingCParams() can be used in tandem with ZSTD_getCParams() to create cParams from compressionLevel.
1676
1717
  * ZSTD_estimateCStreamSize_usingCCtxParams() can be used in tandem with ZSTD_CCtxParams_setParameter(). Only single-threaded compression is supported. This function will return an error code if ZSTD_c_nbWorkers is >= 1.
1677
1718
  * Note : CStream size estimation is only correct for single-threaded compression.
1678
- * ZSTD_DStream memory budget depends on window Size.
1719
+ * ZSTD_estimateCStreamSize_usingCCtxParams() will return an error code if ZSTD_c_nbWorkers is >= 1.
1720
+ * Note 2 : ZSTD_estimateCStreamSize* functions are not compatible with the Block-Level Sequence Producer API at this time.
1721
+ * Size estimates assume that no external sequence producer is registered.
1722
+ *
1723
+ * ZSTD_DStream memory budget depends on frame's window Size.
1679
1724
  * This information can be passed manually, using ZSTD_estimateDStreamSize,
1680
1725
  * or deducted from a valid frame Header, using ZSTD_estimateDStreamSize_fromFrame();
1726
+ * Any frame requesting a window size larger than max specified one will be rejected.
1681
1727
  * Note : if streaming is init with function ZSTD_init?Stream_usingDict(),
1682
1728
  * an internal ?Dict will be created, which additional size is not estimated here.
1683
1729
  * In this case, get total size by adding ZSTD_estimate?DictSize
1684
- * Note 2 : only single-threaded compression is supported.
1685
- * ZSTD_estimateCStreamSize_usingCCtxParams() will return an error code if ZSTD_c_nbWorkers is >= 1.
1686
- * Note 3 : ZSTD_estimateCStreamSize* functions are not compatible with the Block-Level Sequence Producer API at this time.
1687
- * Size estimates assume that no external sequence producer is registered.
1688
1730
  */
1689
- ZSTDLIB_STATIC_API size_t ZSTD_estimateCStreamSize(int compressionLevel);
1731
+ ZSTDLIB_STATIC_API size_t ZSTD_estimateCStreamSize(int maxCompressionLevel);
1690
1732
  ZSTDLIB_STATIC_API size_t ZSTD_estimateCStreamSize_usingCParams(ZSTD_compressionParameters cParams);
1691
1733
  ZSTDLIB_STATIC_API size_t ZSTD_estimateCStreamSize_usingCCtxParams(const ZSTD_CCtx_params* params);
1692
- ZSTDLIB_STATIC_API size_t ZSTD_estimateDStreamSize(size_t windowSize);
1734
+ ZSTDLIB_STATIC_API size_t ZSTD_estimateDStreamSize(size_t maxWindowSize);
1693
1735
  ZSTDLIB_STATIC_API size_t ZSTD_estimateDStreamSize_fromFrame(const void* src, size_t srcSize);
1694
1736
 
1695
1737
  /*! ZSTD_estimate?DictSize() :
@@ -1946,11 +1988,6 @@ ZSTDLIB_STATIC_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const vo
1946
1988
  */
1947
1989
  #define ZSTD_c_literalCompressionMode ZSTD_c_experimentalParam5
1948
1990
 
1949
- /* Tries to fit compressed block size to be around targetCBlockSize.
1950
- * No target when targetCBlockSize == 0.
1951
- * There is no guarantee on compressed block size (default:0) */
1952
- #define ZSTD_c_targetCBlockSize ZSTD_c_experimentalParam6
1953
-
1954
1991
  /* User's best guess of source size.
1955
1992
  * Hint is not valid when srcSizeHint == 0.
1956
1993
  * There is no guarantee that hint is close to actual source size,
@@ -2430,6 +2467,22 @@ ZSTDLIB_STATIC_API size_t ZSTD_DCtx_getParameter(ZSTD_DCtx* dctx, ZSTD_dParamete
2430
2467
  */
2431
2468
  #define ZSTD_d_disableHuffmanAssembly ZSTD_d_experimentalParam5
2432
2469
 
2470
+ /* ZSTD_d_maxBlockSize
2471
+ * Allowed values are between 1KB and ZSTD_BLOCKSIZE_MAX (128KB).
2472
+ * The default is ZSTD_BLOCKSIZE_MAX, and setting to 0 will set to the default.
2473
+ *
2474
+ * Forces the decompressor to reject blocks whose content size is
2475
+ * larger than the configured maxBlockSize. When maxBlockSize is
2476
+ * larger than the windowSize, the windowSize is used instead.
2477
+ * This saves memory on the decoder when you know all blocks are small.
2478
+ *
2479
+ * This option is typically used in conjunction with ZSTD_c_maxBlockSize.
2480
+ *
2481
+ * WARNING: This causes the decoder to reject otherwise valid frames
2482
+ * that have block sizes larger than the configured maxBlockSize.
2483
+ */
2484
+ #define ZSTD_d_maxBlockSize ZSTD_d_experimentalParam6
2485
+
2433
2486
 
2434
2487
  /*! ZSTD_DCtx_setFormat() :
2435
2488
  * This function is REDUNDANT. Prefer ZSTD_DCtx_setParameter().
@@ -2557,7 +2610,7 @@ size_t ZSTD_initCStream_usingCDict_advanced(ZSTD_CStream* zcs,
2557
2610
  * explicitly specified.
2558
2611
  *
2559
2612
  * start a new frame, using same parameters from previous frame.
2560
- * This is typically useful to skip dictionary loading stage, since it will re-use it in-place.
2613
+ * This is typically useful to skip dictionary loading stage, since it will reuse it in-place.
2561
2614
  * Note that zcs must be init at least once before using ZSTD_resetCStream().
2562
2615
  * If pledgedSrcSize is not known at reset time, use macro ZSTD_CONTENTSIZE_UNKNOWN.
2563
2616
  * If pledgedSrcSize > 0, its value must be correct, as it will be written in header, and controlled at the end.
@@ -2633,7 +2686,7 @@ ZSTDLIB_STATIC_API size_t ZSTD_initDStream_usingDDict(ZSTD_DStream* zds, const Z
2633
2686
  *
2634
2687
  * ZSTD_DCtx_reset(zds, ZSTD_reset_session_only);
2635
2688
  *
2636
- * re-use decompression parameters from previous init; saves dictionary loading
2689
+ * reuse decompression parameters from previous init; saves dictionary loading
2637
2690
  */
2638
2691
  ZSTD_DEPRECATED("use ZSTD_DCtx_reset, see zstd.h for detailed instructions")
2639
2692
  ZSTDLIB_STATIC_API size_t ZSTD_resetDStream(ZSTD_DStream* zds);
@@ -2765,7 +2818,7 @@ ZSTDLIB_STATIC_API size_t ZSTD_resetDStream(ZSTD_DStream* zds);
2765
2818
 
2766
2819
  #define ZSTD_SEQUENCE_PRODUCER_ERROR ((size_t)(-1))
2767
2820
 
2768
- typedef size_t ZSTD_sequenceProducer_F (
2821
+ typedef size_t (*ZSTD_sequenceProducer_F) (
2769
2822
  void* sequenceProducerState,
2770
2823
  ZSTD_Sequence* outSeqs, size_t outSeqsCapacity,
2771
2824
  const void* src, size_t srcSize,
@@ -2797,7 +2850,23 @@ ZSTDLIB_STATIC_API void
2797
2850
  ZSTD_registerSequenceProducer(
2798
2851
  ZSTD_CCtx* cctx,
2799
2852
  void* sequenceProducerState,
2800
- ZSTD_sequenceProducer_F* sequenceProducer
2853
+ ZSTD_sequenceProducer_F sequenceProducer
2854
+ );
2855
+
2856
+ /*! ZSTD_CCtxParams_registerSequenceProducer() :
2857
+ * Same as ZSTD_registerSequenceProducer(), but operates on ZSTD_CCtx_params.
2858
+ * This is used for accurate size estimation with ZSTD_estimateCCtxSize_usingCCtxParams(),
2859
+ * which is needed when creating a ZSTD_CCtx with ZSTD_initStaticCCtx().
2860
+ *
2861
+ * If you are using the external sequence producer API in a scenario where ZSTD_initStaticCCtx()
2862
+ * is required, then this function is for you. Otherwise, you probably don't need it.
2863
+ *
2864
+ * See tests/zstreamtest.c for example usage. */
2865
+ ZSTDLIB_STATIC_API void
2866
+ ZSTD_CCtxParams_registerSequenceProducer(
2867
+ ZSTD_CCtx_params* params,
2868
+ void* sequenceProducerState,
2869
+ ZSTD_sequenceProducer_F sequenceProducer
2801
2870
  );
2802
2871
 
2803
2872
 
@@ -2820,7 +2889,7 @@ ZSTD_registerSequenceProducer(
2820
2889
 
2821
2890
  A ZSTD_CCtx object is required to track streaming operations.
2822
2891
  Use ZSTD_createCCtx() / ZSTD_freeCCtx() to manage resource.
2823
- ZSTD_CCtx object can be re-used multiple times within successive compression operations.
2892
+ ZSTD_CCtx object can be reused multiple times within successive compression operations.
2824
2893
 
2825
2894
  Start by initializing a context.
2826
2895
  Use ZSTD_compressBegin(), or ZSTD_compressBegin_usingDict() for dictionary compression.
@@ -2841,7 +2910,7 @@ ZSTD_registerSequenceProducer(
2841
2910
  It's possible to use srcSize==0, in which case, it will write a final empty block to end the frame.
2842
2911
  Without last block mark, frames are considered unfinished (hence corrupted) by compliant decoders.
2843
2912
 
2844
- `ZSTD_CCtx` object can be re-used (ZSTD_compressBegin()) to compress again.
2913
+ `ZSTD_CCtx` object can be reused (ZSTD_compressBegin()) to compress again.
2845
2914
  */
2846
2915
 
2847
2916
  /*===== Buffer-less streaming compression functions =====*/
@@ -2873,7 +2942,7 @@ size_t ZSTD_compressBegin_usingCDict_advanced(ZSTD_CCtx* const cctx, const ZSTD_
2873
2942
 
2874
2943
  A ZSTD_DCtx object is required to track streaming operations.
2875
2944
  Use ZSTD_createDCtx() / ZSTD_freeDCtx() to manage it.
2876
- A ZSTD_DCtx object can be re-used multiple times.
2945
+ A ZSTD_DCtx object can be reused multiple times.
2877
2946
 
2878
2947
  First typical operation is to retrieve frame parameters, using ZSTD_getFrameHeader().
2879
2948
  Frame header is extracted from the beginning of compressed frame, so providing only the frame's beginning is enough.
data/ext/extconf.rb CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  require "mkmf"
4
4
 
5
+ using Module.new {
6
+ refine Object do
7
+ def has_function_modifier?(modifier_code)
8
+ try_compile(<<~CODE)
9
+ #{modifier_code}
10
+ void
11
+ func1(void) {
12
+ }
13
+ CODE
14
+ end
15
+ end
16
+ }
17
+
5
18
  $INCFLAGS = %w(
6
19
  -I$(srcdir)/../contrib
7
20
  -I$(srcdir)/../contrib/zstd/lib
@@ -26,9 +39,14 @@ __attribute__ ((visibility("hidden"))) int conftest(void) { return 0; }
26
39
  VISIBILITY
27
40
  if try_cflags("-fvisibility=hidden")
28
41
  $CFLAGS << " -fvisibility=hidden"
29
- $defs << %('-DRBEXT_API=__attribute__ ((visibility("default")))')
42
+ $defs << %(-DRBEXT_API='__attribute__ ((visibility("default")))')
30
43
  end
31
44
  end
32
45
  end
33
46
 
47
+ mod = %w(__attribute__((__noreturn__)) __declspec(noreturn) [[noreturn]] _Noreturn).find { |m|
48
+ has_function_modifier?(m)
49
+ }
50
+ $defs << %(-DRBEXT_NORETURN='#{mod}')
51
+
34
52
  create_makefile File.join(RUBY_VERSION.slice(/\d+\.\d+/), "extzstd")
data/ext/extzstd.c CHANGED
@@ -71,6 +71,7 @@ extzstd_check_error(ssize_t errcode)
71
71
  }
72
72
  }
73
73
 
74
+ RBEXT_NORETURN
74
75
  void
75
76
  extzstd_error(ssize_t errcode)
76
77
  {
@@ -80,8 +81,6 @@ extzstd_error(ssize_t errcode)
80
81
  VALUE
81
82
  extzstd_make_errorf(ssize_t errcode, const char *fmt, ...)
82
83
  {
83
- VALUE e;
84
-
85
84
  if (fmt && strlen(fmt) > 0) {
86
85
  VALUE args[] = { SSIZET2NUM(errcode), Qnil };
87
86
  va_list va;
@@ -461,17 +460,22 @@ static VALUE
461
460
  dict_s_add_entropy_tables_from_buffer(VALUE mod, VALUE dict, VALUE dict_capacity, VALUE sample)
462
461
  {
463
462
  /*
464
- * size_t ZDICT_addEntropyTablesFromBuffer(
465
- * void* dictBuffer, size_t dictContentSize, size_t dictBufferCapacity,
466
- * const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples);
463
+ * ZDICTLIB_API size_t ZDICT_finalizeDictionary(void* dstDictBuffer, size_t maxDictSize,
464
+ * const void* dictContent, size_t dictContentSize,
465
+ * const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples,
466
+ * ZDICT_params_t parameters);
467
467
  */
468
468
 
469
469
  rb_check_type(dict, RUBY_T_STRING);
470
470
  rb_check_type(sample, RUBY_T_STRING);
471
471
  size_t capa = NUM2SIZET(dict_capacity);
472
472
  aux_str_modify_expand(dict, capa);
473
+ char *destptr = RSTRING_PTR(dict);
474
+ size_t destlen = RSTRING_LEN(dict);
475
+ const char *sampleptr = RSTRING_PTR(sample);
473
476
  size_t samplesize = RSTRING_LEN(sample);
474
- size_t s = ZDICT_addEntropyTablesFromBuffer(RSTRING_PTR(dict), RSTRING_LEN(dict), capa, RSTRING_PTR(sample), &samplesize, 1);
477
+ ZDICT_params_t params = { 0, 0, 0 };
478
+ size_t s = ZDICT_finalizeDictionary(destptr, capa, destptr, destlen, sampleptr, &samplesize, 1, params);
475
479
  extzstd_check_error(s);
476
480
  rb_str_set_len(dict, s);
477
481
  return dict;
@@ -539,15 +543,32 @@ less_s_encode(VALUE mod, VALUE src, VALUE dest, VALUE maxdest, VALUE predict, VA
539
543
 
540
544
  if (extzstd_params_p(params)) {
541
545
  /*
542
- * ZSTDLIB_API size_t ZSTD_compress_advanced(
543
- * ZSTD_CCtx* ctx,
544
- * void* dst, size_t dstCapacity,
545
- * const void* src, size_t srcSize,
546
- * const void* dict,size_t dictSize,
547
- * ZSTD_parameters params);
546
+ * ZSTDLIB_API size_t ZSTD_compress2( ZSTD_CCtx* cctx,
547
+ * void* dst, size_t dstCapacity,
548
+ * const void* src, size_t srcSize);
549
+ * ZSTDLIB_API size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, int value);
550
+ * ZSTDLIB_API size_t ZSTD_CCtx_setPledgedSrcSize(ZSTD_CCtx* cctx, unsigned long long pledgedSrcSize);
548
551
  */
549
552
  ZSTD_CCtx *zstd = ZSTD_createCCtx();
550
- size_t s = ZSTD_compress_advanced(zstd, r, rsize, q, qsize, d, dsize, *extzstd_getparams(params));
553
+ ZSTD_parameters *param = extzstd_getparams(params);
554
+
555
+ aux_ZSTD_CCtx_setParameter(zstd, ZSTD_c_windowLog, param->cParams.windowLog);
556
+ aux_ZSTD_CCtx_setParameter(zstd, ZSTD_c_chainLog, param->cParams.chainLog);
557
+ aux_ZSTD_CCtx_setParameter(zstd, ZSTD_c_hashLog, param->cParams.hashLog);
558
+ aux_ZSTD_CCtx_setParameter(zstd, ZSTD_c_searchLog, param->cParams.searchLog);
559
+ aux_ZSTD_CCtx_setParameter(zstd, ZSTD_c_minMatch, param->cParams.minMatch);
560
+ aux_ZSTD_CCtx_setParameter(zstd, ZSTD_c_targetLength, param->cParams.targetLength);
561
+ aux_ZSTD_CCtx_setParameter(zstd, ZSTD_c_strategy, param->cParams.strategy);
562
+
563
+ aux_ZSTD_CCtx_setParameter(zstd, ZSTD_c_contentSizeFlag, param->fParams.contentSizeFlag);
564
+ aux_ZSTD_CCtx_setParameter(zstd, ZSTD_c_checksumFlag, param->fParams.checksumFlag);
565
+ aux_ZSTD_CCtx_setParameter(zstd, ZSTD_c_dictIDFlag, !param->fParams.noDictIDFlag);
566
+
567
+ //aux_ZSTD_CCtx_setPledgedSrcSize(zstd, (unsigned long long)qsize);
568
+
569
+ aux_ZSTD_CCtx_loadDictionary(zstd, d, dsize);
570
+
571
+ size_t s = ZSTD_compress2(zstd, r, rsize, q, qsize);
551
572
  ZSTD_freeCCtx(zstd);
552
573
  extzstd_check_error(s);
553
574
  rb_str_set_len(dest, s);
@@ -587,7 +608,7 @@ less_s_decode(VALUE mod, VALUE src, VALUE dest, VALUE maxdest, VALUE predict)
587
608
  aux_string_pointer(src, &q, &qsize);
588
609
 
589
610
  char *r;
590
- size_t rsize = (NIL_P(maxdest)) ? ZSTD_getDecompressedSize(q, qsize) : NUM2SIZET(maxdest);
611
+ size_t rsize = (NIL_P(maxdest)) ? ZSTD_getFrameContentSize(q, qsize) : NUM2SIZET(maxdest);
591
612
  aux_string_expand_pointer(dest, &r, rsize);
592
613
  rb_obj_infect(dest, src);
593
614
 
@@ -634,4 +655,7 @@ Init_extzstd(void)
634
655
  init_dictionary();
635
656
  init_contextless();
636
657
  extzstd_init_stream();
658
+
659
+ (void)params_alloc_dummy;
660
+ (void)getparamsp;
637
661
  }
data/ext/extzstd.h CHANGED
@@ -35,7 +35,7 @@ extern VALUE extzstd_eError;
35
35
  extern void init_extzstd_stream(void);
36
36
  extern void extzstd_init_buffered(void);
37
37
  extern void extzstd_init_stream(void);
38
- extern void extzstd_error(ssize_t errcode);
38
+ extern RBEXT_NORETURN void extzstd_error(ssize_t errcode);
39
39
  extern void extzstd_check_error(ssize_t errcode);
40
40
  extern VALUE extzstd_make_error(ssize_t errcode);
41
41
  extern VALUE extzstd_make_errorf(ssize_t errcode, const char *fmt, ...);
@@ -44,7 +44,7 @@ extern ZSTD_parameters *extzstd_getparams(VALUE v);
44
44
  extern int extzstd_params_p(VALUE v);
45
45
  extern VALUE extzstd_params_alloc(ZSTD_parameters **p);
46
46
 
47
- static inline void
47
+ static RBEXT_NORETURN inline void
48
48
  referror(VALUE v)
49
49
  {
50
50
  rb_raise(rb_eRuntimeError,
@@ -52,7 +52,7 @@ referror(VALUE v)
52
52
  rb_obj_classname(v), (void *)v);
53
53
  }
54
54
 
55
- static inline void
55
+ static RBEXT_NORETURN inline void
56
56
  reiniterror(VALUE v)
57
57
  {
58
58
  rb_raise(rb_eRuntimeError,
@@ -200,14 +200,14 @@ aux_const_dig_str_0(VALUE obj, const char *p[], const char **pp)
200
200
  #endif
201
201
 
202
202
 
203
- static void
203
+ static inline void
204
204
  aux_string_pointer(VALUE str, const char **ptr, size_t *size)
205
205
  {
206
206
  rb_check_type(str, RUBY_T_STRING);
207
207
  RSTRING_GETMEM(str, *ptr, *size);
208
208
  }
209
209
 
210
- static void
210
+ static inline void
211
211
  aux_string_pointer_with_nil(VALUE str, const char **ptr, size_t *size)
212
212
  {
213
213
  if (NIL_P(str)) {
@@ -218,7 +218,7 @@ aux_string_pointer_with_nil(VALUE str, const char **ptr, size_t *size)
218
218
  }
219
219
  }
220
220
 
221
- static void
221
+ static inline void
222
222
  aux_string_expand_pointer(VALUE str, char **ptr, size_t size)
223
223
  {
224
224
  rb_check_type(str, RUBY_T_STRING);
@@ -232,4 +232,31 @@ aux_string_expand_pointer(VALUE str, char **ptr, size_t size)
232
232
  # define rb_obj_infect(dest, src) ((void)(dest), (void)(src))
233
233
  #endif
234
234
 
235
+ #define MAKE_AUX_FUNC(auxdecl, funcall, cleanup) \
236
+ static inline size_t \
237
+ auxdecl \
238
+ { \
239
+ size_t s = funcall; \
240
+ \
241
+ if (ZSTD_isError(s)) { \
242
+ cleanup; \
243
+ extzstd_error(s); \
244
+ } \
245
+ \
246
+ return s; \
247
+ } \
248
+
249
+ MAKE_AUX_FUNC(aux_ZSTD_CCtx_reset(ZSTD_CCtx *zstd, ZSTD_ResetDirective reset),
250
+ ZSTD_CCtx_reset(zstd, reset),
251
+ ZSTD_freeCCtx(zstd))
252
+ MAKE_AUX_FUNC(aux_ZSTD_CCtx_setParameter(ZSTD_CCtx *ctx, ZSTD_cParameter param, int value),
253
+ ZSTD_CCtx_setParameter(ctx, param, value),
254
+ ZSTD_freeCCtx(ctx))
255
+ MAKE_AUX_FUNC(aux_ZSTD_CCtx_setPledgedSrcSize(ZSTD_CCtx *ctx, unsigned long long pledgedSrcSize),
256
+ ZSTD_CCtx_setPledgedSrcSize(ctx, pledgedSrcSize),
257
+ ZSTD_freeCCtx(ctx))
258
+ MAKE_AUX_FUNC(aux_ZSTD_CCtx_loadDictionary(ZSTD_CCtx *ctx, const void* dict, size_t dictSize),
259
+ ZSTD_CCtx_loadDictionary(ctx, dict, dictSize),
260
+ ZSTD_freeCCtx(ctx))
261
+
235
262
  #endif /* EXTZSTD_H */