summaryrefslogtreecommitdiff
path: root/lib/win32
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2006-09-03 23:35:48 +0000
committerChris Wilson <chris+github@qwirx.com>2006-09-03 23:35:48 +0000
commit4434ff992787675604d9868d555887579d07fc52 (patch)
tree865204de364570beac25e7ea67c00ad1fc532d49 /lib/win32
parent054f818ce7f7d9e274da16b5ab6956792fa1b986 (diff)
(refs #3)
Return INVALID_HANDLE_VALUE instead of NULL from openfile() on failure
Diffstat (limited to 'lib/win32')
-rw-r--r--lib/win32/emu.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/win32/emu.cpp b/lib/win32/emu.cpp
index 37699bb1..f13fb899 100644
--- a/lib/win32/emu.cpp
+++ b/lib/win32/emu.cpp
@@ -486,18 +486,20 @@ std::string ConvertPathToAbsoluteUnicode(const char *pFileName)
//
// 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 @@ HANDLE openfile(const char *pFileName, int flags, int mode)
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 @@ HANDLE openfile(const char *pFileName, int flags, int mode)
{
::syslog(LOG_WARNING, "Failed to open file %s: "
"error %i", pFileName, GetLastError());
- return NULL;
+ return INVALID_HANDLE_VALUE;
}
return hdir;