extlz4 0.3.4 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/Rakefile +21 -3
  4. data/contrib/lz4/CODING_STYLE +57 -0
  5. data/contrib/lz4/LICENSE +1 -1
  6. data/contrib/lz4/Makefile.inc +17 -15
  7. data/contrib/lz4/NEWS +25 -0
  8. data/contrib/lz4/README.md +16 -5
  9. data/contrib/lz4/SECURITY.md +17 -0
  10. data/contrib/lz4/build/README.md +4 -15
  11. data/contrib/lz4/build/VS2022/_build.bat +39 -0
  12. data/contrib/lz4/build/VS2022/_setup.bat +35 -0
  13. data/contrib/lz4/build/VS2022/_test.bat +38 -0
  14. data/contrib/lz4/build/VS2022/build-and-test-win32-debug.bat +26 -0
  15. data/contrib/lz4/build/VS2022/build-and-test-win32-release.bat +26 -0
  16. data/contrib/lz4/build/VS2022/build-and-test-x64-debug.bat +26 -0
  17. data/contrib/lz4/build/VS2022/build-and-test-x64-release.bat +26 -0
  18. data/contrib/lz4/build/VS2022/datagen/datagen.vcxproj +7 -3
  19. data/contrib/lz4/build/{VS2017 → VS2022}/lz4/lz4.vcxproj +21 -7
  20. data/contrib/lz4/build/VS2022/lz4.sln +5 -2
  21. data/contrib/lz4/build/cmake/CMakeLists.txt +95 -100
  22. data/contrib/lz4/build/meson/GetLz4LibraryVersion.py +39 -0
  23. data/contrib/lz4/build/meson/README.md +34 -0
  24. data/contrib/lz4/build/meson/meson/contrib/gen_manual/meson.build +42 -0
  25. data/contrib/lz4/build/meson/meson/contrib/meson.build +11 -0
  26. data/contrib/lz4/build/meson/meson/examples/meson.build +32 -0
  27. data/contrib/lz4/build/meson/meson/lib/meson.build +87 -0
  28. data/contrib/lz4/build/meson/meson/meson.build +135 -0
  29. data/contrib/lz4/build/meson/meson/ossfuzz/meson.build +35 -0
  30. data/contrib/lz4/build/meson/meson/programs/meson.build +91 -0
  31. data/contrib/lz4/build/meson/meson/tests/meson.build +162 -0
  32. data/contrib/lz4/build/meson/meson.build +31 -0
  33. data/contrib/lz4/build/meson/meson_options.txt +44 -0
  34. data/contrib/lz4/build/visual/README.md +5 -0
  35. data/contrib/lz4/build/visual/generate_solution.cmd +55 -0
  36. data/contrib/lz4/build/visual/generate_vs2015.cmd +3 -0
  37. data/contrib/lz4/build/visual/generate_vs2017.cmd +3 -0
  38. data/contrib/lz4/build/visual/generate_vs2019.cmd +3 -0
  39. data/contrib/lz4/build/visual/generate_vs2022.cmd +3 -0
  40. data/contrib/lz4/lib/README.md +25 -1
  41. data/contrib/lz4/lib/lz4.c +206 -99
  42. data/contrib/lz4/lib/lz4.h +111 -69
  43. data/contrib/lz4/lib/lz4file.c +111 -81
  44. data/contrib/lz4/lib/lz4file.h +2 -2
  45. data/contrib/lz4/lib/lz4frame.c +179 -121
  46. data/contrib/lz4/lib/lz4frame.h +162 -103
  47. data/contrib/lz4/lib/lz4hc.c +943 -382
  48. data/contrib/lz4/lib/lz4hc.h +43 -42
  49. data/contrib/lz4/lib/xxhash.c +21 -21
  50. data/contrib/lz4/ossfuzz/decompress_fuzzer.c +1 -1
  51. data/contrib/lz4/ossfuzz/fuzz_helpers.h +1 -1
  52. data/ext/blockapi.c +11 -11
  53. data/ext/frameapi.c +23 -23
  54. metadata +34 -28
  55. data/contrib/lz4/build/VS2010/datagen/datagen.vcxproj +0 -169
  56. data/contrib/lz4/build/VS2010/frametest/frametest.vcxproj +0 -176
  57. data/contrib/lz4/build/VS2010/fullbench/fullbench.vcxproj +0 -176
  58. data/contrib/lz4/build/VS2010/fullbench-dll/fullbench-dll.vcxproj +0 -180
  59. data/contrib/lz4/build/VS2010/fuzzer/fuzzer.vcxproj +0 -173
  60. data/contrib/lz4/build/VS2010/liblz4/liblz4.vcxproj +0 -175
  61. data/contrib/lz4/build/VS2010/liblz4-dll/liblz4-dll.rc +0 -51
  62. data/contrib/lz4/build/VS2010/liblz4-dll/liblz4-dll.vcxproj +0 -179
  63. data/contrib/lz4/build/VS2010/lz4/lz4.vcxproj +0 -189
  64. data/contrib/lz4/build/VS2010/lz4.sln +0 -98
  65. data/contrib/lz4/build/VS2017/datagen/datagen.vcxproj +0 -173
  66. data/contrib/lz4/build/VS2017/frametest/frametest.vcxproj +0 -180
  67. data/contrib/lz4/build/VS2017/fullbench/fullbench.vcxproj +0 -180
  68. data/contrib/lz4/build/VS2017/fullbench-dll/fullbench-dll.vcxproj +0 -184
  69. data/contrib/lz4/build/VS2017/fuzzer/fuzzer.vcxproj +0 -177
  70. data/contrib/lz4/build/VS2017/liblz4/liblz4.vcxproj +0 -179
  71. data/contrib/lz4/build/VS2017/liblz4-dll/liblz4-dll.rc +0 -51
  72. data/contrib/lz4/build/VS2017/liblz4-dll/liblz4-dll.vcxproj +0 -183
  73. data/contrib/lz4/build/VS2017/lz4/lz4.rc +0 -51
  74. data/contrib/lz4/build/VS2017/lz4.sln +0 -103
  75. /data/contrib/lz4/build/{VS2010 → VS2022}/lz4/lz4.rc +0 -0
