Skip to content

Commit

Permalink
zstd: Apply default config to ZipDecompressor without options (#608)
Browse files Browse the repository at this point in the history
This was only applied when options were specified.
  • Loading branch information
klauspost committed May 30, 2022
1 parent 8316d3d commit 3122d7a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion zstd/zip.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ const ZipMethodWinZip = 93
// See https://pkware.cachefly.net/webdocs/APPNOTE/APPNOTE-6.3.9.TXT
const ZipMethodPKWare = 20

var zipReaderPool sync.Pool
// zipReaderPool is the default reader pool.
var zipReaderPool = sync.Pool{New: func() interface{} {
z, err := NewReader(nil, WithDecoderLowmem(true), WithDecoderMaxWindow(128<<20), WithDecoderConcurrency(1))
if err != nil {
panic(err)
}
return z
}}

// newZipReader creates a pooled zip decompressor.
func newZipReader(opts ...DOption) func(r io.Reader) io.ReadCloser {
Expand Down

0 comments on commit 3122d7a

Please sign in to comment.