wx3.0: fix various string printing on linux

wide-char must use %ls format on linux. Don't rely on non standard %s/%S
This commit is contained in:
Gregory Hainaut 2014-06-29 12:42:58 +02:00
parent cfa8e94e95
commit 76237955c7
9 changed files with 18 additions and 16 deletions

View File

@ -49,18 +49,18 @@ wxString DiagnosticOrigin::ToString( const wxChar* msg ) const
{ {
FastFormatUnicode message; FastFormatUnicode message;
message.Write( L"%s(%d) : assertion failed:\n", srcfile, line ); message.Write( L"%ls(%d) : assertion failed:\n", srcfile, line );
if( function != NULL ) if( function != NULL )
message.Write( " Function: %S\n", function ); message.Write( " Function: %s\n", function );
message.Write(L" Thread: %s\n", WX_STR(Threading::pxGetCurrentThreadName()) ); message.Write(L" Thread: %s\n", WX_STR(Threading::pxGetCurrentThreadName()) );
if( condition != NULL ) if( condition != NULL )
message.Write(L" Condition: %S\n", condition); message.Write(L" Condition: %ls\n", condition);
if( msg != NULL ) if( msg != NULL )
message.Write(L" Message: %S\n", msg); message.Write(L" Message: %ls\n", msg);
return message; return message;
} }

View File

