isomorfeus-ferret 0.17.2 → 0.17.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/ext/isomorfeus_ferret_ext/benchmark.c +9 -20
  3. data/ext/isomorfeus_ferret_ext/benchmarks_all.h +1 -2
  4. data/ext/isomorfeus_ferret_ext/bm_hash.c +1 -2
  5. data/ext/isomorfeus_ferret_ext/brotli_dec_decode.c +4 -2
  6. data/ext/isomorfeus_ferret_ext/brotli_enc_encode.c +3 -2
  7. data/ext/isomorfeus_ferret_ext/frb_analysis.c +4 -5
  8. data/ext/isomorfeus_ferret_ext/frb_field_info.c +3 -4
  9. data/ext/isomorfeus_ferret_ext/frb_index.c +118 -125
  10. data/ext/isomorfeus_ferret_ext/frb_lazy_doc.c +14 -16
  11. data/ext/isomorfeus_ferret_ext/frb_search.c +31 -23
  12. data/ext/isomorfeus_ferret_ext/frb_store.c +27 -13
  13. data/ext/isomorfeus_ferret_ext/frb_utils.c +3 -6
  14. data/ext/isomorfeus_ferret_ext/frt_analysis.c +39 -46
  15. data/ext/isomorfeus_ferret_ext/frt_analysis.h +9 -9
  16. data/ext/isomorfeus_ferret_ext/frt_array.c +11 -22
  17. data/ext/isomorfeus_ferret_ext/frt_bitvector.h +3 -6
  18. data/ext/isomorfeus_ferret_ext/frt_doc_field.c +87 -0
  19. data/ext/isomorfeus_ferret_ext/frt_doc_field.h +26 -0
  20. data/ext/isomorfeus_ferret_ext/frt_document.c +4 -97
  21. data/ext/isomorfeus_ferret_ext/frt_document.h +2 -27
  22. data/ext/isomorfeus_ferret_ext/frt_except.c +8 -6
  23. data/ext/isomorfeus_ferret_ext/frt_except.h +1 -2
  24. data/ext/isomorfeus_ferret_ext/frt_field_index.c +13 -32
  25. data/ext/isomorfeus_ferret_ext/frt_field_index.h +0 -6
  26. data/ext/isomorfeus_ferret_ext/frt_field_info.c +69 -0
  27. data/ext/isomorfeus_ferret_ext/frt_field_info.h +49 -0
  28. data/ext/isomorfeus_ferret_ext/frt_field_infos.c +196 -0
  29. data/ext/isomorfeus_ferret_ext/frt_field_infos.h +35 -0
  30. data/ext/isomorfeus_ferret_ext/frt_global.c +10 -4
  31. data/ext/isomorfeus_ferret_ext/frt_global.h +11 -15
  32. data/ext/isomorfeus_ferret_ext/frt_hash.c +8 -8
  33. data/ext/isomorfeus_ferret_ext/frt_hash.h +1 -2
  34. data/ext/isomorfeus_ferret_ext/frt_hashset.c +20 -40
  35. data/ext/isomorfeus_ferret_ext/frt_hashset.h +1 -2
  36. data/ext/isomorfeus_ferret_ext/frt_helper.c +7 -15
  37. data/ext/isomorfeus_ferret_ext/frt_in_stream.c +35 -45
  38. data/ext/isomorfeus_ferret_ext/frt_in_stream.h +3 -2
  39. data/ext/isomorfeus_ferret_ext/frt_ind.c +20 -38
  40. data/ext/isomorfeus_ferret_ext/frt_index.c +292 -790
  41. data/ext/isomorfeus_ferret_ext/frt_index.h +1 -102
  42. data/ext/isomorfeus_ferret_ext/frt_lang.c +5 -10
  43. data/ext/isomorfeus_ferret_ext/frt_lazy_doc.c +3 -3
  44. data/ext/isomorfeus_ferret_ext/frt_lazy_doc.h +1 -1
  45. data/ext/isomorfeus_ferret_ext/frt_lazy_doc_field.c +18 -25
  46. data/ext/isomorfeus_ferret_ext/frt_lazy_doc_field.h +5 -5
  47. data/ext/isomorfeus_ferret_ext/frt_mdbx_store.c +102 -70
  48. data/ext/isomorfeus_ferret_ext/frt_mempool.c +8 -16
  49. data/ext/isomorfeus_ferret_ext/frt_multimapper.c +23 -46
  50. data/ext/isomorfeus_ferret_ext/frt_multimapper.h +4 -8
  51. data/ext/isomorfeus_ferret_ext/frt_out_stream.c +31 -43
  52. data/ext/isomorfeus_ferret_ext/frt_out_stream.h +2 -2
  53. data/ext/isomorfeus_ferret_ext/frt_posh.c +6 -819
  54. data/ext/isomorfeus_ferret_ext/frt_posh.h +0 -57
  55. data/ext/isomorfeus_ferret_ext/frt_priorityqueue.c +11 -22
  56. data/ext/isomorfeus_ferret_ext/frt_priorityqueue.h +1 -2
  57. data/ext/isomorfeus_ferret_ext/frt_q_boolean.c +85 -171
  58. data/ext/isomorfeus_ferret_ext/frt_q_match_all.c +8 -16
  59. data/ext/isomorfeus_ferret_ext/frt_q_multi_term.c +1 -2
  60. data/ext/isomorfeus_ferret_ext/frt_q_parser.c +49 -98
  61. data/ext/isomorfeus_ferret_ext/frt_q_phrase.c +52 -104
  62. data/ext/isomorfeus_ferret_ext/frt_q_range.c +6 -12
  63. data/ext/isomorfeus_ferret_ext/frt_q_span.c +113 -226
  64. data/ext/isomorfeus_ferret_ext/frt_q_wildcard.c +1 -2
  65. data/ext/isomorfeus_ferret_ext/frt_ram_store.c +134 -85
  66. data/ext/isomorfeus_ferret_ext/frt_search.c +82 -164
  67. data/ext/isomorfeus_ferret_ext/frt_similarity.c +11 -22
  68. data/ext/isomorfeus_ferret_ext/frt_similarity.h +1 -2
  69. data/ext/isomorfeus_ferret_ext/frt_store.c +13 -25
  70. data/ext/isomorfeus_ferret_ext/frt_store.h +86 -52
  71. data/ext/isomorfeus_ferret_ext/frt_term_vectors.c +8 -16
  72. data/ext/isomorfeus_ferret_ext/frt_win32.h +5 -10
  73. data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.c +12 -11
  74. data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.h +11 -13
  75. data/ext/isomorfeus_ferret_ext/lz4.c +422 -195
  76. data/ext/isomorfeus_ferret_ext/lz4.h +114 -46
  77. data/ext/isomorfeus_ferret_ext/lz4frame.c +421 -242
  78. data/ext/isomorfeus_ferret_ext/lz4frame.h +122 -53
  79. data/ext/isomorfeus_ferret_ext/lz4hc.c +127 -111
  80. data/ext/isomorfeus_ferret_ext/lz4hc.h +14 -14
  81. data/ext/isomorfeus_ferret_ext/lz4xxhash.h +1 -1
  82. data/ext/isomorfeus_ferret_ext/mdbx.c +3762 -2526
  83. data/ext/isomorfeus_ferret_ext/mdbx.h +115 -70
  84. data/ext/isomorfeus_ferret_ext/test.c +40 -87
  85. data/ext/isomorfeus_ferret_ext/test.h +3 -6
  86. data/ext/isomorfeus_ferret_ext/test_1710.c +11 -13
  87. data/ext/isomorfeus_ferret_ext/test_analysis.c +32 -64
  88. data/ext/isomorfeus_ferret_ext/test_array.c +6 -12
  89. data/ext/isomorfeus_ferret_ext/test_bitvector.c +12 -24
  90. data/ext/isomorfeus_ferret_ext/test_document.c +23 -33
  91. data/ext/isomorfeus_ferret_ext/test_except.c +10 -21
  92. data/ext/isomorfeus_ferret_ext/test_fields.c +62 -68
  93. data/ext/isomorfeus_ferret_ext/test_file_deleter.c +15 -23
  94. data/ext/isomorfeus_ferret_ext/test_filter.c +17 -27
  95. data/ext/isomorfeus_ferret_ext/test_global.c +14 -29
  96. data/ext/isomorfeus_ferret_ext/test_hash.c +19 -38
  97. data/ext/isomorfeus_ferret_ext/test_hashset.c +8 -16
  98. data/ext/isomorfeus_ferret_ext/test_helper.c +4 -8
  99. data/ext/isomorfeus_ferret_ext/test_highlighter.c +16 -28
  100. data/ext/isomorfeus_ferret_ext/test_index.c +277 -487
  101. data/ext/isomorfeus_ferret_ext/test_lang.c +7 -14
  102. data/ext/isomorfeus_ferret_ext/test_mdbx_store.c +2 -5
  103. data/ext/isomorfeus_ferret_ext/test_mempool.c +5 -10
  104. data/ext/isomorfeus_ferret_ext/test_multimapper.c +3 -6
  105. data/ext/isomorfeus_ferret_ext/test_priorityqueue.c +9 -18
  106. data/ext/isomorfeus_ferret_ext/test_q_const_score.c +4 -6
  107. data/ext/isomorfeus_ferret_ext/test_q_filtered.c +3 -4
  108. data/ext/isomorfeus_ferret_ext/test_q_fuzzy.c +9 -15
  109. data/ext/isomorfeus_ferret_ext/test_q_parser.c +8 -16
  110. data/ext/isomorfeus_ferret_ext/test_q_span.c +19 -35
  111. data/ext/isomorfeus_ferret_ext/test_ram_store.c +14 -13
  112. data/ext/isomorfeus_ferret_ext/test_search.c +60 -109
  113. data/ext/isomorfeus_ferret_ext/test_segments.c +8 -13
  114. data/ext/isomorfeus_ferret_ext/test_similarity.c +2 -4
  115. data/ext/isomorfeus_ferret_ext/test_sort.c +14 -24
  116. data/ext/isomorfeus_ferret_ext/test_store.c +96 -115
  117. data/ext/isomorfeus_ferret_ext/test_term.c +9 -15
  118. data/ext/isomorfeus_ferret_ext/test_term_vectors.c +9 -14
  119. data/ext/isomorfeus_ferret_ext/test_test.c +4 -8
  120. data/ext/isomorfeus_ferret_ext/test_threading.c +14 -20
  121. data/ext/isomorfeus_ferret_ext/testhelper.c +11 -21
  122. data/ext/isomorfeus_ferret_ext/testhelper.h +1 -1
  123. data/ext/isomorfeus_ferret_ext/tests_all.h +1 -2
  124. data/lib/isomorfeus/ferret/index/index.rb +1 -1
  125. data/lib/isomorfeus/ferret/version.rb +1 -1
  126. metadata +24 -4