@@ -173,16 +173,16 @@ typedef LZ4F_contentChecksum_t contentChecksum_t;
173
173
  * setting all parameters to default.
174
174
  * It's then possible to update selectively some parameters */
175
175
  typedef struct {
176
- LZ4F_blockSizeID_t blockSizeID; /* max64KB, max256KB, max1MB, max4MB; 0 == default */
177
- LZ4F_blockMode_t blockMode; /* LZ4F_blockLinked, LZ4F_blockIndependent; 0 == default */
178
- LZ4F_contentChecksum_t contentChecksumFlag; /* 1: frame terminated with 32-bit checksum of decompressed data; 0: disabled (default) */
176
+ LZ4F_blockSizeID_t blockSizeID; /* max64KB, max256KB, max1MB, max4MB; 0 == default (LZ4F_max64KB) */
177
+ LZ4F_blockMode_t blockMode; /* LZ4F_blockLinked, LZ4F_blockIndependent; 0 == default (LZ4F_blockLinked) */
178
+ LZ4F_contentChecksum_t contentChecksumFlag; /* 1: add a 32-bit checksum of frame's decompressed data; 0 == default (disabled) */
179
179
  LZ4F_frameType_t frameType; /* read-only field : LZ4F_frame or LZ4F_skippableFrame */
180
180
  unsigned long long contentSize; /* Size of uncompressed content ; 0 == unknown */
181
181
  unsigned dictID; /* Dictionary ID, sent by compressor to help decoder select correct dictionary; 0 == no dictID provided */
182
- LZ4F_blockChecksum_t blockChecksumFlag; /* 1: each block followed by a checksum of block's compressed data; 0: disabled (default) */
182
+ LZ4F_blockChecksum_t blockChecksumFlag; /* 1: each block followed by a checksum of block's compressed data; 0 == default (disabled) */
183
183
  } LZ4F_frameInfo_t;
