aboutsummaryrefslogtreecommitdiffstats
path: root/formats/packfile/common.go
diff options
context:
space:
mode:
Diffstat (limited to 'formats/packfile/common.go')
-rw-r--r--formats/packfile/common.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/formats/packfile/common.go b/formats/packfile/common.go
index 4a97dc7..06c63d4 100644
--- a/formats/packfile/common.go
+++ b/formats/packfile/common.go
@@ -6,20 +6,17 @@ import (
)
type trackingReader struct {
- r io.Reader
- n int
+ r io.Reader
+ position int64
}
-func (t *trackingReader) Pos() int { return t.n }
-
func (t *trackingReader) Read(p []byte) (n int, err error) {
n, err = t.r.Read(p)
if err != nil {
return 0, err
}
- t.n += n
-
+ t.position += int64(n)
return n, err
}
@@ -34,6 +31,6 @@ func (t *trackingReader) ReadByte() (c byte, err error) {
return 0, fmt.Errorf("read %d bytes, should have read just 1", n)
}
- t.n += n // n is 1
+ t.position++
return p[0], nil
}