]> git.saurik.com Git - wxWidgets.git/commitdiff
added workaround for Unicode functions not working under MSLU
authorVáclav Slavík <vslavik@fastmail.fm>
Mon, 31 Dec 2001 00:45:29 +0000 (00:45 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Mon, 31 Dec 2001 00:45:29 +0000 (00:45 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13258 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/filefn.h
src/common/filefn.cpp

index e076faacfc63381541ebb63643f03a9fee6ce0b7..b235f2b1dc99718016793f822cb05796d458a5d7 100644 (file)
@@ -80,7 +80,11 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString;
     #define   wxTell       _tell
 
     #if wxUSE_UNICODE
-        #define   wxOpen       _wopen
+        #if wxUSE_UNICODE_MSLU
+            WXDLLEXPORT int wxOpen(const wxChar *name, int flags, int mode);
+        #else
+            #define   wxOpen       _wopen
+        #endif
         #define   wxAccess     _waccess
 
         #define   wxMkDir      _wmkdir
index fc22b03128b011fa8f68633451895c808a9401fc..4bbe6747d1f7dd80aea9bd1ae7fb4fba14b6ab40 100644 (file)
@@ -1764,3 +1764,28 @@ bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special )
 #ifdef __VISUALC__
     #pragma warning(default:4706)   // assignment within conditional expression
 #endif // VC++
+
+//------------------------------------------------------------------------
+// Missing functions in Unicode for Win9x
+//------------------------------------------------------------------------
+
+// NB: MSLU only covers Win32 API, it doesn't provide Unicode implementation of
+//     libc functions. Unfortunately, some of MSVCRT wchar_t functions
+//     (e.g. _wopen) don't work on Windows 9x, so we have to workaround it
+//     by calling the char version. We still want to use wchar_t version on
+//     NT/2000/XP, though, because they allow for Unicode file names.
+#if wxUSE_UNICODE_MSLU
+
+    #if defined( __VISUALC__ ) \
+        || ( defined(__MINGW32__) && wxCHECK_W32API_VERSION( 0, 5 ) ) \
+        || ( defined(__MWERKS__) && defined(__WXMSW__) )
+    WXDLLEXPORT int wxOpen(const wxChar *name, int flags, int mode)
+    {
+        if ( wxGetOsVersion() == wxWINDOWS_NT )
+            return _wopen(name, flags, mode);
+        else
+            return _open(wxConvFile.cWX2MB(name), flags, mode);
+    }
+    #endif
+
+#endif // wxUSE_UNICODE_MSLU