mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-17 10:13:34 +00:00
rollup merge of #21736: sfackler/bufread-capacity-fix
We don't care about how much space the allocation has, but the actual usable space in the buffer. r? @alexcrichton
This commit is contained in:
commit
ebee4b4b37
@ -111,7 +111,7 @@ impl<R: Reader> Buffer for BufferedReader<R> {
|
||||
|
||||
impl<R: Reader> Reader for BufferedReader<R> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
|
||||
if self.pos == self.cap && buf.len() >= self.buf.capacity() {
|
||||
if self.pos == self.cap && buf.len() >= self.buf.len() {
|
||||
return self.inner.read(buf);
|
||||
}
|
||||
let nread = {
|
||||
|
Loading…
Reference in New Issue
Block a user