184
184
 
185
- #define LZ4F_INIT_FRAMEINFO { LZ4F_default, LZ4F_blockLinked, LZ4F_noContentChecksum, LZ4F_frame, 0ULL, 0U, LZ4F_noBlockChecksum } /* v1.8.3+ */
185
+ #define LZ4F_INIT_FRAMEINFO { LZ4F_max64KB, LZ4F_blockLinked, LZ4F_noContentChecksum, LZ4F_frame, 0ULL, 0U, LZ4F_noBlockChecksum } /* v1.8.3+ */
186
186
 
187
187
  /*! LZ4F_preferences_t :
188
188
  * makes it possible to supply advanced compression instructions to streaming interface.
@@ -204,7 +204,26 @@ typedef struct {
204
204
  * Simple compression function
205
205
  ***********************************/
206
206
 
207
- LZ4FLIB_API int LZ4F_compressionLevel_max(void); /* v1.8.0+ */
207
+ /*! LZ4F_compressFrame() :
208
+ * Compress srcBuffer content into an LZ4-compressed frame.
209
+ * It's a one shot operation, all input content is consumed, and all output is generated.
210
+ *
211
+ * Note : it's a stateless operation (no LZ4F_cctx state needed).
212
+ * In order to reduce load on the allocator, LZ4F_compressFrame(), by default,
213
+ * uses the stack to allocate space for the compression state and some table.
214
+ * If this usage of the stack is too much for your application,
215
+ * consider compiling `lz4frame.c` with compile-time macro LZ4F_HEAPMODE set to 1 instead.
216
+ * All state allocations will use the Heap.
217
+ * It also means each invocation of LZ4F_compressFrame() will trigger several internal alloc/free invocations.
218
+ *
219
+ * @dstCapacity MUST be >= LZ4F_compressFrameBound(srcSize, preferencesPtr).
220
+ * @preferencesPtr is optional : one can provide NULL, in which case all preferences are set to default.
221
+ * @return : number of bytes written into dstBuffer.
222
+ * or an error code if it fails (can be tested using LZ4F_isError())
223
+ */
224
+ LZ4FLIB_API size_t LZ4F_compressFrame(void* dstBuffer, size_t dstCapacity,
225
+ const void* srcBuffer, size_t srcSize,
226
+ const LZ4F_preferences_t* preferencesPtr);
208
227
 
209
228
  /*! LZ4F_compressFrameBound() :
210
229
  * Returns the maximum possible compressed size with LZ4F_compressFrame() given srcSize and preferences.
@@ -214,16 +233,11 @@ LZ4FLIB_API int LZ4F_compressionLevel_max(void); /* v1.8.0+ */
214
233
  */
215
234
  LZ4FLIB_API size_t LZ4F_compressFrameBound(size_t srcSize, const LZ4F_preferences_t* preferencesPtr);
216
235
 
217
- /*! LZ4F_compressFrame() :
218
- * Compress an entire srcBuffer into a valid LZ4 frame.
219
- * dstCapacity MUST be >= LZ4F_compressFrameBound(srcSize, preferencesPtr).
220
- * The LZ4F_preferences_t structure is optional : you can provide NULL as argument. All preferences will be set to default.
221
- * @return : number of bytes written into dstBuffer.
222
- * or an error code if it fails (can be tested using LZ4F_isError())
236
+
237
+ /*! LZ4F_compressionLevel_max() :
238
+ * @return maximum allowed compression level (currently: 12)
223
239
  */
