1
0
mirror of https://github.com/golang/go synced 2024-11-22 00:04:41 -07:00

bytes.Buffer.ReadFrom: fix bug.

Fixes #852.

R=rsc
CC=golang-dev
https://golang.org/cl/1680042
This commit is contained in:
Rob Pike 2010-06-15 17:40:47 -07:00
parent 6c08859b0e
commit 9baa7a51ba

View File

@ -134,7 +134,7 @@ func (b *Buffer) ReadFrom(r io.Reader) (n int64, err os.Error) {
b.off = 0 b.off = 0
} }
m, e := r.Read(b.buf[len(b.buf):cap(b.buf)]) m, e := r.Read(b.buf[len(b.buf):cap(b.buf)])
b.buf = b.buf[b.off : len(b.buf)+m] b.buf = b.buf[0 : len(b.buf)+m]
n += int64(m) n += int64(m)
if e == os.EOF { if e == os.EOF {
break break