Increase cgolz4 Writer buf len for older lz4 libs

This commit is contained in:
Nigel Tao committed 2019-12-23 17:30:50 +11:00
1 parent 6f7e9dfa26
commit 7d4a3a127d
2 files changed
+13 -1

No files matched your search

+7 -1
View File
@@ -346,6 +346,12 @@ func (c *WriterRecycler) Close() error {
return nil
}
func minDstLenForBlockMaxLen() uint64 {
return uint64(C.cgolz4_compress_min_dst_len(C.uint32_t(blockMaxLen)))
}
const writerBufLen = 2*blockMaxLen + 16
// Writer compresses to the lz4 format.
//
// Compressed bytes may be buffered and not sent to the underlying io.Writer
@@ -353,7 +359,7 @@ func (c *WriterRecycler) Close() error {
//
// The zero value is not usable until Reset is called.
type Writer struct {
buf [2 * blockMaxLen]byte
buf [writerBufLen]byte
j uint32
w io.Writer
begun bool