aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Kliuchnikov <eustas@google.com>2017-06-21 10:59:38 +0200
committerGitHub <noreply@github.com>2017-06-21 10:59:38 +0200
commita4d2956dedadd7ddf23a3674e12620f6d4058f42 (patch)
treecb6533066a2962d7a14e94cd081599aac62bf986
parent00cacfdff66f5eab84ddc985dec31d8bcaea1e41 (diff)
downloadbrotli-a4d2956dedadd7ddf23a3674e12620f6d4058f42.zip
brotli-a4d2956dedadd7ddf23a3674e12620f6d4058f42.tar.gz
brotli-a4d2956dedadd7ddf23a3674e12620f6d4058f42.tar.bz2
Update wrappers (#564)
* golang: add build information via `cgo.go` * golang: fix lgwin parameter behavior * Java: add proguard configuration
-rwxr-xr-xgo/cbrotli/cgo.go13
-rwxr-xr-xgo/cbrotli/writer.go9
-rwxr-xr-xjava/org/brotli/dec/BUILD1
-rwxr-xr-xjava/org/brotli/dec/proguard.cfg2
4 files changed, 20 insertions, 5 deletions
diff --git a/go/cbrotli/cgo.go b/go/cbrotli/cgo.go
new file mode 100755
index 0000000..f953f72
--- /dev/null
+++ b/go/cbrotli/cgo.go
@@ -0,0 +1,13 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Distributed under MIT license.
+// See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+
+package cbrotli
+
+// Inform golang build system that it should link brotli libraries.
+
+// #cgo LDFLAGS: -lbrotlicommon
+// #cgo LDFLAGS: -lbrotlidec
+// #cgo LDFLAGS: -lbrotlienc
+import "C"
diff --git a/go/cbrotli/writer.go b/go/cbrotli/writer.go
index 279a2f2..9fa75ab 100755
--- a/go/cbrotli/writer.go
+++ b/go/cbrotli/writer.go
@@ -56,9 +56,6 @@ type WriterOptions struct {
// LGWin is the base 2 logarithm of the sliding window size.
// Range is 10 to 24. 0 indicates automatic configuration based on Quality.
LGWin int
- // BufferSize is the number of bytes to use to buffer encoded output.
- // 0 indicates an implementation-defined default.
- BufferSize int
}
// Writer implements io.WriteCloser by writing Brotli-encoded data to an
@@ -80,8 +77,10 @@ func NewWriter(dst io.Writer, options WriterOptions) *Writer {
state := C.BrotliEncoderCreateInstance(nil, nil, nil)
C.BrotliEncoderSetParameter(
state, C.BROTLI_PARAM_QUALITY, (C.uint32_t)(options.Quality))
- C.BrotliEncoderSetParameter(
- state, C.BROTLI_PARAM_LGWIN, (C.uint32_t)(options.LGWin))
+ if options.LGWin > 0 {
+ C.BrotliEncoderSetParameter(
+ state, C.BROTLI_PARAM_LGWIN, (C.uint32_t)(options.LGWin))
+ }
return &Writer{
dst: dst,
state: state,
diff --git a/java/org/brotli/dec/BUILD b/java/org/brotli/dec/BUILD
index 32c5897..cd5d8d1 100755
--- a/java/org/brotli/dec/BUILD
+++ b/java/org/brotli/dec/BUILD
@@ -11,6 +11,7 @@ java_library(
["*.java"],
exclude = ["*Test*.java"],
),
+ proguard_specs = ["proguard.cfg"],
)
java_library(
diff --git a/java/org/brotli/dec/proguard.cfg b/java/org/brotli/dec/proguard.cfg
new file mode 100755
index 0000000..b5f047e
--- /dev/null
+++ b/java/org/brotli/dec/proguard.cfg
@@ -0,0 +1,2 @@
+# DictionaryData is an optionally / dynamically loaded built-in dictionary.
+-keep class org.brotli.dec.DictionaryData