zstdlib 0.1.2-x86-mingw32 → 0.2.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +6 -0
  3. data/CHANGES.md +7 -0
  4. data/README.md +4 -3
  5. data/ext/zstdlib/extconf.rb +1 -1
  6. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/common/bitstream.h +0 -0
  7. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/common/compiler.h +1 -1
  8. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/common/cpu.h +0 -0
  9. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/common/debug.c +0 -0
  10. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/common/debug.h +0 -0
  11. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/common/entropy_common.c +0 -0
  12. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/common/error_private.c +0 -0
  13. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/common/error_private.h +0 -0
  14. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/common/fse.h +1 -1
  15. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/common/fse_decompress.c +0 -0
  16. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/common/huf.h +0 -0
  17. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/common/mem.h +0 -0
  18. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/common/pool.c +0 -0
  19. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/common/pool.h +0 -0
  20. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/common/threading.c +2 -2
  21. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/common/threading.h +0 -0
  22. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/common/xxhash.c +2 -2
  23. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/common/xxhash.h +0 -0
  24. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/common/zstd_common.c +0 -0
  25. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/common/zstd_errors.h +0 -0
  26. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/common/zstd_internal.h +55 -2
  27. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/compress/fse_compress.c +2 -2
  28. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/compress/hist.c +0 -0
  29. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/compress/hist.h +0 -0
  30. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/compress/huf_compress.c +0 -0
  31. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/compress/zstd_compress.c +423 -296
  32. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/compress/zstd_compress_internal.h +14 -11
  33. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/compress/zstd_double_fast.c +0 -0
  34. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/compress/zstd_double_fast.h +0 -0
  35. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/compress/zstd_fast.c +203 -124
  36. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/compress/zstd_fast.h +0 -0
  37. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/compress/zstd_lazy.c +0 -0
  38. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/compress/zstd_lazy.h +1 -1
  39. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/compress/zstd_ldm.c +1 -1
  40. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/compress/zstd_ldm.h +0 -0
  41. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/compress/zstd_opt.c +27 -11
  42. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/compress/zstd_opt.h +0 -0
  43. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/compress/zstdmt_compress.c +41 -49
  44. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/compress/zstdmt_compress.h +43 -26
  45. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/decompress/huf_decompress.c +0 -0
  46. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/decompress/zstd_ddict.c +4 -4
  47. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/decompress/zstd_ddict.h +0 -0
  48. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/decompress/zstd_decompress.c +257 -164
  49. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/decompress/zstd_decompress_block.c +51 -47
  50. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/decompress/zstd_decompress_block.h +0 -0
  51. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/decompress/zstd_decompress_internal.h +7 -0
  52. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/lib/zstd.h +689 -542
  53. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/zlibWrapper/gzclose.c +0 -0
  54. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/zlibWrapper/gzcompatibility.h +0 -0
  55. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/zlibWrapper/gzguts.h +2 -0
  56. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/zlibWrapper/gzlib.c +0 -0
  57. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/zlibWrapper/gzread.c +0 -0
  58. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/zlibWrapper/gzwrite.c +0 -0
  59. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/zlibWrapper/zstd_zlibwrapper.c +0 -0
  60. data/ext/zstdlib/{zstd-1.3.8 → zstd-1.4.0}/zlibWrapper/zstd_zlibwrapper.h +0 -0
  61. data/lib/2.2/zstdlib.so +0 -0
  62. data/lib/2.3/zstdlib.so +0 -0
  63. data/lib/2.4/zstdlib.so +0 -0
  64. data/lib/2.5/zstdlib.so +0 -0
  65. data/lib/2.6/zstdlib.so +0 -0
  66. metadata +58 -57
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ef725afea38f67405058681d5146d5a0373c3540b100bfc9b2af84c70930849
4
- data.tar.gz: 78e0d2435c6761240a96b06de64a09463991c56e89fcbe332c58ef53e2b7967c
3
+ metadata.gz: 02e64a9bac079fe88a08517eb7fb7918018080685b527e99b1ba7412999110f4
4
+ data.tar.gz: 9345621416bedf6903d028289c4e86c7e056e7d343dbb8f32d0cfa8f76257681
5
5
  SHA512:
6
- metadata.gz: '0117515922c7825205dc3fbc939df88fb4719898b0a5de1e26d403630e962efe38ce5e97533f7a382b5528cde4e9896cff14149f0c1c7e2eb7b961e9a49499df'
7
- data.tar.gz: fa992084f5bc3819f23beef6df2ab843d165373bcea61f6ea9738eec0120174f5685bbddfd7613bd9192b30e0b52f49d0d7adef47b0c6809e858fc9637455d87
6
+ metadata.gz: '0128b7581a37600bb1b010c05169dbd888fe53b67b825be6d64dc5804cd41975b69131926276e45cbced625fd65d78e49aab75d87513fcefbe7c506b8df6bae8'
7
+ data.tar.gz: 818a5cf8bc94e5794e986c445fd412ee9076c1fa4c33d693a19a5acb6c87e3b9f168f0343a265a975c17d8773706a65303b1ab48ead15199010563dd885c7bc5
data/.yardopts ADDED
@@ -0,0 +1,6 @@
1
+ --no-private
2
+ --protected
3
+ --readme README.md
4
+ -m markdown
5
+ -
6
+ *.md
data/CHANGES.md CHANGED
@@ -1,3 +1,10 @@
1
+ # 0.2.0
2
+
3
+ Zstd version update to `1.4.0`
4
+
5
+ Documentation updates.
6
+
7
+
1
8
  # 0.1.2
