Fixed issues with decompress.Decoder

This commit is contained in:
Caleb Gardner
2023-01-05 01:29:23 -06:00
parent 089ef53c8c
commit ce2e45ceec
4 changed files with 4 additions and 13 deletions
+1 -1
View File
@@ -18,5 +18,5 @@ type Resetable interface {
type Decoder interface {
//Decodes a chunk of data all at once.
Decode(in []byte, outSize int) ([]byte, error)
Decode(in []byte) ([]byte, error)
}
-9
View File
@@ -16,12 +16,3 @@ func (l Lz4) Reset(old, src io.Reader) error {
old.(*lz4.Reader).Reset(src)
return nil
}
func (l Lz4) Decode(in []byte, outSize int) (out []byte, err error) {
out = make([]byte, outSize)
outLen, err := lz4.UncompressBlock(in, out)
if outLen < outSize {
out = out[:outLen]
}
return
}
+2 -2
View File
@@ -19,9 +19,9 @@ func (z Zstd) Reset(old, src io.Reader) error {
return old.(*zstd.Decoder).Reset(src)
}
func (z Zstd) Decode(in []byte, outSize int) ([]byte, error) {
func (z Zstd) Decode(in []byte) ([]byte, error) {
if z.writeToReader == nil {
z.writeToReader, _ = zstd.NewReader(nil)
}
return z.writeToReader.DecodeAll(in, make([]byte, outSize))
return z.writeToReader.DecodeAll(in, nil)
}