summaryrefslogtreecommitdiff
path: root/vendor/github.com/klauspost/compress/zstd/encoder.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-04-12 18:25:00 +0200
committerGitHub <noreply@github.com>2021-04-12 18:25:00 +0200
commit7203e0a76a82e278b6a41e7a5851463a0b2f571e (patch)
tree04252a3261ecba007ace7055154fc8d2ce8a9aea /vendor/github.com/klauspost/compress/zstd/encoder.go
parent3803a2630f2bc53f18cbf2b7a825ff1b068a0fb7 (diff)
parent3627c4b691a357fc531c2761f07ccfecf937dd12 (diff)
downloadpodman-7203e0a76a82e278b6a41e7a5851463a0b2f571e.tar.gz
podman-7203e0a76a82e278b6a41e7a5851463a0b2f571e.tar.bz2
podman-7203e0a76a82e278b6a41e7a5851463a0b2f571e.zip
Merge pull request #9994 from containers/dependabot/go_modules/github.com/containers/image/v5-5.11.0
Bump github.com/containers/image/v5 from 5.10.5 to 5.11.0
Diffstat (limited to 'vendor/github.com/klauspost/compress/zstd/encoder.go')
-rw-r--r--vendor/github.com/klauspost/compress/zstd/encoder.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/vendor/github.com/klauspost/compress/zstd/encoder.go b/vendor/github.com/klauspost/compress/zstd/encoder.go
index f5759211d..6f0265099 100644
--- a/vendor/github.com/klauspost/compress/zstd/encoder.go
+++ b/vendor/github.com/klauspost/compress/zstd/encoder.go
@@ -106,7 +106,7 @@ func (e *Encoder) Reset(w io.Writer) {
s.encoder = e.o.encoder()
}
if s.writing == nil {
- s.writing = &blockEnc{}
+ s.writing = &blockEnc{lowMem: e.o.lowMem}
s.writing.init()
}
s.writing.initNewEncode()
@@ -176,6 +176,12 @@ func (e *Encoder) nextBlock(final bool) error {
}
if !s.headerWritten {
// If we have a single block encode, do a sync compression.
+ if final && len(s.filling) == 0 && !e.o.fullZero {
+ s.headerWritten = true
+ s.fullFrameWritten = true
+ s.eofWritten = true
+ return nil
+ }
if final && len(s.filling) > 0 {
s.current = e.EncodeAll(s.filling, s.current[:0])
var n2 int
@@ -471,7 +477,7 @@ func (e *Encoder) EncodeAll(src, dst []byte) []byte {
}
// If less than 1MB, allocate a buffer up front.
- if len(dst) == 0 && cap(dst) == 0 && len(src) < 1<<20 {
+ if len(dst) == 0 && cap(dst) == 0 && len(src) < 1<<20 && !e.o.lowMem {
dst = make([]byte, 0, len(src))
}
dst, err := fh.appendTo(dst)