2
9
 
3
10
  Implemented `Zstdlib::ZSTD_VERSION` constant and `Zstdlib.zstd_version` module method for Zstd version retrieval.
data/README.md CHANGED
@@ -10,7 +10,8 @@ Unlike the other Zstd bindings available for Ruby, *Zstdlib* utilizes Zstd's nat
10
10
 
11
11
  This specifically means that `Zstdlib` module is and will be (mostly) API-compatible with standard Ruby `Zlib` module and thus _zstdlib_ can be used as a drop-in replacement for _zlib_: just replace `Zlib` with `Zstdlib` throughout the source code and you're in!
12
12
 
13
- Streams produced by `Zstdlib::Deflate` can be decompressed with standard _zstd_ utility and hence can be written to _.zst_ or _.zstd_ files.
13
+ Streams produced by `Zstdlib::Deflate` class can be decompressed with standard _zstd_ utility and hence can be written to _.zst_ or _.zstd_ files.
14
+ Conversely, the `Zstdlib::Inflate` class can handle data from such files.
14
15
 
15
16
  ## Use cases
16
17
 
@@ -80,7 +81,7 @@ Source code and Windows-specific multi-versioned binary gems can be obtained fro
80
81
 
81
82
  ## Release history
82
83
 
83
- For user-visible changes refer to [change log](/CHANGES.md).
84
+ For user-visible changes refer to [change log](CHANGES.md).
84
85
 
85
86
  ## Caveats
86
87
 
@@ -89,7 +90,7 @@ This module is in testing phase so things beyond basic interface might not work
89
90
  Documentation extracted from _zstdlib_ still contains traces of old zlib-related pieces.
90
91
  Just keep this in mind and substitute *zlib* with *zstdlib* upon browsing.
91
92
 
92
- Gzip support, although available in Zstd's Zlib compatibility layer, is currently disabled.
93
+ Gzip _.gz_ file support, although available in Zstd's Zlib compatibility layer, is currently disabled.
93
94
 
94
95
  Zstd's external compression dictionaries capability is not (yet) implemented.
95
96
 
@@ -6,7 +6,7 @@ require 'fileutils'
6
6
  include RbConfig
7
7
  include FileUtils
8
8
 
9
- ZSTD_VERSION = '1.3.8'
9
+ ZSTD_VERSION = '1.4.0'
10
10
  ZLIB_VERSION = '1.2.11'
11
11
  RB_VERSION = CONFIG['MAJOR']+'.'+CONFIG['MINOR']
12
12
  ZMOD_VERSION = RB_VERSION >= '2.3' ? '2.6' : RB_VERSION # Review requirements with every new zlib module release!
@@ -40,7 +40,7 @@
40
40
 
41
41
  /**
42
42
  * FORCE_INLINE_TEMPLATE is used to define C "templates", which take constant
43
- * parameters. They must be inlined for the compiler to elimininate the constant
43
+ * parameters. They must be inlined for the compiler to eliminate the constant
44
44
  * branches.
45
45
  */
46
46
  #define FORCE_INLINE_TEMPLATE static INLINE_KEYWORD FORCE_INLINE_ATTR
