diff options
author | techknowlogick <techknowlogick@gitea.io> | 2021-02-28 18:08:33 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-28 18:08:33 -0500 |
commit | 47f6a4ec3f058f69b65fb6501d6ac98994b8f8da (patch) | |
tree | 4d1421a4c836de9de4014117419c151035c17eec /vendor/github.com/glycerine | |
parent | 030646eea41e17e58e11e73b19339630b6d6148e (diff) | |
download | gitea-47f6a4ec3f058f69b65fb6501d6ac98994b8f8da.tar.gz gitea-47f6a4ec3f058f69b65fb6501d6ac98994b8f8da.zip |
go1.16 (#14783)
Diffstat (limited to 'vendor/github.com/glycerine')
-rw-r--r-- | vendor/github.com/glycerine/go-unsnap-stream/unsnap.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/vendor/github.com/glycerine/go-unsnap-stream/unsnap.go b/vendor/github.com/glycerine/go-unsnap-stream/unsnap.go index 0d33949e96..995b5edfbf 100644 --- a/vendor/github.com/glycerine/go-unsnap-stream/unsnap.go +++ b/vendor/github.com/glycerine/go-unsnap-stream/unsnap.go @@ -79,7 +79,7 @@ func (f *SnappyFile) Read(p []byte) (n int, err error) { //nEncRead, nDecAdded, err := UnsnapOneFrame(f.Filep, &f.EncBuf, &f.DecBuf, f.Fname) _, _, err = UnsnapOneFrame(f.Reader, &f.EncBuf, &f.DecBuf, f.Fname) if err != nil && err != io.EOF { - panic(err) + return } n, _ = f.DecBuf.Read(p) @@ -265,10 +265,10 @@ func UnsnapOneFrame(r io.Reader, encBuf *FixedSizeRingBuf, outDecodedBuf *FixedS // ok=snappy: corrupt input // len(dec) == 0 // - panic(fmt.Sprintf("could not decode snappy stream: '%s' and len dec=%d and ok=%v\n", fname, len(dec), ok)) + err = fmt.Errorf("could not decode snappy stream: '%s' and len dec=%d and error='%v'\n", fname, len(dec), ok) // get back to caller with what we've got so far - return nEnc, nDec, nil + return nEnc, nDec, err } // fmt.Printf("ok, b is %#v , %#v\n", ok, dec) @@ -336,7 +336,8 @@ func UnsnapOneFrame(r io.Reader, encBuf *FixedSizeRingBuf, outDecodedBuf *FixedS } default: - panic(fmt.Sprintf("unrecognized/unsupported chunk type %#v", chunk_type)) + err = fmt.Errorf("unrecognized/unsupported chunk type %#v; on fname='%v'", chunk_type, fname) + return nEnc, nDec, err } } // end for{} |