[Box Backup-commit] COMMIT r1122 - box/trunk/lib/win32

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Fri Oct 27 20:17:00 BST 2006


Author: chris
Date: 2006-10-27 20:17:00 +0100 (Fri, 27 Oct 2006)
New Revision: 1122

Modified:
   box/trunk/lib/win32/emu.cpp
Log:
Return INVALID_HANDLE_VALUE instead of NULL from openfile() on failure.


Modified: box/trunk/lib/win32/emu.cpp
===================================================================
--- box/trunk/lib/win32/emu.cpp	2006-10-27 19:15:49 UTC (rev 1121)
+++ box/trunk/lib/win32/emu.cpp	2006-10-27 19:17:00 UTC (rev 1122)
@@ -486,18 +486,20 @@
 //
 // Function
 //		Name:    openfile
-//		Purpose: replacement for any open calls - handles unicode filenames - supplied in utf8
+//		Purpose: replacement for any open calls - handles unicode 
+//			filenames - supplied in utf8
 //		Created: 25th October 2004
 //
 // --------------------------------------------------------------------------
 HANDLE openfile(const char *pFileName, int flags, int mode)
 {
-	std::string AbsPathWithUnicode = ConvertPathToAbsoluteUnicode(pFileName);
+	std::string AbsPathWithUnicode = 
+		ConvertPathToAbsoluteUnicode(pFileName);
 	
 	if (AbsPathWithUnicode.size() == 0)
 	{
 		// error already logged by ConvertPathToAbsoluteUnicode()
-		return NULL;
+		return INVALID_HANDLE_VALUE;
 	}
 	
 	WCHAR* pBuffer = ConvertUtf8ToWideString(AbsPathWithUnicode.c_str());
@@ -506,7 +508,7 @@
 	if (pBuffer == NULL)
 	{
 		// error already logged by ConvertUtf8ToWideString()
-		return NULL;
+		return INVALID_HANDLE_VALUE;
 	}
 
 	// flags could be O_WRONLY | O_CREAT | O_RDONLY
@@ -553,7 +555,7 @@
 	{
 		::syslog(LOG_WARNING, "Failed to open file %s: "
 			"error %i", pFileName, GetLastError());
-		return NULL;
+		return INVALID_HANDLE_VALUE;
 	}
 
 	return hdir;




More information about the Boxbackup-commit mailing list