mirror of
https://github.com/rclone/rclone.git
synced 2024-11-26 02:14:42 +01:00
Remove io.SeekStart and replace with 0 as it is go 1.7 only
This commit is contained in:
parent
5b8327038a
commit
93e84403bb
@ -44,7 +44,7 @@ func (fh *ReadFileHandle) seek(offset int64) error {
|
||||
// Can we seek it directly?
|
||||
if do, ok := fh.r.(io.Seeker); ok {
|
||||
fs.Debug(fh.o, "ReadFileHandle.seek from %d to %d (io.Seeker)", fh.offset, offset)
|
||||
_, err := do.Seek(offset, io.SeekStart)
|
||||
_, err := do.Seek(offset, 0)
|
||||
if err != nil {
|
||||
fs.Debug(fh.o, "ReadFileHandle.Read io.Seeker failed: %v", err)
|
||||
return err
|
||||
|
@ -542,7 +542,7 @@ func (c *cipher) newDecrypterSeek(open OpenAtOffset, offset int64) (fh *decrypte
|
||||
}
|
||||
fh.open = open // will be called by fh.Seek
|
||||
if offset != 0 {
|
||||
_, err = fh.Seek(offset, io.SeekStart)
|
||||
_, err = fh.Seek(offset, 0)
|
||||
if err != nil {
|
||||
_ = fh.Close()
|
||||
return nil, err
|
||||
@ -593,7 +593,7 @@ func (fh *decrypter) Seek(offset int64, whence int) (int64, error) {
|
||||
if fh.open == nil {
|
||||
return 0, fh.finish(errors.New("can't seek - not initialised with newDecrypterSeek"))
|
||||
}
|
||||
if whence != io.SeekStart {
|
||||
if whence != 0 {
|
||||
return 0, fh.finish(errors.New("can only seek from the start"))
|
||||
}
|
||||
|
||||
@ -606,7 +606,7 @@ func (fh *decrypter) Seek(offset int64, whence int) (int64, error) {
|
||||
|
||||
// Can we seek it directly?
|
||||
if do, ok := fh.rc.(io.Seeker); ok {
|
||||
_, err := do.Seek(offset, io.SeekStart)
|
||||
_, err := do.Seek(offset, 0)
|
||||
if err != nil {
|
||||
return 0, fh.finish(err)
|
||||
}
|
||||
|
@ -895,7 +895,7 @@ func TestNewDecrypterSeek(t *testing.T) {
|
||||
// Now try decoding it with a single open and lots of seeks
|
||||
rc, err := c.DecryptDataSeek(open, 0)
|
||||
for _, offset := range trials {
|
||||
_, err := rc.Seek(int64(offset), io.SeekStart)
|
||||
_, err := rc.Seek(int64(offset), 0)
|
||||
assert.NoError(t, err)
|
||||
|
||||
seekedDecrypted, err := ioutil.ReadAll(rc)
|
||||
|
Loading…
Reference in New Issue
Block a user