zstdlib 0.13.0-x86-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +6 -0
- data/CHANGES.md +107 -0
- data/Gemfile +3 -0
- data/README.md +107 -0
- data/Rakefile +59 -0
- data/ext/zstdlib_c/extconf.rb +59 -0
- data/ext/zstdlib_c/ruby/zlib-2.2/zstdlib.c +4675 -0
- data/ext/zstdlib_c/ruby/zlib-2.3/zstdlib.c +4702 -0
- data/ext/zstdlib_c/ruby/zlib-2.4/zstdlib.c +4859 -0
- data/ext/zstdlib_c/ruby/zlib-2.5/zstdlib.c +4864 -0
- data/ext/zstdlib_c/ruby/zlib-2.6/zstdlib.c +4906 -0
- data/ext/zstdlib_c/ruby/zlib-2.7/zstdlib.c +4895 -0
- data/ext/zstdlib_c/ruby/zlib-3.0/zstdlib.c +4994 -0
- data/ext/zstdlib_c/ruby/zlib-3.1/zstdlib.c +5076 -0
- data/ext/zstdlib_c/ruby/zlib-3.2/zstdlib.c +5090 -0
- data/ext/zstdlib_c/ruby/zlib-3.3/zstdlib.c +5090 -0
- data/ext/zstdlib_c/zlib-1.3.1/adler32.c +164 -0
- data/ext/zstdlib_c/zlib-1.3.1/compress.c +75 -0
- data/ext/zstdlib_c/zlib-1.3.1/crc32.c +1049 -0
- data/ext/zstdlib_c/zlib-1.3.1/crc32.h +9446 -0
- data/ext/zstdlib_c/zlib-1.3.1/deflate.c +2139 -0
- data/ext/zstdlib_c/zlib-1.3.1/deflate.h +377 -0
- data/ext/zstdlib_c/zlib-1.3.1/gzclose.c +23 -0
- data/ext/zstdlib_c/zlib-1.3.1/gzguts.h +214 -0
- data/ext/zstdlib_c/zlib-1.3.1/gzlib.c +582 -0
- data/ext/zstdlib_c/zlib-1.3.1/gzread.c +602 -0
- data/ext/zstdlib_c/zlib-1.3.1/gzwrite.c +631 -0
- data/ext/zstdlib_c/zlib-1.3.1/infback.c +628 -0
- data/ext/zstdlib_c/zlib-1.3.1/inffast.c +320 -0
- data/ext/zstdlib_c/zlib-1.3.1/inffast.h +11 -0
- data/ext/zstdlib_c/zlib-1.3.1/inffixed.h +94 -0
- data/ext/zstdlib_c/zlib-1.3.1/inflate.c +1526 -0
- data/ext/zstdlib_c/zlib-1.3.1/inflate.h +126 -0
- data/ext/zstdlib_c/zlib-1.3.1/inftrees.c +299 -0
- data/ext/zstdlib_c/zlib-1.3.1/inftrees.h +62 -0
- data/ext/zstdlib_c/zlib-1.3.1/trees.c +1117 -0
- data/ext/zstdlib_c/zlib-1.3.1/trees.h +128 -0
- data/ext/zstdlib_c/zlib-1.3.1/uncompr.c +85 -0
- data/ext/zstdlib_c/zlib-1.3.1/zconf.h +543 -0
- data/ext/zstdlib_c/zlib-1.3.1/zlib.h +1938 -0
- data/ext/zstdlib_c/zlib-1.3.1/zutil.c +299 -0
- data/ext/zstdlib_c/zlib-1.3.1/zutil.h +254 -0
- data/ext/zstdlib_c/zlib.mk +14 -0
- data/ext/zstdlib_c/zlibwrapper/zlibwrapper.c +10 -0
- data/ext/zstdlib_c/zlibwrapper.mk +14 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/allocations.h +55 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/bits.h +200 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/bitstream.h +457 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/compiler.h +450 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/cpu.h +249 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/debug.c +30 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/debug.h +116 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/entropy_common.c +340 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/error_private.c +63 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/error_private.h +168 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/fse.h +640 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/fse_decompress.c +313 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/huf.h +286 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/mem.h +426 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/pool.c +371 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/pool.h +90 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/portability_macros.h +158 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/threading.c +182 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/threading.h +150 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/xxhash.c +18 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/xxhash.h +7020 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/zstd_common.c +48 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/zstd_deps.h +111 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/zstd_internal.h +392 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/common/zstd_trace.h +163 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/clevels.h +134 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/fse_compress.c +625 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/hist.c +181 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/hist.h +75 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/huf_compress.c +1464 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_compress.c +7153 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_compress_internal.h +1534 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_compress_literals.c +235 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_compress_literals.h +39 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_compress_sequences.c +442 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_compress_sequences.h +54 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_compress_superblock.c +688 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_compress_superblock.h +32 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_cwksp.h +748 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_double_fast.c +770 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_double_fast.h +50 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_fast.c +968 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_fast.h +38 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_lazy.c +2199 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_lazy.h +202 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_ldm.c +730 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_ldm.h +117 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_ldm_geartab.h +106 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_opt.c +1576 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstd_opt.h +80 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstdmt_compress.c +1882 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/compress/zstdmt_compress.h +113 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/decompress/huf_decompress.c +1944 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/decompress/huf_decompress_amd64.S +595 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/decompress/zstd_ddict.c +244 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/decompress/zstd_ddict.h +44 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/decompress/zstd_decompress.c +2407 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/decompress/zstd_decompress_block.c +2215 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/decompress/zstd_decompress_block.h +73 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/decompress/zstd_decompress_internal.h +240 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/zdict.h +474 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/zstd.h +3089 -0
- data/ext/zstdlib_c/zstd-1.5.6/lib/zstd_errors.h +114 -0
- data/ext/zstdlib_c/zstd-1.5.6/zlibWrapper/gzclose.c +26 -0
- data/ext/zstdlib_c/zstd-1.5.6/zlibWrapper/gzcompatibility.h +68 -0
- data/ext/zstdlib_c/zstd-1.5.6/zlibWrapper/gzguts.h +229 -0
- data/ext/zstdlib_c/zstd-1.5.6/zlibWrapper/gzlib.c +587 -0
- data/ext/zstdlib_c/zstd-1.5.6/zlibWrapper/gzread.c +637 -0
- data/ext/zstdlib_c/zstd-1.5.6/zlibWrapper/gzwrite.c +631 -0
- data/ext/zstdlib_c/zstd-1.5.6/zlibWrapper/zstd_zlibwrapper.c +1200 -0
- data/ext/zstdlib_c/zstd-1.5.6/zlibWrapper/zstd_zlibwrapper.h +91 -0
- data/ext/zstdlib_c/zstd.mk +15 -0
- data/lib/2.4/zstdlib_c.so +0 -0
- data/lib/2.5/zstdlib_c.so +0 -0
- data/lib/2.6/zstdlib_c.so +0 -0
- data/lib/2.7/zstdlib_c.so +0 -0
- data/lib/3.0/zstdlib_c.so +0 -0
- data/lib/3.1/zstdlib_c.so +0 -0
- data/lib/3.2/zstdlib_c.so +0 -0
- data/lib/3.3/zstdlib_c.so +0 -0
- data/lib/zstdlib.rb +6 -0
- data/test/zstdlib_test.rb +21 -0
- metadata +243 -0
@@ -0,0 +1,168 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
|
+
* All rights reserved.
|
4
|
+
*
|
5
|
+
* This source code is licensed under both the BSD-style license (found in the
|
6
|
+
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
7
|
+
* in the COPYING file in the root directory of this source tree).
|
8
|
+
* You may select, at your option, one of the above-listed licenses.
|
9
|
+
*/
|
10
|
+
|
11
|
+
/* Note : this module is expected to remain private, do not expose it */
|
12
|
+
|
13
|
+
#ifndef ERROR_H_MODULE
|
14
|
+
#define ERROR_H_MODULE
|
15
|
+
|
16
|
+
#if defined (__cplusplus)
|
17
|
+
extern "C" {
|
18
|
+
#endif
|
19
|
+
|
20
|
+
|
21
|
+
/* ****************************************
|
22
|
+
* Dependencies
|
23
|
+
******************************************/
|
24
|
+
#include "../zstd_errors.h" /* enum list */
|
25
|
+
#include "compiler.h"
|
26
|
+
#include "debug.h"
|
27
|
+
#include "zstd_deps.h" /* size_t */
|
28
|
+
|
29
|
+
|
30
|
+
/* ****************************************
|
31
|
+
* Compiler-specific
|
32
|
+
******************************************/
|
33
|
+
#if defined(__GNUC__)
|
34
|
+
# define ERR_STATIC static __attribute__((unused))
|
35
|
+
#elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
|
36
|
+
# define ERR_STATIC static inline
|
37
|
+
#elif defined(_MSC_VER)
|
38
|
+
# define ERR_STATIC static __inline
|
39
|
+
#else
|
40
|
+
# define ERR_STATIC static /* this version may generate warnings for unused static functions; disable the relevant warning */
|
41
|
+
#endif
|
42
|
+
|
43
|
+
|
44
|
+
/*-****************************************
|
45
|
+
* Customization (error_public.h)
|
46
|
+
******************************************/
|
47
|
+
typedef ZSTD_ErrorCode ERR_enum;
|
48
|
+
#define PREFIX(name) ZSTD_error_##name
|
49
|
+
|
50
|
+
|
51
|
+
/*-****************************************
|
52
|
+
* Error codes handling
|
53
|
+
******************************************/
|
54
|
+
#undef ERROR /* already defined on Visual Studio */
|
55
|
+
#define ERROR(name) ZSTD_ERROR(name)
|
56
|
+
#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
|
57
|
+
|
58
|
+
ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
|
59
|
+
|
60
|
+
ERR_STATIC ERR_enum ERR_getErrorCode(size_t code) { if (!ERR_isError(code)) return (ERR_enum)0; return (ERR_enum) (0-code); }
|
61
|
+
|
62
|
+
/* check and forward error code */
|
63
|
+
#define CHECK_V_F(e, f) \
|
64
|
+
size_t const e = f; \
|
65
|
+
do { \
|
66
|
+
if (ERR_isError(e)) \
|
67
|
+
return e; \
|
68
|
+
} while (0)
|
69
|
+
#define CHECK_F(f) do { CHECK_V_F(_var_err__, f); } while (0)
|
70
|
+
|
71
|
+
|
72
|
+
/*-****************************************
|
73
|
+
* Error Strings
|
74
|
+
******************************************/
|
75
|
+
|
76
|
+
const char* ERR_getErrorString(ERR_enum code); /* error_private.c */
|
77
|
+
|
78
|
+
ERR_STATIC const char* ERR_getErrorName(size_t code)
|
79
|
+
{
|
80
|
+
return ERR_getErrorString(ERR_getErrorCode(code));
|
81
|
+
}
|
82
|
+
|
83
|
+
/**
|
84
|
+
* Ignore: this is an internal helper.
|
85
|
+
*
|
86
|
+
* This is a helper function to help force C99-correctness during compilation.
|
87
|
+
* Under strict compilation modes, variadic macro arguments can't be empty.
|
88
|
+
* However, variadic function arguments can be. Using a function therefore lets
|
89
|
+
* us statically check that at least one (string) argument was passed,
|
90
|
+
* independent of the compilation flags.
|
91
|
+
*/
|
92
|
+
static INLINE_KEYWORD UNUSED_ATTR
|
93
|
+
void _force_has_format_string(const char *format, ...) {
|
94
|
+
(void)format;
|
95
|
+
}
|
96
|
+
|
97
|
+
/**
|
98
|
+
* Ignore: this is an internal helper.
|
99
|
+
*
|
100
|
+
* We want to force this function invocation to be syntactically correct, but
|
101
|
+
* we don't want to force runtime evaluation of its arguments.
|
102
|
+
*/
|
103
|
+
#define _FORCE_HAS_FORMAT_STRING(...) \
|
104
|
+
do { \
|
105
|
+
if (0) { \
|
106
|
+
_force_has_format_string(__VA_ARGS__); \
|
107
|
+
} \
|
108
|
+
} while (0)
|
109
|
+
|
110
|
+
#define ERR_QUOTE(str) #str
|
111
|
+
|
112
|
+
/**
|
113
|
+
* Return the specified error if the condition evaluates to true.
|
114
|
+
*
|
115
|
+
* In debug modes, prints additional information.
|
116
|
+
* In order to do that (particularly, printing the conditional that failed),
|
117
|
+
* this can't just wrap RETURN_ERROR().
|
118
|
+
*/
|
119
|
+
#define RETURN_ERROR_IF(cond, err, ...) \
|
120
|
+
do { \
|
121
|
+
if (cond) { \
|
122
|
+
RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s", \
|
123
|
+
__FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
|
124
|
+
_FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \
|
125
|
+
RAWLOG(3, ": " __VA_ARGS__); \
|
126
|
+
RAWLOG(3, "\n"); \
|
127
|
+
return ERROR(err); \
|
128
|
+
} \
|
129
|
+
} while (0)
|
130
|
+
|
131
|
+
/**
|
132
|
+
* Unconditionally return the specified error.
|
133
|
+
*
|
134
|
+
* In debug modes, prints additional information.
|
135
|
+
*/
|
136
|
+
#define RETURN_ERROR(err, ...) \
|
137
|
+
do { \
|
138
|
+
RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \
|
139
|
+
__FILE__, __LINE__, ERR_QUOTE(ERROR(err))); \
|
140
|
+
_FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \
|
141
|
+
RAWLOG(3, ": " __VA_ARGS__); \
|
142
|
+
RAWLOG(3, "\n"); \
|
143
|
+
return ERROR(err); \
|
144
|
+
} while(0)
|
145
|
+
|
146
|
+
/**
|
147
|
+
* If the provided expression evaluates to an error code, returns that error code.
|
148
|
+
*
|
149
|
+
* In debug modes, prints additional information.
|
150
|
+
*/
|
151
|
+
#define FORWARD_IF_ERROR(err, ...) \
|
152
|
+
do { \
|
153
|
+
size_t const err_code = (err); \
|
154
|
+
if (ERR_isError(err_code)) { \
|
155
|
+
RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s", \
|
156
|
+
__FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
|
157
|
+
_FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \
|
158
|
+
RAWLOG(3, ": " __VA_ARGS__); \
|
159
|
+
RAWLOG(3, "\n"); \
|
160
|
+
return err_code; \
|
161
|
+
} \
|
162
|
+
} while(0)
|
163
|
+
|
164
|
+
#if defined (__cplusplus)
|
165
|
+
}
|
166
|
+
#endif
|
167
|
+
|
168
|
+
#endif /* ERROR_H_MODULE */
|