]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix wxBase compilation with UTF-8-based wxString under MSW.
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 23 May 2012 21:16:45 +0000 (21:16 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 23 May 2012 21:16:45 +0000 (21:16 +0000)
Use wxString::t_str() instead of wx_str() in Windows API function calls.

Closes #14325.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71546 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
src/common/appbase.cpp
src/common/strvararg.cpp
src/msw/crashrpt.cpp
src/msw/dde.cpp
src/msw/debughlp.cpp
src/msw/registry.cpp
src/msw/utils.cpp
src/msw/utilsexc.cpp
src/msw/volume.cpp

index 84a8530d226f4c26f973226693574aa5776c204d..2fb3acad3bd9d9f7ba60ed853c6d4c40b8887eea 100644 (file)
@@ -576,6 +576,7 @@ MSW:
 - Fix handling of composite windows in wxToolTip (Armel Asselin).
 - Add VT_I8 support to wxAutomationObject (PB).
 - Fix wxListbook size calculations to avoid spurious scrollbars.
+- Fix non-GUI code compilation with wxUSE_UNICODE_UTF8 (Kolya Kosenko).
 
 OSX:
 
index e10734beaafee36ee03db695c8466b7dae0f0490..3671f0ee0e395a53a6b94e9336f75b4c1dec7899 100644 (file)
@@ -1190,7 +1190,7 @@ bool DoShowAssertDialog(const wxString& msg)
               wxT("You can also choose [Cancel] to suppress ")
               wxT("further warnings.");
 
-    switch ( ::MessageBox(NULL, msgDlg.wx_str(), wxT("wxWidgets Debug Alert"),
+    switch ( ::MessageBox(NULL, msgDlg.t_str(), wxT("wxWidgets Debug Alert"),
                           MB_YESNOCANCEL | MB_ICONSTOP ) )
     {
         case IDYES:
index 484fe0f883acf24b14e65189a09da19085e7ac15..656359a6b275b81c345cce20317ad46ea6c22110 100644 (file)
@@ -435,6 +435,8 @@ class wxPrintfFormatConverterWchar : public wxFormatConverterBase<wchar_t>
 };
 #endif // !wxUSE_UTF8_LOCALE_ONLY
 
+#endif // __WINDOWS__/!__WINDOWS__
+
 #if wxUSE_UNICODE_UTF8
 class wxPrintfFormatConverterUtf8 : public wxFormatConverterBase<char>
 {
@@ -458,8 +460,6 @@ class wxPrintfFormatConverterUtf8 : public wxFormatConverterBase<char>
 };
 #endif // wxUSE_UNICODE_UTF8
 
-#endif // __WINDOWS__/!__WINDOWS__
-
 #if !wxUSE_UNICODE // FIXME-UTF8: remove
 class wxPrintfFormatConverterANSI : public wxFormatConverterBase<char>
 {
index 4bf374f676b875104fb1ad972fde62bf6f4187f2..e618107487f433121cc0a410f8cf8c9bcf0a7bfe 100644 (file)
@@ -247,7 +247,7 @@ bool wxCrashReportImpl::Generate(int flags, EXCEPTION_POINTERS *ep)
 /* static */
 void wxCrashReport::SetFileName(const wxString& filename)
 {
-    wxStrlcpy(gs_reportFilename, filename.wx_str(), WXSIZEOF(gs_reportFilename));
+    wxStrlcpy(gs_reportFilename, filename.t_str(), WXSIZEOF(gs_reportFilename));
 }
 
 /* static */
index bb85ac799a043ff2d3d3660f17dead15b70d477d..10f0dc792a2a8f9c7be63783ac01261e1ee52764 100644 (file)
@@ -1068,7 +1068,7 @@ static HSZ DDEAtomFromString(const wxString& s)
 {
     wxASSERT_MSG( DDEIdInst, wxT("DDE not initialized") );
 
-    HSZ hsz = DdeCreateStringHandle(DDEIdInst, (wxChar*)s.wx_str(), DDE_CP);
+    HSZ hsz = DdeCreateStringHandle(DDEIdInst, const_cast<wxChar*>(static_cast<const wxChar*>(s.t_str())), DDE_CP);
     if ( !hsz )
     {
         DDELogError(_("Failed to create DDE string"));
index 40396b7b1932a812660b2501b3fcb2e093e2b216..927c293a869b96a7a6a168bd0e39dfd928e1f100 100644 (file)
@@ -146,7 +146,7 @@ const wxString& wxDbgHelpDLL::GetErrorMessage()
 void wxDbgHelpDLL::LogError(const wxChar *func)
 {
     ::OutputDebugString(wxString::Format(wxT("dbghelp: %s() failed: %s\r\n"),
-                        func, wxSysErrorMsg(::GetLastError())).wx_str());
+                        func, wxSysErrorMsg(::GetLastError())).t_str());
 }
 
 // ----------------------------------------------------------------------------
index 948d9249fb4eee02421b035047a60e12135f22b2..80903a6e4d473375c01d9edc10d3c1a17ba13f41 100644 (file)
@@ -1057,7 +1057,7 @@ bool wxRegKey::SetValue(const wxString& szValue, const wxString& strValue)
       m_dwLastError = RegSetValueEx((HKEY) m_hKey,
                                     RegValueStr(szValue),
                                     (DWORD) RESERVED, REG_SZ,
-                                    (RegString)strValue.t_str(),
+                                    (RegString)static_cast<const TCHAR *>(strValue.t_str()),
                                     (strValue.Len() + 1)*sizeof(wxChar));
       if ( m_dwLastError == ERROR_SUCCESS )
         return true;
index 9c2d7590511975fed55ad84ba47f047cde8a2d26..d672e75d5dae388ed0acae26fa3789d9a82aab8f 100644 (file)
@@ -1115,8 +1115,8 @@ wxLoadUserResource(const void **outData,
     wxCHECK_MSG( outData && outLen, false, "output pointers can't be NULL" );
 
     HRSRC hResource = ::FindResource(instance,
-                                     resourceName.wx_str(),
-                                     resourceType.wx_str());
+                                     resourceName.t_str(),
+                                     resourceType.t_str());
     if ( !hResource )
         return false;
 
index 734ca45d118f7b2fd43e1126e5b4a9f162aa2e26..ae2558770ec549e0c24b9c2b7191091e9c4038b9 100644 (file)
@@ -857,14 +857,14 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler,
                     // WinCE requires appname to be non null
                     // Win32 allows for null
 #ifdef __WXWINCE__
-                 (wxChar *)
-                 moduleName.wx_str(),// application name
-                 (wxChar *)
-                 arguments.wx_str(), // arguments
+                 static_cast<const TCHAR *>(
+                 moduleName.t_str()),// application name
+                 const_cast<TCHAR *>(static_cast<const TCHAR *>(
+                 arguments.t_str())), // arguments
 #else
                  NULL,               // application name (use only cmd line)
-                 (wxChar *)
-                 command.wx_str(),   // full command line
+                 const_cast<TCHAR *>(static_cast<const TCHAR *>(
+                 command.t_str())),   // full command line
 #endif
                  NULL,               // security attributes: defaults for both
                  NULL,               //   the process and its main thread
@@ -872,7 +872,7 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler,
                  dwFlags,            // process creation flags
                  envBuffer.data(),   // environment (may be NULL which is fine)
                  useCwd              // initial working directory
-                    ? const_cast<wxChar *>(env->cwd.wx_str())
+                    ? const_cast<TCHAR *>(static_cast<const TCHAR *>(env->cwd.t_str()))
                     : NULL,          //     (or use the same)
                  &si,                // startup info (unused here)
                  &pi                 // process info
index 3ea20ccae4a7c4083df78632a96d5acf68ca5c5f..5414ddb7ad1c091162c99f51b770dd1ff17e2988 100644 (file)
@@ -288,7 +288,7 @@ static void BuildListFromNN(wxArrayString& list, NETRESOURCE* pResSrc,
                         // The filter function will not know mounted from unmounted, and neither do we unless
                         // we are iterating using RESOURCE_CONNECTED, in which case they all are mounted.
                         // Volumes on disconnected servers, however, will correctly show as unmounted.
-                        FilteredAdd(list, filename.wx_str(), flagsSet, flagsUnset&~wxFS_VOL_MOUNTED);
+                        FilteredAdd(list, filename.t_str(), flagsSet, flagsUnset&~wxFS_VOL_MOUNTED);
                         if (scope == RESOURCE_GLOBALNET)
                             s_fileInfo[filename].m_flags &= ~wxFS_VOL_MOUNTED;
                     }
@@ -502,7 +502,7 @@ bool wxFSVolumeBase::Create(const wxString& name)
 
     // Display name.
     SHFILEINFO fi;
-    long rc = SHGetFileInfo(m_volName.wx_str(), 0, &fi, sizeof(fi), SHGFI_DISPLAYNAME);
+    long rc = SHGetFileInfo(m_volName.t_str(), 0, &fi, sizeof(fi), SHGFI_DISPLAYNAME);
     if (!rc)
     {
         wxLogError(_("Cannot read typename from '%s'!"), m_volName.c_str());