diff options
author | Chris Wilson <chris+github@qwirx.com> | 2014-09-04 01:36:52 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2014-09-04 01:36:52 +0000 |
commit | df3f2e6ac830bf6ad1a5ada8f07107b7c0622e68 (patch) | |
tree | 640de23469d8a93cd10d475681788b2745a4af65 | |
parent | 936592b07908cf51ad8de3699a628fd8bb6fda0b (diff) |
Fix error in BufferedStream::StreamDataLeft.
StreamDataLeft() incorrectly returned false when there was still data
buffered, which made IOStream::CopyStreamTo stop copying early, resulting
in incomplete files when copying data out of a BufferedStream. This meant
that tests involving a local protocol, where a BufferedStream was copied
directly to a RaidFile, resulted in corrupted files that would not verify.
-rw-r--r-- | lib/common/BufferedStream.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/common/BufferedStream.cpp b/lib/common/BufferedStream.cpp index cef0a73f..847cf66c 100644 --- a/lib/common/BufferedStream.cpp +++ b/lib/common/BufferedStream.cpp @@ -189,7 +189,9 @@ void BufferedStream::Close() // -------------------------------------------------------------------------- bool BufferedStream::StreamDataLeft() { - return mrSource.StreamDataLeft(); + // Return true if either the source has data left to read, or we have + // buffered data still to be read. + return mrSource.StreamDataLeft() || (mBufferPosition < mBufferSize); } // -------------------------------------------------------------------------- |