Skip to content

Commit

Permalink
Don't create dest buffer, leave that to the lib.
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Wakely <[email protected]>
  • Loading branch information
StephenWakely committed Oct 16, 2024
1 parent 717c911 commit 4aaaa7b
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ func NewZstdNativeStrategy(level int) *ZstdNativeStrategy {

// Compress will compress the data with zstd
func (s *ZstdNativeStrategy) Compress(src []byte) ([]byte, error) {
return s.encoder.EncodeAll(src, make([]byte, 0, len(src))), nil
return s.encoder.EncodeAll(src, nil), nil
}

// Decompress will decompress the data with zstd
func (*ZstdNativeStrategy) Decompress(_ []byte) ([]byte, error) {
//return zstd.Decompress(nil, src)
return nil, nil
decoder, _ := zstd.NewReader(nil)
return decoder.DecodeAll(encoded, nil)

Check failure on line 44 in comp/serializer/compression/compressionimpl/strategy/zstd_native_strategy.go

View workflow job for this annotation

GitHub Actions / CodeQL-Build (javascript)

undefined: encoded

Check failure on line 44 in comp/serializer/compression/compressionimpl/strategy/zstd_native_strategy.go

View workflow job for this annotation

GitHub Actions / CodeQL-Build (python)

undefined: encoded

Check failure on line 44 in comp/serializer/compression/compressionimpl/strategy/zstd_native_strategy.go

View workflow job for this annotation

GitHub Actions / CodeQL-Build (cpp)

undefined: encoded
}

// CompressBound returns the worst case size needed for a destination buffer when using zstd
Expand Down

0 comments on commit 4aaaa7b

Please sign in to comment.