Use wxPrintf in interactive tests
Remove unneeded calls to c_str() and mb_str().
This commit is contained in:
parent
57180d68c8
commit
a5b1a418bb
@ -107,8 +107,8 @@ void InteractiveInputTestCase::TestDiskInfo()
|
||||
else
|
||||
{
|
||||
wxPrintf(wxT("%sKb total, %sKb free on '%s'.\n"),
|
||||
(total / 1024).ToString().c_str(),
|
||||
(free / 1024).ToString().c_str(),
|
||||
(total / 1024).ToString(),
|
||||
(free / 1024).ToString(),
|
||||
pathname);
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@ void InteractiveInputTestCase::TestRegExInteractive()
|
||||
}
|
||||
else
|
||||
{
|
||||
wxPrintf(wxT("Pattern matches at '%s'\n"), re.GetMatch(text).c_str());
|
||||
wxPrintf(wxT("Pattern matches at '%s'\n"), re.GetMatch(text));
|
||||
|
||||
size_t start, len;
|
||||
for ( size_t n = 1; ; n++ )
|
||||
@ -177,7 +177,7 @@ void InteractiveInputTestCase::TestRegExInteractive()
|
||||
}
|
||||
|
||||
wxPrintf(wxT("Subexpr %u matched '%s'\n"),
|
||||
n, wxString(text + start, len).c_str());
|
||||
n, wxString(text + start, len));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -235,7 +235,7 @@ void InteractiveInputTestCase::TestFtpInteractive()
|
||||
else
|
||||
{
|
||||
wxPrintf(wxT("--- Connected to %s, current directory is '%s'\n"),
|
||||
hostname, ftp.Pwd().c_str());
|
||||
hostname, ftp.Pwd());
|
||||
}
|
||||
|
||||
wxChar buf[128];
|
||||
@ -263,16 +263,16 @@ void InteractiveInputTestCase::TestFtpInteractive()
|
||||
wxArrayString files;
|
||||
if ( !ftp.GetList(files, wildcard, start == wxT("LIST")) )
|
||||
{
|
||||
wxPrintf(wxT("ERROR: failed to get %s of files\n"), start.c_str());
|
||||
wxPrintf(wxT("ERROR: failed to get %s of files\n"), start);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxPrintf(wxT("--- %s of '%s' under '%s':\n"),
|
||||
start.c_str(), wildcard.c_str(), ftp.Pwd().c_str());
|
||||
start, wildcard, ftp.Pwd());
|
||||
size_t count = files.GetCount();
|
||||
for ( size_t n = 0; n < count; n++ )
|
||||
{
|
||||
wxPrintf(wxT("\t%s\n"), files[n].c_str());
|
||||
wxPrintf(wxT("\t%s\n"), files[n]);
|
||||
}
|
||||
wxPuts(wxT("--- End of the file list"));
|
||||
}
|
||||
@ -286,7 +286,7 @@ void InteractiveInputTestCase::TestFtpInteractive()
|
||||
wxPrintf(wxT(" (return code %c)"), ch);
|
||||
}
|
||||
|
||||
wxPrintf(wxT(", server reply:\n%s\n\n"), ftp.GetLastResult().c_str());
|
||||
wxPrintf(wxT(", server reply:\n%s\n\n"), ftp.GetLastResult());
|
||||
}
|
||||
}
|
||||
|
||||
@ -334,7 +334,7 @@ void InteractiveInputTestCase::TestDateTimeInteractive()
|
||||
}
|
||||
|
||||
wxPrintf(wxT("%s: day %u, week of month %u/%u, week of year %u\n"),
|
||||
dt.Format(wxT("%b %d, %Y")).c_str(),
|
||||
dt.Format(wxT("%b %d, %Y")),
|
||||
dt.GetDayOfYear(),
|
||||
dt.GetWeekOfMonth(wxDateTime::Monday_First),
|
||||
dt.GetWeekOfMonth(wxDateTime::Sunday_First),
|
||||
|
@ -104,17 +104,17 @@ void InteractiveOutputTestCase::TestDllListLoaded()
|
||||
for ( size_t n = 0; n < count; ++n )
|
||||
{
|
||||
const wxDynamicLibraryDetails& details = dlls[n];
|
||||
printf("%-45s", (const char *)details.GetPath().mb_str());
|
||||
wxPrintf("%-45s", details.GetPath());
|
||||
|
||||
void *addr wxDUMMY_INITIALIZE(NULL);
|
||||
size_t len wxDUMMY_INITIALIZE(0);
|
||||
if ( details.GetAddress(&addr, &len) )
|
||||
{
|
||||
printf(" %08lx:%08lx",
|
||||
wxPrintf(" %08lx:%08lx",
|
||||
(unsigned long)addr, (unsigned long)((char *)addr + len));
|
||||
}
|
||||
|
||||
printf(" %s\n", (const char *)details.GetVersion().mb_str());
|
||||
wxPrintf(" %s\n", details.GetVersion());
|
||||
}
|
||||
|
||||
wxPuts(wxEmptyString);
|
||||
@ -149,7 +149,7 @@ void InteractiveOutputTestCase::TestMimeEnum()
|
||||
if ( !filetype )
|
||||
{
|
||||
wxPrintf(wxT(" nothing known about the filetype '%s'!\n"),
|
||||
mimetypes[n].c_str());
|
||||
mimetypes[n]);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -166,8 +166,7 @@ void InteractiveOutputTestCase::TestMimeEnum()
|
||||
extsAll += exts[e];
|
||||
}
|
||||
|
||||
wxPrintf(wxT(" %s: %s (%s)\n"),
|
||||
mimetypes[n].c_str(), desc.c_str(), extsAll.c_str());
|
||||
wxPrintf(wxT(" %s: %s (%s)\n"), mimetypes[n], desc, extsAll);
|
||||
}
|
||||
|
||||
wxPuts(wxEmptyString);
|
||||
@ -194,7 +193,7 @@ void InteractiveOutputTestCase::TestMimeFilename()
|
||||
wxFileType *ft = wxTheMimeTypesManager->GetFileTypeFromExtension(ext);
|
||||
if ( !ft )
|
||||
{
|
||||
wxPrintf(wxT("WARNING: extension '%s' is unknown.\n"), ext.c_str());
|
||||
wxPrintf(wxT("WARNING: extension '%s' is unknown.\n"), ext);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -209,8 +208,7 @@ void InteractiveOutputTestCase::TestMimeFilename()
|
||||
else
|
||||
cmd = wxString(wxT('"')) + cmd + wxT('"');
|
||||
|
||||
wxPrintf(wxT("To open %s (%s) run:\n %s\n"),
|
||||
fname.c_str(), desc.c_str(), cmd.c_str());
|
||||
wxPrintf(wxT("To open %s (%s) run:\n %s\n"), fname, desc, cmd);
|
||||
|
||||
delete ft;
|
||||
}
|
||||
@ -261,12 +259,12 @@ void InteractiveOutputTestCase::TestOsInfo()
|
||||
int major, minor;
|
||||
wxGetOsVersion(&major, &minor);
|
||||
wxPrintf(wxT("Running under: %s, version %d.%d\n"),
|
||||
wxGetOsDescription().c_str(), major, minor);
|
||||
wxGetOsDescription(), major, minor);
|
||||
|
||||
wxPrintf(wxT("%ld free bytes of memory left.\n"), wxGetFreeMemory().ToLong());
|
||||
|
||||
wxPrintf(wxT("Host name is %s (%s).\n"),
|
||||
wxGetHostName().c_str(), wxGetFullHostName().c_str());
|
||||
wxGetHostName(), wxGetFullHostName());
|
||||
|
||||
wxPuts(wxEmptyString);
|
||||
#endif // TEST_INFO_FUNCTIONS
|
||||
@ -280,12 +278,12 @@ void InteractiveOutputTestCase::TestPlatformInfo()
|
||||
// get this platform
|
||||
wxPlatformInfo plat;
|
||||
|
||||
wxPrintf(wxT("Operating system family name is: %s\n"), plat.GetOperatingSystemFamilyName().c_str());
|
||||
wxPrintf(wxT("Operating system name is: %s\n"), plat.GetOperatingSystemIdName().c_str());
|
||||
wxPrintf(wxT("Port ID name is: %s\n"), plat.GetPortIdName().c_str());
|
||||
wxPrintf(wxT("Port ID short name is: %s\n"), plat.GetPortIdShortName().c_str());
|
||||
wxPrintf(wxT("Architecture is: %s\n"), plat.GetArchName().c_str());
|
||||
wxPrintf(wxT("Endianness is: %s\n"), plat.GetEndiannessName().c_str());
|
||||
wxPrintf(wxT("Operating system family name is: %s\n"), plat.GetOperatingSystemFamilyName());
|
||||
wxPrintf(wxT("Operating system name is: %s\n"), plat.GetOperatingSystemIdName());
|
||||
wxPrintf(wxT("Port ID name is: %s\n"), plat.GetPortIdName());
|
||||
wxPrintf(wxT("Port ID short name is: %s\n"), plat.GetPortIdShortName());
|
||||
wxPrintf(wxT("Architecture is: %s\n"), plat.GetArchName());
|
||||
wxPrintf(wxT("Endianness is: %s\n"), plat.GetEndiannessName());
|
||||
|
||||
wxPuts(wxEmptyString);
|
||||
#endif // TEST_INFO_FUNCTIONS
|
||||
@ -296,10 +294,10 @@ void InteractiveOutputTestCase::TestUserInfo()
|
||||
#ifdef TEST_INFO_FUNCTIONS
|
||||
wxPuts(wxT("*** Testing user info functions ***\n"));
|
||||
|
||||
wxPrintf(wxT("User id is:\t%s\n"), wxGetUserId().c_str());
|
||||
wxPrintf(wxT("User name is:\t%s\n"), wxGetUserName().c_str());
|
||||
wxPrintf(wxT("Home dir is:\t%s\n"), wxGetHomeDir().c_str());
|
||||
wxPrintf(wxT("Email address:\t%s\n"), wxGetEmailAddress().c_str());
|
||||
wxPrintf(wxT("User id is:\t%s\n"), wxGetUserId());
|
||||
wxPrintf(wxT("User name is:\t%s\n"), wxGetUserName());
|
||||
wxPrintf(wxT("Home dir is:\t%s\n"), wxGetHomeDir());
|
||||
wxPrintf(wxT("Email address:\t%s\n"), wxGetEmailAddress());
|
||||
|
||||
wxPuts(wxEmptyString);
|
||||
#endif // TEST_INFO_FUNCTIONS
|
||||
@ -332,23 +330,21 @@ public:
|
||||
protected:
|
||||
virtual void OnStackFrame(const wxStackFrame& frame)
|
||||
{
|
||||
printf("[%2d] ", (int) frame.GetLevel());
|
||||
wxPrintf("[%2d] ", (int) frame.GetLevel());
|
||||
|
||||
wxString name = frame.GetName();
|
||||
if ( !name.empty() )
|
||||
{
|
||||
printf("%-20.40s", (const char*)name.mb_str());
|
||||
wxPrintf("%-20.40s", name);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("0x%08lx", (unsigned long)frame.GetAddress());
|
||||
wxPrintf("0x%08lx", (unsigned long)frame.GetAddress());
|
||||
}
|
||||
|
||||
if ( frame.HasSourceLocation() )
|
||||
{
|
||||
printf("\t%s:%d",
|
||||
(const char*)frame.GetFileName().mb_str(),
|
||||
(int)frame.GetLine());
|
||||
wxPrintf("\t%s:%d", frame.GetFileName(), (int)frame.GetLine());
|
||||
}
|
||||
|
||||
puts("");
|
||||
@ -356,9 +352,7 @@ protected:
|
||||
wxString type, val;
|
||||
for ( size_t n = 0; frame.GetParam(n, &type, &name, &val); n++ )
|
||||
{
|
||||
printf("\t%s %s = %s\n", (const char*)type.mb_str(),
|
||||
(const char*)name.mb_str(),
|
||||
(const char*)val.mb_str());
|
||||
wxPrintf("\t%s %s = %s\n", type, name, val);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -395,30 +389,30 @@ void InteractiveOutputTestCase::TestStandardPaths()
|
||||
wxTheApp->SetAppName(wxT("console"));
|
||||
|
||||
wxStandardPathsBase& stdp = wxStandardPaths::Get();
|
||||
wxPrintf(wxT("Config dir (sys):\t%s\n"), stdp.GetConfigDir().c_str());
|
||||
wxPrintf(wxT("Config dir (user):\t%s\n"), stdp.GetUserConfigDir().c_str());
|
||||
wxPrintf(wxT("Data dir (sys):\t\t%s\n"), stdp.GetDataDir().c_str());
|
||||
wxPrintf(wxT("Data dir (sys local):\t%s\n"), stdp.GetLocalDataDir().c_str());
|
||||
wxPrintf(wxT("Data dir (user):\t%s\n"), stdp.GetUserDataDir().c_str());
|
||||
wxPrintf(wxT("Data dir (user local):\t%s\n"), stdp.GetUserLocalDataDir().c_str());
|
||||
wxPrintf(wxT("Documents dir:\t\t%s\n"), stdp.GetDocumentsDir().c_str());
|
||||
wxPrintf(wxT("Cache dir:\t\t%s\n"), stdp.GetUserDir(wxStandardPaths::Dir_Cache).c_str());
|
||||
wxPrintf(wxT("Desktop dir:\t\t%s\n"), stdp.GetUserDir(wxStandardPaths::Dir_Desktop).c_str());
|
||||
wxPrintf(wxT("Downloads dir:\t\t%s\n"), stdp.GetUserDir(wxStandardPaths::Dir_Downloads).c_str());
|
||||
wxPrintf(wxT("Music dir:\t\t%s\n"), stdp.GetUserDir(wxStandardPaths::Dir_Music).c_str());
|
||||
wxPrintf(wxT("Pictures dir:\t\t%s\n"), stdp.GetUserDir(wxStandardPaths::Dir_Pictures).c_str());
|
||||
wxPrintf(wxT("Videos dir:\t\t%s\n"), stdp.GetUserDir(wxStandardPaths::Dir_Videos).c_str());
|
||||
wxPrintf(wxT("Executable path:\t%s\n"), stdp.GetExecutablePath().c_str());
|
||||
wxPrintf(wxT("Plugins dir:\t\t%s\n"), stdp.GetPluginsDir().c_str());
|
||||
wxPrintf(wxT("Resources dir:\t\t%s\n"), stdp.GetResourcesDir().c_str());
|
||||
wxPrintf(wxT("Config dir (sys):\t%s\n"), stdp.GetConfigDir());
|
||||
wxPrintf(wxT("Config dir (user):\t%s\n"), stdp.GetUserConfigDir());
|
||||
wxPrintf(wxT("Data dir (sys):\t\t%s\n"), stdp.GetDataDir());
|
||||
wxPrintf(wxT("Data dir (sys local):\t%s\n"), stdp.GetLocalDataDir());
|
||||
wxPrintf(wxT("Data dir (user):\t%s\n"), stdp.GetUserDataDir());
|
||||
wxPrintf(wxT("Data dir (user local):\t%s\n"), stdp.GetUserLocalDataDir());
|
||||
wxPrintf(wxT("Documents dir:\t\t%s\n"), stdp.GetDocumentsDir());
|
||||
wxPrintf(wxT("Cache dir:\t\t%s\n"), stdp.GetUserDir(wxStandardPaths::Dir_Cache));
|
||||
wxPrintf(wxT("Desktop dir:\t\t%s\n"), stdp.GetUserDir(wxStandardPaths::Dir_Desktop));
|
||||
wxPrintf(wxT("Downloads dir:\t\t%s\n"), stdp.GetUserDir(wxStandardPaths::Dir_Downloads));
|
||||
wxPrintf(wxT("Music dir:\t\t%s\n"), stdp.GetUserDir(wxStandardPaths::Dir_Music));
|
||||
wxPrintf(wxT("Pictures dir:\t\t%s\n"), stdp.GetUserDir(wxStandardPaths::Dir_Pictures));
|
||||
wxPrintf(wxT("Videos dir:\t\t%s\n"), stdp.GetUserDir(wxStandardPaths::Dir_Videos));
|
||||
wxPrintf(wxT("Executable path:\t%s\n"), stdp.GetExecutablePath());
|
||||
wxPrintf(wxT("Plugins dir:\t\t%s\n"), stdp.GetPluginsDir());
|
||||
wxPrintf(wxT("Resources dir:\t\t%s\n"), stdp.GetResourcesDir());
|
||||
wxPrintf(wxT("Localized res. dir:\t%s\n"),
|
||||
stdp.GetLocalizedResourcesDir(wxT("fr")).c_str());
|
||||
stdp.GetLocalizedResourcesDir(wxT("fr")));
|
||||
wxPrintf(wxT("Message catalogs dir:\t%s\n"),
|
||||
stdp.GetLocalizedResourcesDir
|
||||
(
|
||||
wxT("fr"),
|
||||
wxStandardPaths::ResourceCat_Messages
|
||||
).c_str());
|
||||
));
|
||||
|
||||
wxPuts("\n");
|
||||
#endif // TEST_STDPATHS
|
||||
@ -475,8 +469,8 @@ void InteractiveOutputTestCase::TestFSVolume()
|
||||
|
||||
wxPrintf(wxT("%u: %s (%s), %s, %s, %s\n"),
|
||||
n + 1,
|
||||
vol.GetDisplayName().c_str(),
|
||||
vol.GetName().c_str(),
|
||||
vol.GetDisplayName(),
|
||||
vol.GetName(),
|
||||
volumeKinds[vol.GetKind()],
|
||||
vol.IsWritable() ? wxT("rw") : wxT("ro"),
|
||||
vol.GetFlags() & wxFS_VOL_REMOVABLE ? wxT("removable")
|
||||
|
Loading…
Reference in New Issue
Block a user