]> Cypherpunks.ru repositories - gostls13.git/commitdiff
io: remove manual SectionReader.Size in SectionReader.ReadAt
authorJorropo <jorropo.pgm@gmail.com>
Fri, 2 Jun 2023 18:20:18 +0000 (20:20 +0200)
committerGopher Robot <gobot@golang.org>
Sat, 5 Aug 2023 23:26:21 +0000 (23:26 +0000)
Change-Id: Ib3e8953dbdefa2b78c31b1bcbf0909bce248e423
Reviewed-on: https://go-review.googlesource.com/c/go/+/500475
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>

src/io/io.go

index 01f36e0ce133b7fe7083858b712fc90343133dfe..ce269a7b9f568dcc012ca0bac3f8cdccd91e90d8 100644 (file)
@@ -540,7 +540,7 @@ func (s *SectionReader) Seek(offset int64, whence int) (int64, error) {
 }
 
 func (s *SectionReader) ReadAt(p []byte, off int64) (n int, err error) {
-       if off < 0 || off >= s.limit-s.base {
+       if off < 0 || off >= s.Size() {
                return 0, EOF
        }
        off += s.base