Implemented the various printf() functions under

Unicode with their GNU libc 2.2 funtions. This
    saves us some unicode<->ansi conversion and we
    no longer need the experimental printf() code
    in string.cpp. I had to implement wxSprintf()
    using wxSnprintf() as the former doesn't exist
    in Unicode GNU libc 2.2.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16442 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2002-08-10 11:58:15 +00:00
parent e6ccaf1a99
commit a59c124d06
4 changed files with 84 additions and 100 deletions

View File

@@ -393,85 +393,6 @@ WXDLLEXPORT int wxRename(const wxChar *oldpath, const wxChar *newpath)
{
return rename( wxConvFile.cWX2MB(oldpath), wxConvFile.cWX2MB(newpath) );
}
int WXDLLEXPORT wxPrintf(const wxChar *fmt, ...)
{
va_list argptr;
int ret;
va_start(argptr, fmt);
ret = wxVprintf(fmt, argptr);
va_end(argptr);
return ret;
}
int WXDLLEXPORT wxVprintf(const wxChar *fmt, va_list argptr)
{
wxString str;
str.PrintfV(fmt,argptr);
printf("%s", (const char*)str.mb_str());
return str.Len();
}
int WXDLLEXPORT wxFprintf(FILE *stream, const wxChar *fmt, ...)
{
va_list argptr;
int ret;
va_start(argptr, fmt);
ret = wxVfprintf(stream, fmt, argptr);
va_end(argptr);
return ret;
}
int WXDLLEXPORT wxVfprintf(FILE *stream, const wxChar *fmt, va_list argptr)
{
wxString str;
str.PrintfV(fmt,argptr);
fprintf(stream, "%s", (const char*)str.mb_str());
return str.Len();
}
int WXDLLEXPORT wxSprintf(wxChar *buf, const wxChar *fmt, ...)
{
va_list argptr;
int ret;
va_start(argptr, fmt);
ret = wxVsprintf(buf, fmt, argptr);
va_end(argptr);
return ret;
}
int WXDLLEXPORT wxVsprintf(wxChar *buf, const wxChar *fmt, va_list argptr)
{
// this might be sort of inefficient, but it doesn't matter since
// we'd prefer people to use wxString::Printf directly instead anyway
wxString str;
str.PrintfV(fmt,argptr);
wxStrcpy(buf,str.c_str());
return str.Len();
}
int WXDLLEXPORT wxSscanf(const wxChar *buf, const wxChar *fmt, ...)
{
va_list argptr;
int ret;
va_start(argptr, fmt);
ret = wxVsscanf(buf, fmt, argptr);
va_end(argptr);
return ret;
}
int WXDLLEXPORT wxVsscanf(const wxChar *buf, const wxChar *fmt, va_list argptr)
{
int ret;
// this will work only for numeric conversion! Strings will not be converted correctly
// hopefully this is all we'll need
ret = vsscanf(wxConvLibc.cWX2MB(buf), wxConvLibc.cWX2MB(fmt), argptr);
return ret;
}
#endif
#ifndef wxAtof