extzstd 0.0.3.CONCEPT → 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY.ja +5 -0
  3. data/LICENSE +6 -6
  4. data/README.md +35 -22
  5. data/contrib/zstd/LICENSE +13 -9
  6. data/contrib/zstd/README.md +37 -44
  7. data/contrib/zstd/common/entropy_common.c +33 -39
  8. data/contrib/zstd/common/error_private.c +43 -0
  9. data/contrib/zstd/common/error_private.h +11 -60
  10. data/contrib/zstd/common/fse.h +11 -5
  11. data/contrib/zstd/common/fse_decompress.c +14 -16
  12. data/contrib/zstd/common/huf.h +1 -1
  13. data/contrib/zstd/common/mem.h +36 -43
  14. data/contrib/zstd/common/xxhash.c +31 -18
  15. data/contrib/zstd/common/xxhash.h +71 -35
  16. data/contrib/zstd/common/zbuff.h +29 -35
  17. data/contrib/zstd/common/zstd_common.c +24 -32
  18. data/contrib/zstd/common/zstd_errors.h +60 -0
  19. data/contrib/zstd/common/zstd_internal.h +109 -80
  20. data/contrib/zstd/compress/fse_compress.c +9 -6
  21. data/contrib/zstd/compress/huf_compress.c +30 -74
  22. data/contrib/zstd/compress/zbuff_compress.c +43 -51
  23. data/contrib/zstd/compress/zstd_compress.c +953 -763
  24. data/contrib/zstd/compress/zstd_opt.h +115 -261
  25. data/contrib/zstd/decompress/huf_decompress.c +29 -40
  26. data/contrib/zstd/decompress/zbuff_decompress.c +36 -78
  27. data/contrib/zstd/decompress/zstd_decompress.c +976 -496
  28. data/contrib/zstd/dictBuilder/divsufsort.h +5 -5
  29. data/contrib/zstd/dictBuilder/zdict.c +194 -229
  30. data/contrib/zstd/dictBuilder/zdict.h +66 -68
  31. data/contrib/zstd/legacy/zstd_legacy.h +168 -49
  32. data/contrib/zstd/legacy/zstd_v01.c +95 -178
  33. data/contrib/zstd/legacy/zstd_v01.h +12 -32
  34. data/contrib/zstd/legacy/zstd_v02.c +48 -274
  35. data/contrib/zstd/legacy/zstd_v02.h +12 -32
  36. data/contrib/zstd/legacy/zstd_v03.c +48 -274
  37. data/contrib/zstd/legacy/zstd_v03.h +12 -32
  38. data/contrib/zstd/legacy/zstd_v04.c +63 -320
  39. data/contrib/zstd/legacy/zstd_v04.h +13 -33
  40. data/contrib/zstd/legacy/zstd_v05.c +80 -345
  41. data/contrib/zstd/legacy/zstd_v05.h +9 -31
  42. data/contrib/zstd/legacy/zstd_v06.c +48 -458
  43. data/contrib/zstd/legacy/zstd_v06.h +41 -67
  44. data/contrib/zstd/legacy/zstd_v07.c +4544 -0
  45. data/contrib/zstd/legacy/zstd_v07.h +173 -0
  46. data/contrib/zstd/zstd.h +640 -0
  47. data/ext/extconf.rb +7 -3
  48. data/ext/extzstd.c +263 -106
  49. data/ext/extzstd.h +8 -6
  50. data/ext/extzstd_nogvls.h +0 -117
  51. data/ext/extzstd_stream.c +347 -0
  52. data/ext/zstd_common.c +8 -0
  53. data/ext/zstd_compress.c +6 -0
  54. data/ext/zstd_decompress.c +5 -0
  55. data/ext/zstd_dictbuilder.c +5 -0
  56. data/ext/zstd_legacy_v07.c +1 -0
  57. data/gemstub.rb +18 -16
  58. data/lib/extzstd/version.rb +1 -1
  59. data/lib/extzstd.rb +77 -43
  60. data/test/test_basic.rb +11 -6
  61. metadata +23 -10
  62. data/contrib/zstd/common/error_public.h +0 -77
  63. data/contrib/zstd/common/zstd.h +0 -475
  64. data/ext/extzstd_buffered.c +0 -265
  65. data/ext/zstd_amalgam.c +0 -18
