[Box Backup-commit] COMMIT r949 - box/chris/merge/lib/win32

subversion at fluffy.co.uk subversion at fluffy.co.uk
Mon Sep 4 00:35:48 BST 2006


Author: chris
Date: 2006-09-04 00:35:48 +0100 (Mon, 04 Sep 2006)
New Revision: 949

Modified:
   box/chris/merge/lib/win32/emu.cpp
Log:
(refs #3)

Return INVALID_HANDLE_VALUE instead of NULL from openfile() on failure


Modified: box/chris/merge/lib/win32/emu.cpp
===================================================================
--- box/chris/merge/lib/win32/emu.cpp	2006-09-03 22:54:58 UTC (rev 948)
+++ box/chris/merge/lib/win32/emu.cpp	2006-09-03 23:35:48 UTC (rev 949)
@@ -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