224
- LZ4FLIB_API size_t LZ4F_compressFrame(void* dstBuffer, size_t dstCapacity,
225
- const void* srcBuffer, size_t srcSize,
226
- const LZ4F_preferences_t* preferencesPtr);
240
+ LZ4FLIB_API int LZ4F_compressionLevel_max(void); /* v1.8.0+ */
227
241
 
228
242
 
229
243
  /*-***********************************
@@ -278,7 +292,7 @@ LZ4FLIB_API LZ4F_errorCode_t LZ4F_freeCompressionContext(LZ4F_cctx* cctx);
278
292
  /*! LZ4F_compressBegin() :
279
293
  * will write the frame header into dstBuffer.
280
294
  * dstCapacity must be >= LZ4F_HEADER_SIZE_MAX bytes.
281
- * `prefsPtr` is optional : you can provide NULL as argument, all preferences will then be set to default.
295
+ * `prefsPtr` is optional : NULL can be provided to set all preferences to default.
282
296
  * @return : number of bytes written into dstBuffer for the header
283
297
  * or an error code (which can be tested using LZ4F_isError())
284
298
  */
@@ -355,8 +369,9 @@ typedef struct LZ4F_dctx_s LZ4F_dctx; /* incomplete type */
355
369
  typedef LZ4F_dctx* LZ4F_decompressionContext_t; /* compatibility with previous API versions */
356
370
 
