diff options
author | Matthew Heon <mheon@redhat.com> | 2020-08-24 17:39:46 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2020-08-27 15:03:01 -0400 |
commit | 1a30bcde30bfdffd90d01455e56940703bf407a5 (patch) | |
tree | dc69f5929bc97602116fa8ea1e5d5d94aa4c6028 /vendor/github.com/klauspost/compress/huff0/compress.go | |
parent | 72c5b35ea5db44ca1c81a688d90f5c3aa8f8262e (diff) | |
download | podman-1a30bcde30bfdffd90d01455e56940703bf407a5.tar.gz podman-1a30bcde30bfdffd90d01455e56940703bf407a5.tar.bz2 podman-1a30bcde30bfdffd90d01455e56940703bf407a5.zip |
Update c/storage to v1.23.2
Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'vendor/github.com/klauspost/compress/huff0/compress.go')
-rw-r--r-- | vendor/github.com/klauspost/compress/huff0/compress.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/vendor/github.com/klauspost/compress/huff0/compress.go b/vendor/github.com/klauspost/compress/huff0/compress.go index 0843cb014..f9ed5f830 100644 --- a/vendor/github.com/klauspost/compress/huff0/compress.go +++ b/vendor/github.com/klauspost/compress/huff0/compress.go @@ -77,8 +77,11 @@ func compress(in []byte, s *Scratch, compressor func(src []byte) ([]byte, error) // Each symbol present maximum once or too well distributed. return nil, false, ErrIncompressible } - - if s.Reuse == ReusePolicyPrefer && canReuse { + if s.Reuse == ReusePolicyMust && !canReuse { + // We must reuse, but we can't. + return nil, false, ErrIncompressible + } + if (s.Reuse == ReusePolicyPrefer || s.Reuse == ReusePolicyMust) && canReuse { keepTable := s.cTable keepTL := s.actualTableLog s.cTable = s.prevTable @@ -90,6 +93,9 @@ func compress(in []byte, s *Scratch, compressor func(src []byte) ([]byte, error) s.OutData = s.Out return s.Out, true, nil } + if s.Reuse == ReusePolicyMust { + return nil, false, ErrIncompressible + } // Do not attempt to re-use later. s.prevTable = s.prevTable[:0] } |