brotli 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/README.md +1 -1
- data/brotli.gemspec +5 -2
- data/lib/brotli/version.rb +1 -1
- data/smoke.sh +8 -0
- data/spec/brotli_spec.rb +88 -0
- data/spec/inflate_spec.rb +75 -0
- data/spec/spec_helper.rb +4 -0
- data/vendor/brotli/common/constants.h +47 -0
- data/vendor/brotli/common/dictionary.c +9474 -0
- data/vendor/brotli/common/dictionary.h +29 -0
- data/vendor/brotli/common/port.h +107 -0
- data/vendor/brotli/common/types.h +58 -0
- metadata +15 -3
@@ -0,0 +1,29 @@
|
|
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
|
+
/* Collection of static dictionary words. */
|
8
|
+
|
9
|
+
#ifndef BROTLI_COMMON_DICTIONARY_H_
|
10
|
+
#define BROTLI_COMMON_DICTIONARY_H_
|
11
|
+
|
12
|
+
#include "./types.h"
|
13
|
+
|
14
|
+
#if defined(__cplusplus) || defined(c_plusplus)
|
15
|
+
extern "C" {
|
16
|
+
#endif
|
17
|
+
|
18
|
+
extern const uint8_t kBrotliDictionary[122784];
|
19
|
+
extern const uint32_t kBrotliDictionaryOffsetsByLength[25];
|
20
|
+
extern const uint8_t kBrotliDictionarySizeBitsByLength[25];
|
21
|
+
|
22
|
+
#define kBrotliMinDictionaryWordLength 4
|
23
|
+
#define kBrotliMaxDictionaryWordLength 24
|
24
|
+
|
25
|
+
#if defined(__cplusplus) || defined(c_plusplus)
|
26
|
+
} /* extern "C" */
|
27
|
+
#endif
|
28
|
+
|
29
|
+
#endif /* BROTLI_COMMON_DICTIONARY_H_ */
|
@@ -0,0 +1,107 @@
|
|
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 features and build options. */
|
8
|
+
|
9
|
+
#ifndef BROTLI_COMMON_PORT_H_
|
10
|
+
#define BROTLI_COMMON_PORT_H_
|
11
|
+
|
12
|
+
/* Compatibility with non-clang compilers. */
|
13
|
+
#ifndef __has_builtin
|
14
|
+
#define __has_builtin(x) 0
|
15
|
+
#endif
|
16
|
+
|
17
|
+
#ifndef __has_attribute
|
18
|
+
#define __has_attribute(x) 0
|
19
|
+
#endif
|
20
|
+
|
21
|
+
#ifndef __has_feature
|
22
|
+
#define __has_feature(x) 0
|
23
|
+
#endif
|
24
|
+
|
25
|
+
#if defined(__GNUC__) && defined(__GNUC_MINOR__)
|
26
|
+
#define BROTLI_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
|
27
|
+
#else
|
28
|
+
#define BROTLI_GCC_VERSION 0
|
29
|
+
#endif
|
30
|
+
|
31
|
+
#if defined(__ICC)
|
32
|
+
#define BROTLI_ICC_VERSION __ICC
|
33
|
+
#else
|
34
|
+
#define BROTLI_ICC_VERSION 0
|
35
|
+
#endif
|
36
|
+
|
37
|
+
#if defined(BROTLI_BUILD_MODERN_COMPILER)
|
38
|
+
#define BROTLI_MODERN_COMPILER 1
|
39
|
+
#elif BROTLI_GCC_VERSION > 300 || BROTLI_ICC_VERSION >= 1600
|
40
|
+
#define BROTLI_MODERN_COMPILER 1
|
41
|
+
#else
|
42
|
+
#define BROTLI_MODERN_COMPILER 0
|
43
|
+
#endif
|
44
|
+
|
45
|
+
/* Define "PREDICT_TRUE" and "PREDICT_FALSE" macros for capable compilers.
|
46
|
+
|
47
|
+
To apply compiler hint, enclose the branching condition into macros, like this:
|
48
|
+
|
49
|
+
if (PREDICT_TRUE(zero == 0)) {
|
50
|
+
// main execution path
|
51
|
+
} else {
|
52
|
+
// compiler should place this code outside of main execution path
|
53
|
+
}
|
54
|
+
|
55
|
+
OR:
|
56
|
+
|
57
|
+
if (PREDICT_FALSE(something_rare_or_unexpected_happens)) {
|
58
|
+
// compiler should place this code outside of main execution path
|
59
|
+
}
|
60
|
+
|
61
|
+
*/
|
62
|
+
#if BROTLI_MODERN_COMPILER || __has_builtin(__builtin_expect)
|
63
|
+
#define PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
|
64
|
+
#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
|
65
|
+
#else
|
66
|
+
#define PREDICT_FALSE(x) (x)
|
67
|
+
#define PREDICT_TRUE(x) (x)
|
68
|
+
#endif
|
69
|
+
|
70
|
+
#if BROTLI_MODERN_COMPILER || __has_attribute(always_inline)
|
71
|
+
#define ATTRIBUTE_ALWAYS_INLINE __attribute__ ((always_inline))
|
72
|
+
#else
|
73
|
+
#define ATTRIBUTE_ALWAYS_INLINE
|
74
|
+
#endif
|
75
|
+
|
76
|
+
#if defined(_WIN32) || defined(__CYGWIN__)
|
77
|
+
#define ATTRIBUTE_VISIBILITY_HIDDEN
|
78
|
+
#elif BROTLI_MODERN_COMPILER || __has_attribute(visibility)
|
79
|
+
#define ATTRIBUTE_VISIBILITY_HIDDEN __attribute__ ((visibility ("hidden")))
|
80
|
+
#else
|
81
|
+
#define ATTRIBUTE_VISIBILITY_HIDDEN
|
82
|
+
#endif
|
83
|
+
|
84
|
+
#ifndef BROTLI_INTERNAL
|
85
|
+
#define BROTLI_INTERNAL ATTRIBUTE_VISIBILITY_HIDDEN
|
86
|
+
#endif
|
87
|
+
|
88
|
+
#ifndef _MSC_VER
|
89
|
+
#if defined(__cplusplus) || !defined(__STRICT_ANSI__) || \
|
90
|
+
__STDC_VERSION__ >= 199901L
|
91
|
+
#define BROTLI_INLINE inline ATTRIBUTE_ALWAYS_INLINE
|
92
|
+
#else
|
93
|
+
#define BROTLI_INLINE
|
94
|
+
#endif
|
95
|
+
#else /* _MSC_VER */
|
96
|
+
#define BROTLI_INLINE __forceinline
|
97
|
+
#endif /* _MSC_VER */
|
98
|
+
|
99
|
+
#if BROTLI_MODERN_COMPILER || __has_attribute(noinline)
|
100
|
+
#define BROTLI_NOINLINE __attribute__((noinline))
|
101
|
+
#else
|
102
|
+
#define BROTLI_NOINLINE
|
103
|
+
#endif
|
104
|
+
|
105
|
+
#define BROTLI_UNUSED(X) (void)(X)
|
106
|
+
|
107
|
+
#endif /* BROTLI_COMMON_PORT_H_ */
|
@@ -0,0 +1,58 @@
|
|
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
|
+
/* Common types */
|
8
|
+
|
9
|
+
#ifndef BROTLI_COMMON_TYPES_H_
|
10
|
+
#define BROTLI_COMMON_TYPES_H_
|
11
|
+
|
12
|
+
#include <stddef.h> /* for size_t */
|
13
|
+
|
14
|
+
#if defined(_MSC_VER) && (_MSC_VER < 1600)
|
15
|
+
typedef __int8 int8_t;
|
16
|
+
typedef unsigned __int8 uint8_t;
|
17
|
+
typedef __int16 int16_t;
|
18
|
+
typedef unsigned __int16 uint16_t;
|
19
|
+
typedef __int32 int32_t;
|
20
|
+
typedef unsigned __int32 uint32_t;
|
21
|
+
typedef unsigned __int64 uint64_t;
|
22
|
+
typedef __int64 int64_t;
|
23
|
+
#else
|
24
|
+
#include <stdint.h>
|
25
|
+
#endif /* defined(_MSC_VER) && (_MSC_VER < 1600) */
|
26
|
+
|
27
|
+
#if (!defined(_MSC_VER) || (_MSC_VER >= 1800)) && \
|
28
|
+
(defined(__cplusplus) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L))
|
29
|
+
#include <stdbool.h>
|
30
|
+
#define BROTLI_BOOL bool
|
31
|
+
#define BROTLI_TRUE true
|
32
|
+
#define BROTLI_FALSE false
|
33
|
+
#define TO_BROTLI_BOOL(X) (!!(X))
|
34
|
+
#else
|
35
|
+
typedef enum {
|
36
|
+
BROTLI_FALSE = 0,
|
37
|
+
BROTLI_TRUE = !BROTLI_FALSE
|
38
|
+
} BROTLI_BOOL;
|
39
|
+
#define TO_BROTLI_BOOL(X) (!!(X) ? BROTLI_TRUE : BROTLI_FALSE)
|
40
|
+
#endif
|
41
|
+
|
42
|
+
#define MAKE_UINT64_T(high, low) ((((uint64_t)(high)) << 32) | low)
|
43
|
+
|
44
|
+
#define BROTLI_UINT32_MAX (~((uint32_t)0))
|
45
|
+
#define BROTLI_SIZE_MAX (~((size_t)0))
|
46
|
+
|
47
|
+
/* Allocating function pointer. Function MUST return 0 in the case of failure.
|
48
|
+
Otherwise it MUST return a valid pointer to a memory region of at least
|
49
|
+
size length. Neither items nor size are allowed to be 0.
|
50
|
+
opaque argument is a pointer provided by client and could be used to bind
|
51
|
+
function to specific object (memory pool). */
|
52
|
+
typedef void* (*brotli_alloc_func)(void* opaque, size_t size);
|
53
|
+
|
54
|
+
/* Deallocating function pointer. Function SHOULD be no-op in the case the
|
55
|
+
address is 0. */
|
56
|
+
typedef void (*brotli_free_func)(void* opaque, void* address);
|
57
|
+
|
58
|
+
#endif /* BROTLI_COMMON_TYPES_H_ */
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brotli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- miyucy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -105,7 +105,16 @@ files:
|
|
105
105
|
- ext/brotli/extconf.rb
|
106
106
|
- lib/brotli.rb
|
107
107
|
- lib/brotli/version.rb
|
108
|
+
- smoke.sh
|
109
|
+
- spec/brotli_spec.rb
|
110
|
+
- spec/inflate_spec.rb
|
111
|
+
- spec/spec_helper.rb
|
108
112
|
- vendor/brotli/LICENSE
|
113
|
+
- vendor/brotli/common/constants.h
|
114
|
+
- vendor/brotli/common/dictionary.c
|
115
|
+
- vendor/brotli/common/dictionary.h
|
116
|
+
- vendor/brotli/common/port.h
|
117
|
+
- vendor/brotli/common/types.h
|
109
118
|
- vendor/brotli/dec/bit_reader.c
|
110
119
|
- vendor/brotli/dec/bit_reader.h
|
111
120
|
- vendor/brotli/dec/context.h
|
@@ -200,4 +209,7 @@ rubygems_version: 2.4.5
|
|
200
209
|
signing_key:
|
201
210
|
specification_version: 4
|
202
211
|
summary: Brotli compressor/decompressor
|
203
|
-
test_files:
|
212
|
+
test_files:
|
213
|
+
- spec/brotli_spec.rb
|
214
|
+
- spec/inflate_spec.rb
|
215
|
+
- spec/spec_helper.rb
|