Fixed issues with decompress.Decoder
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user