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