357
371
  typedef struct {
358
- unsigned stableDst; /* pledges that last 64KB decompressed data will remain available unmodified between invocations.
359
- * This optimization skips storage operations in tmp buffers. */
372
+ unsigned stableDst; /* pledges that last 64KB decompressed data is present right before @dstBuffer pointer.
373
+ * This optimization skips internal storage operations.
374
+ * Once set, this pledge must remain valid up to the end of current frame. */
360
375
  unsigned skipChecksums; /* disable checksum calculation and verification, even when one is present in frame, to save CPU time.
361
376
  * Setting this option to 1 once disables all checksums for the rest of the frame. */
362
377
  unsigned reserved1; /* must be set to zero for forward compatibility */
@@ -463,6 +478,11 @@ LZ4F_getFrameInfo(LZ4F_dctx* dctx,
463
478
  * `dstBuffer` can freely change between each consecutive function invocation.
464
479
  * `dstBuffer` content will be overwritten.
465
480
  *
481
+ * Note: if `LZ4F_getFrameInfo()` is called before `LZ4F_decompress()`, srcBuffer must be updated to reflect
482
+ * the number of bytes consumed after reading the frame header. Failure to update srcBuffer before calling
483
+ * `LZ4F_decompress()` will cause decompression failure or, even worse, successful but incorrect decompression.
484
+ * See the `LZ4F_getFrameInfo()` docs for details.
485
+ *
466
486
  * @return : an hint of how many `srcSize` bytes LZ4F_decompress() expects for next call.
467
487
  * Schematically, it's the size of the current (or remaining) compressed block + header of next block.
468
488
  * Respecting the hint provides some small speed benefit, because it skips intermediate buffers.
@@ -493,6 +513,109 @@ LZ4F_decompress(LZ4F_dctx* dctx,
493
513
  LZ4FLIB_API void LZ4F_resetDecompressionContext(LZ4F_dctx* dctx); /* always successful */
494
514
 
495
515
 
516
+ /**********************************
517
+ * Dictionary compression API
518
+ *********************************/
519
+
520
+ /* A Dictionary is useful for the compression of small messages (KB range).
521
+ * It dramatically improves compression efficiency.
522
+ *
523
+ * LZ4 can ingest any input as dictionary, though only the last 64 KB are useful.
524
+ * Better results are generally achieved by using Zstandard's Dictionary Builder
525
+ * to generate a high-quality dictionary from a set of samples.
526
+ *
527
+ * The same dictionary will have to be used on the decompression side
528
+ * for decoding to be successful.
529
+ * To help identify the correct dictionary at decoding stage,
530
+ * the frame header allows optional embedding of a dictID field.
531
+ */
532
+
533
+ /*! LZ4F_compressBegin_usingDict() : stable since v1.10
534
+ * Inits dictionary compression streaming, and writes the frame header into dstBuffer.
535
+ * @dstCapacity must be >= LZ4F_HEADER_SIZE_MAX bytes.
536
+ * @prefsPtr is optional : one may provide NULL as argument,
537
+ * however, it's the only way to provide dictID in the frame header.
538
+ * @dictBuffer must outlive the compression session.
539
+ * @return : number of bytes written into dstBuffer for the header,
540
+ * or an error code (which can be tested using LZ4F_isError())
541
+ * NOTE: The LZ4Frame spec allows each independent block to be compressed with the dictionary,
542
+ * but this entry supports a more limited scenario, where only the first block uses the dictionary.
543
+ * This is still useful for small data, which only need one block anyway.
544
+ * For larger inputs, one may be more interested in LZ4F_compressFrame_usingCDict() below.
545
+ */
546
+ LZ4FLIB_API size_t
547
+ LZ4F_compressBegin_usingDict(LZ4F_cctx* cctx,
548
+ void* dstBuffer, size_t dstCapacity,
549
+ const void* dictBuffer, size_t dictSize,
550
+ const LZ4F_preferences_t* prefsPtr);
551
+
552
+ /*! LZ4F_decompress_usingDict() : stable since v1.10
553
+ * Same as LZ4F_decompress(), using a predefined dictionary.
554
+ * Dictionary is used "in place", without any preprocessing.
555
+ ** It must remain accessible throughout the entire frame decoding. */
556
+ LZ4FLIB_API size_t
557
+ LZ4F_decompress_usingDict(LZ4F_dctx* dctxPtr,
558
+ void* dstBuffer, size_t* dstSizePtr,
559
+ const void* srcBuffer, size_t* srcSizePtr,
560
+ const void* dict, size_t dictSize,
561
+ const LZ4F_decompressOptions_t* decompressOptionsPtr);
562
+
563
+ /*****************************************
564
+ * Bulk processing dictionary compression
565
+ *****************************************/
566
+
567
+ /* Loading a dictionary has a cost, since it involves construction of tables.
568
+ * The Bulk processing dictionary API makes it possible to share this cost
569
+ * over an arbitrary number of compression jobs, even concurrently,
570
+ * markedly improving compression latency for these cases.
571
+ *
572
+ * Note that there is no corresponding bulk API for the decompression side,
573
+ * because dictionary does not carry any initialization cost for decompression.
574
+ * Use the regular LZ4F_decompress_usingDict() there.
575
+ */
576
+ typedef struct LZ4F_CDict_s LZ4F_CDict;
577
+
578
+ /*! LZ4_createCDict() : stable since v1.10
579
+ * When compressing multiple messages / blocks using the same dictionary, it's recommended to initialize it just once.
580
+ * LZ4_createCDict() will create a digested dictionary, ready to start future compression operations without startup delay.
581
+ * LZ4_CDict can be created once and shared by multiple threads concurrently, since its usage is read-only.
582
+ * @dictBuffer can be released after LZ4_CDict creation, since its content is copied within CDict. */
583
+ LZ4FLIB_API LZ4F_CDict* LZ4F_createCDict(const void* dictBuffer, size_t dictSize);
584
+ LZ4FLIB_API void LZ4F_freeCDict(LZ4F_CDict* CDict);
585
+
586
+ /*! LZ4_compressFrame_usingCDict() : stable since v1.10
587
+ * Compress an entire srcBuffer into a valid LZ4 frame using a digested Dictionary.
588
+ * @cctx must point to a context created by LZ4F_createCompressionContext().
589
+ * If @cdict==NULL, compress without a dictionary.
590
+ * @dstBuffer MUST be >= LZ4F_compressFrameBound(srcSize, preferencesPtr).
591
+ * If this condition is not respected, function will fail (@return an errorCode).
592
+ * The LZ4F_preferences_t structure is optional : one may provide NULL as argument,
593
+ * but it's not recommended, as it's the only way to provide @dictID in the frame header.
594
+ * @return : number of bytes written into dstBuffer.
595
+ * or an error code if it fails (can be tested using LZ4F_isError())
596
+ * Note: for larger inputs generating multiple independent blocks,
597
+ * this entry point uses the dictionary for each block. */
598
+ LZ4FLIB_API size_t
599
+ LZ4F_compressFrame_usingCDict(LZ4F_cctx* cctx,
600
+ void* dst, size_t dstCapacity,
601
+ const void* src, size_t srcSize,
602
+ const LZ4F_CDict* cdict,
603
+ const LZ4F_preferences_t* preferencesPtr);
604
+
605
+ /*! LZ4F_compressBegin_usingCDict() : stable since v1.10
606
+ * Inits streaming dictionary compression, and writes the frame header into dstBuffer.
607
+ * @dstCapacity must be >= LZ4F_HEADER_SIZE_MAX bytes.
608
+ * @prefsPtr is optional : one may provide NULL as argument,
609
+ * note however that it's the only way to insert a @dictID in the frame header.
610
+ * @cdict must outlive the compression session.
611
+ * @return : number of bytes written into dstBuffer for the header,
612
+ * or an error code, which can be tested using LZ4F_isError(). */
613
+ LZ4FLIB_API size_t
614
+ LZ4F_compressBegin_usingCDict(LZ4F_cctx* cctx,
615
+ void* dstBuffer, size_t dstCapacity,
616
+ const LZ4F_CDict* cdict,
617
+ const LZ4F_preferences_t* prefsPtr);
618
+
496
619
 
497
620
  #if defined (__cplusplus)
498
621
  }
@@ -503,11 +626,8 @@ LZ4FLIB_API void LZ4F_resetDecompressionContext(LZ4F_dctx* dctx); /* always su
503
626
  #if defined(LZ4F_STATIC_LINKING_ONLY) && !defined(LZ4F_H_STATIC_09782039843)
504
627
  #define LZ4F_H_STATIC_09782039843
505
628
 
506
- #if defined (__cplusplus)
507
- extern "C" {
508
- #endif
509
-
510
- /* These declarations are not stable and may change in the future.
629
+ /* Note :
630
+ * The below declarations are not stable and may change in the future.
511
631
  * They are therefore only safe to depend on
512
632
  * when the caller is statically linked against the library.
513
633
  * To access their declarations, define LZ4F_STATIC_LINKING_ONLY.
@@ -517,6 +637,11 @@ extern "C" {
517
637
  * by defining LZ4F_PUBLISH_STATIC_FUNCTIONS.
518
638
  * Use at your own risk.
519
639
  */
640
+
641
+ #if defined (__cplusplus)
642
+ extern "C" {
643
+ #endif
644
+
520
645
  #ifdef LZ4F_PUBLISH_STATIC_FUNCTIONS
521
646
  # define LZ4FLIB_STATIC_API LZ4FLIB_API
522
647
  #else
@@ -530,7 +655,7 @@ extern "C" {
530
655
  ITEM(ERROR_GENERIC) \
531
656
  ITEM(ERROR_maxBlockSize_invalid) \
532
657
  ITEM(ERROR_blockMode_invalid) \
533
- ITEM(ERROR_contentChecksumFlag_invalid) \
658
+ ITEM(ERROR_parameter_invalid) \
534
659
  ITEM(ERROR_compressionLevel_invalid) \
535
660
  ITEM(ERROR_headerVersion_wrong) \
536
661
  ITEM(ERROR_blockChecksum_invalid) \
@@ -548,6 +673,8 @@ extern "C" {
548
673
  ITEM(ERROR_frameDecoding_alreadyStarted) \
549
674
  ITEM(ERROR_compressionState_uninitialized) \
550
675
  ITEM(ERROR_parameter_null) \
676
+ ITEM(ERROR_io_write) \
677
+ ITEM(ERROR_io_read) \
551
678
  ITEM(ERROR_maxCode)
552
679
 
553
680
  #define LZ4F_GENERATE_ENUM(ENUM) LZ4F_##ENUM,
@@ -558,22 +685,26 @@ typedef enum { LZ4F_LIST_ERRORS(LZ4F_GENERATE_ENUM)
558
685
 
559
686
  LZ4FLIB_STATIC_API LZ4F_errorCodes LZ4F_getErrorCode(size_t functionResult);
560
687
 
688
+ /**********************************
689
+ * Advanced compression operations
690
+ *********************************/
561
691
 
562
692
  /*! LZ4F_getBlockSize() :
563
- * Return, in scalar format (size_t),
564
- * the maximum block size associated with blockSizeID.
693
+ * @return, in scalar format (size_t),
694
+ * the maximum block size associated with @blockSizeID,
695
+ * or an error code (can be tested using LZ4F_isError()) if @blockSizeID is invalid.
565
696
  **/
566
697
  LZ4FLIB_STATIC_API size_t LZ4F_getBlockSize(LZ4F_blockSizeID_t blockSizeID);
567
698
 
568
699
  /*! LZ4F_uncompressedUpdate() :
569
- * LZ4F_uncompressedUpdate() can be called repetitively to add as much data uncompressed data as necessary.
700
+ * LZ4F_uncompressedUpdate() can be called repetitively to add data stored as uncompressed blocks.
570
701
  * Important rule: dstCapacity MUST be large enough to store the entire source buffer as
571
702
  * no compression is done for this operation
572
703
  * If this condition is not respected, LZ4F_uncompressedUpdate() will fail (result is an errorCode).
573
704
  * After an error, the state is left in a UB state, and must be re-initialized or freed.
574
- * If previously a compressed block was written, buffered data is flushed
705
+ * If previously a compressed block was written, buffered data is flushed first,
575
706
  * before appending uncompressed data is continued.
576
- * This is only supported when LZ4F_blockIndependent is used
707
+ * This operation is only supported when LZ4F_blockIndependent is used.
577
708
  * `cOptPtr` is optional : NULL can be provided, in which case all options are set to default.
578
709
  * @return : number of bytes written into `dstBuffer` (it can be zero, meaning input data was just buffered).
579
710
  * or an error code if it fails (which can be tested using LZ4F_isError())
@@ -585,82 +716,10 @@ LZ4F_uncompressedUpdate(LZ4F_cctx* cctx,
585
716
  const LZ4F_compressOptions_t* cOptPtr);
586
717
 
587
718
  /**********************************
588
- * Bulk processing dictionary API
719
+ * Custom memory allocation
589
720
  *********************************/
590
721
 
591
- /* A Dictionary is useful for the compression of small messages (KB range).
592
- * It dramatically improves compression efficiency.
593
- *
594
- * LZ4 can ingest any input as dictionary, though only the last 64 KB are useful.
595
- * Best results are generally achieved by using Zstandard's Dictionary Builder
596
- * to generate a high-quality dictionary from a set of samples.
597
- *
598
- * Loading a dictionary has a cost, since it involves construction of tables.
599
- * The Bulk processing dictionary API makes it possible to share this cost
600
- * over an arbitrary number of compression jobs, even concurrently,
601
- * markedly improving compression latency for these cases.
602
- *
603
- * The same dictionary will have to be used on the decompression side
604
- * for decoding to be successful.
605
- * To help identify the correct dictionary at decoding stage,
606
- * the frame header allows optional embedding of a dictID field.
607
- */
608
- typedef struct LZ4F_CDict_s LZ4F_CDict;
609
-
610
- /*! LZ4_createCDict() :
611
- * When compressing multiple messages / blocks using the same dictionary, it's recommended to load it just once.
612
- * LZ4_createCDict() will create a digested dictionary, ready to start future compression operations without startup delay.
613
- * LZ4_CDict can be created once and shared by multiple threads concurrently, since its usage is read-only.
614
- * `dictBuffer` can be released after LZ4_CDict creation, since its content is copied within CDict */
615
- LZ4FLIB_STATIC_API LZ4F_CDict* LZ4F_createCDict(const void* dictBuffer, size_t dictSize);
616
- LZ4FLIB_STATIC_API void LZ4F_freeCDict(LZ4F_CDict* CDict);
617
-
618
-
619
- /*! LZ4_compressFrame_usingCDict() :
620
- * Compress an entire srcBuffer into a valid LZ4 frame using a digested Dictionary.
621
- * cctx must point to a context created by LZ4F_createCompressionContext().
622
- * If cdict==NULL, compress without a dictionary.
623
- * dstBuffer MUST be >= LZ4F_compressFrameBound(srcSize, preferencesPtr).
624
- * If this condition is not respected, function will fail (@return an errorCode).
625
- * The LZ4F_preferences_t structure is optional : you may provide NULL as argument,
626
- * but it's not recommended, as it's the only way to provide dictID in the frame header.
627
- * @return : number of bytes written into dstBuffer.
628
- * or an error code if it fails (can be tested using LZ4F_isError()) */
629
- LZ4FLIB_STATIC_API size_t
630
- LZ4F_compressFrame_usingCDict(LZ4F_cctx* cctx,
631
- void* dst, size_t dstCapacity,
632
- const void* src, size_t srcSize,
633
- const LZ4F_CDict* cdict,
634
- const LZ4F_preferences_t* preferencesPtr);
635
-
636
-
637
- /*! LZ4F_compressBegin_usingCDict() :
638
- * Inits streaming dictionary compression, and writes the frame header into dstBuffer.
639
- * dstCapacity must be >= LZ4F_HEADER_SIZE_MAX bytes.
640
- * `prefsPtr` is optional : you may provide NULL as argument,
641
- * however, it's the only way to provide dictID in the frame header.
642
- * @return : number of bytes written into dstBuffer for the header,
643
- * or an error code (which can be tested using LZ4F_isError()) */
644
- LZ4FLIB_STATIC_API size_t
645
- LZ4F_compressBegin_usingCDict(LZ4F_cctx* cctx,
646
- void* dstBuffer, size_t dstCapacity,
647
- const LZ4F_CDict* cdict,
648
- const LZ4F_preferences_t* prefsPtr);
649
-
650
-
651
- /*! LZ4F_decompress_usingDict() :
652
- * Same as LZ4F_decompress(), using a predefined dictionary.
653
- * Dictionary is used "in place", without any preprocessing.
654
- ** It must remain accessible throughout the entire frame decoding. */
655
- LZ4FLIB_STATIC_API size_t
656
- LZ4F_decompress_usingDict(LZ4F_dctx* dctxPtr,
657
- void* dstBuffer, size_t* dstSizePtr,
658
- const void* srcBuffer, size_t* srcSizePtr,
659
- const void* dict, size_t dictSize,
660
- const LZ4F_decompressOptions_t* decompressOptionsPtr);
661
-
662
-
663
- /*! Custom memory allocation :
722
+ /*! Custom memory allocation : v1.9.4+
664
723
  * These prototypes make it possible to pass custom allocation/free functions.
665
724
  * LZ4F_customMem is provided at state creation time, using LZ4F_create*_advanced() listed below.
666
725
  * All allocation/free operations will be completed using these custom variants instead of regular <stdlib.h> ones.