summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/klauspost/compress/s2/decode.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2022-08-13 16:14:26 +0200
committerGitHub <noreply@github.com>2022-08-13 16:14:26 +0200
commit6a3fc713978a0c1c9290a4afd08b47886b49b635 (patch)
treeaa62cd85cf5671646c75ee38b3fc140ef7edcea8 /vendor/github.com/klauspost/compress/s2/decode.go
parent3c4192ebf6a32e30cdd23a9644c2ceca72a006fa (diff)
downloadmatterbridge-msglm-6a3fc713978a0c1c9290a4afd08b47886b49b635.tar.gz
matterbridge-msglm-6a3fc713978a0c1c9290a4afd08b47886b49b635.tar.bz2
matterbridge-msglm-6a3fc713978a0c1c9290a4afd08b47886b49b635.zip
Update dependencies and go1.18 (#1873)
* Update dependencies and go1.18 * Exclude unnecessary linters and update build to go1.18
Diffstat (limited to 'vendor/github.com/klauspost/compress/s2/decode.go')
-rw-r--r--vendor/github.com/klauspost/compress/s2/decode.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/vendor/github.com/klauspost/compress/s2/decode.go b/vendor/github.com/klauspost/compress/s2/decode.go
index 2aba9e27..b5fa4d3f 100644
--- a/vendor/github.com/klauspost/compress/s2/decode.go
+++ b/vendor/github.com/klauspost/compress/s2/decode.go
@@ -791,6 +791,7 @@ func (r *Reader) Skip(n int64) error {
} else {
// Skip block completely
n -= int64(dLen)
+ r.blockStart += int64(dLen)
dLen = 0
}
r.i, r.j = 0, dLen
@@ -921,6 +922,15 @@ func (r *Reader) ReadSeeker(random bool, index []byte) (*ReadSeeker, error) {
err = r.index.LoadStream(rs)
if err != nil {
if err == ErrUnsupported {
+ // If we don't require random seeking, reset input and return.
+ if !random {
+ _, err = rs.Seek(pos, io.SeekStart)
+ if err != nil {
+ return nil, ErrCantSeek{Reason: "resetting stream returned: " + err.Error()}
+ }
+ r.index = nil
+ return &ReadSeeker{Reader: r}, nil
+ }
return nil, ErrCantSeek{Reason: "input stream does not contain an index"}
}
return nil, ErrCantSeek{Reason: "reading index returned: " + err.Error()}