Use int64 for the length in the RewindReader

This commit is contained in:
Alexander Neumann
2018-03-04 10:40:42 +01:00
parent 99f7fd74e3
commit 929afc63d5
4 changed files with 21 additions and 21 deletions

View File

@@ -119,7 +119,7 @@ func (b *restBackend) Save(ctx context.Context, h restic.Handle, rd restic.Rewin
if err != nil {
return errors.Wrap(err, "NewRequest")
}
req.Header.Set("Content-Length", strconv.Itoa(rd.Length()))
req.Header.Set("Content-Length", strconv.FormatInt(rd.Length(), 10))
req.Header.Set("Content-Type", "application/octet-stream")
req.Header.Set("Accept", contentTypeV2)

View File

@@ -443,7 +443,7 @@ func (s *Suite) TestListCancel(t *testing.T) {
type errorCloser struct {
io.ReadSeeker
l int
l int64
t testing.TB
}
@@ -452,7 +452,7 @@ func (ec errorCloser) Close() error {
return errors.New("forbidden method close was called")
}
func (ec errorCloser) Length() int {
func (ec errorCloser) Length() int64 {
return ec.l
}
@@ -536,7 +536,7 @@ func (s *Suite) TestSave(t *testing.T) {
// wrap the tempfile in an errorCloser, so we can detect if the backend
// closes the reader
err = b.Save(context.TODO(), h, errorCloser{t: t, l: length, ReadSeeker: tmpfile})
err = b.Save(context.TODO(), h, errorCloser{t: t, l: int64(length), ReadSeeker: tmpfile})
if err != nil {
t.Fatal(err)
}