[Box Backup-commit] COMMIT r3395 - box/trunk/lib/common

subversion at boxbackup.org subversion at boxbackup.org
Thu Sep 4 02:36:52 BST 2014


Author: chris
Date: 2014-09-04 02:36:52 +0100 (Thu, 04 Sep 2014)
New Revision: 3395

Modified:
   box/trunk/lib/common/BufferedStream.cpp
Log:
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.

Modified: box/trunk/lib/common/BufferedStream.cpp
===================================================================
--- box/trunk/lib/common/BufferedStream.cpp	2014-09-04 01:36:50 UTC (rev 3394)
+++ box/trunk/lib/common/BufferedStream.cpp	2014-09-04 01:36:52 UTC (rev 3395)
@@ -189,7 +189,9 @@
 // --------------------------------------------------------------------------
 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);
 }
 
 // --------------------------------------------------------------------------




More information about the Boxbackup-commit mailing list