buf[lenCur++] = ch
#define APPEND_STR(s) \
- for ( const char *p = s; *p; p++ ) \
{ \
- APPEND_CH((wchar_t)(*p)); \
- }
-
-#define APPEND_WSTR(s) \
- for ( const wchar_t *p = s; *p; p++ ) \
- { \
- APPEND_CH(*p); \
+ for ( const wxChar *p = s; *p; p++ ) \
+ { \
+ APPEND_CH(*p); \
+ } \
}
switch (format[++n]) {
::sprintf(szScratch, s_szFlags, val);
}
- APPEND_STR(szScratch);
+ APPEND_STR(wxConvLibc.cMB2WX(szScratch));
done = TRUE;
break;
::sprintf(szScratch, s_szFlags, val);
}
- APPEND_STR(szScratch);
+ APPEND_STR(wxConvLibc.cMB2WX(szScratch));
done = TRUE;
break;
s_szFlags[flagofs] = '\0';
::sprintf(szScratch, s_szFlags, val);
- APPEND_STR(szScratch);
+ APPEND_STR(wxConvLibc.cMB2WX(szScratch));
done = TRUE;
}
if (s.Len() < min_width)
s.Pad(min_width - s.Len(), wxT(' '), adj_left);
- APPEND_WSTR(s);
+ APPEND_STR(s);
} else {
wxChar *val = va_arg(argptr, wxChar *);
size_t len = wxSTRING_MAXLEN;
if (s.Len() < min_width)
s.Pad(min_width - s.Len(), wxT(' '), adj_left);
- APPEND_WSTR(s);
+ APPEND_STR(s);
}
done = TRUE;
break;
// implement the standard IO functions for wide char if libc doesn't have them
// ----------------------------------------------------------------------------
-#ifndef HAVE_FPUTWC
+#ifdef wxNEED_FPUTWC
int wxFputs(const wchar_t *ws, FILE *stream)
{
return wxFputs(ws, stream);
}
-#endif // HAVE_FPUTWC
+#endif // wxNEED_FPUTWC
// NB: we only implement va_list functions here, the ones taking ... are
// defined below for wxNEED_PRINTF_CONVERSION case anyhow and we reuse
public:
wxFormatConverter(const wxChar *format);
- operator const wxChar *() const { return m_fmt.c_str(); }
+ // notice that we only translated the string if m_fmtOrig == NULL (as set
+ // by CopyAllBefore()), otherwise we should simply use the original format
+ operator const wxChar *() const
+ { return m_fmtOrig ? m_fmtOrig : m_fmt.c_str(); }
private:
// copy another character to the translated format: this function does the
{
if ( !m_fmtOrig )
{
- // we're translating, d copy
+ // we're translating, do copy
m_fmt += ch;
}
else
{
va_list argptr;
va_start(argptr, format);
-
+
int ret = vwprintf( wxFormatConverter(format), argptr );
va_end(argptr);