mirror of
https://github.com/containers/skopeo.git
synced 2025-09-22 10:27:08 +00:00
Update to c/image v4.0.1
Update to use the correct c/image/v4 import path, work originally from https://github.com/containers/skopeo/pull/733 by Valentin Rothberg <rothberg@redhat.com>. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
committed by
Miloslav Trmač
parent
881edbf122
commit
7922028d7c
51
vendor/github.com/klauspost/compress/zstd/decoder.go
generated
vendored
51
vendor/github.com/klauspost/compress/zstd/decoder.go
generated
vendored
@@ -127,6 +127,9 @@ func (d *Decoder) Read(p []byte) (int, error) {
|
||||
}
|
||||
}
|
||||
if len(d.current.b) > 0 {
|
||||
if debug {
|
||||
println("returning", n, "still bytes left:", len(d.current.b))
|
||||
}
|
||||
// Only return error at end of block
|
||||
return n, nil
|
||||
}
|
||||
@@ -159,6 +162,9 @@ func (d *Decoder) Reset(r io.Reader) error {
|
||||
|
||||
// If bytes buffer and < 1MB, do sync decoding anyway.
|
||||
if bb, ok := r.(*bytes.Buffer); ok && bb.Len() < 1<<20 {
|
||||
if debug {
|
||||
println("*bytes.Buffer detected, doing sync decode, len:", bb.Len())
|
||||
}
|
||||
b := bb.Bytes()
|
||||
dst, err := d.DecodeAll(b, nil)
|
||||
if err == nil {
|
||||
@@ -167,6 +173,9 @@ func (d *Decoder) Reset(r io.Reader) error {
|
||||
d.current.b = dst
|
||||
d.current.err = err
|
||||
d.current.flushed = true
|
||||
if debug {
|
||||
println("sync decode to ", len(dst), "bytes, err:", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -193,7 +202,9 @@ func (d *Decoder) drainOutput() {
|
||||
d.current.cancel = nil
|
||||
}
|
||||
if d.current.d != nil {
|
||||
println("re-adding current decoder", d.current.d, len(d.decoders))
|
||||
if debug {
|
||||
printf("re-adding current decoder %p, decoders: %d", d.current.d, len(d.decoders))
|
||||
}
|
||||
d.decoders <- d.current.d
|
||||
d.current.d = nil
|
||||
d.current.b = nil
|
||||
@@ -206,7 +217,9 @@ func (d *Decoder) drainOutput() {
|
||||
select {
|
||||
case v := <-d.current.output:
|
||||
if v.d != nil {
|
||||
println("got decoder", v.d)
|
||||
if debug {
|
||||
printf("re-adding decoder %p", v.d)
|
||||
}
|
||||
d.decoders <- v.d
|
||||
}
|
||||
if v.err == errEndOfStream {
|
||||
@@ -259,20 +272,22 @@ func (d *Decoder) DecodeAll(input, dst []byte) ([]byte, error) {
|
||||
if d.current.err == ErrDecoderClosed {
|
||||
return dst, ErrDecoderClosed
|
||||
}
|
||||
//println(len(d.frames), len(d.decoders), d.current)
|
||||
|
||||
// Grab a block decoder and frame decoder.
|
||||
block, frame := <-d.decoders, <-d.frames
|
||||
defer func() {
|
||||
if debug {
|
||||
printf("re-adding decoder: %p", block)
|
||||
}
|
||||
d.decoders <- block
|
||||
frame.rawInput = nil
|
||||
frame.bBuf = nil
|
||||
d.frames <- frame
|
||||
}()
|
||||
if cap(dst) == 0 {
|
||||
// Allocate 1MB by default.
|
||||
dst = make([]byte, 0, 1<<20)
|
||||
}
|
||||
br := byteBuf(input)
|
||||
frame.bBuf = input
|
||||
|
||||
for {
|
||||
err := frame.reset(&br)
|
||||
err := frame.reset(&frame.bBuf)
|
||||
if err == io.EOF {
|
||||
return dst, nil
|
||||
}
|
||||
@@ -290,11 +305,21 @@ func (d *Decoder) DecodeAll(input, dst []byte) ([]byte, error) {
|
||||
dst = dst2
|
||||
}
|
||||
}
|
||||
if cap(dst) == 0 {
|
||||
// Allocate window size * 2 by default if nothing is provided and we didn't get frame content size.
|
||||
size := frame.WindowSize * 2
|
||||
// Cap to 1 MB.
|
||||
if size > 1<<20 {
|
||||
size = 1 << 20
|
||||
}
|
||||
dst = make([]byte, 0, frame.WindowSize)
|
||||
}
|
||||
|
||||
dst, err = frame.runDecoder(dst, block)
|
||||
if err != nil {
|
||||
return dst, err
|
||||
}
|
||||
if len(br) == 0 {
|
||||
if len(frame.bBuf) == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -305,6 +330,9 @@ func (d *Decoder) DecodeAll(input, dst []byte) ([]byte, error) {
|
||||
// If an error occurs d.err will be set.
|
||||
func (d *Decoder) nextBlock() {
|
||||
if d.current.d != nil {
|
||||
if debug {
|
||||
printf("re-adding current decoder %p", d.current.d)
|
||||
}
|
||||
d.decoders <- d.current.d
|
||||
d.current.d = nil
|
||||
}
|
||||
@@ -377,6 +405,9 @@ func (d *Decoder) startStreamDecoder(inStream chan decodeStream) {
|
||||
defer d.streamWg.Done()
|
||||
frame := newFrameDec(d.o)
|
||||
for stream := range inStream {
|
||||
if debug {
|
||||
println("got new stream")
|
||||
}
|
||||
br := readerWrapper{r: stream.r}
|
||||
decodeStream:
|
||||
for {
|
||||
|
Reference in New Issue
Block a user