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

subversion at boxbackup.org subversion
Wed Nov 11 19:22:58 GMT 2009


Author: chris
Date: 2009-11-11 19:22:52 +0000 (Wed, 11 Nov 2009)
New Revision: 2584

Modified:
   box/trunk/lib/common/Archive.h
Log:
Add methods to read and write exact 32-bit and 64-bit types.


Modified: box/trunk/lib/common/Archive.h
===================================================================
--- box/trunk/lib/common/Archive.h	2009-11-11 19:21:48 UTC (rev 2583)
+++ box/trunk/lib/common/Archive.h	2009-11-11 19:22:52 UTC (rev 2584)
@@ -45,6 +45,7 @@
 	{
 		Write((int) Item);
 	}
+	void WriteExact(uint32_t Item) { Write((int)Item); }
 	void Write(int Item)
 	{
 		int32_t privItem = htonl(Item);
@@ -55,6 +56,7 @@
 		int64_t privItem = box_hton64(Item);
 		mrStream.Write(&privItem, sizeof(privItem));
 	}
+	void WriteExact(uint64_t Item) { Write(Item); }
 	void Write(uint64_t Item)
 	{
 		uint64_t privItem = box_hton64(Item);
@@ -88,6 +90,7 @@
 			rItemOut = false;
 		}
 	}
+	void ReadExact(uint32_t &rItemOut) { Read((int&)rItemOut); }
 	void Read(int &rItemOut)
 	{
 		int32_t privItem;
@@ -106,6 +109,7 @@
 		}
 		rItemOut = box_ntoh64(privItem);
 	}
+	void ReadExact(uint64_t &rItemOut) { Read(rItemOut); }
 	void Read(uint64_t &rItemOut)
 	{
 		uint64_t privItem;




More information about the Boxbackup-commit mailing list