snappy 0.4.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 +1 -1
- data/.github/workflows/publish.yml +7 -13
- data/Dockerfile +1 -1
- data/Gemfile +1 -0
- data/README.md +3 -0
- data/Rakefile +1 -1
- 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/test/snappy_test.rb +29 -4
- data/vendor/snappy/BUILD.bazel +211 -0
- data/vendor/snappy/CMakeLists.txt +32 -10
- data/vendor/snappy/MODULE.bazel +23 -0
- data/vendor/snappy/NEWS +15 -0
- data/vendor/snappy/README.md +4 -4
- data/vendor/snappy/WORKSPACE +27 -0
- data/vendor/snappy/WORKSPACE.bzlmod +0 -0
- data/vendor/snappy/cmake/config.h.in +3 -0
- data/vendor/snappy/snappy-internal.h +29 -0
- data/vendor/snappy/snappy-stubs-internal.h +6 -0
- data/vendor/snappy/snappy.cc +258 -37
- data/vendor/snappy/snappy.h +41 -6
- data/vendor/snappy/snappy_benchmark.cc +38 -18
- data/vendor/snappy/snappy_compress_fuzzer.cc +18 -14
- data/vendor/snappy/snappy_unittest.cc +13 -0
- metadata +8 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3a62e55dcd9b5df9f78b9cd0ecd24b5aac02e4905c08eefc0f023cd8f8d6c19e
|
|
4
|
+
data.tar.gz: 501fbd93edca8aecc762e39788e23323ccdd5a7a84be24f51b85c5d3d61e1e6e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 44a906dd1caa7caf4831640a2c1d659e789df8d50b61c5ef024113f70f30b91a0359f5e312c8037f3591b4147c6ef9c56160b87aff056324760a16aec0a39ac9
|
|
7
|
+
data.tar.gz: 25b779a716a13967be79a0c8e7e715a98569c2e2dfe6b7d46152874f06348f780943d739181caca2e4409d9ef056df477b2e49831e22fd9970344160db46f29b
|
data/.github/workflows/main.yml
CHANGED
|
@@ -10,10 +10,14 @@ jobs:
|
|
|
10
10
|
strategy:
|
|
11
11
|
fail-fast: false
|
|
12
12
|
matrix:
|
|
13
|
-
ruby: [
|
|
13
|
+
ruby: [4.0, jruby]
|
|
14
|
+
if: github.repository == 'miyucy/snappy'
|
|
14
15
|
runs-on: ubuntu-latest
|
|
16
|
+
permissions:
|
|
17
|
+
contents: write
|
|
18
|
+
id-token: write
|
|
15
19
|
steps:
|
|
16
|
-
- uses: actions/checkout@
|
|
20
|
+
- uses: actions/checkout@v4
|
|
17
21
|
with:
|
|
18
22
|
submodules: true
|
|
19
23
|
- name: Set up Ruby
|
|
@@ -21,14 +25,4 @@ jobs:
|
|
|
21
25
|
with:
|
|
22
26
|
ruby-version: ${{ matrix.ruby }}
|
|
23
27
|
bundler-cache: true
|
|
24
|
-
-
|
|
25
|
-
run: |
|
|
26
|
-
mkdir -p ~/.gem
|
|
27
|
-
cat << EOF > ~/.gem/credentials
|
|
28
|
-
---
|
|
29
|
-
:github: Bearer ${{secrets.GITHUB_TOKEN}}
|
|
30
|
-
:rubygems_api_key: ${{secrets.RUBYGEMS_API_KEY}}
|
|
31
|
-
EOF
|
|
32
|
-
chmod 600 ~/.gem/credentials
|
|
33
|
-
bundle exec rake release[remote]
|
|
34
|
-
rm -f ~/.gem/credentials
|
|
28
|
+
- uses: rubygems/release-gem@v1
|
data/Dockerfile
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -10,6 +10,9 @@ see https://github.com/google/snappy
|
|
|
10
10
|
```bash
|
|
11
11
|
$ brew install snappy
|
|
12
12
|
$ brew install autoconf automake cmake libtool
|
|
13
|
+
|
|
14
|
+
# This step may be needed if gem installation fails
|
|
15
|
+
bundle config build.snappy --with-snappy-dir=/opt/homebrew/opt/snappy
|
|
13
16
|
```
|
|
14
17
|
|
|
15
18
|
### Ubuntu
|
data/Rakefile
CHANGED
|
@@ -31,7 +31,7 @@ if defined?(JRUBY_VERSION)
|
|
|
31
31
|
|
|
32
32
|
desc "Compile the extension"
|
|
33
33
|
task compile: :setup do
|
|
34
|
-
ant.javac destdir: "${build.dir}", includeantruntime: "no", target: "1.
|
|
34
|
+
ant.javac destdir: "${build.dir}", includeantruntime: "no", target: "1.8", source: "1.8", debug: "on" do
|
|
35
35
|
classpath refid: "compile.class.path"
|
|
36
36
|
src { pathelement location: "${src.dir}" }
|
|
37
37
|
end
|
data/lib/snappy/shim.rb
CHANGED
|
@@ -3,28 +3,8 @@
|
|
|
3
3
|
module Snappy
|
|
4
4
|
module_function
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def b(str)
|
|
12
|
-
str
|
|
13
|
-
end
|
|
14
|
-
else
|
|
15
|
-
def set_encoding(io)
|
|
16
|
-
io.set_encoding Encoding::ASCII_8BIT
|
|
17
|
-
io
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
if ::String.instance_methods.include? :b
|
|
21
|
-
def b(str)
|
|
22
|
-
str.b
|
|
23
|
-
end
|
|
24
|
-
else
|
|
25
|
-
def b(str)
|
|
26
|
-
str.force_encoding Encoding::ASCII_8BIT
|
|
27
|
-
end
|
|
28
|
-
end
|
|
6
|
+
def set_encoding(io)
|
|
7
|
+
io.set_encoding Encoding::ASCII_8BIT
|
|
8
|
+
io
|
|
29
9
|
end
|
|
30
10
|
end
|
data/lib/snappy/version.rb
CHANGED
data/lib/snappy/writer.rb
CHANGED
data/lib/snappy_ext.jar
CHANGED
|
Binary file
|
data/test/snappy_test.rb
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "test_helper"
|
|
4
|
+
require "securerandom"
|
|
4
5
|
|
|
5
6
|
class SnappyTest < Test::Unit::TestCase
|
|
6
|
-
T = [*"a".."z", *"A".."Z", *"0".."9"].freeze
|
|
7
|
-
|
|
8
7
|
def random_data(length = 1024)
|
|
9
|
-
|
|
8
|
+
SecureRandom.alphanumeric(length)
|
|
10
9
|
end
|
|
11
10
|
|
|
12
11
|
test "VERSION" do
|
|
@@ -20,6 +19,11 @@ class SnappyTest < Test::Unit::TestCase
|
|
|
20
19
|
assert_equal s, Snappy.inflate(Snappy.deflate(s))
|
|
21
20
|
end
|
|
22
21
|
|
|
22
|
+
test "binary data" do
|
|
23
|
+
s = SecureRandom.random_bytes(1024)
|
|
24
|
+
assert_equal s, Snappy.inflate(Snappy.deflate(s))
|
|
25
|
+
end
|
|
26
|
+
|
|
23
27
|
test "well done (pair)" do
|
|
24
28
|
s = random_data
|
|
25
29
|
[
|
|
@@ -83,13 +87,34 @@ class SnappyTest < Test::Unit::TestCase
|
|
|
83
87
|
notify "Ractor not defined"
|
|
84
88
|
omit
|
|
85
89
|
end
|
|
90
|
+
unless RUBY_VERSION.start_with?("4")
|
|
91
|
+
omit
|
|
92
|
+
end
|
|
86
93
|
s = random_data
|
|
87
94
|
a = Array.new(2) do
|
|
88
95
|
Ractor.new(s) do |s|
|
|
89
96
|
Snappy.inflate(Snappy.deflate(s)) == s
|
|
90
97
|
end
|
|
91
98
|
end
|
|
92
|
-
assert_equal [true, true], a.map(&:
|
|
99
|
+
assert_equal [true, true], a.map(&:value)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
test "take2" do
|
|
103
|
+
unless defined? ::Ractor
|
|
104
|
+
notify "Ractor not defined"
|
|
105
|
+
omit
|
|
106
|
+
end
|
|
107
|
+
unless RUBY_VERSION.start_with?("4")
|
|
108
|
+
omit
|
|
109
|
+
end
|
|
110
|
+
s = random_data
|
|
111
|
+
i = Ractor.new(s) do |s|
|
|
112
|
+
Snappy.deflate(s)
|
|
113
|
+
end.value
|
|
114
|
+
j = Ractor.new(i) do |i|
|
|
115
|
+
Snappy.inflate(i)
|
|
116
|
+
end.value
|
|
117
|
+
assert_equal s, j
|
|
93
118
|
end
|
|
94
119
|
end
|
|
95
120
|
end
|
|
@@ -0,0 +1,211 @@
|
|
|
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.
|
|
28
|
+
|
|
29
|
+
package(default_visibility = ["//visibility:public"])
|
|
30
|
+
|
|
31
|
+
licenses(["notice"])
|
|
32
|
+
|
|
33
|
+
SNAPPY_VERSION = (1, 2, 2)
|
|
34
|
+
|
|
35
|
+
config_setting(
|
|
36
|
+
name = "windows",
|
|
37
|
+
constraint_values = ["@platforms//os:windows"],
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
cc_library(
|
|
41
|
+
name = "config",
|
|
42
|
+
hdrs = ["config.h"],
|
|
43
|
+
defines = ["HAVE_CONFIG_H"],
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
cc_library(
|
|
47
|
+
name = "snappy-stubs-public",
|
|
48
|
+
hdrs = [":snappy-stubs-public.h"],
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
cc_library(
|
|
52
|
+
name = "snappy-stubs-internal",
|
|
53
|
+
srcs = ["snappy-stubs-internal.cc"],
|
|
54
|
+
hdrs = ["snappy-stubs-internal.h"],
|
|
55
|
+
deps = [
|
|
56
|
+
":config",
|
|
57
|
+
":snappy-stubs-public",
|
|
58
|
+
],
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
cc_library(
|
|
62
|
+
name = "snappy",
|
|
63
|
+
srcs = [
|
|
64
|
+
"snappy.cc",
|
|
65
|
+
"snappy-internal.h",
|
|
66
|
+
"snappy-sinksource.cc",
|
|
67
|
+
],
|
|
68
|
+
hdrs = [
|
|
69
|
+
"snappy.h",
|
|
70
|
+
"snappy-sinksource.h",
|
|
71
|
+
],
|
|
72
|
+
copts = select({
|
|
73
|
+
":windows": [],
|
|
74
|
+
"//conditions:default": [
|
|
75
|
+
"-Wno-sign-compare",
|
|
76
|
+
],
|
|
77
|
+
}),
|
|
78
|
+
deps = [
|
|
79
|
+
":config",
|
|
80
|
+
":snappy-stubs-internal",
|
|
81
|
+
":snappy-stubs-public",
|
|
82
|
+
],
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
cc_library(
|
|
86
|
+
name = "snappy-c",
|
|
87
|
+
srcs = ["snappy-c.cc"],
|
|
88
|
+
hdrs = ["snappy-c.h"],
|
|
89
|
+
deps = [":snappy"],
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
filegroup(
|
|
93
|
+
name = "testdata",
|
|
94
|
+
srcs = glob(["testdata/*"]),
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
cc_library(
|
|
98
|
+
name = "snappy-test",
|
|
99
|
+
testonly = True,
|
|
100
|
+
srcs = [
|
|
101
|
+
"snappy-test.cc",
|
|
102
|
+
"snappy_test_data.cc",
|
|
103
|
+
],
|
|
104
|
+
hdrs = [
|
|
105
|
+
"snappy-test.h",
|
|
106
|
+
"snappy_test_data.h",
|
|
107
|
+
],
|
|
108
|
+
deps = [":snappy-stubs-internal"],
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
cc_test(
|
|
112
|
+
name = "snappy_benchmark",
|
|
113
|
+
srcs = ["snappy_benchmark.cc"],
|
|
114
|
+
data = [":testdata"],
|
|
115
|
+
deps = [
|
|
116
|
+
":snappy",
|
|
117
|
+
":snappy-test",
|
|
118
|
+
"@com_google_benchmark//:benchmark_main",
|
|
119
|
+
],
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
cc_test(
|
|
123
|
+
name = "snappy_unittest",
|
|
124
|
+
srcs = [
|
|
125
|
+
"snappy_unittest.cc",
|
|
126
|
+
],
|
|
127
|
+
data = [":testdata"],
|
|
128
|
+
deps = [
|
|
129
|
+
":snappy",
|
|
130
|
+
":snappy-test",
|
|
131
|
+
"@com_google_googletest//:gtest_main",
|
|
132
|
+
],
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
# Generate a config.h similar to what cmake would produce.
|
|
136
|
+
genrule(
|
|
137
|
+
name = "config_h",
|
|
138
|
+
outs = ["config.h"],
|
|
139
|
+
cmd = """cat <<EOF >$@
|
|
140
|
+
#define HAVE_STDDEF_H 1
|
|
141
|
+
#define HAVE_STDINT_H 1
|
|
142
|
+
#ifdef __has_builtin
|
|
143
|
+
# if !defined(HAVE_BUILTIN_EXPECT) && __has_builtin(__builtin_expect)
|
|
144
|
+
# define HAVE_BUILTIN_EXPECT 1
|
|
145
|
+
# endif
|
|
146
|
+
# if !defined(HAVE_BUILTIN_CTZ) && __has_builtin(__builtin_ctzll)
|
|
147
|
+
# define HAVE_BUILTIN_CTZ 1
|
|
148
|
+
# endif
|
|
149
|
+
# if !defined(HAVE_BUILTIN_PREFETCH) && __has_builtin(__builtin_prefetech)
|
|
150
|
+
# define HAVE_BUILTIN_PREFETCH 1
|
|
151
|
+
# endif
|
|
152
|
+
#elif defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >= 4)
|
|
153
|
+
# ifndef HAVE_BUILTIN_EXPECT
|
|
154
|
+
# define HAVE_BUILTIN_EXPECT 1
|
|
155
|
+
# endif
|
|
156
|
+
# ifndef HAVE_BUILTIN_CTZ
|
|
157
|
+
# define HAVE_BUILTIN_CTZ 1
|
|
158
|
+
# endif
|
|
159
|
+
# ifndef HAVE_BUILTIN_PREFETCH
|
|
160
|
+
# define HAVE_BUILTIN_PREFETCH 1
|
|
161
|
+
# endif
|
|
162
|
+
#endif
|
|
163
|
+
|
|
164
|
+
#if defined(_WIN32) && !defined(HAVE_WINDOWS_H)
|
|
165
|
+
#define HAVE_WINDOWS_H 1
|
|
166
|
+
#endif
|
|
167
|
+
|
|
168
|
+
#ifdef __has_include
|
|
169
|
+
# if !defined(HAVE_BYTESWAP_H) && __has_include(<byteswap.h>)
|
|
170
|
+
# define HAVE_BYTESWAP_H 1
|
|
171
|
+
# endif
|
|
172
|
+
# if !defined(HAVE_UNISTD_H) && __has_include(<unistd.h>)
|
|
173
|
+
# define HAVE_UNISTD_H 1
|
|
174
|
+
# endif
|
|
175
|
+
# if !defined(HAVE_SYS_ENDIAN_H) && __has_include(<sys/endian.h>)
|
|
176
|
+
# define HAVE_SYS_ENDIAN_H 1
|
|
177
|
+
# endif
|
|
178
|
+
# if !defined(HAVE_SYS_MMAN_H) && __has_include(<sys/mman.h>)
|
|
179
|
+
# define HAVE_SYS_MMAN_H 1
|
|
180
|
+
# endif
|
|
181
|
+
# if !defined(HAVE_SYS_UIO_H) && __has_include(<sys/uio.h>)
|
|
182
|
+
# define HAVE_SYS_UIO_H 1
|
|
183
|
+
# endif
|
|
184
|
+
# if !defined(HAVE_SYS_TIME_H) && __has_include(<sys/time.h>)
|
|
185
|
+
# define HAVE_SYS_TIME_H 1
|
|
186
|
+
# endif
|
|
187
|
+
#endif
|
|
188
|
+
|
|
189
|
+
#ifndef SNAPPY_IS_BIG_ENDIAN
|
|
190
|
+
# ifdef __s390x__
|
|
191
|
+
# define SNAPPY_IS_BIG_ENDIAN 1
|
|
192
|
+
# elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
|
193
|
+
# define SNAPPY_IS_BIG_ENDIAN 1
|
|
194
|
+
# endif
|
|
195
|
+
#endif
|
|
196
|
+
EOF
|
|
197
|
+
""",
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
genrule(
|
|
201
|
+
name = "snappy_stubs_public_h",
|
|
202
|
+
srcs = ["snappy-stubs-public.h.in"],
|
|
203
|
+
outs = ["snappy-stubs-public.h"],
|
|
204
|
+
# Assume sys/uio.h is available on non-Windows.
|
|
205
|
+
# Set the version numbers.
|
|
206
|
+
cmd = ("""sed -e 's/$${HAVE_SYS_UIO_H_01}/!_WIN32/g' \
|
|
207
|
+
-e 's/$${PROJECT_VERSION_MAJOR}/%d/g' \
|
|
208
|
+
-e 's/$${PROJECT_VERSION_MINOR}/%d/g' \
|
|
209
|
+
-e 's/$${PROJECT_VERSION_PATCH}/%d/g' \
|
|
210
|
+
$< >$@""" % SNAPPY_VERSION),
|
|
211
|
+
)
|
|
@@ -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)
|
|
@@ -38,7 +38,7 @@ if(NOT CMAKE_CXX_STANDARD)
|
|
|
38
38
|
endif(NOT CMAKE_CXX_STANDARD)
|
|
39
39
|
|
|
40
40
|
# https://github.com/izenecloud/cmake/blob/master/SetCompilerWarningAll.cmake
|
|
41
|
-
if(
|
|
41
|
+
if(MSVC)
|
|
42
42
|
# Use the highest warning level for Visual Studio.
|
|
43
43
|
set(CMAKE_CXX_WARNING_LEVEL 4)
|
|
44
44
|
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
|
@@ -55,7 +55,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
|
|
55
55
|
# Disable RTTI.
|
|
56
56
|
string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
57
57
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
|
|
58
|
-
else(
|
|
58
|
+
else(MSVC)
|
|
59
59
|
# Use -Wall for clang and gcc.
|
|
60
60
|
if(NOT CMAKE_CXX_FLAGS MATCHES "-Wall")
|
|
61
61
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
|
@@ -73,6 +73,11 @@ else(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
|
|
73
73
|
endif(NOT CMAKE_CXX_FLAGS MATCHES "-Werror")
|
|
74
74
|
endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
75
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
|
+
|
|
76
81
|
# Disable C++ exceptions.
|
|
77
82
|
string(REGEX REPLACE "-fexceptions" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
78
83
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
|
|
@@ -80,7 +85,7 @@ else(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
|
|
80
85
|
# Disable RTTI.
|
|
81
86
|
string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
82
87
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
|
|
83
|
-
endif(
|
|
88
|
+
endif(MSVC)
|
|
84
89
|
|
|
85
90
|
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make
|
|
86
91
|
# it prominent in the GUI.
|
|
@@ -141,6 +146,8 @@ endif(SNAPPY_REQUIRE_AVX2)
|
|
|
141
146
|
# Used by googletest.
|
|
142
147
|
check_cxx_compiler_flag(-Wno-missing-field-initializers
|
|
143
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)
|
|
144
151
|
|
|
145
152
|
include(CheckCXXSourceCompiles)
|
|
146
153
|
check_cxx_source_compiles("
|
|
@@ -153,6 +160,12 @@ int main() {
|
|
|
153
160
|
return __builtin_ctzll(0);
|
|
154
161
|
}" HAVE_BUILTIN_CTZ)
|
|
155
162
|
|
|
163
|
+
check_cxx_source_compiles("
|
|
164
|
+
int main() {
|
|
165
|
+
__builtin_prefetch(0, 0, 3);
|
|
166
|
+
return 0;
|
|
167
|
+
}" HAVE_BUILTIN_PREFETCH)
|
|
168
|
+
|
|
156
169
|
check_cxx_source_compiles("
|
|
157
170
|
__attribute__((always_inline)) int zero() { return 0; }
|
|
158
171
|
|
|
@@ -193,10 +206,13 @@ int main() {
|
|
|
193
206
|
|
|
194
207
|
check_cxx_source_compiles("
|
|
195
208
|
#include <arm_neon.h>
|
|
209
|
+
#include <stdint.h>
|
|
196
210
|
int main() {
|
|
197
211
|
uint8_t val = 3, dup[8];
|
|
198
|
-
uint8x16_t
|
|
199
|
-
|
|
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);
|
|
200
216
|
return 0;
|
|
201
217
|
}" SNAPPY_HAVE_NEON)
|
|
202
218
|
|
|
@@ -245,9 +261,7 @@ target_sources(snappy
|
|
|
245
261
|
"snappy-stubs-internal.cc"
|
|
246
262
|
"snappy.cc"
|
|
247
263
|
"${PROJECT_BINARY_DIR}/config.h"
|
|
248
|
-
|
|
249
|
-
# Only CMake 3.3+ supports PUBLIC sources in targets exported by "install".
|
|
250
|
-
$<$<VERSION_GREATER:CMAKE_VERSION,3.2>:PUBLIC>
|
|
264
|
+
PUBLIC
|
|
251
265
|
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/snappy-c.h>
|
|
252
266
|
$<INSTALL_INTERFACE:include/snappy-c.h>
|
|
253
267
|
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/snappy-sinksource.h>
|
|
@@ -284,6 +298,9 @@ if(SNAPPY_BUILD_TESTS OR SNAPPY_BUILD_BENCHMARKS)
|
|
|
284
298
|
|
|
285
299
|
# Test files include snappy-test.h, HAVE_CONFIG_H must be defined.
|
|
286
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)
|
|
287
304
|
|
|
288
305
|
target_link_libraries(snappy_test_support snappy)
|
|
289
306
|
|
|
@@ -323,6 +340,11 @@ if(SNAPPY_BUILD_TESTS)
|
|
|
323
340
|
APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers)
|
|
324
341
|
endif(SNAPPY_HAVE_NO_MISSING_FIELD_INITIALIZERS)
|
|
325
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
|
+
|
|
326
348
|
add_executable(snappy_unittest "")
|
|
327
349
|
target_sources(snappy_unittest
|
|
328
350
|
PRIVATE
|
|
@@ -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,18 @@
|
|
|
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
|
+
|
|
1
16
|
Snappy v1.1.10, Mar 8th 2023:
|
|
2
17
|
|
|
3
18
|
* Performance improvements
|
data/vendor/snappy/README.md
CHANGED
|
@@ -140,10 +140,10 @@ explicitly supports the following:
|
|
|
140
140
|
1. C++11
|
|
141
141
|
2. Clang (gcc and MSVC are best-effort).
|
|
142
142
|
3. Low level optimizations (e.g. assembly or equivalent intrinsics) for:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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
147
|
4. Supports only the Snappy compression scheme as described in
|
|
148
148
|
[format_description.txt](format_description.txt).
|
|
149
149
|
5. CMake for building
|
|
@@ -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
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
/* Define to 1 if the compiler supports __builtin_expect. */
|
|
11
11
|
#cmakedefine01 HAVE_BUILTIN_EXPECT
|
|
12
12
|
|
|
13
|
+
/* Define to 1 if the compiler supports __builtin_prefetch. */
|
|
14
|
+
#cmakedefine01 HAVE_BUILTIN_PREFETCH
|
|
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
|
|