simpify Buffer.FillFrom()

pull/314/head
Darien Raymond 2016-12-05 15:30:08 +01:00
parent cf3eb0e77d
commit 10b75e8961
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 2 additions and 3 deletions

View File

@ -219,9 +219,8 @@ func (b *Buffer) Read(data []byte) (int, error) {
func (b *Buffer) FillFrom(reader io.Reader) (int, error) {
begin := b.Len()
b.Value = b.Value[:cap(b.Value)]
nBytes, err := reader.Read(b.Value[begin:])
b.Value = b.Value[:begin+nBytes]
nBytes, err := reader.Read(b.head[b.offset+begin:])
b.Value = b.head[:b.offset+begin+nBytes]
return nBytes, err
}