//
// use with extreme care and only when you're really sure the warnings must be
// suppressed!
+template<typename T>
static int
-wxUnsafeSnprintf(wxChar *buf, size_t len, const wxChar *fmt, ...)
+wxUnsafeSnprintf(T *buf, size_t len, const wxChar *fmt, ...)
{
va_list args;
va_start(args, fmt);
void WrongFormatStrings();
#endif // wxUSE_WXVSNPRINTF
void Miscellaneous();
- void Misc(wxChar *buffer, int size);
+ template<typename T> void Misc(T *buffer, int size);
// compares the expectedString and the result of wxVsnprintf() char by char
// for all its lenght (not only for first expectedLen chars) and also
#ifdef __WXMSW__
CMP3("123456789", "%I64d", (wxLongLong_t)123456789);
- CMP3("123456789abcdef", "%I64x", (wxLongLong_t)0x123456789abcdef);
+ CMP3("123456789abcdef", "%I64x", wxLL(0x123456789abcdef));
#endif
}
#endif
-void VsnprintfTestCase::Misc(wxChar *buffer, int size)
+template<typename T>
+void VsnprintfTestCase::Misc(T *buffer, int size)
{
// Remember that wx*printf could be mapped either to system
// implementation or to wx implementation.
// format and gcc would warn about this otherwise
r = wxUnsafeSnprintf(buffer, size,
- "unicode string: %ls %lc - ansi string: %hs %hc\n\n",
+ _T("unicode string: %ls %lc - ansi string: %hs %hc\n\n"),
L"unicode!!", L'W', "ansi!!", 'w');
CPPUNIT_ASSERT( r != -1 );
CPPUNIT_ASSERT_EQUAL(
void VsnprintfTestCase::BigToSmallBuffer()
{
- wxChar buf[1024], buf2[16], buf3[4], buf4;
-
- Misc(buf, 1024);
- Misc(buf2, 16);
- Misc(buf3, 4);
- Misc(&buf4, 1);
+ // VC6 can't compile this code
+#if !defined(__VISUALC__) || (__VISUALC__ >= 1310)
+#if wxUSE_UNICODE
+ wchar_t bufw[1024], bufw2[16], bufw3[4], bufw4;
+ Misc(bufw, 1024);
+ Misc(bufw2, 16);
+ Misc(bufw3, 4);
+ Misc(&bufw4, 1);
+#endif // wxUSE_UNICODE
+
+ char bufa[1024], bufa2[16], bufa3[4], bufa4;
+ Misc(bufa, 1024);
+ Misc(bufa2, 16);
+ Misc(bufa3, 4);
+ Misc(&bufa4, 1);
+#endif // !VC6
}
void VsnprintfTestCase::DoMisc(