Set cap when returning slice from chunkReader

query-exec-mode
Jack Christensen 2022-02-26 09:37:14 -06:00
parent e641d0a5ad
commit 2fad63c189
1 changed files with 2 additions and 2 deletions

View File

@ -41,7 +41,7 @@ func newChunkReader(r io.Reader, minBufSize int) *chunkReader {
func (r *chunkReader) Next(n int) (buf []byte, err error) {
// n bytes already in buf
if (r.wp - r.rp) >= n {
buf = r.buf[r.rp : r.rp+n]
buf = r.buf[r.rp : r.rp+n : r.rp+n]
r.rp += n
r.resetBufIfEmpty()
return buf, err
@ -63,7 +63,7 @@ func (r *chunkReader) Next(n int) (buf []byte, err error) {
return nil, err
}
buf = r.buf[r.rp : r.rp+n]
buf = r.buf[r.rp : r.rp+n : r.rp+n]
r.rp += n
r.resetBufIfEmpty()
return buf, nil