@@ -1,7 +1,7 @@
1
1
  /*
2
- LZ4 auto-framing library
2
+ LZ4F - LZ4-Frame library
3
3
  Header File
4
- Copyright (C) 2011-2017, Yann Collet.
4
+ Copyright (C) 2011-2020, Yann Collet.
5
5
  BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
6
6
 
7
7
  Redistribution and use in source and binary forms, with or without
@@ -39,7 +39,7 @@
39
39
  * LZ4F also offers streaming capabilities.
40
40
  *
41
41
  * lz4.h is not required when using lz4frame.h,
42
- * except to extract common constant such as LZ4_VERSION_NUMBER.
42
+ * except to extract common constants such as LZ4_VERSION_NUMBER.
43
43
  * */
44
44
 
45
45
  #ifndef LZ4F_H_09782039843
@@ -54,12 +54,12 @@ extern "C" {
54
54
 
55
55
 
56
56
  /**
57
- Introduction
58
-
59
- lz4frame.h implements LZ4 frame specification (doc/lz4_Frame_format.md).
60
- lz4frame.h provides frame compression functions that take care
61
- of encoding standard metadata alongside LZ4-compressed blocks.
62
- */
57
+ * Introduction
58
+ *
59
+ * lz4frame.h implements LZ4 frame specification: see doc/lz4_Frame_format.md .
60
+ * LZ4 Frames are compatible with `lz4` CLI,
61
+ * and designed to be interoperable with any system.
62
+ **/
63
63
 
64
64
  /*-***************************************************************
65
65
  * Compiler specifics
@@ -210,7 +210,7 @@ LZ4FLIB_API int LZ4F_compressionLevel_max(void); /* v1.8.0+ */
210
210
  * Returns the maximum possible compressed size with LZ4F_compressFrame() given srcSize and preferences.
211
211
  * `preferencesPtr` is optional. It can be replaced by NULL, in which case, the function will assume default preferences.
212
212
  * Note : this result is only usable with LZ4F_compressFrame().
213
- * It may also be used with LZ4F_compressUpdate() _if no flush() operation_ is performed.
213
+ * It may also be relevant to LZ4F_compressUpdate() _only if_ no flush() operation is ever performed.
214
214
  */
215
215
  LZ4FLIB_API size_t LZ4F_compressFrameBound(size_t srcSize, const LZ4F_preferences_t* preferencesPtr);
216
216
 
@@ -230,7 +230,7 @@ LZ4FLIB_API size_t LZ4F_compressFrame(void* dstBuffer, size_t dstCapacity,
230
230
  * Advanced compression functions
231
231
  *************************************/
232
232
  typedef struct LZ4F_cctx_s LZ4F_cctx; /* incomplete type */
233
- typedef LZ4F_cctx* LZ4F_compressionContext_t; /* for compatibility with previous API version */
233
+ typedef LZ4F_cctx* LZ4F_compressionContext_t; /* for compatibility with older APIs, prefer using LZ4F_cctx */
234
234
 
235
235
  typedef struct {
236
236
  unsigned stableSrc; /* 1 == src content will remain present on future calls to LZ4F_compress(); skip copying src content within tmp buffer */
@@ -243,20 +243,27 @@ typedef struct {
243
243
  LZ4FLIB_API unsigned LZ4F_getVersion(void);
244
244
 
245
245
  /*! LZ4F_createCompressionContext() :
246
- * The first thing to do is to create a compressionContext object, which will be used in all compression operations.
247
- * This is achieved using LZ4F_createCompressionContext(), which takes as argument a version.
248
- * The version provided MUST be LZ4F_VERSION. It is intended to track potential version mismatch, notably when using DLL.
249
- * The function will provide a pointer to a fully allocated LZ4F_cctx object.
250
- * If @return != zero, there was an error during context creation.
251
- * Object can release its memory using LZ4F_freeCompressionContext();
252
- */
246
+ * The first thing to do is to create a compressionContext object,
247
+ * which will keep track of operation state during streaming compression.
248
+ * This is achieved using LZ4F_createCompressionContext(), which takes as argument a version,
249
+ * and a pointer to LZ4F_cctx*, to write the resulting pointer into.
250
+ * @version provided MUST be LZ4F_VERSION. It is intended to track potential version mismatch, notably when using DLL.
251
+ * The function provides a pointer to a fully allocated LZ4F_cctx object.
252
+ * @cctxPtr MUST be != NULL.
253
+ * If @return != zero, context creation failed.
254
+ * A created compression context can be employed multiple times for consecutive streaming operations.
255
+ * Once all streaming compression jobs are completed,
256
+ * the state object can be released using LZ4F_freeCompressionContext().
257
+ * Note1 : LZ4F_freeCompressionContext() is always successful. Its return value can be ignored.
258
+ * Note2 : LZ4F_freeCompressionContext() works fine with NULL input pointers (do nothing).
259
+ **/
253
260
  LZ4FLIB_API LZ4F_errorCode_t LZ4F_createCompressionContext(LZ4F_cctx** cctxPtr, unsigned version);
254
261
  LZ4FLIB_API LZ4F_errorCode_t LZ4F_freeCompressionContext(LZ4F_cctx* cctx);
255
262
 
256
263
 
257
264
  /*---- Compression ----*/
258
265
 
259
- #define LZ4F_HEADER_SIZE_MIN 7 /* LZ4 Frame header size can vary, depending on selected paramaters */
266
+ #define LZ4F_HEADER_SIZE_MIN 7 /* LZ4 Frame header size can vary, depending on selected parameters */
260
267
  #define LZ4F_HEADER_SIZE_MAX 19
261
268
 
262
269
  /* Size in bytes of a block header in little-endian format. Highest bit indicates if block data is uncompressed */
@@ -301,8 +308,9 @@ LZ4FLIB_API size_t LZ4F_compressBound(size_t srcSize, const LZ4F_preferences_t*
301
308
  * Important rule: dstCapacity MUST be large enough to ensure operation success even in worst case situations.
302
309
  * This value is provided by LZ4F_compressBound().
303
310
  * If this condition is not respected, LZ4F_compress() will fail (result is an errorCode).
304
- * LZ4F_compressUpdate() doesn't guarantee error recovery.
305
- * When an error occurs, compression context must be freed or resized.
311
+ * After an error, the state is left in a UB state, and must be re-initialized or freed.
312
+ * If previously an uncompressed block was written, buffered data is flushed
313
+ * before appending compressed data is continued.
306
314
  * `cOptPtr` is optional : NULL can be provided, in which case all options are set to default.
307
315
  * @return : number of bytes written into `dstBuffer` (it can be zero, meaning input data was just buffered).
308
316
  * or an error code if it fails (which can be tested using LZ4F_isError())
@@ -347,8 +355,12 @@ typedef struct LZ4F_dctx_s LZ4F_dctx; /* incomplete type */
347
355
  typedef LZ4F_dctx* LZ4F_decompressionContext_t; /* compatibility with previous API versions */
348
356
 
349
357
  typedef struct {
350
- unsigned stableDst; /* pledges that last 64KB decompressed data will remain available unmodified. This optimization skips storage operations in tmp buffers. */
351
- unsigned reserved[3]; /* must be set to zero for forward compatibility */
358
+ unsigned stableDst; /* pledges that last 64KB decompressed data will remain available unmodified between invocations.
359
+ * This optimization skips storage operations in tmp buffers. */
360
+ unsigned skipChecksums; /* disable checksum calculation and verification, even when one is present in frame, to save CPU time.
361
+ * Setting this option to 1 once disables all checksums for the rest of the frame. */
362
+ unsigned reserved1; /* must be set to zero for forward compatibility */
363
+ unsigned reserved0; /* idem */
352
364
  } LZ4F_decompressOptions_t;
353
365
 
354
366
 
@@ -356,9 +368,10 @@ typedef struct {
356
368
 
357
369
  /*! LZ4F_createDecompressionContext() :
358
370
  * Create an LZ4F_dctx object, to track all decompression operations.
359
- * The version provided MUST be LZ4F_VERSION.
360
- * The function provides a pointer to an allocated and initialized LZ4F_dctx object.
361
- * The result is an errorCode, which can be tested using LZ4F_isError().
371
+ * @version provided MUST be LZ4F_VERSION.
372
+ * @dctxPtr MUST be valid.
373
+ * The function fills @dctxPtr with the value of a pointer to an allocated and initialized LZ4F_dctx object.
374
+ * The @return is an errorCode, which can be tested using LZ4F_isError().
362
375
  * dctx memory can be released using LZ4F_freeDecompressionContext();
363
376
  * Result of LZ4F_freeDecompressionContext() indicates current state of decompressionContext when being released.
364
377
  * That is, it should be == 0 if decompression has been completed fully and correctly.
@@ -371,6 +384,8 @@ LZ4FLIB_API LZ4F_errorCode_t LZ4F_freeDecompressionContext(LZ4F_dctx* dctx);
371
384
  * Streaming decompression functions
372
385
  *************************************/
373
386
 
387
+ #define LZ4F_MAGICNUMBER 0x184D2204U
388
+ #define LZ4F_MAGIC_SKIPPABLE_START 0x184D2A50U
374
389
  #define LZ4F_MIN_SIZE_TO_KNOW_HEADER_LENGTH 5
375
390
 
376
391
  /*! LZ4F_headerSize() : v1.9.0+
@@ -386,7 +401,7 @@ LZ4FLIB_API size_t LZ4F_headerSize(const void* src, size_t srcSize);
386
401
 
387
402
  /*! LZ4F_getFrameInfo() :
388
403
  * This function extracts frame parameters (max blockSize, dictID, etc.).
389
- * Its usage is optional: user can call LZ4F_decompress() directly.
404
+ * Its usage is optional: user can also invoke LZ4F_decompress() directly.
390
405
  *
391
406
  * Extracted information will fill an existing LZ4F_frameInfo_t structure.
392
407
  * This can be useful for allocation and dictionary identification purposes.
@@ -427,9 +442,10 @@ LZ4FLIB_API size_t LZ4F_headerSize(const void* src, size_t srcSize);
427
442
  * note 1 : in case of error, dctx is not modified. Decoding operation can resume from beginning safely.
428
443
  * note 2 : frame parameters are *copied into* an already allocated LZ4F_frameInfo_t structure.
429
444
  */
430
- LZ4FLIB_API size_t LZ4F_getFrameInfo(LZ4F_dctx* dctx,
431
- LZ4F_frameInfo_t* frameInfoPtr,
432
- const void* srcBuffer, size_t* srcSizePtr);
445
+ LZ4FLIB_API size_t
446
+ LZ4F_getFrameInfo(LZ4F_dctx* dctx,
447
+ LZ4F_frameInfo_t* frameInfoPtr,
448
+ const void* srcBuffer, size_t* srcSizePtr);
433
449
 
434
450
  /*! LZ4F_decompress() :
435
451
  * Call this function repetitively to regenerate data compressed in `srcBuffer`.
@@ -462,10 +478,11 @@ LZ4FLIB_API size_t LZ4F_getFrameInfo(LZ4F_dctx* dctx,
462
478
  *
463
479
  * After a frame is fully decoded, dctx can be used again to decompress another frame.
464
480
  */
465
- LZ4FLIB_API size_t LZ4F_decompress(LZ4F_dctx* dctx,
466
- void* dstBuffer, size_t* dstSizePtr,
467
- const void* srcBuffer, size_t* srcSizePtr,
468
- const LZ4F_decompressOptions_t* dOptPtr);
481
+ LZ4FLIB_API size_t
482
+ LZ4F_decompress(LZ4F_dctx* dctx,
483
+ void* dstBuffer, size_t* dstSizePtr,
484
+ const void* srcBuffer, size_t* srcSizePtr,
485
+ const LZ4F_decompressOptions_t* dOptPtr);
469
486
 
470
487
 
471
488
  /*! LZ4F_resetDecompressionContext() : added in v1.8.0
@@ -529,6 +546,8 @@ extern "C" {
529
546
  ITEM(ERROR_headerChecksum_invalid) \
530
547
  ITEM(ERROR_contentChecksum_invalid) \
531
548
  ITEM(ERROR_frameDecoding_alreadyStarted) \
549
+ ITEM(ERROR_compressionState_uninitialized) \
550
+ ITEM(ERROR_parameter_null) \
532
551
  ITEM(ERROR_maxCode)
533
552
 
534
553
  #define LZ4F_GENERATE_ENUM(ENUM) LZ4F_##ENUM,
@@ -539,7 +558,31 @@ typedef enum { LZ4F_LIST_ERRORS(LZ4F_GENERATE_ENUM)
539
558
 
540
559
  LZ4FLIB_STATIC_API LZ4F_errorCodes LZ4F_getErrorCode(size_t functionResult);
541
560
 
542
- LZ4FLIB_STATIC_API size_t LZ4F_getBlockSize(unsigned);
561
+
562
+ /*! LZ4F_getBlockSize() :
563
+ * Return, in scalar format (size_t),
564
+ * the maximum block size associated with blockSizeID.
565
+ **/
566
+ LZ4FLIB_STATIC_API size_t LZ4F_getBlockSize(LZ4F_blockSizeID_t blockSizeID);
567
+
568
+ /*! LZ4F_uncompressedUpdate() :
569
+ * LZ4F_uncompressedUpdate() can be called repetitively to add as much data uncompressed data as necessary.
570
+ * Important rule: dstCapacity MUST be large enough to store the entire source buffer as
571
+ * no compression is done for this operation
572
+ * If this condition is not respected, LZ4F_uncompressedUpdate() will fail (result is an errorCode).
573
+ * 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
575
+ * before appending uncompressed data is continued.
576
+ * This is only supported when LZ4F_blockIndependent is used
577
+ * `cOptPtr` is optional : NULL can be provided, in which case all options are set to default.
578
+ * @return : number of bytes written into `dstBuffer` (it can be zero, meaning input data was just buffered).
579
+ * or an error code if it fails (which can be tested using LZ4F_isError())
580
+ */
581
+ LZ4FLIB_STATIC_API size_t
582
+ LZ4F_uncompressedUpdate(LZ4F_cctx* cctx,
583
+ void* dstBuffer, size_t dstCapacity,
584
+ const void* srcBuffer, size_t srcSize,
585
+ const LZ4F_compressOptions_t* cOptPtr);
543
586
 
544
587
  /**********************************
545
588
  * Bulk processing dictionary API
@@ -583,12 +626,12 @@ LZ4FLIB_STATIC_API void LZ4F_freeCDict(LZ4F_CDict* CDict);
583
626
  * but it's not recommended, as it's the only way to provide dictID in the frame header.
584
627
  * @return : number of bytes written into dstBuffer.
585
628
  * or an error code if it fails (can be tested using LZ4F_isError()) */
586
- LZ4FLIB_STATIC_API size_t LZ4F_compressFrame_usingCDict(
587
- LZ4F_cctx* cctx,
588
- void* dst, size_t dstCapacity,
589
- const void* src, size_t srcSize,
590
- const LZ4F_CDict* cdict,
591
- const LZ4F_preferences_t* preferencesPtr);
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);
592
635
 
593
636
 
594
637
  /*! LZ4F_compressBegin_usingCDict() :
@@ -598,23 +641,49 @@ LZ4FLIB_STATIC_API size_t LZ4F_compressFrame_usingCDict(
598
641
  * however, it's the only way to provide dictID in the frame header.
599
642
  * @return : number of bytes written into dstBuffer for the header,
600
643
  * or an error code (which can be tested using LZ4F_isError()) */
601
- LZ4FLIB_STATIC_API size_t LZ4F_compressBegin_usingCDict(
602
- LZ4F_cctx* cctx,
603
- void* dstBuffer, size_t dstCapacity,
604
- const LZ4F_CDict* cdict,
605
- const LZ4F_preferences_t* prefsPtr);
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);
606
649
 
607
650
 
608
651
  /*! LZ4F_decompress_usingDict() :
609
652
  * Same as LZ4F_decompress(), using a predefined dictionary.
610
653
  * Dictionary is used "in place", without any preprocessing.
611
- * It must remain accessible throughout the entire frame decoding. */
612
- LZ4FLIB_STATIC_API size_t LZ4F_decompress_usingDict(
613
- LZ4F_dctx* dctxPtr,
614
- void* dstBuffer, size_t* dstSizePtr,
615
- const void* srcBuffer, size_t* srcSizePtr,
616
- const void* dict, size_t dictSize,
617
- const LZ4F_decompressOptions_t* decompressOptionsPtr);
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 :
664
+ * These prototypes make it possible to pass custom allocation/free functions.
665
+ * LZ4F_customMem is provided at state creation time, using LZ4F_create*_advanced() listed below.
666
+ * All allocation/free operations will be completed using these custom variants instead of regular <stdlib.h> ones.
667
+ */
668
+ typedef void* (*LZ4F_AllocFunction) (void* opaqueState, size_t size);
669
+ typedef void* (*LZ4F_CallocFunction) (void* opaqueState, size_t size);
670
+ typedef void (*LZ4F_FreeFunction) (void* opaqueState, void* address);
671
+ typedef struct {
672
+ LZ4F_AllocFunction customAlloc;
673
+ LZ4F_CallocFunction customCalloc; /* optional; when not defined, uses customAlloc + memset */
674
+ LZ4F_FreeFunction customFree;
675
+ void* opaqueState;
676
+ } LZ4F_CustomMem;
677
+ static
678
+ #ifdef __GNUC__
679
+ __attribute__((__unused__))
680
+ #endif
681
+ LZ4F_CustomMem const LZ4F_defaultCMem = { NULL, NULL, NULL, NULL }; /**< this constant defers to stdlib's functions */
682
+
683
+ LZ4FLIB_STATIC_API LZ4F_cctx* LZ4F_createCompressionContext_advanced(LZ4F_CustomMem customMem, unsigned version);
684
+ LZ4FLIB_STATIC_API LZ4F_dctx* LZ4F_createDecompressionContext_advanced(LZ4F_CustomMem customMem, unsigned version);
685
+ LZ4FLIB_STATIC_API LZ4F_CDict* LZ4F_createCDict_advanced(LZ4F_CustomMem customMem, const void* dictBuffer, size_t dictSize);
686
+
618
687
 
619
688
  #if defined (__cplusplus)
620
689
  }