Fix up check to bypass internal buffer

We don't care about how much space the allocation has, but the actual
usable space in the buffer.
This commit is contained in:
Steven Fackler 2015-01-28 20:12:00 -08:00
parent c5961ad06d
commit 26276f4751
1 changed files with 1 additions and 1 deletions

View File

@ -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 = {