@@ -358,7 +358,7 @@ size_t FSE_decompress_wksp(void* dst, size_t dstCapacity, const void* cSrc, size
358
358
  typedef enum {
359
359
  FSE_repeat_none, /**< Cannot use the previous table */
360
360
  FSE_repeat_check, /**< Can use the previous table but it must be checked */
361
- FSE_repeat_valid /**< Can use the previous table and it is asumed to be valid */
361
+ FSE_repeat_valid /**< Can use the previous table and it is assumed to be valid */
362
362
  } FSE_repeat;
363
363
 
364
364
  /* *****************************************
@@ -14,8 +14,8 @@
14
14
  * This file will hold wrapper for systems, which do not support pthreads
15
15
  */
16
16
 
17
- /* create fake symbol to avoid empty trnaslation unit warning */
18
- int g_ZSTD_threading_useles_symbol;
17
+ /* create fake symbol to avoid empty translation unit warning */
18
+ int g_ZSTD_threading_useless_symbol;
19
19
 
20
20
  #if defined(ZSTD_MULTITHREAD) && defined(_WIN32)
21
21
 
@@ -66,10 +66,10 @@
66
66
  /* #define XXH_ACCEPT_NULL_INPUT_POINTER 1 */
67
67
 
68
68
  /*!XXH_FORCE_NATIVE_FORMAT :
69
- * By default, xxHash library provides endian-independant Hash values, based on little-endian convention.
69
+ * By default, xxHash library provides endian-independent Hash values, based on little-endian convention.
70
70
  * Results are therefore identical for little-endian and big-endian CPU.
71
71
  * This comes at a performance cost for big-endian CPU, since some swapping is required to emulate little-endian format.
72
- * Should endian-independance be of no importance for your application, you may set the #define below to 1,
72
+ * Should endian-independence be of no importance for your application, you may set the #define below to 1,
73
73
  * to improve speed for Big-endian CPU.
74
74
  * This option has no impact on Little_Endian CPU.
75
75
  */
@@ -53,8 +53,50 @@ extern "C" {
53
53
  #undef MAX
54
54
  #define MIN(a,b) ((a)<(b) ? (a) : (b))
55
55
  #define MAX(a,b) ((a)>(b) ? (a) : (b))
56
- #define CHECK_F(f) { size_t const errcod = f; if (ERR_isError(errcod)) return errcod; } /* check and Forward error code */
57
- #define CHECK_E(f, e) { size_t const errcod = f; if (ERR_isError(errcod)) return ERROR(e); } /* check and send Error code */
56
+
57
+ /**
58
+ * Return the specified error if the condition evaluates to true.
59
+ *
60
+ * In debug modes, prints additional information. In order to do that
61
+ * (particularly, printing the conditional that failed), this can't just wrap
62
+ * RETURN_ERROR().
63
+ */
64
+ #define RETURN_ERROR_IF(cond, err, ...) \
65
+ if (cond) { \
66
+ RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s", __FILE__, __LINE__, ZSTD_QUOTE(cond), ZSTD_QUOTE(ERROR(err))); \
67
+ RAWLOG(3, ": " __VA_ARGS__); \
68
+ RAWLOG(3, "\n"); \
69
+ return ERROR(err); \
70
+ }
71
+
72
+ /**
73
+ * Unconditionally return the specified error.
74
+ *
75
+ * In debug modes, prints additional information.
76
+ */
77
+ #define RETURN_ERROR(err, ...) \
78
+ do { \
79
+ RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", __FILE__, __LINE__, ZSTD_QUOTE(ERROR(err))); \
80
+ RAWLOG(3, ": " __VA_ARGS__); \
81
+ RAWLOG(3, "\n"); \
82
+ return ERROR(err); \
83
+ } while(0);
84
+
85
+ /**
86
+ * If the provided expression evaluates to an error code, returns that error code.
87
+ *
88
+ * In debug modes, prints additional information.
89
+ */
90
+ #define FORWARD_IF_ERROR(err, ...) \
91
+ do { \
92
+ size_t const err_code = (err); \
93
+ if (ERR_isError(err_code)) { \
94
+ RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s", __FILE__, __LINE__, ZSTD_QUOTE(err), ERR_getErrorName(err_code)); \
95
+ RAWLOG(3, ": " __VA_ARGS__); \
96
+ RAWLOG(3, "\n"); \
97
+ return err_code; \
98
+ } \
99
+ } while(0);
58
100
 
59
101
 
60
102
  /*-*************************************
@@ -200,6 +242,17 @@ typedef struct {
200
242
  U32 longLengthPos;
201
243
  } seqStore_t;
202
244
 
245
+ /**
246
+ * Contains the compressed frame size and an upper-bound for the decompressed frame size.
247
+ * Note: before using `compressedSize`, check for errors using ZSTD_isError().
248
+ * similarly, before using `decompressedBound`, check for errors using:
249
+ * `decompressedBound != ZSTD_CONTENTSIZE_ERROR`
250
+ */
251
+ typedef struct {
252
+ size_t compressedSize;
253
+ unsigned long long decompressedBound;
254
+ } ZSTD_frameSizeInfo; /* decompress & legacy */
255
+
203
256
  const seqStore_t* ZSTD_getSeqStore(const ZSTD_CCtx* ctx); /* compress & dictBuilder */
204
257
  void ZSTD_seqToCodes(const seqStore_t* seqStorePtr); /* compress, dictBuilder, decodeCorpus (shouldn't get its definition from here) */
205
258
 
@@ -129,9 +129,9 @@ size_t FSE_buildCTable_wksp(FSE_CTable* ct,
129
129
  { U32 position = 0;
130
130
  U32 symbol;
131
131
  for (symbol=0; symbol<=maxSymbolValue; symbol++) {
132
- int nbOccurences;
132
+ int nbOccurrences;
133
133
  int const freq = normalizedCounter[symbol];
134
- for (nbOccurences=0; nbOccurences<freq; nbOccurences++) {
134
+ for (nbOccurrences=0; nbOccurrences<freq; nbOccurrences++) {
135
135
  tableSymbol[position] = (FSE_FUNCTION_TYPE)symbol;
136
136
  position = (position + step) & tableMask;
137
137
  while (position > highThreshold)