isomorfeus-ferret 0.12.6 → 0.12.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -4
- data/ext/isomorfeus_ferret_ext/brotli_common_constants.c +15 -0
- data/ext/isomorfeus_ferret_ext/brotli_common_constants.h +200 -0
- data/ext/isomorfeus_ferret_ext/brotli_common_context.c +156 -0
- data/ext/isomorfeus_ferret_ext/brotli_common_context.h +113 -0
- data/ext/isomorfeus_ferret_ext/brotli_common_dictionary.c +5914 -0
- data/ext/isomorfeus_ferret_ext/brotli_common_dictionary.h +64 -0
- data/ext/isomorfeus_ferret_ext/brotli_common_platform.c +22 -0
- data/ext/isomorfeus_ferret_ext/brotli_common_platform.h +594 -0
- data/ext/isomorfeus_ferret_ext/brotli_common_transform.c +291 -0
- data/ext/isomorfeus_ferret_ext/brotli_common_transform.h +85 -0
- data/ext/isomorfeus_ferret_ext/brotli_common_version.h +26 -0
- data/ext/isomorfeus_ferret_ext/brotli_dec_bit_reader.c +76 -0
- data/ext/isomorfeus_ferret_ext/brotli_dec_bit_reader.h +351 -0
- data/ext/isomorfeus_ferret_ext/brotli_dec_decode.c +2608 -0
- data/ext/isomorfeus_ferret_ext/brotli_dec_huffman.c +339 -0
- data/ext/isomorfeus_ferret_ext/brotli_dec_huffman.h +121 -0
- data/ext/isomorfeus_ferret_ext/brotli_dec_prefix.h +732 -0
- data/ext/isomorfeus_ferret_ext/brotli_dec_state.c +159 -0
- data/ext/isomorfeus_ferret_ext/brotli_dec_state.h +365 -0
- data/ext/isomorfeus_ferret_ext/brotli_decode.h +344 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_backward_references.c +145 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_backward_references.h +39 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_backward_references_hq.c +843 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_backward_references_hq.h +95 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_backward_references_inc.h +163 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_bit_cost.c +35 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_bit_cost.h +63 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_bit_cost_inc.h +127 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_block_encoder_inc.h +34 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_block_splitter.c +194 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_block_splitter.h +51 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_block_splitter_inc.h +440 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_brotli_bit_stream.c +1314 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_brotli_bit_stream.h +84 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_cluster.c +56 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_cluster.h +48 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_cluster_inc.h +320 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_command.c +28 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_command.h +190 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_compress_fragment.c +790 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_compress_fragment.h +61 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_compress_fragment_two_pass.c +645 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_compress_fragment_two_pass.h +54 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_dictionary_hash.c +1846 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_dictionary_hash.h +25 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_encode.c +1927 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_encoder_dict.c +33 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_encoder_dict.h +43 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_entropy_encode.c +503 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_entropy_encode.h +122 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_entropy_encode_static.h +539 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_fast_log.c +105 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_fast_log.h +66 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_find_match_length.h +79 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_hash.h +488 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_hash_composite_inc.h +125 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_hash_forgetful_chain_inc.h +293 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_hash_longest_match64_inc.h +267 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_hash_longest_match_inc.h +262 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_hash_longest_match_quickly_inc.h +266 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_hash_rolling_inc.h +212 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_hash_to_binary_tree_inc.h +329 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_histogram.c +100 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_histogram.h +63 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_histogram_inc.h +51 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_literal_cost.c +175 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_literal_cost.h +30 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_memory.c +170 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_memory.h +114 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_metablock.c +663 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_metablock.h +105 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_metablock_inc.h +183 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_params.h +46 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_prefix.h +53 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_quality.h +165 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_ringbuffer.h +167 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_static_dict.c +486 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_static_dict.h +40 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_static_dict_lut.h +5864 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_utf8_util.c +85 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_utf8_util.h +32 -0
- data/ext/isomorfeus_ferret_ext/brotli_enc_write_bits.h +87 -0
- data/ext/isomorfeus_ferret_ext/brotli_encode.h +448 -0
- data/ext/isomorfeus_ferret_ext/brotli_port.h +288 -0
- data/ext/isomorfeus_ferret_ext/brotli_types.h +83 -0
- data/ext/isomorfeus_ferret_ext/frb_index.c +35 -4
- data/ext/isomorfeus_ferret_ext/frt_document.h +1 -0
- data/ext/isomorfeus_ferret_ext/frt_fs_store.c +1 -0
- data/ext/isomorfeus_ferret_ext/frt_index.c +174 -25
- data/ext/isomorfeus_ferret_ext/frt_index.h +6 -3
- data/ext/isomorfeus_ferret_ext/frt_ram_store.c +1 -0
- data/ext/isomorfeus_ferret_ext/test_fields.c +57 -45
- data/ext/isomorfeus_ferret_ext/test_index.c +4 -1
- data/lib/isomorfeus/ferret/version.rb +1 -1
- metadata +88 -3
@@ -0,0 +1,288 @@
|
|
1
|
+
/* Copyright 2016 Google Inc. All Rights Reserved.
|
2
|
+
|
3
|
+
Distributed under MIT license.
|
4
|
+
See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
|
5
|
+
*/
|
6
|
+
|
7
|
+
/* Macros for compiler / platform specific API declarations. */
|
8
|
+
|
9
|
+
#ifndef BROTLI_COMMON_PORT_H_
|
10
|
+
#define BROTLI_COMMON_PORT_H_
|
11
|
+
|
12
|
+
/* The following macros were borrowed from https://github.com/nemequ/hedley
|
13
|
+
* with permission of original author - Evan Nemerson <evan@nemerson.com> */
|
14
|
+
|
15
|
+
/* >>> >>> >>> hedley macros */
|
16
|
+
|
17
|
+
#define BROTLI_MAKE_VERSION(major, minor, revision) \
|
18
|
+
(((major) * 1000000) + ((minor) * 1000) + (revision))
|
19
|
+
|
20
|
+
#if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__)
|
21
|
+
#define BROTLI_GNUC_VERSION \
|
22
|
+
BROTLI_MAKE_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
|
23
|
+
#elif defined(__GNUC__)
|
24
|
+
#define BROTLI_GNUC_VERSION BROTLI_MAKE_VERSION(__GNUC__, __GNUC_MINOR__, 0)
|
25
|
+
#endif
|
26
|
+
|
27
|
+
#if defined(BROTLI_GNUC_VERSION)
|
28
|
+
#define BROTLI_GNUC_VERSION_CHECK(major, minor, patch) \
|
29
|
+
(BROTLI_GNUC_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
|
30
|
+
#else
|
31
|
+
#define BROTLI_GNUC_VERSION_CHECK(major, minor, patch) (0)
|
32
|
+
#endif
|
33
|
+
|
34
|
+
#if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000)
|
35
|
+
#define BROTLI_MSVC_VERSION \
|
36
|
+
BROTLI_MAKE_VERSION((_MSC_FULL_VER / 10000000), \
|
37
|
+
(_MSC_FULL_VER % 10000000) / 100000, \
|
38
|
+
(_MSC_FULL_VER % 100000) / 100)
|
39
|
+
#elif defined(_MSC_FULL_VER)
|
40
|
+
#define BROTLI_MSVC_VERSION \
|
41
|
+
BROTLI_MAKE_VERSION((_MSC_FULL_VER / 1000000), \
|
42
|
+
(_MSC_FULL_VER % 1000000) / 10000, \
|
43
|
+
(_MSC_FULL_VER % 10000) / 10)
|
44
|
+
#elif defined(_MSC_VER)
|
45
|
+
#define BROTLI_MSVC_VERSION \
|
46
|
+
BROTLI_MAKE_VERSION(_MSC_VER / 100, _MSC_VER % 100, 0)
|
47
|
+
#endif
|
48
|
+
|
49
|
+
#if !defined(_MSC_VER)
|
50
|
+
#define BROTLI_MSVC_VERSION_CHECK(major, minor, patch) (0)
|
51
|
+
#elif defined(_MSC_VER) && (_MSC_VER >= 1400)
|
52
|
+
#define BROTLI_MSVC_VERSION_CHECK(major, minor, patch) \
|
53
|
+
(_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch)))
|
54
|
+
#elif defined(_MSC_VER) && (_MSC_VER >= 1200)
|
55
|
+
#define BROTLI_MSVC_VERSION_CHECK(major, minor, patch) \
|
56
|
+
(_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch)))
|
57
|
+
#else
|
58
|
+
#define BROTLI_MSVC_VERSION_CHECK(major, minor, patch) \
|
59
|
+
(_MSC_VER >= ((major * 100) + (minor)))
|
60
|
+
#endif
|
61
|
+
|
62
|
+
#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE)
|
63
|
+
#define BROTLI_INTEL_VERSION \
|
64
|
+
BROTLI_MAKE_VERSION(__INTEL_COMPILER / 100, \
|
65
|
+
__INTEL_COMPILER % 100, \
|
66
|
+
__INTEL_COMPILER_UPDATE)
|
67
|
+
#elif defined(__INTEL_COMPILER)
|
68
|
+
#define BROTLI_INTEL_VERSION \
|
69
|
+
BROTLI_MAKE_VERSION(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0)
|
70
|
+
#endif
|
71
|
+
|
72
|
+
#if defined(BROTLI_INTEL_VERSION)
|
73
|
+
#define BROTLI_INTEL_VERSION_CHECK(major, minor, patch) \
|
74
|
+
(BROTLI_INTEL_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
|
75
|
+
#else
|
76
|
+
#define BROTLI_INTEL_VERSION_CHECK(major, minor, patch) (0)
|
77
|
+
#endif
|
78
|
+
|
79
|
+
#if defined(__PGI) && \
|
80
|
+
defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__)
|
81
|
+
#define BROTLI_PGI_VERSION \
|
82
|
+
BROTLI_MAKE_VERSION(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__)
|
83
|
+
#endif
|
84
|
+
|
85
|
+
#if defined(BROTLI_PGI_VERSION)
|
86
|
+
#define BROTLI_PGI_VERSION_CHECK(major, minor, patch) \
|
87
|
+
(BROTLI_PGI_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
|
88
|
+
#else
|
89
|
+
#define BROTLI_PGI_VERSION_CHECK(major, minor, patch) (0)
|
90
|
+
#endif
|
91
|
+
|
92
|
+
#if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000)
|
93
|
+
#define BROTLI_SUNPRO_VERSION \
|
94
|
+
BROTLI_MAKE_VERSION( \
|
95
|
+
(((__SUNPRO_C >> 16) & 0xf) * 10) + ((__SUNPRO_C >> 12) & 0xf), \
|
96
|
+
(((__SUNPRO_C >> 8) & 0xf) * 10) + ((__SUNPRO_C >> 4) & 0xf), \
|
97
|
+
(__SUNPRO_C & 0xf) * 10)
|
98
|
+
#elif defined(__SUNPRO_C)
|
99
|
+
#define BROTLI_SUNPRO_VERSION \
|
100
|
+
BROTLI_MAKE_VERSION((__SUNPRO_C >> 8) & 0xf, \
|
101
|
+
(__SUNPRO_C >> 4) & 0xf, \
|
102
|
+
(__SUNPRO_C) & 0xf)
|
103
|
+
#elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000)
|
104
|
+
#define BROTLI_SUNPRO_VERSION \
|
105
|
+
BROTLI_MAKE_VERSION( \
|
106
|
+
(((__SUNPRO_CC >> 16) & 0xf) * 10) + ((__SUNPRO_CC >> 12) & 0xf), \
|
107
|
+
(((__SUNPRO_CC >> 8) & 0xf) * 10) + ((__SUNPRO_CC >> 4) & 0xf), \
|
108
|
+
(__SUNPRO_CC & 0xf) * 10)
|
109
|
+
#elif defined(__SUNPRO_CC)
|
110
|
+
#define BROTLI_SUNPRO_VERSION \
|
111
|
+
BROTLI_MAKE_VERSION((__SUNPRO_CC >> 8) & 0xf, \
|
112
|
+
(__SUNPRO_CC >> 4) & 0xf, \
|
113
|
+
(__SUNPRO_CC) & 0xf)
|
114
|
+
#endif
|
115
|
+
|
116
|
+
#if defined(BROTLI_SUNPRO_VERSION)
|
117
|
+
#define BROTLI_SUNPRO_VERSION_CHECK(major, minor, patch) \
|
118
|
+
(BROTLI_SUNPRO_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
|
119
|
+
#else
|
120
|
+
#define BROTLI_SUNPRO_VERSION_CHECK(major, minor, patch) (0)
|
121
|
+
#endif
|
122
|
+
|
123
|
+
#if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION)
|
124
|
+
#define BROTLI_ARM_VERSION \
|
125
|
+
BROTLI_MAKE_VERSION((__ARMCOMPILER_VERSION / 1000000), \
|
126
|
+
(__ARMCOMPILER_VERSION % 1000000) / 10000, \
|
127
|
+
(__ARMCOMPILER_VERSION % 10000) / 100)
|
128
|
+
#elif defined(__CC_ARM) && defined(__ARMCC_VERSION)
|
129
|
+
#define BROTLI_ARM_VERSION \
|
130
|
+
BROTLI_MAKE_VERSION((__ARMCC_VERSION / 1000000), \
|
131
|
+
(__ARMCC_VERSION % 1000000) / 10000, \
|
132
|
+
(__ARMCC_VERSION % 10000) / 100)
|
133
|
+
#endif
|
134
|
+
|
135
|
+
#if defined(BROTLI_ARM_VERSION)
|
136
|
+
#define BROTLI_ARM_VERSION_CHECK(major, minor, patch) \
|
137
|
+
(BROTLI_ARM_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
|
138
|
+
#else
|
139
|
+
#define BROTLI_ARM_VERSION_CHECK(major, minor, patch) (0)
|
140
|
+
#endif
|
141
|
+
|
142
|
+
#if defined(__ibmxl__)
|
143
|
+
#define BROTLI_IBM_VERSION \
|
144
|
+
BROTLI_MAKE_VERSION(__ibmxl_version__, \
|
145
|
+
__ibmxl_release__, \
|
146
|
+
__ibmxl_modification__)
|
147
|
+
#elif defined(__xlC__) && defined(__xlC_ver__)
|
148
|
+
#define BROTLI_IBM_VERSION \
|
149
|
+
BROTLI_MAKE_VERSION(__xlC__ >> 8, __xlC__ & 0xff, (__xlC_ver__ >> 8) & 0xff)
|
150
|
+
#elif defined(__xlC__)
|
151
|
+
#define BROTLI_IBM_VERSION BROTLI_MAKE_VERSION(__xlC__ >> 8, __xlC__ & 0xff, 0)
|
152
|
+
#endif
|
153
|
+
|
154
|
+
#if defined(BROTLI_IBM_VERSION)
|
155
|
+
#define BROTLI_IBM_VERSION_CHECK(major, minor, patch) \
|
156
|
+
(BROTLI_IBM_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
|
157
|
+
#else
|
158
|
+
#define BROTLI_IBM_VERSION_CHECK(major, minor, patch) (0)
|
159
|
+
#endif
|
160
|
+
|
161
|
+
#if defined(__TI_COMPILER_VERSION__)
|
162
|
+
#define BROTLI_TI_VERSION \
|
163
|
+
BROTLI_MAKE_VERSION((__TI_COMPILER_VERSION__ / 1000000), \
|
164
|
+
(__TI_COMPILER_VERSION__ % 1000000) / 1000, \
|
165
|
+
(__TI_COMPILER_VERSION__ % 1000))
|
166
|
+
#endif
|
167
|
+
|
168
|
+
#if defined(BROTLI_TI_VERSION)
|
169
|
+
#define BROTLI_TI_VERSION_CHECK(major, minor, patch) \
|
170
|
+
(BROTLI_TI_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
|
171
|
+
#else
|
172
|
+
#define BROTLI_TI_VERSION_CHECK(major, minor, patch) (0)
|
173
|
+
#endif
|
174
|
+
|
175
|
+
#if defined(__IAR_SYSTEMS_ICC__)
|
176
|
+
#if __VER__ > 1000
|
177
|
+
#define BROTLI_IAR_VERSION \
|
178
|
+
BROTLI_MAKE_VERSION((__VER__ / 1000000), \
|
179
|
+
(__VER__ / 1000) % 1000, \
|
180
|
+
(__VER__ % 1000))
|
181
|
+
#else
|
182
|
+
#define BROTLI_IAR_VERSION BROTLI_MAKE_VERSION(VER / 100, __VER__ % 100, 0)
|
183
|
+
#endif
|
184
|
+
#endif
|
185
|
+
|
186
|
+
#if defined(BROTLI_IAR_VERSION)
|
187
|
+
#define BROTLI_IAR_VERSION_CHECK(major, minor, patch) \
|
188
|
+
(BROTLI_IAR_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
|
189
|
+
#else
|
190
|
+
#define BROTLI_IAR_VERSION_CHECK(major, minor, patch) (0)
|
191
|
+
#endif
|
192
|
+
|
193
|
+
#if defined(__TINYC__)
|
194
|
+
#define BROTLI_TINYC_VERSION \
|
195
|
+
BROTLI_MAKE_VERSION(__TINYC__ / 1000, (__TINYC__ / 100) % 10, __TINYC__ % 100)
|
196
|
+
#endif
|
197
|
+
|
198
|
+
#if defined(BROTLI_TINYC_VERSION)
|
199
|
+
#define BROTLI_TINYC_VERSION_CHECK(major, minor, patch) \
|
200
|
+
(BROTLI_TINYC_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
|
201
|
+
#else
|
202
|
+
#define BROTLI_TINYC_VERSION_CHECK(major, minor, patch) (0)
|
203
|
+
#endif
|
204
|
+
|
205
|
+
#if defined(__has_attribute)
|
206
|
+
#define BROTLI_GNUC_HAS_ATTRIBUTE(attribute, major, minor, patch) \
|
207
|
+
__has_attribute(attribute)
|
208
|
+
#else
|
209
|
+
#define BROTLI_GNUC_HAS_ATTRIBUTE(attribute, major, minor, patch) \
|
210
|
+
BROTLI_GNUC_VERSION_CHECK(major, minor, patch)
|
211
|
+
#endif
|
212
|
+
|
213
|
+
#if defined(__has_builtin)
|
214
|
+
#define BROTLI_GNUC_HAS_BUILTIN(builtin, major, minor, patch) \
|
215
|
+
__has_builtin(builtin)
|
216
|
+
#else
|
217
|
+
#define BROTLI_GNUC_HAS_BUILTIN(builtin, major, minor, patch) \
|
218
|
+
BROTLI_GNUC_VERSION_CHECK(major, minor, patch)
|
219
|
+
#endif
|
220
|
+
|
221
|
+
#if defined(__has_feature)
|
222
|
+
#define BROTLI_HAS_FEATURE(feature) __has_feature(feature)
|
223
|
+
#else
|
224
|
+
#define BROTLI_HAS_FEATURE(feature) (0)
|
225
|
+
#endif
|
226
|
+
|
227
|
+
#if defined(ADDRESS_SANITIZER) || BROTLI_HAS_FEATURE(address_sanitizer) || \
|
228
|
+
defined(THREAD_SANITIZER) || BROTLI_HAS_FEATURE(thread_sanitizer) || \
|
229
|
+
defined(MEMORY_SANITIZER) || BROTLI_HAS_FEATURE(memory_sanitizer)
|
230
|
+
#define BROTLI_SANITIZED 1
|
231
|
+
#else
|
232
|
+
#define BROTLI_SANITIZED 0
|
233
|
+
#endif
|
234
|
+
|
235
|
+
#if defined(_WIN32) || defined(__CYGWIN__)
|
236
|
+
#define BROTLI_PUBLIC
|
237
|
+
#elif BROTLI_GNUC_VERSION_CHECK(3, 3, 0) || \
|
238
|
+
BROTLI_TI_VERSION_CHECK(8, 0, 0) || \
|
239
|
+
BROTLI_INTEL_VERSION_CHECK(16, 0, 0) || \
|
240
|
+
BROTLI_ARM_VERSION_CHECK(4, 1, 0) || \
|
241
|
+
BROTLI_IBM_VERSION_CHECK(13, 1, 0) || \
|
242
|
+
BROTLI_SUNPRO_VERSION_CHECK(5, 11, 0) || \
|
243
|
+
(BROTLI_TI_VERSION_CHECK(7, 3, 0) && \
|
244
|
+
defined(__TI_GNU_ATTRIBUTE_SUPPORT__) && defined(__TI_EABI__))
|
245
|
+
#define BROTLI_PUBLIC __attribute__ ((visibility ("default")))
|
246
|
+
#else
|
247
|
+
#define BROTLI_PUBLIC
|
248
|
+
#endif
|
249
|
+
|
250
|
+
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \
|
251
|
+
!defined(__STDC_NO_VLA__) && !defined(__cplusplus) && \
|
252
|
+
!defined(__PGI) && !defined(__PGIC__) && !defined(__TINYC__)
|
253
|
+
#define BROTLI_ARRAY_PARAM(name) (name)
|
254
|
+
#else
|
255
|
+
#define BROTLI_ARRAY_PARAM(name)
|
256
|
+
#endif
|
257
|
+
|
258
|
+
/* <<< <<< <<< end of hedley macros. */
|
259
|
+
|
260
|
+
#if defined(BROTLI_SHARED_COMPILATION)
|
261
|
+
#if defined(_WIN32)
|
262
|
+
#if defined(BROTLICOMMON_SHARED_COMPILATION)
|
263
|
+
#define BROTLI_COMMON_API __declspec(dllexport)
|
264
|
+
#else
|
265
|
+
#define BROTLI_COMMON_API __declspec(dllimport)
|
266
|
+
#endif /* BROTLICOMMON_SHARED_COMPILATION */
|
267
|
+
#if defined(BROTLIDEC_SHARED_COMPILATION)
|
268
|
+
#define BROTLI_DEC_API __declspec(dllexport)
|
269
|
+
#else
|
270
|
+
#define BROTLI_DEC_API __declspec(dllimport)
|
271
|
+
#endif /* BROTLIDEC_SHARED_COMPILATION */
|
272
|
+
#if defined(BROTLIENC_SHARED_COMPILATION)
|
273
|
+
#define BROTLI_ENC_API __declspec(dllexport)
|
274
|
+
#else
|
275
|
+
#define BROTLI_ENC_API __declspec(dllimport)
|
276
|
+
#endif /* BROTLIENC_SHARED_COMPILATION */
|
277
|
+
#else /* _WIN32 */
|
278
|
+
#define BROTLI_COMMON_API BROTLI_PUBLIC
|
279
|
+
#define BROTLI_DEC_API BROTLI_PUBLIC
|
280
|
+
#define BROTLI_ENC_API BROTLI_PUBLIC
|
281
|
+
#endif /* _WIN32 */
|
282
|
+
#else /* BROTLI_SHARED_COMPILATION */
|
283
|
+
#define BROTLI_COMMON_API
|
284
|
+
#define BROTLI_DEC_API
|
285
|
+
#define BROTLI_ENC_API
|
286
|
+
#endif
|
287
|
+
|
288
|
+
#endif /* BROTLI_COMMON_PORT_H_ */
|
@@ -0,0 +1,83 @@
|
|
1
|
+
/* Copyright 2013 Google Inc. All Rights Reserved.
|
2
|
+
|
3
|
+
Distributed under MIT license.
|
4
|
+
See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
|
5
|
+
*/
|
6
|
+
|
7
|
+
/**
|
8
|
+
* @file
|
9
|
+
* Common types used in decoder and encoder API.
|
10
|
+
*/
|
11
|
+
|
12
|
+
#ifndef BROTLI_COMMON_TYPES_H_
|
13
|
+
#define BROTLI_COMMON_TYPES_H_
|
14
|
+
|
15
|
+
#include <stddef.h> /* for size_t */
|
16
|
+
|
17
|
+
#if defined(_MSC_VER) && (_MSC_VER < 1600)
|
18
|
+
typedef __int8 int8_t;
|
19
|
+
typedef unsigned __int8 uint8_t;
|
20
|
+
typedef __int16 int16_t;
|
21
|
+
typedef unsigned __int16 uint16_t;
|
22
|
+
typedef __int32 int32_t;
|
23
|
+
typedef unsigned __int32 uint32_t;
|
24
|
+
typedef unsigned __int64 uint64_t;
|
25
|
+
typedef __int64 int64_t;
|
26
|
+
#else
|
27
|
+
#include <stdint.h>
|
28
|
+
#endif /* defined(_MSC_VER) && (_MSC_VER < 1600) */
|
29
|
+
|
30
|
+
/**
|
31
|
+
* A portable @c bool replacement.
|
32
|
+
*
|
33
|
+
* ::BROTLI_BOOL is a "documentation" type: actually it is @c int, but in API it
|
34
|
+
* denotes a type, whose only values are ::BROTLI_TRUE and ::BROTLI_FALSE.
|
35
|
+
*
|
36
|
+
* ::BROTLI_BOOL values passed to Brotli should either be ::BROTLI_TRUE or
|
37
|
+
* ::BROTLI_FALSE, or be a result of ::TO_BROTLI_BOOL macros.
|
38
|
+
*
|
39
|
+
* ::BROTLI_BOOL values returned by Brotli should not be tested for equality
|
40
|
+
* with @c true, @c false, ::BROTLI_TRUE, ::BROTLI_FALSE, but rather should be
|
41
|
+
* evaluated, for example: @code{.cpp}
|
42
|
+
* if (SomeBrotliFunction(encoder, BROTLI_TRUE) &&
|
43
|
+
* !OtherBrotliFunction(decoder, BROTLI_FALSE)) {
|
44
|
+
* bool x = !!YetAnotherBrotliFunction(encoder, TO_BROLTI_BOOL(2 * 2 == 4));
|
45
|
+
* DoSomething(x);
|
46
|
+
* }
|
47
|
+
* @endcode
|
48
|
+
*/
|
49
|
+
#define BROTLI_BOOL int
|
50
|
+
/** Portable @c true replacement. */
|
51
|
+
#define BROTLI_TRUE 1
|
52
|
+
/** Portable @c false replacement. */
|
53
|
+
#define BROTLI_FALSE 0
|
54
|
+
/** @c bool to ::BROTLI_BOOL conversion macros. */
|
55
|
+
#define TO_BROTLI_BOOL(X) (!!(X) ? BROTLI_TRUE : BROTLI_FALSE)
|
56
|
+
|
57
|
+
#define BROTLI_MAKE_UINT64_T(high, low) ((((uint64_t)(high)) << 32) | low)
|
58
|
+
|
59
|
+
#define BROTLI_UINT32_MAX (~((uint32_t)0))
|
60
|
+
#define BROTLI_SIZE_MAX (~((size_t)0))
|
61
|
+
|
62
|
+
/**
|
63
|
+
* Allocating function pointer type.
|
64
|
+
*
|
65
|
+
* @param opaque custom memory manager handle provided by client
|
66
|
+
* @param size requested memory region size; can not be @c 0
|
67
|
+
* @returns @c 0 in the case of failure
|
68
|
+
* @returns a valid pointer to a memory region of at least @p size bytes
|
69
|
+
* long otherwise
|
70
|
+
*/
|
71
|
+
typedef void* (*brotli_alloc_func)(void* opaque, size_t size);
|
72
|
+
|
73
|
+
/**
|
74
|
+
* Deallocating function pointer type.
|
75
|
+
*
|
76
|
+
* This function @b SHOULD do nothing if @p address is @c 0.
|
77
|
+
*
|
78
|
+
* @param opaque custom memory manager handle provided by client
|
79
|
+
* @param address memory region pointer returned by ::brotli_alloc_func, or @c 0
|
80
|
+
*/
|
81
|
+
typedef void (*brotli_free_func)(void* opaque, void* address);
|
82
|
+
|
83
|
+
#endif /* BROTLI_COMMON_TYPES_H_ */
|
@@ -41,6 +41,9 @@ static VALUE sym_store;
|
|
41
41
|
static VALUE sym_index;
|
42
42
|
static VALUE sym_term_vector;
|
43
43
|
|
44
|
+
static VALUE sym_compress;
|
45
|
+
static VALUE sym_compressed;
|
46
|
+
|
44
47
|
static VALUE sym_untokenized;
|
45
48
|
static VALUE sym_omit_norms;
|
46
49
|
static VALUE sym_untokenized_omit_norms;
|
@@ -95,11 +98,13 @@ frb_fi_get_params(VALUE roptions,
|
|
95
98
|
*store = FRT_STORE_NO;
|
96
99
|
} else if (v == sym_yes || v == sym_true || v == Qtrue) {
|
97
100
|
*store = FRT_STORE_YES;
|
101
|
+
} else if (v == sym_compress || v == sym_compressed) {
|
102
|
+
*store = FRT_STORE_COMPRESS;
|
98
103
|
} else if (v == Qnil) {
|
99
104
|
/* leave as default */
|
100
105
|
} else {
|
101
106
|
rb_raise(rb_eArgError, ":%s isn't a valid argument for :store."
|
102
|
-
" Please choose from [:yes, :no]",
|
107
|
+
" Please choose from [:yes, :no, :compressed]",
|
103
108
|
rb_id2name(SYM2ID(v)));
|
104
109
|
}
|
105
110
|
|
@@ -219,6 +224,19 @@ frb_fi_is_stored(VALUE self)
|
|
219
224
|
return fi_is_stored(fi) ? Qtrue : Qfalse;
|
220
225
|
}
|
221
226
|
|
227
|
+
/*
|
228
|
+
* call-seq:
|
229
|
+
* fi.compressed? -> bool
|
230
|
+
*
|
231
|
+
* Return true if the field is stored in the index in compressed format.
|
232
|
+
*/
|
233
|
+
static VALUE
|
234
|
+
frb_fi_is_compressed(VALUE self)
|
235
|
+
{
|
236
|
+
FrtFieldInfo *fi = (FrtFieldInfo *)DATA_PTR(self);
|
237
|
+
return fi_is_compressed(fi) ? Qtrue : Qfalse;
|
238
|
+
}
|
239
|
+
|
222
240
|
/*
|
223
241
|
* call-seq:
|
224
242
|
* fi.indexed? -> bool
|
@@ -2698,7 +2716,7 @@ frb_ir_version(VALUE self)
|
|
2698
2716
|
* == Summary
|
2699
2717
|
*
|
2700
2718
|
* The FieldInfo class is the field descriptor for the index. It specifies
|
2701
|
-
* whether a field should be indexed and
|
2719
|
+
* whether a field is compressed or not or whether it should be indexed and
|
2702
2720
|
* tokenized. Every field has a name which must be a symbol. There are three
|
2703
2721
|
* properties that you can set, +:store+, +:index+ and +:term_vector+. You
|
2704
2722
|
* can also set the default +:boost+ for a field as well.
|
@@ -2708,8 +2726,8 @@ frb_ir_version(VALUE self)
|
|
2708
2726
|
* === :store
|
2709
2727
|
*
|
2710
2728
|
* The +:store+ property allows you to specify how a field is stored. You can
|
2711
|
-
* leave a field unstored (+:no+), store it in it's original format (+:yes+)
|
2712
|
-
* By default the document
|
2729
|
+
* leave a field unstored (+:no+), store it in it's original format (+:yes+)
|
2730
|
+
* or store it in compressed format (+:compressed+). By default the document
|
2713
2731
|
* is stored in its original format. If the field is large and it is stored
|
2714
2732
|
* elsewhere where it is easily accessible you might want to leave it
|
2715
2733
|
* unstored. This will keep the index size a lot smaller and make the
|
@@ -2751,6 +2769,9 @@ frb_ir_version(VALUE self)
|
|
2751
2769
|
* | | want to highlight matches.
|
2752
2770
|
* | | or print match excerpts a la
|
2753
2771
|
* | | Google search.
|
2772
|
+
* | |
|
2773
|
+
* | :compressed | Store field in compressed
|
2774
|
+
* | | format.
|
2754
2775
|
* -------------|-------------------------|------------------------------
|
2755
2776
|
* :index | :no | Do not make this field
|
2756
2777
|
* | | searchable.
|
@@ -2809,6 +2830,9 @@ frb_ir_version(VALUE self)
|
|
2809
2830
|
*
|
2810
2831
|
* fi = FieldInfo.new(:created_on, :index => :untokenized_omit_norms,
|
2811
2832
|
* :term_vector => :no)
|
2833
|
+
*
|
2834
|
+
* fi = FieldInfo.new(:image, :store => :compressed, :index => :no,
|
2835
|
+
* :term_vector => :no)
|
2812
2836
|
*/
|
2813
2837
|
static void
|
2814
2838
|
Init_FieldInfo(void)
|
@@ -2817,6 +2841,9 @@ Init_FieldInfo(void)
|
|
2817
2841
|
sym_index = ID2SYM(rb_intern("index"));
|
2818
2842
|
sym_term_vector = ID2SYM(rb_intern("term_vector"));
|
2819
2843
|
|
2844
|
+
sym_compress = ID2SYM(rb_intern("compress"));
|
2845
|
+
sym_compressed = ID2SYM(rb_intern("compressed"));
|
2846
|
+
|
2820
2847
|
sym_untokenized = ID2SYM(rb_intern("untokenized"));
|
2821
2848
|
sym_omit_norms = ID2SYM(rb_intern("omit_norms"));
|
2822
2849
|
sym_untokenized_omit_norms = ID2SYM(rb_intern("untokenized_omit_norms"));
|
@@ -2831,6 +2858,7 @@ Init_FieldInfo(void)
|
|
2831
2858
|
rb_define_method(cFieldInfo, "initialize", frb_fi_init, -1);
|
2832
2859
|
rb_define_method(cFieldInfo, "name", frb_fi_name, 0);
|
2833
2860
|
rb_define_method(cFieldInfo, "stored?", frb_fi_is_stored, 0);
|
2861
|
+
rb_define_method(cFieldInfo, "compressed?", frb_fi_is_compressed, 0);
|
2834
2862
|
rb_define_method(cFieldInfo, "indexed?", frb_fi_is_indexed, 0);
|
2835
2863
|
rb_define_method(cFieldInfo, "tokenized?", frb_fi_is_tokenized, 0);
|
2836
2864
|
rb_define_method(cFieldInfo, "omit_norms?", frb_fi_omit_norms, 0);
|
@@ -2869,6 +2897,9 @@ Init_FieldInfo(void)
|
|
2869
2897
|
* field_infos.add_field(:created_on, :index => :untokenized_omit_norms,
|
2870
2898
|
* :term_vector => :no)
|
2871
2899
|
*
|
2900
|
+
* field_infos.add_field(:image, :store => :compressed, :index => :no,
|
2901
|
+
* :term_vector => :no)
|
2902
|
+
*
|
2872
2903
|
* field_infos.create_index("/path/to/index")
|
2873
2904
|
*
|
2874
2905
|
* == Default Properties
|
@@ -241,6 +241,7 @@ static off_t fs_length(FrtStore *store, const char *filename)
|
|
241
241
|
|
242
242
|
static void fso_flush_i(FrtOutStream *os, const frt_uchar *src, int len)
|
243
243
|
{
|
244
|
+
if (len == 0) { return; }
|
244
245
|
if (len != write(os->file.fd, src, len)) {
|
245
246
|
FRT_RAISE(FRT_IO_ERROR, "flushing src of length %d, <%s>", len,
|
246
247
|
strerror(errno));
|