X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b5c3f53e153f3522e7bcc6a9d1c7d2ac0da657a6..dd9f8b6bb6935360a8271dc3e8749fb026b601a8:/tests/strings/vsnprintf.cpp?ds=inline diff --git a/tests/strings/vsnprintf.cpp b/tests/strings/vsnprintf.cpp index c781f06f61..61b9abae3f 100644 --- a/tests/strings/vsnprintf.cpp +++ b/tests/strings/vsnprintf.cpp @@ -84,8 +84,9 @@ int r; // // use with extreme care and only when you're really sure the warnings must be // suppressed! +template 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); @@ -153,7 +154,7 @@ private: void WrongFormatStrings(); #endif // wxUSE_WXVSNPRINTF void Miscellaneous(); - void Misc(wxChar *buffer, int size); + template 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 @@ -375,12 +376,13 @@ void VsnprintfTestCase::LongLong() #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 +void VsnprintfTestCase::Misc(T *buffer, int size) { // Remember that wx*printf could be mapped either to system // implementation or to wx implementation. @@ -461,12 +463,22 @@ void VsnprintfTestCase::WrongFormatStrings() 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(