diff options
author | Chris Wilson <chris+github@qwirx.com> | 2006-10-27 19:17:00 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2006-10-27 19:17:00 +0000 |
commit | c782c09e6d73f85c6eb946a62f77d4d4a124a688 (patch) | |
tree | bbf5e30aba97a2e9a77aa7bb893551f04e06d2f1 | |
parent | 69159a442c66eabcff1fe1ac74401460a22c00ad (diff) |
Return INVALID_HANDLE_VALUE instead of NULL from openfile() on failure.
-rw-r--r-- | lib/win32/emu.cpp | 12 |
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; |