From a4d2956dedadd7ddf23a3674e12620f6d4058f42 Mon Sep 17 00:00:00 2001 From: Eugene Kliuchnikov Date: Wed, 21 Jun 2017 10:59:38 +0200 Subject: Update wrappers (#564) * golang: add build information via `cgo.go` * golang: fix lgwin parameter behavior * Java: add proguard configuration --- go/cbrotli/cgo.go | 13 +++++++++++++ go/cbrotli/writer.go | 9 ++++----- 2 files changed, 17 insertions(+), 5 deletions(-) create mode 100755 go/cbrotli/cgo.go (limited to 'go') 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, -- cgit v1.1