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

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Mon Mar 5 00:06:26 GMT 2007


Author: chris
Date: 2007-03-05 00:06:26 +0000 (Mon, 05 Mar 2007)
New Revision: 1369

Modified:
   box/chris/merge/lib/common/FileStream.cpp
Log:
Add logging in remaining places where Common OSFileOpenError can be thrown.

Fix compile warning (signed vs unsigned comparison)

(refs #3, merges part of [1099], and [1368])


Modified: box/chris/merge/lib/common/FileStream.cpp
===================================================================
--- box/chris/merge/lib/common/FileStream.cpp	2007-03-05 00:02:37 UTC (rev 1368)
+++ box/chris/merge/lib/common/FileStream.cpp	2007-03-05 00:06:26 UTC (rev 1369)
@@ -10,6 +10,7 @@
 #include "Box.h"
 #include "FileStream.h"
 #include "CommonException.h"
+#include "Logging.h"
 
 #include <errno.h>
 
@@ -73,6 +74,7 @@
 #endif
 	{
 		MEMLEAKFINDER_NOT_A_LEAK(this);
+		BOX_ERROR("FileStream: called with invalid file handle");
 		THROW_EXCEPTION(CommonException, OSFileOpenError)
 	}
 #ifdef WIN32
@@ -100,6 +102,7 @@
 #endif
 	{
 		MEMLEAKFINDER_NOT_A_LEAK(this);
+		BOX_ERROR("FileStream: copying unopened file");
 		THROW_EXCEPTION(CommonException, OSFileOpenError)
 	}
 }
@@ -157,8 +160,8 @@
 	}
 	else
 	{
-		::syslog(LOG_ERR, "Failed to read from file: error %d",
-			GetLastError());
+		BOX_ERROR("Failed to read from file: " <<
+			GetErrorMessage(GetLastError()));
 		r = -1;
 	}
 #else
@@ -222,7 +225,7 @@
 		NULL
 		);
 
-	if ( (res == 0) || (numBytesWritten != NBytes))
+	if ((res == 0) || (numBytesWritten != (DWORD)NBytes))
 	{
 		// DWORD err = GetLastError();
 		THROW_EXCEPTION(CommonException, OSFileWriteError)




More information about the Boxbackup-commit mailing list