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
1 changed files with 1 additions and 1 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue