int pad_int; // %d, %i, %o, %u, %x, %X
long int pad_longint; // %ld, etc
#ifdef wxLongLong_t
- long long int pad_longlongint; // %Ld, etc
+ wxLongLong_t pad_longlongint; // %Ld, etc
#endif
size_t pad_sizet; // %Zd, etc
else if (ilen == 2)
#ifdef wxLongLong_t
m_type = wxPAT_LONGLONGINT;
-#else // !long long
+#else // !wxLongLong_t
m_type = wxPAT_LONGINT;
-#endif // long long/!long long
+#endif // wxLongLong_t/!wxLongLong_t
else if (ilen == 3)
m_type = wxPAT_SIZET;
done = true;
break;
#ifdef wxLongLong_t
case wxPAT_LONGLONGINT:
- p->pad_longlongint = va_arg(argptr, long long int);
+ p->pad_longlongint = va_arg(argptr, wxLongLong_t);
break;
-#endif
+#endif // wxLongLong_t
case wxPAT_SIZET:
p->pad_sizet = va_arg(argptr, size_t);
break;
return lenMax+1; // not enough space in the output buffer !
}
- wxASSERT(lenCur == wxStrlen(buf));
+ // Don't do:
+ // wxASSERT(lenCur == wxStrlen(buf));
+ // in fact if we embedded NULLs in the output buffer (using %c with a '\0')
+ // such check would fail
+
return lenCur;
}
#endif // !wxVsnprintf_
#if !defined(wxSnprintf_)
-int WXDLLEXPORT wxSnprintf_(wxChar *buf, size_t len, const wxChar *format, ...)
+int WXDLLEXPORT wxDoSnprintf_(wxChar *buf, size_t len, const wxChar *format, ...)
{
va_list argptr;
va_start(argptr, format);
#if defined(__DMC__)
/* Digital Mars adds count to _stprintf (C99) so convert */
#if wxUSE_UNICODE
- int wxSprintf (wchar_t * __RESTRICT s, const wchar_t * __RESTRICT format, ... )
+ int wxDoSprintf (wchar_t * __RESTRICT s, const wchar_t * __RESTRICT format, ... )
{
va_list arglist;
#if defined(wxNEED_PRINTF_CONVERSION) || defined(wxNEED_WPRINTF)
-int wxScanf( const wxChar *format, ... )
+int wxDoScanf( const wxChar *format, ... )
{
va_list argptr;
va_start(argptr, format);
return ret;
}
-int wxSscanf( const wxChar *str, const wxChar *format, ... )
+int wxDoSscanf( const wxChar *str, const wxChar *format, ... )
{
va_list argptr;
va_start(argptr, format);
return ret;
}
-int wxFscanf( FILE *stream, const wxChar *format, ... )
+int wxDoFscanf( FILE *stream, const wxChar *format, ... )
{
va_list argptr;
va_start(argptr, format);
return ret;
}
-int wxPrintf( const wxChar *format, ... )
+int wxDoPrintf( const wxChar *format, ... )
{
va_list argptr;
va_start(argptr, format);
}
#ifndef wxSnprintf
-int wxSnprintf( wxChar *str, size_t size, const wxChar *format, ... )
+int wxDoSnprintf( wxChar *str, size_t size, const wxChar *format, ... )
{
va_list argptr;
va_start(argptr, format);
}
#endif // wxSnprintf
-int wxSprintf( wxChar *str, const wxChar *format, ... )
+int wxDoSprintf( wxChar *str, const wxChar *format, ... )
{
va_list argptr;
va_start(argptr, format);
return s.length();
}
-int wxFprintf( FILE *stream, const wxChar *format, ... )
+int wxDoFprintf( FILE *stream, const wxChar *format, ... )
{
va_list argptr;
va_start( argptr, format );
}
#endif
+
+// ----------------------------------------------------------------------------
+// wxUniChar
+// ----------------------------------------------------------------------------
+
+/* static */
+wxUniChar::unicode_type wxUniChar::From8bit(char c)
+{
+ // all supported charsets have the first 128 characters same as ASCII:
+ if ( (unsigned char)c < 0x80 )
+ return c;
+
+ wchar_t buf[2];
+ if ( wxConvLibc.ToWChar(buf, 2, &c, 1) != 2 )
+ return wxT('?'); // FIXME-UTF8: what to use as failure character?
+ return buf[0];
+}
+
+/* static */
+char wxUniChar::To8bit(wxUniChar::unicode_type c)
+{
+ // all supported charsets have the first 128 characters same as ASCII:
+ if ( c < 0x80 )
+ return c;
+
+ wchar_t in = c;
+ char buf[2];
+ if ( wxConvLibc.FromWChar(buf, 2, &in, 1) != 2 )
+ return '?'; // FIXME-UTF8: what to use as failure character?
+ return buf[0];
+}