[Box Backup-commit] COMMIT r1586 - box/chris/merge/lib/common

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Sat Apr 28 18:13:34 BST 2007


Author: chris
Date: 2007-04-28 18:13:34 +0100 (Sat, 28 Apr 2007)
New Revision: 1586

Modified:
   box/chris/merge/lib/common/PartialReadStream.cpp
   box/chris/merge/lib/common/PartialReadStream.h
   box/chris/merge/lib/common/ReadGatherStream.cpp
Log:
Fix inability to handle streams over 2GB properly. (refs #3)


Modified: box/chris/merge/lib/common/PartialReadStream.cpp
===================================================================
--- box/chris/merge/lib/common/PartialReadStream.cpp	2007-04-28 17:11:36 UTC (rev 1585)
+++ box/chris/merge/lib/common/PartialReadStream.cpp	2007-04-28 17:13:34 UTC (rev 1586)
@@ -16,13 +16,15 @@
 // --------------------------------------------------------------------------
 //
 // Function
-//		Name:    PartialReadStream::PartialReadStream(IOStream &, int)
-//		Purpose: Constructor, taking another stream and the number of bytes
-//				 to be read from it.
+//		Name:    PartialReadStream::PartialReadStream(IOStream &,
+//			 pos_type)
+//		Purpose: Constructor, taking another stream and the number of
+//			 bytes to be read from it.
 //		Created: 2003/08/26
 //
 // --------------------------------------------------------------------------
-PartialReadStream::PartialReadStream(IOStream &rSource, int BytesToRead)
+PartialReadStream::PartialReadStream(IOStream &rSource,
+	pos_type BytesToRead)
 	: mrSource(rSource),
 	  mBytesLeft(BytesToRead)
 {

Modified: box/chris/merge/lib/common/PartialReadStream.h
===================================================================
--- box/chris/merge/lib/common/PartialReadStream.h	2007-04-28 17:11:36 UTC (rev 1585)
+++ box/chris/merge/lib/common/PartialReadStream.h	2007-04-28 17:13:34 UTC (rev 1586)
@@ -23,7 +23,7 @@
 class PartialReadStream : public IOStream
 {
 public:
-	PartialReadStream(IOStream &rSource, int BytesToRead);
+	PartialReadStream(IOStream &rSource, pos_type BytesToRead);
 	~PartialReadStream();
 private:
 	// no copying allowed
@@ -39,7 +39,7 @@
 
 private:
 	IOStream &mrSource;
-	int mBytesLeft;
+	pos_type mBytesLeft;
 };
 
 #endif // PARTIALREADSTREAM__H

Modified: box/chris/merge/lib/common/ReadGatherStream.cpp
===================================================================
--- box/chris/merge/lib/common/ReadGatherStream.cpp	2007-04-28 17:11:36 UTC (rev 1585)
+++ box/chris/merge/lib/common/ReadGatherStream.cpp	2007-04-28 17:13:34 UTC (rev 1586)
@@ -59,8 +59,9 @@
 //
 // Function
 //		Name:    ReadGatherStream::AddComponent(IOStream *)
-//		Purpose: Add a component to this stream, returning the index of this component
-//				 in the internal list. Use this with AddBlock()
+//		Purpose: Add a component to this stream, returning the index
+//			 of this component in the internal list. Use this
+//			 with AddBlock()
 //		Created: 10/12/03
 //
 // --------------------------------------------------------------------------
@@ -145,10 +146,10 @@
 		if(mPositionInCurrentBlock < mBlocks[mCurrentBlock].mLength)
 		{
 			// Read!
-			int s = mBlocks[mCurrentBlock].mLength - mPositionInCurrentBlock;
+			pos_type s = mBlocks[mCurrentBlock].mLength - mPositionInCurrentBlock;
 			if(s > bytesToRead) s = bytesToRead;
 			
-			int r = mComponents[mBlocks[mCurrentBlock].mComponent]->Read(buffer, s, Timeout);
+			pos_type r = mComponents[mBlocks[mCurrentBlock].mComponent]->Read(buffer, s, Timeout);
 			
 			// update variables
 			mPositionInCurrentBlock += r;




More information about the Boxbackup-commit mailing list