@@ -1,34 +1,12 @@
1
- /*
2
- zstd_v06 - decoder for 0.6 format
3
- Header File
4
- Copyright (C) 2014-2016, Yann Collet.
5
-
6
- BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
7
-
8
- Redistribution and use in source and binary forms, with or without
9
- modification, are permitted provided that the following conditions are
10
- met:
11
- * Redistributions of source code must retain the above copyright
12
- notice, this list of conditions and the following disclaimer.
13
- * Redistributions in binary form must reproduce the above
14
- copyright notice, this list of conditions and the following disclaimer
15
- in the documentation and/or other materials provided with the
16
- distribution.
17
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
-
29
- You can contact the author at :
30
- - zstd source repository : https://github.com/Cyan4973/zstd
31
- */
1
+ /**
2
+ * Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ */
9
+
32
10
  #ifndef ZSTDv06_H
33
11
  #define ZSTDv06_H
34
12
 
@@ -36,23 +14,19 @@
36
14
  extern "C" {
37
15
  #endif
38
16
 
39
- /*-*************************************
40
- * Dependencies
41
- ***************************************/
17
+ /*====== Dependency ======*/
42
18
  #include <stddef.h> /* size_t */
43
19
 
44
20
 
45
- /*-***************************************************************
46
- * Export parameters
47
- *****************************************************************/
21
+ /*====== Export for Windows ======*/
48
22
  /*!
49
23
  * ZSTDv06_DLL_EXPORT :
50
24
  * Enable exporting of functions when building a Windows DLL
51
25
  */
52
26
  #if defined(_WIN32) && defined(ZSTDv06_DLL_EXPORT) && (ZSTDv06_DLL_EXPORT==1)
53
- # define ZSTDLIB_API __declspec(dllexport)
27
+ # define ZSTDLIBv06_API __declspec(dllexport)
54
28
  #else
55
- # define ZSTDLIB_API
29
+ # define ZSTDLIBv06_API
56
30
  #endif
57
31
 
58
32
 
@@ -64,18 +38,18 @@ extern "C" {
64
38
  `dstCapacity` must be large enough, equal or larger than originalSize.
65
39
  @return : the number of bytes decompressed into `dst` (<= `dstCapacity`),
66
40
  or an errorCode if it fails (which can be tested using ZSTDv06_isError()) */
67
- ZSTDLIB_API size_t ZSTDv06_decompress( void* dst, size_t dstCapacity,
68
- const void* src, size_t compressedSize);
41
+ ZSTDLIBv06_API size_t ZSTDv06_decompress( void* dst, size_t dstCapacity,
42
+ const void* src, size_t compressedSize);
69
43
 
70
44
 
71
45
  /* *************************************
72
46
  * Helper functions
73
47
  ***************************************/
74
- ZSTDLIB_API size_t ZSTDv06_compressBound(size_t srcSize); /*!< maximum compressed size (worst case scenario) */
48
+ ZSTDLIBv06_API size_t ZSTDv06_compressBound(size_t srcSize); /*!< maximum compressed size (worst case scenario) */
75
49
 
76
50
  /* Error Management */
77
- ZSTDLIB_API unsigned ZSTDv06_isError(size_t code); /*!< tells if a `size_t` function result is an error code */
78
- ZSTDLIB_API const char* ZSTDv06_getErrorName(size_t code); /*!< provides readable string for an error code */
51
+ ZSTDLIBv06_API unsigned ZSTDv06_isError(size_t code); /*!< tells if a `size_t` function result is an error code */
52
+ ZSTDLIBv06_API const char* ZSTDv06_getErrorName(size_t code); /*!< provides readable string for an error code */
79
53
 
80
54
 
81
55
  /* *************************************
@@ -83,12 +57,12 @@ ZSTDLIB_API const char* ZSTDv06_getErrorName(size_t code); /*!< provides rea
83
57
  ***************************************/
84
58
  /** Decompression context */
85
59
  typedef struct ZSTDv06_DCtx_s ZSTDv06_DCtx;
86
- ZSTDLIB_API ZSTDv06_DCtx* ZSTDv06_createDCtx(void);
87
- ZSTDLIB_API size_t ZSTDv06_freeDCtx(ZSTDv06_DCtx* dctx); /*!< @return : errorCode */
60
+ ZSTDLIBv06_API ZSTDv06_DCtx* ZSTDv06_createDCtx(void);
61
+ ZSTDLIBv06_API size_t ZSTDv06_freeDCtx(ZSTDv06_DCtx* dctx); /*!< @return : errorCode */
88
62
 
89
63
  /** ZSTDv06_decompressDCtx() :
90
64
  * Same as ZSTDv06_decompress(), but requires an already allocated ZSTDv06_DCtx (see ZSTDv06_createDCtx()) */
91
- ZSTDLIB_API size_t ZSTDv06_decompressDCtx(ZSTDv06_DCtx* ctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
65
+ ZSTDLIBv06_API size_t ZSTDv06_decompressDCtx(ZSTDv06_DCtx* ctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
92
66
 
93
67
 
94
68
  /*-***********************
@@ -98,10 +72,10 @@ ZSTDLIB_API size_t ZSTDv06_decompressDCtx(ZSTDv06_DCtx* ctx, void* dst, size_t d
98
72
  * Decompression using a pre-defined Dictionary content (see dictBuilder).
99
73
  * Dictionary must be identical to the one used during compression, otherwise regenerated data will be corrupted.
100
74
  * Note : dict can be NULL, in which case, it's equivalent to ZSTDv06_decompressDCtx() */
101
- ZSTDLIB_API size_t ZSTDv06_decompress_usingDict(ZSTDv06_DCtx* dctx,
102
- void* dst, size_t dstCapacity,
103
- const void* src, size_t srcSize,
104
- const void* dict,size_t dictSize);
75
+ ZSTDLIBv06_API size_t ZSTDv06_decompress_usingDict(ZSTDv06_DCtx* dctx,
76
+ void* dst, size_t dstCapacity,
77
+ const void* src, size_t srcSize,
78
+ const void* dict,size_t dictSize);
105
79
 
106
80
 
107
81
  /*-************************
@@ -110,12 +84,12 @@ ZSTDLIB_API size_t ZSTDv06_decompress_usingDict(ZSTDv06_DCtx* dctx,
110
84
  struct ZSTDv06_frameParams_s { unsigned long long frameContentSize; unsigned windowLog; };
111
85
  typedef struct ZSTDv06_frameParams_s ZSTDv06_frameParams;
112
86
 
113
- ZSTDLIB_API size_t ZSTDv06_getFrameParams(ZSTDv06_frameParams* fparamsPtr, const void* src, size_t srcSize); /**< doesn't consume input */
114
- ZSTDLIB_API size_t ZSTDv06_decompressBegin_usingDict(ZSTDv06_DCtx* dctx, const void* dict, size_t dictSize);
115
- ZSTDLIB_API void ZSTDv06_copyDCtx(ZSTDv06_DCtx* dctx, const ZSTDv06_DCtx* preparedDCtx);
87
+ ZSTDLIBv06_API size_t ZSTDv06_getFrameParams(ZSTDv06_frameParams* fparamsPtr, const void* src, size_t srcSize); /**< doesn't consume input */
88
+ ZSTDLIBv06_API size_t ZSTDv06_decompressBegin_usingDict(ZSTDv06_DCtx* dctx, const void* dict, size_t dictSize);
89
+ ZSTDLIBv06_API void ZSTDv06_copyDCtx(ZSTDv06_DCtx* dctx, const ZSTDv06_DCtx* preparedDCtx);
116
90
 
117
- ZSTDLIB_API size_t ZSTDv06_nextSrcSizeToDecompress(ZSTDv06_DCtx* dctx);
118
- ZSTDLIB_API size_t ZSTDv06_decompressContinue(ZSTDv06_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
91
+ ZSTDLIBv06_API size_t ZSTDv06_nextSrcSizeToDecompress(ZSTDv06_DCtx* dctx);
92
+ ZSTDLIBv06_API size_t ZSTDv06_decompressContinue(ZSTDv06_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
119
93
 
120
94
 
121
95
 
@@ -124,15 +98,15 @@ ZSTDLIB_API size_t ZSTDv06_decompressContinue(ZSTDv06_DCtx* dctx, void* dst, siz
124
98
  ***************************************/
125
99
 
126
100
  typedef struct ZBUFFv06_DCtx_s ZBUFFv06_DCtx;
127
- ZSTDLIB_API ZBUFFv06_DCtx* ZBUFFv06_createDCtx(void);
128
- ZSTDLIB_API size_t ZBUFFv06_freeDCtx(ZBUFFv06_DCtx* dctx);
101
+ ZSTDLIBv06_API ZBUFFv06_DCtx* ZBUFFv06_createDCtx(void);
102
+ ZSTDLIBv06_API size_t ZBUFFv06_freeDCtx(ZBUFFv06_DCtx* dctx);
129
103
 
130
- ZSTDLIB_API size_t ZBUFFv06_decompressInit(ZBUFFv06_DCtx* dctx);
131
- ZSTDLIB_API size_t ZBUFFv06_decompressInitDictionary(ZBUFFv06_DCtx* dctx, const void* dict, size_t dictSize);
104
+ ZSTDLIBv06_API size_t ZBUFFv06_decompressInit(ZBUFFv06_DCtx* dctx);
105
+ ZSTDLIBv06_API size_t ZBUFFv06_decompressInitDictionary(ZBUFFv06_DCtx* dctx, const void* dict, size_t dictSize);
132
106
 
133
- ZSTDLIB_API size_t ZBUFFv06_decompressContinue(ZBUFFv06_DCtx* dctx,
134
- void* dst, size_t* dstCapacityPtr,
135
- const void* src, size_t* srcSizePtr);
107
+ ZSTDLIBv06_API size_t ZBUFFv06_decompressContinue(ZBUFFv06_DCtx* dctx,
108
+ void* dst, size_t* dstCapacityPtr,
109
+ const void* src, size_t* srcSizePtr);
136
110
 
137
111
  /*-***************************************************************************
138
112
  * Streaming decompression howto
@@ -162,13 +136,13 @@ ZSTDLIB_API size_t ZBUFFv06_decompressContinue(ZBUFFv06_DCtx* dctx,
162
136
  /* *************************************
163
137
  * Tool functions
164
138
  ***************************************/
165
- ZSTDLIB_API unsigned ZBUFFv06_isError(size_t errorCode);
166
- ZSTDLIB_API const char* ZBUFFv06_getErrorName(size_t errorCode);
139
+ ZSTDLIBv06_API unsigned ZBUFFv06_isError(size_t errorCode);
140
+ ZSTDLIBv06_API const char* ZBUFFv06_getErrorName(size_t errorCode);
167
141
 
168
142
  /** Functions below provide recommended buffer sizes for Compression or Decompression operations.
169
143
  * These sizes are just hints, they tend to offer better latency */
170
- ZSTDLIB_API size_t ZBUFFv06_recommendedDInSize(void);
171
- ZSTDLIB_API size_t ZBUFFv06_recommendedDOutSize(void);
144
+ ZSTDLIBv06_API size_t ZBUFFv06_recommendedDInSize(void);
145
+ ZSTDLIBv06_API size_t ZBUFFv06_recommendedDOutSize(void);
172
146
 
173
147
 
174
148
  /*-*************************************