Fix wxBase compilation with UTF-8-based wxString under MSW.

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
This commit is contained in:
Vadim Zeitlin
2012-05-23 21:16:45 +00:00
parent 364f3b0700
commit b2b6da49e2
10 changed files with 19 additions and 18 deletions

View 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:

View 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:

View 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>
{

View 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 */

View 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"));

View 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());
}
// ----------------------------------------------------------------------------

View 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;

View 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;

View 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

View 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());