snappy 0.3.0-java → 0.5.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +2 -2
- data/.github/workflows/publish.yml +7 -13
- data/Dockerfile +1 -1
- data/Gemfile +1 -0
- data/README.md +20 -1
- data/Rakefile +1 -1
- data/ext/extconf.rb +13 -11
- data/lib/snappy/shim.rb +3 -23
- data/lib/snappy/version.rb +1 -1
- data/lib/snappy/writer.rb +1 -1
- data/lib/snappy_ext.jar +0 -0
- data/snappy.gemspec +1 -0
- data/test/snappy_test.rb +29 -4
- data/vendor/snappy/BUILD.bazel +211 -0
- data/vendor/snappy/CMakeLists.txt +176 -31
- data/vendor/snappy/CONTRIBUTING.md +9 -4
- data/vendor/snappy/MODULE.bazel +23 -0
- data/vendor/snappy/NEWS +27 -0
- data/vendor/snappy/README.md +52 -35
- data/vendor/snappy/WORKSPACE +27 -0
- data/vendor/snappy/WORKSPACE.bzlmod +0 -0
- data/vendor/snappy/cmake/config.h.in +30 -23
- data/vendor/snappy/snappy-internal.h +218 -25
- data/vendor/snappy/snappy-sinksource.cc +26 -9
- data/vendor/snappy/snappy-sinksource.h +11 -11
- data/vendor/snappy/snappy-stubs-internal.cc +1 -1
- data/vendor/snappy/snappy-stubs-internal.h +231 -306
- data/vendor/snappy/snappy-stubs-public.h.in +0 -11
- data/vendor/snappy/snappy-test.cc +88 -198
- data/vendor/snappy/snappy-test.h +102 -285
- data/vendor/snappy/snappy.cc +1412 -425
- data/vendor/snappy/snappy.h +60 -10
- data/vendor/snappy/snappy_benchmark.cc +398 -0
- data/vendor/snappy/snappy_compress_fuzzer.cc +21 -16
- data/vendor/snappy/snappy_test_data.cc +57 -0
- data/vendor/snappy/snappy_test_data.h +68 -0
- data/vendor/snappy/snappy_test_tool.cc +471 -0
- data/vendor/snappy/snappy_uncompress_fuzzer.cc +3 -2
- data/vendor/snappy/snappy_unittest.cc +183 -666
- metadata +13 -8
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
27
27
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28
28
|
|
|
29
|
-
cmake_minimum_required(VERSION 3.
|
|
30
|
-
project(Snappy VERSION 1.
|
|
29
|
+
cmake_minimum_required(VERSION 3.10)
|
|
30
|
+
project(Snappy VERSION 1.2.2 LANGUAGES C CXX)
|
|
31
31
|
|
|
32
32
|
# C++ standard can be overridden when this is used as a sub-project.
|
|
33
33
|
if(NOT CMAKE_CXX_STANDARD)
|
|
@@ -37,12 +37,64 @@ if(NOT CMAKE_CXX_STANDARD)
|
|
|
37
37
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
38
38
|
endif(NOT CMAKE_CXX_STANDARD)
|
|
39
39
|
|
|
40
|
+
# https://github.com/izenecloud/cmake/blob/master/SetCompilerWarningAll.cmake
|
|
41
|
+
if(MSVC)
|
|
42
|
+
# Use the highest warning level for Visual Studio.
|
|
43
|
+
set(CMAKE_CXX_WARNING_LEVEL 4)
|
|
44
|
+
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
|
45
|
+
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
46
|
+
else(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
|
47
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
|
|
48
|
+
endif(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
|
49
|
+
|
|
50
|
+
# Disable C++ exceptions.
|
|
51
|
+
string(REGEX REPLACE "/EH[a-z]+" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
52
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHs-c-")
|
|
53
|
+
add_definitions(-D_HAS_EXCEPTIONS=0)
|
|
54
|
+
|
|
55
|
+
# Disable RTTI.
|
|
56
|
+
string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
57
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
|
|
58
|
+
else(MSVC)
|
|
59
|
+
# Use -Wall for clang and gcc.
|
|
60
|
+
if(NOT CMAKE_CXX_FLAGS MATCHES "-Wall")
|
|
61
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
|
62
|
+
endif(NOT CMAKE_CXX_FLAGS MATCHES "-Wall")
|
|
63
|
+
|
|
64
|
+
# Use -Wextra for clang and gcc.
|
|
65
|
+
if(NOT CMAKE_CXX_FLAGS MATCHES "-Wextra")
|
|
66
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
|
|
67
|
+
endif(NOT CMAKE_CXX_FLAGS MATCHES "-Wextra")
|
|
68
|
+
|
|
69
|
+
# Use -Werror for clang only.
|
|
70
|
+
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
71
|
+
if(NOT CMAKE_CXX_FLAGS MATCHES "-Werror")
|
|
72
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
|
|
73
|
+
endif(NOT CMAKE_CXX_FLAGS MATCHES "-Werror")
|
|
74
|
+
endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
75
|
+
|
|
76
|
+
# Disable sign comparison warnings. Matches upcoming Bazel setup.
|
|
77
|
+
if(NOT CMAKE_CXX_FLAGS MATCHES "-Wno-sign-compare")
|
|
78
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-compare")
|
|
79
|
+
endif(NOT CMAKE_CXX_FLAGS MATCHES "-Wno-sign-compare")
|
|
80
|
+
|
|
81
|
+
# Disable C++ exceptions.
|
|
82
|
+
string(REGEX REPLACE "-fexceptions" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
83
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
|
|
84
|
+
|
|
85
|
+
# Disable RTTI.
|
|
86
|
+
string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
87
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
|
|
88
|
+
endif(MSVC)
|
|
89
|
+
|
|
40
90
|
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make
|
|
41
91
|
# it prominent in the GUI.
|
|
42
92
|
option(BUILD_SHARED_LIBS "Build shared libraries(DLLs)." OFF)
|
|
43
93
|
|
|
44
94
|
option(SNAPPY_BUILD_TESTS "Build Snappy's own tests." ON)
|
|
45
95
|
|
|
96
|
+
option(SNAPPY_BUILD_BENCHMARKS "Build Snappy's benchmarks" ON)
|
|
97
|
+
|
|
46
98
|
option(SNAPPY_FUZZING_BUILD "Build Snappy for fuzzing." OFF)
|
|
47
99
|
|
|
48
100
|
option(SNAPPY_REQUIRE_AVX "Target processors with AVX support." OFF)
|
|
@@ -55,8 +107,6 @@ include(TestBigEndian)
|
|
|
55
107
|
test_big_endian(SNAPPY_IS_BIG_ENDIAN)
|
|
56
108
|
|
|
57
109
|
include(CheckIncludeFile)
|
|
58
|
-
check_include_file("byteswap.h" HAVE_BYTESWAP_H)
|
|
59
|
-
check_include_file("sys/endian.h" HAVE_SYS_ENDIAN_H)
|
|
60
110
|
check_include_file("sys/mman.h" HAVE_SYS_MMAN_H)
|
|
61
111
|
check_include_file("sys/resource.h" HAVE_SYS_RESOURCE_H)
|
|
62
112
|
check_include_file("sys/time.h" HAVE_SYS_TIME_H)
|
|
@@ -67,6 +117,7 @@ check_include_file("windows.h" HAVE_WINDOWS_H)
|
|
|
67
117
|
include(CheckLibraryExists)
|
|
68
118
|
check_library_exists(z zlibVersion "" HAVE_LIBZ)
|
|
69
119
|
check_library_exists(lzo2 lzo1x_1_15_compress "" HAVE_LIBLZO2)
|
|
120
|
+
check_library_exists(lz4 LZ4_compress_default "" HAVE_LIBLZ4)
|
|
70
121
|
|
|
71
122
|
include(CheckCXXCompilerFlag)
|
|
72
123
|
CHECK_CXX_COMPILER_FLAG("/arch:AVX" HAVE_VISUAL_STUDIO_ARCH_AVX)
|
|
@@ -92,6 +143,12 @@ elseif (SNAPPY_REQUIRE_AVX)
|
|
|
92
143
|
endif(HAVE_CLANG_MAVX)
|
|
93
144
|
endif(SNAPPY_REQUIRE_AVX2)
|
|
94
145
|
|
|
146
|
+
# Used by googletest.
|
|
147
|
+
check_cxx_compiler_flag(-Wno-missing-field-initializers
|
|
148
|
+
SNAPPY_HAVE_NO_MISSING_FIELD_INITIALIZERS)
|
|
149
|
+
check_cxx_compiler_flag(-Wno-implicit-int-float-conversion
|
|
150
|
+
SNAPPY_HAVE_NO_IMPLICIT_INT_FLOAT_CONVERSION)
|
|
151
|
+
|
|
95
152
|
include(CheckCXXSourceCompiles)
|
|
96
153
|
check_cxx_source_compiles("
|
|
97
154
|
int main() {
|
|
@@ -103,6 +160,19 @@ int main() {
|
|
|
103
160
|
return __builtin_ctzll(0);
|
|
104
161
|
}" HAVE_BUILTIN_CTZ)
|
|
105
162
|
|
|
163
|
+
check_cxx_source_compiles("
|
|
164
|
+
int main() {
|
|
165
|
+
__builtin_prefetch(0, 0, 3);
|
|
166
|
+
return 0;
|
|
167
|
+
}" HAVE_BUILTIN_PREFETCH)
|
|
168
|
+
|
|
169
|
+
check_cxx_source_compiles("
|
|
170
|
+
__attribute__((always_inline)) int zero() { return 0; }
|
|
171
|
+
|
|
172
|
+
int main() {
|
|
173
|
+
return zero();
|
|
174
|
+
}" HAVE_ATTRIBUTE_ALWAYS_INLINE)
|
|
175
|
+
|
|
106
176
|
check_cxx_source_compiles("
|
|
107
177
|
#include <tmmintrin.h>
|
|
108
178
|
|
|
@@ -115,26 +185,41 @@ int main() {
|
|
|
115
185
|
return 0;
|
|
116
186
|
}" SNAPPY_HAVE_SSSE3)
|
|
117
187
|
|
|
188
|
+
check_cxx_source_compiles("
|
|
189
|
+
#include <immintrin.h>
|
|
190
|
+
int main() {
|
|
191
|
+
return _mm_crc32_u32(0, 1);
|
|
192
|
+
}" SNAPPY_HAVE_X86_CRC32)
|
|
193
|
+
|
|
194
|
+
check_cxx_source_compiles("
|
|
195
|
+
#include <arm_neon.h>
|
|
196
|
+
#include <arm_acle.h>
|
|
197
|
+
int main() {
|
|
198
|
+
return __crc32cw(0, 1);
|
|
199
|
+
}" SNAPPY_HAVE_NEON_CRC32)
|
|
200
|
+
|
|
118
201
|
check_cxx_source_compiles("
|
|
119
202
|
#include <immintrin.h>
|
|
120
203
|
int main() {
|
|
121
204
|
return _bzhi_u32(0, 1);
|
|
122
205
|
}" SNAPPY_HAVE_BMI2)
|
|
123
206
|
|
|
207
|
+
check_cxx_source_compiles("
|
|
208
|
+
#include <arm_neon.h>
|
|
209
|
+
#include <stdint.h>
|
|
210
|
+
int main() {
|
|
211
|
+
uint8_t val = 3, dup[8];
|
|
212
|
+
uint8x16_t v1 = vld1q_dup_u8(&val);
|
|
213
|
+
uint8x16_t v2 = vqtbl1q_u8(v1, v1);
|
|
214
|
+
vst1q_u8(dup, v1);
|
|
215
|
+
vst1q_u8(dup, v2);
|
|
216
|
+
return 0;
|
|
217
|
+
}" SNAPPY_HAVE_NEON)
|
|
218
|
+
|
|
124
219
|
include(CheckSymbolExists)
|
|
125
220
|
check_symbol_exists("mmap" "sys/mman.h" HAVE_FUNC_MMAP)
|
|
126
221
|
check_symbol_exists("sysconf" "unistd.h" HAVE_FUNC_SYSCONF)
|
|
127
222
|
|
|
128
|
-
find_package(GTest QUIET)
|
|
129
|
-
if(GTEST_FOUND)
|
|
130
|
-
set(HAVE_GTEST 1)
|
|
131
|
-
endif(GTEST_FOUND)
|
|
132
|
-
|
|
133
|
-
find_package(Gflags QUIET)
|
|
134
|
-
if(GFLAGS_FOUND)
|
|
135
|
-
set(HAVE_GFLAGS 1)
|
|
136
|
-
endif(GFLAGS_FOUND)
|
|
137
|
-
|
|
138
223
|
configure_file(
|
|
139
224
|
"cmake/config.h.in"
|
|
140
225
|
"${PROJECT_BINARY_DIR}/config.h"
|
|
@@ -176,9 +261,7 @@ target_sources(snappy
|
|
|
176
261
|
"snappy-stubs-internal.cc"
|
|
177
262
|
"snappy.cc"
|
|
178
263
|
"${PROJECT_BINARY_DIR}/config.h"
|
|
179
|
-
|
|
180
|
-
# Only CMake 3.3+ supports PUBLIC sources in targets exported by "install".
|
|
181
|
-
$<$<VERSION_GREATER:CMAKE_VERSION,3.2>:PUBLIC>
|
|
264
|
+
PUBLIC
|
|
182
265
|
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/snappy-c.h>
|
|
183
266
|
$<INSTALL_INTERFACE:include/snappy-c.h>
|
|
184
267
|
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/snappy-sinksource.h>
|
|
@@ -202,38 +285,100 @@ if(BUILD_SHARED_LIBS)
|
|
|
202
285
|
set_target_properties(snappy PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
|
203
286
|
endif(BUILD_SHARED_LIBS)
|
|
204
287
|
|
|
205
|
-
if(SNAPPY_BUILD_TESTS)
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
add_executable(snappy_unittest "")
|
|
209
|
-
target_sources(snappy_unittest
|
|
288
|
+
if(SNAPPY_BUILD_TESTS OR SNAPPY_BUILD_BENCHMARKS)
|
|
289
|
+
add_library(snappy_test_support "")
|
|
290
|
+
target_sources(snappy_test_support
|
|
210
291
|
PRIVATE
|
|
211
|
-
"snappy_unittest.cc"
|
|
212
292
|
"snappy-test.cc"
|
|
293
|
+
"snappy-test.h"
|
|
294
|
+
"snappy_test_data.cc"
|
|
295
|
+
"snappy_test_data.h"
|
|
296
|
+
"${PROJECT_BINARY_DIR}/config.h"
|
|
213
297
|
)
|
|
214
|
-
|
|
215
|
-
|
|
298
|
+
|
|
299
|
+
# Test files include snappy-test.h, HAVE_CONFIG_H must be defined.
|
|
300
|
+
target_compile_definitions(snappy_test_support PUBLIC -DHAVE_CONFIG_H)
|
|
301
|
+
if(BUILD_SHARED_LIBS)
|
|
302
|
+
set_target_properties(snappy_test_support PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
|
303
|
+
endif(BUILD_SHARED_LIBS)
|
|
304
|
+
|
|
305
|
+
target_link_libraries(snappy_test_support snappy)
|
|
216
306
|
|
|
217
307
|
if(HAVE_LIBZ)
|
|
218
|
-
target_link_libraries(
|
|
308
|
+
target_link_libraries(snappy_test_support z)
|
|
219
309
|
endif(HAVE_LIBZ)
|
|
220
310
|
if(HAVE_LIBLZO2)
|
|
221
|
-
target_link_libraries(
|
|
311
|
+
target_link_libraries(snappy_test_support lzo2)
|
|
222
312
|
endif(HAVE_LIBLZO2)
|
|
313
|
+
if(HAVE_LIBLZ4)
|
|
314
|
+
target_link_libraries(snappy_test_support lz4)
|
|
315
|
+
endif(HAVE_LIBLZ4)
|
|
223
316
|
|
|
224
|
-
target_include_directories(
|
|
225
|
-
BEFORE
|
|
317
|
+
target_include_directories(snappy_test_support
|
|
318
|
+
BEFORE PUBLIC
|
|
226
319
|
"${PROJECT_SOURCE_DIR}"
|
|
227
|
-
"${GTEST_INCLUDE_DIRS}"
|
|
228
|
-
"${GFLAGS_INCLUDE_DIRS}"
|
|
229
320
|
)
|
|
321
|
+
endif(SNAPPY_BUILD_TESTS OR SNAPPY_BUILD_BENCHMARKS)
|
|
322
|
+
|
|
323
|
+
if(SNAPPY_BUILD_TESTS)
|
|
324
|
+
enable_testing()
|
|
325
|
+
|
|
326
|
+
# Prevent overriding the parent project's compiler/linker settings on Windows.
|
|
327
|
+
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
|
328
|
+
set(install_gtest OFF)
|
|
329
|
+
set(install_gmock OFF)
|
|
330
|
+
set(build_gmock ON)
|
|
331
|
+
|
|
332
|
+
# This project is tested using GoogleTest.
|
|
333
|
+
add_subdirectory("third_party/googletest")
|
|
334
|
+
|
|
335
|
+
# GoogleTest triggers a missing field initializers warning.
|
|
336
|
+
if(SNAPPY_HAVE_NO_MISSING_FIELD_INITIALIZERS)
|
|
337
|
+
set_property(TARGET gtest
|
|
338
|
+
APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers)
|
|
339
|
+
set_property(TARGET gmock
|
|
340
|
+
APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers)
|
|
341
|
+
endif(SNAPPY_HAVE_NO_MISSING_FIELD_INITIALIZERS)
|
|
342
|
+
|
|
343
|
+
if(SNAPPY_HAVE_NO_IMPLICIT_INT_FLOAT_CONVERSION)
|
|
344
|
+
set_property(TARGET gtest
|
|
345
|
+
APPEND PROPERTY COMPILE_OPTIONS -Wno-implicit-int-float-conversion)
|
|
346
|
+
endif(SNAPPY_HAVE_NO_IMPLICIT_INT_FLOAT_CONVERSION)
|
|
347
|
+
|
|
348
|
+
add_executable(snappy_unittest "")
|
|
349
|
+
target_sources(snappy_unittest
|
|
350
|
+
PRIVATE
|
|
351
|
+
"snappy_unittest.cc"
|
|
352
|
+
)
|
|
353
|
+
target_link_libraries(snappy_unittest snappy_test_support gmock_main gtest)
|
|
230
354
|
|
|
231
355
|
add_test(
|
|
232
356
|
NAME snappy_unittest
|
|
233
357
|
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
|
|
234
358
|
COMMAND "${PROJECT_BINARY_DIR}/snappy_unittest")
|
|
359
|
+
|
|
360
|
+
add_executable(snappy_test_tool "")
|
|
361
|
+
target_sources(snappy_test_tool
|
|
362
|
+
PRIVATE
|
|
363
|
+
"snappy_test_tool.cc"
|
|
364
|
+
)
|
|
365
|
+
target_link_libraries(snappy_test_tool snappy_test_support)
|
|
235
366
|
endif(SNAPPY_BUILD_TESTS)
|
|
236
367
|
|
|
368
|
+
if(SNAPPY_BUILD_BENCHMARKS)
|
|
369
|
+
add_executable(snappy_benchmark "")
|
|
370
|
+
target_sources(snappy_benchmark
|
|
371
|
+
PRIVATE
|
|
372
|
+
"snappy_benchmark.cc"
|
|
373
|
+
)
|
|
374
|
+
target_link_libraries(snappy_benchmark snappy_test_support benchmark_main)
|
|
375
|
+
|
|
376
|
+
# This project uses Google benchmark for benchmarking.
|
|
377
|
+
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
|
|
378
|
+
set(BENCHMARK_ENABLE_EXCEPTIONS OFF CACHE BOOL "" FORCE)
|
|
379
|
+
add_subdirectory("third_party/benchmark")
|
|
380
|
+
endif(SNAPPY_BUILD_BENCHMARKS)
|
|
381
|
+
|
|
237
382
|
if(SNAPPY_FUZZING_BUILD)
|
|
238
383
|
add_executable(snappy_compress_fuzzer "")
|
|
239
384
|
target_sources(snappy_compress_fuzzer
|
|
@@ -6,7 +6,7 @@ just a few small guidelines you need to follow.
|
|
|
6
6
|
## Contributor License Agreement
|
|
7
7
|
|
|
8
8
|
Contributions to this project must be accompanied by a Contributor License
|
|
9
|
-
Agreement. You (or your employer) retain the copyright to your contribution
|
|
9
|
+
Agreement. You (or your employer) retain the copyright to your contribution;
|
|
10
10
|
this simply gives us permission to use and redistribute your contributions as
|
|
11
11
|
part of the project. Head over to <https://cla.developers.google.com/> to see
|
|
12
12
|
your current agreements on file or to sign a new one.
|
|
@@ -15,12 +15,17 @@ You generally only need to submit a CLA once, so if you've already submitted one
|
|
|
15
15
|
(even if it was for a different project), you probably don't need to do it
|
|
16
16
|
again.
|
|
17
17
|
|
|
18
|
-
## Code
|
|
18
|
+
## Code Reviews
|
|
19
19
|
|
|
20
20
|
All submissions, including submissions by project members, require review. We
|
|
21
21
|
use GitHub pull requests for this purpose. Consult
|
|
22
22
|
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
|
|
23
23
|
information on using pull requests.
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
See [the README](README.md#contributing-to-the-snappy-project) for areas
|
|
26
|
+
where we are likely to accept external contributions.
|
|
27
|
+
|
|
28
|
+
## Community Guidelines
|
|
29
|
+
|
|
30
|
+
This project follows [Google's Open Source Community
|
|
31
|
+
Guidelines](https://opensource.google/conduct/).
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module(
|
|
2
|
+
name = "snappy",
|
|
3
|
+
version = "1.2.2",
|
|
4
|
+
compatibility_level = 1,
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
bazel_dep(
|
|
8
|
+
name = "googletest",
|
|
9
|
+
version = "1.14.0.bcr.1",
|
|
10
|
+
dev_dependency = True,
|
|
11
|
+
repo_name = "com_google_googletest",
|
|
12
|
+
)
|
|
13
|
+
bazel_dep(
|
|
14
|
+
name = "google_benchmark",
|
|
15
|
+
version = "1.9.0",
|
|
16
|
+
dev_dependency = True,
|
|
17
|
+
repo_name = "com_google_benchmark",
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
bazel_dep(
|
|
21
|
+
name = "platforms",
|
|
22
|
+
version = "0.0.9",
|
|
23
|
+
)
|
data/vendor/snappy/NEWS
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
Snappy v1.2.2, Mar 26th 2025:
|
|
2
|
+
|
|
3
|
+
* We added a new compression level in v1.2.1 which compresses a bit
|
|
4
|
+
denser but slower. Decompression speed should be even faster with it.
|
|
5
|
+
|
|
6
|
+
* We fixed a very old issue of data corruption when compressed size
|
|
7
|
+
exceeds 4GB. This can happen when you compress data close to 4GB
|
|
8
|
+
and it's incompressible, for example, random data.
|
|
9
|
+
|
|
10
|
+
* Started to use minimum CMake 3.10 because older ones are not
|
|
11
|
+
planned to be supported.
|
|
12
|
+
|
|
13
|
+
* Various other small fixes and performance improvements (especially
|
|
14
|
+
for clang).
|
|
15
|
+
|
|
16
|
+
Snappy v1.1.10, Mar 8th 2023:
|
|
17
|
+
|
|
18
|
+
* Performance improvements
|
|
19
|
+
|
|
20
|
+
* Compilation fixes for various environments
|
|
21
|
+
|
|
22
|
+
Snappy v1.1.9, May 4th 2021:
|
|
23
|
+
|
|
24
|
+
* Performance improvements.
|
|
25
|
+
|
|
26
|
+
* Google Test and Google Benchmark are now bundled in third_party/.
|
|
27
|
+
|
|
1
28
|
Snappy v1.1.8, January 15th 2020:
|
|
2
29
|
|
|
3
30
|
* Small performance improvements.
|
data/vendor/snappy/README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Snappy, a fast compressor/decompressor.
|
|
2
2
|
|
|
3
|
+
[](https://github.com/google/snappy/actions/workflows/build.yml)
|
|
3
4
|
|
|
4
5
|
Introduction
|
|
5
6
|
============
|
|
@@ -69,6 +70,7 @@ You need the CMake version specified in [CMakeLists.txt](./CMakeLists.txt)
|
|
|
69
70
|
or later to build:
|
|
70
71
|
|
|
71
72
|
```bash
|
|
73
|
+
git submodule update --init
|
|
72
74
|
mkdir build
|
|
73
75
|
cd build && cmake ../ && make
|
|
74
76
|
```
|
|
@@ -107,42 +109,57 @@ information.
|
|
|
107
109
|
Tests and benchmarks
|
|
108
110
|
====================
|
|
109
111
|
|
|
110
|
-
When you compile Snappy,
|
|
111
|
-
library itself. You do not need
|
|
112
|
-
but
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
112
|
+
When you compile Snappy, the following binaries are compiled in addition to the
|
|
113
|
+
library itself. You do not need them to use the compressor from your own
|
|
114
|
+
library, but they are useful for Snappy development.
|
|
115
|
+
|
|
116
|
+
* `snappy_benchmark` contains microbenchmarks used to tune compression and
|
|
117
|
+
decompression performance.
|
|
118
|
+
* `snappy_unittests` contains unit tests, verifying correctness on your machine
|
|
119
|
+
in various scenarios.
|
|
120
|
+
* `snappy_test_tool` can benchmark Snappy against a few other compression
|
|
121
|
+
libraries (zlib, LZO, LZF, and QuickLZ), if they were detected at configure
|
|
122
|
+
time. To benchmark using a given file, give the compression algorithm you want
|
|
123
|
+
to test Snappy against (e.g. --zlib) and then a list of one or more file names
|
|
124
|
+
on the command line.
|
|
125
|
+
|
|
126
|
+
If you want to change or optimize Snappy, please run the tests and benchmarks to
|
|
127
|
+
verify you have not broken anything.
|
|
128
|
+
|
|
129
|
+
The testdata/ directory contains the files used by the microbenchmarks, which
|
|
130
|
+
should provide a reasonably balanced starting point for benchmarking. (Note that
|
|
131
|
+
baddata[1-3].snappy are not intended as benchmarks; they are used to verify
|
|
132
|
+
correctness in the presence of corrupted data in the unit test.)
|
|
133
|
+
|
|
134
|
+
Contributing to the Snappy Project
|
|
135
|
+
==================================
|
|
136
|
+
|
|
137
|
+
In addition to the aims listed at the top of the [README](README.md) Snappy
|
|
138
|
+
explicitly supports the following:
|
|
139
|
+
|
|
140
|
+
1. C++11
|
|
141
|
+
2. Clang (gcc and MSVC are best-effort).
|
|
142
|
+
3. Low level optimizations (e.g. assembly or equivalent intrinsics) for:
|
|
143
|
+
- [x86](https://en.wikipedia.org/wiki/X86)
|
|
144
|
+
- [x86-64](https://en.wikipedia.org/wiki/X86-64)
|
|
145
|
+
- ARMv7 (32-bit)
|
|
146
|
+
- ARMv8 (AArch64)
|
|
147
|
+
4. Supports only the Snappy compression scheme as described in
|
|
148
|
+
[format_description.txt](format_description.txt).
|
|
149
|
+
5. CMake for building
|
|
150
|
+
|
|
151
|
+
Changes adding features or dependencies outside of the core area of focus listed
|
|
152
|
+
above might not be accepted. If in doubt post a message to the
|
|
153
|
+
[Snappy discussion mailing list](https://groups.google.com/g/snappy-compression).
|
|
154
|
+
|
|
155
|
+
We are unlikely to accept contributions to the build configuration files, such
|
|
156
|
+
as `CMakeLists.txt`. We are focused on maintaining a build configuration that
|
|
157
|
+
allows us to test that the project works in a few supported configurations
|
|
158
|
+
inside Google. We are not currently interested in supporting other requirements,
|
|
159
|
+
such as different operating systems, compilers, or build systems.
|
|
143
160
|
|
|
144
161
|
Contact
|
|
145
162
|
=======
|
|
146
163
|
|
|
147
|
-
Snappy is distributed through GitHub. For the latest version
|
|
148
|
-
|
|
164
|
+
Snappy is distributed through GitHub. For the latest version and other
|
|
165
|
+
information, see https://github.com/google/snappy.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Copyright 2023 Google Inc. All Rights Reserved.
|
|
2
|
+
#
|
|
3
|
+
# Redistribution and use in source and binary forms, with or without
|
|
4
|
+
# modification, are permitted provided that the following conditions are
|
|
5
|
+
# met:
|
|
6
|
+
#
|
|
7
|
+
# * Redistributions of source code must retain the above copyright
|
|
8
|
+
# notice, this list of conditions and the following disclaimer.
|
|
9
|
+
# * Redistributions in binary form must reproduce the above
|
|
10
|
+
# copyright notice, this list of conditions and the following disclaimer
|
|
11
|
+
# in the documentation and/or other materials provided with the
|
|
12
|
+
# distribution.
|
|
13
|
+
# * Neither the name of Google Inc. nor the names of its
|
|
14
|
+
# contributors may be used to endorse or promote products derived from
|
|
15
|
+
# this software without specific prior written permission.
|
|
16
|
+
#
|
|
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.
|
|
File without changes
|
|
@@ -1,62 +1,69 @@
|
|
|
1
1
|
#ifndef THIRD_PARTY_SNAPPY_OPENSOURCE_CMAKE_CONFIG_H_
|
|
2
2
|
#define THIRD_PARTY_SNAPPY_OPENSOURCE_CMAKE_CONFIG_H_
|
|
3
3
|
|
|
4
|
+
/* Define to 1 if the compiler supports __attribute__((always_inline)). */
|
|
5
|
+
#cmakedefine01 HAVE_ATTRIBUTE_ALWAYS_INLINE
|
|
6
|
+
|
|
4
7
|
/* Define to 1 if the compiler supports __builtin_ctz and friends. */
|
|
5
|
-
#
|
|
8
|
+
#cmakedefine01 HAVE_BUILTIN_CTZ
|
|
6
9
|
|
|
7
10
|
/* Define to 1 if the compiler supports __builtin_expect. */
|
|
8
|
-
#
|
|
11
|
+
#cmakedefine01 HAVE_BUILTIN_EXPECT
|
|
9
12
|
|
|
10
|
-
/* Define to 1 if
|
|
11
|
-
#
|
|
13
|
+
/* Define to 1 if the compiler supports __builtin_prefetch. */
|
|
14
|
+
#cmakedefine01 HAVE_BUILTIN_PREFETCH
|
|
12
15
|
|
|
13
16
|
/* Define to 1 if you have a definition for mmap() in <sys/mman.h>. */
|
|
14
|
-
#
|
|
17
|
+
#cmakedefine01 HAVE_FUNC_MMAP
|
|
15
18
|
|
|
16
19
|
/* Define to 1 if you have a definition for sysconf() in <unistd.h>. */
|
|
17
|
-
#
|
|
18
|
-
|
|
19
|
-
/* Define to 1 to use the gflags package for command-line parsing. */
|
|
20
|
-
#cmakedefine HAVE_GFLAGS 1
|
|
21
|
-
|
|
22
|
-
/* Define to 1 if you have Google Test. */
|
|
23
|
-
#cmakedefine HAVE_GTEST 1
|
|
20
|
+
#cmakedefine01 HAVE_FUNC_SYSCONF
|
|
24
21
|
|
|
25
22
|
/* Define to 1 if you have the `lzo2' library (-llzo2). */
|
|
26
|
-
#
|
|
23
|
+
#cmakedefine01 HAVE_LIBLZO2
|
|
27
24
|
|
|
28
25
|
/* Define to 1 if you have the `z' library (-lz). */
|
|
29
|
-
#
|
|
26
|
+
#cmakedefine01 HAVE_LIBZ
|
|
30
27
|
|
|
31
|
-
/* Define to 1 if you have the
|
|
32
|
-
#
|
|
28
|
+
/* Define to 1 if you have the `lz4' library (-llz4). */
|
|
29
|
+
#cmakedefine01 HAVE_LIBLZ4
|
|
33
30
|
|
|
34
31
|
/* Define to 1 if you have the <sys/mman.h> header file. */
|
|
35
|
-
#
|
|
32
|
+
#cmakedefine01 HAVE_SYS_MMAN_H
|
|
36
33
|
|
|
37
34
|
/* Define to 1 if you have the <sys/resource.h> header file. */
|
|
38
|
-
#
|
|
35
|
+
#cmakedefine01 HAVE_SYS_RESOURCE_H
|
|
39
36
|
|
|
40
37
|
/* Define to 1 if you have the <sys/time.h> header file. */
|
|
41
|
-
#
|
|
38
|
+
#cmakedefine01 HAVE_SYS_TIME_H
|
|
42
39
|
|
|
43
40
|
/* Define to 1 if you have the <sys/uio.h> header file. */
|
|
44
|
-
#
|
|
41
|
+
#cmakedefine01 HAVE_SYS_UIO_H
|
|
45
42
|
|
|
46
43
|
/* Define to 1 if you have the <unistd.h> header file. */
|
|
47
|
-
#
|
|
44
|
+
#cmakedefine01 HAVE_UNISTD_H
|
|
48
45
|
|
|
49
46
|
/* Define to 1 if you have the <windows.h> header file. */
|
|
50
|
-
#
|
|
47
|
+
#cmakedefine01 HAVE_WINDOWS_H
|
|
51
48
|
|
|
52
49
|
/* Define to 1 if you target processors with SSSE3+ and have <tmmintrin.h>. */
|
|
53
50
|
#cmakedefine01 SNAPPY_HAVE_SSSE3
|
|
54
51
|
|
|
52
|
+
/* Define to 1 if you target processors with SSE4.2 and have <crc32intrin.h>. */
|
|
53
|
+
#cmakedefine01 SNAPPY_HAVE_X86_CRC32
|
|
54
|
+
|
|
55
55
|
/* Define to 1 if you target processors with BMI2+ and have <bmi2intrin.h>. */
|
|
56
56
|
#cmakedefine01 SNAPPY_HAVE_BMI2
|
|
57
57
|
|
|
58
|
+
/* Define to 1 if you target processors with NEON and have <arm_neon.h>. */
|
|
59
|
+
#cmakedefine01 SNAPPY_HAVE_NEON
|
|
60
|
+
|
|
61
|
+
/* Define to 1 if you have <arm_neon.h> and <arm_acle.h> and want to optimize
|
|
62
|
+
compression speed by using __crc32cw from <arm_acle.h>. */
|
|
63
|
+
#cmakedefine01 SNAPPY_HAVE_NEON_CRC32
|
|
64
|
+
|
|
58
65
|
/* Define to 1 if your processor stores words with the most significant byte
|
|
59
66
|
first (like Motorola and SPARC, unlike Intel and VAX). */
|
|
60
|
-
#
|
|
67
|
+
#cmakedefine01 SNAPPY_IS_BIG_ENDIAN
|
|
61
68
|
|
|
62
69
|
#endif // THIRD_PARTY_SNAPPY_OPENSOURCE_CMAKE_CONFIG_H_
|