mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-07-26 11:44:22 -04:00
simpify Buffer.FillFrom()
This commit is contained in:
parent
cf3eb0e77d
commit
10b75e8961
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user