@ -129,7 +129,7 @@ void* VirtualMemoryReserve::Reserve( size_t size, uptr base, uptr upper_bounds )
if (!m_baseptr || (upper_bounds != 0 && (((uptr)m_baseptr + reserved_bytes) > upper_bounds))) if (!m_baseptr || (upper_bounds != 0 && (((uptr)m_baseptr + reserved_bytes) > upper_bounds)))
{ {
DevCon.Warning( L"%s: host memory @ %s -> %s is unavailable; attempting to map elsewhere...", DevCon.Warning( L"%s: host memory @ %ls -> %ls is unavailable; attempting to map elsewhere...",
WX_STR(m_name), pxsPtr(base), pxsPtr(base + size) ); WX_STR(m_name), pxsPtr(base), pxsPtr(base + size) );
SafeSysMunmap(m_baseptr, reserved_bytes); SafeSysMunmap(m_baseptr, reserved_bytes);
@ -157,7 +157,7 @@ void* VirtualMemoryReserve::Reserve( size_t size, uptr base, uptr upper_bounds )
else else
mbkb.Write( "[%ukb]", reserved_bytes / 1024 ); mbkb.Write( "[%ukb]", reserved_bytes / 1024 );
DevCon.WriteLn( Color_Gray, L"%-32s @ %s -> %s %s", WX_STR(m_name), DevCon.WriteLn( Color_Gray, L"%-32s @ %ls -> %ls %ls", WX_STR(m_name),
pxsPtr(m_baseptr), pxsPtr((uptr)m_baseptr+reserved_bytes), mbkb.c_str()); pxsPtr(m_baseptr), pxsPtr((uptr)m_baseptr+reserved_bytes), mbkb.c_str());
return m_baseptr; return m_baseptr;
@ -295,7 +295,7 @@ void BaseVmReserveListener::OnPageFaultEvent(const PageFaultInfo& info, bool& ha
if (!m_allow_writes) if (!m_allow_writes)
{ {
pxFailRel( pxsFmt( pxFailRel( pxsFmt(
L"Memory Protection Fault @ %s (%s)\n" L"Memory Protection Fault @ %ls (%s)\n"
L"Modification of this reserve has been disabled (m_allow_writes == false).", L"Modification of this reserve has been disabled (m_allow_writes == false).",
pxsPtr(info.addr), WX_STR(m_name)) pxsPtr(info.addr), WX_STR(m_name))
); );

View File

@ -70,15 +70,15 @@ void pxLogConsole::DoLog( wxLogLevel level, const wxChar *szString, time_t t )
// fallthrough! // fallthrough!
case wxLOG_Message: case wxLOG_Message:
Console.WriteLn( L"[wx] %s", szString ); Console.WriteLn( L"[wx] %ls", szString );
break; break;
case wxLOG_Error: case wxLOG_Error:
Console.Error( L"[wx] %s", szString ); Console.Error( L"[wx] %ls", szString );
break; break;
case wxLOG_Warning: case wxLOG_Warning:
Console.Warning( L"[wx] %s", szString ); Console.Warning( L"[wx] %ls", szString );
break; break;
} }
} }

View File

@ -567,7 +567,7 @@ void GSFrame::OnUpdateTitle( wxTimerEvent& evt )
const u64& smode2 = *(u64*)PS2GS_BASE(GS_SMODE2); const u64& smode2 = *(u64*)PS2GS_BASE(GS_SMODE2);
SetTitle( pxsFmt( L"%s | %s (%s) | Limiter: %s | fps: %6.02f%s | State %d", SetTitle( pxsFmt( L"%s | %ls (%ls) | Limiter: %ls | fps: %6.02f%ls | State %d",
WX_STR(fromUTF8(gsDest)), WX_STR(fromUTF8(gsDest)),
(smode2 & 1) ? L"Interlaced" : L"Progressive", (smode2 & 1) ? L"Interlaced" : L"Progressive",
(smode2 & 2) ? L"frame" : L"field", (smode2 & 2) ? L"frame" : L"field",

View File

@ -57,8 +57,10 @@ void BaseMcdListView::LoadSaveColumns( IniInterface& ini )
{ {
const ListViewColumnInfo& cinfo = GetDefaultColumnInfo(col); const ListViewColumnInfo& cinfo = GetDefaultColumnInfo(col);
label.Clear(); label.Clear();
label.Write( L"ColumnWidth_%s", cinfo.name ); label.Write( L"ColumnWidth_%ls", cinfo.name );
int width = GetColumnWidth(col); int width = GetColumnWidth(col);
ini.Entry( label, width, cinfo.width ); ini.Entry( label, width, cinfo.width );
if (ini.IsLoading()) if (ini.IsLoading())

View File

@ -129,7 +129,7 @@ static void LoadBiosVersion( pxInputStream& fp, u32& version, wxString& descript
version = strtol(vermaj, (char**)NULL, 0) << 8; version = strtol(vermaj, (char**)NULL, 0) << 8;
version|= strtol(vermin, (char**)NULL, 0); version|= strtol(vermin, (char**)NULL, 0);
Console.WriteLn(L"Bios Found: %s", result.c_str()); Console.WriteLn(L"Bios Found: %ls", result.c_str());
description = result.c_str(); description = result.c_str();
zoneStr = fromUTF8(zone); zoneStr = fromUTF8(zone);

View File

@ -125,7 +125,7 @@ static void recEventTest()
// stackframe setup code in this function) // stackframe setup code in this function)
static void __fastcall StackFrameCheckFailed( int espORebp, int regval ) static void __fastcall StackFrameCheckFailed( int espORebp, int regval )
{ {
pxFailDev( pxsFmt( L"(R3000A Recompiler Stackframe) Sanity check failed on %s\n\tCurrent=%d; Saved=%d", pxFailDev( pxsFmt( L"(R3000A Recompiler Stackframe) Sanity check failed on %ls\n\tCurrent=%d; Saved=%d",
(espORebp==0) ? L"ESP" : L"EBP", regval, (espORebp==0) ? s_store_esp : s_store_ebp ) (espORebp==0) ? L"ESP" : L"EBP", regval, (espORebp==0) ? s_store_esp : s_store_ebp )
); );

View File

@ -273,7 +273,7 @@ _vifT static __fi u8* dVifsetVUptr(uint cl, uint wl, bool isFill) {
// it clears the buffer only. // it clears the buffer only.
static __fi void dVifRecLimit(int idx) { static __fi void dVifRecLimit(int idx) {
if (nVif[idx].recWritePtr > (nVif[idx].recReserve->GetPtrEnd() - _256kb)) { if (nVif[idx].recWritePtr > (nVif[idx].recReserve->GetPtrEnd() - _256kb)) {
DevCon.WriteLn(L"nVif Recompiler Cache Reset! [%s > %s]", DevCon.WriteLn(L"nVif Recompiler Cache Reset! [%ls > %ls]",
pxsPtr(nVif[idx].recWritePtr), pxsPtr(nVif[idx].recReserve->GetPtrEnd()) pxsPtr(nVif[idx].recWritePtr), pxsPtr(nVif[idx].recReserve->GetPtrEnd())
); );
nVif[idx].recReserve->Reset(); nVif[idx].recReserve->Reset();

View File

@ -426,7 +426,7 @@ void VifUnpackSSE_Init()
DevCon.WriteLn( "Unpack function generation complete. Generated function statistics:" ); DevCon.WriteLn( "Unpack function generation complete. Generated function statistics:" );
DevCon.Indent().WriteLn( DevCon.Indent().WriteLn(
L"Reserved buffer : %u bytes @ %s\n" L"Reserved buffer : %u bytes @ %ls\n"
L"x86 code generated : %u bytes\n", L"x86 code generated : %u bytes\n",
(uint)nVifUpkExec->GetCommittedBytes(), (uint)nVifUpkExec->GetCommittedBytes(),
pxsPtr(nVifUpkExec->GetPtr()), pxsPtr(nVifUpkExec->GetPtr()),