From a38b83c353cce75329b2c53c0eaa4ad0f500ccf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karsten=20Ball=C3=BCder?= Date: Wed, 25 Nov 1998 12:13:54 +0000 Subject: [PATCH] fixed the vsprintf() problem once and for all git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1048 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/string.cpp | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/common/string.cpp b/src/common/string.cpp index cb949eb688..e4ff09bf0f 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -101,6 +101,24 @@ extern const char *g_szNul = &g_strEmpty.dummy; #define NAMESPACE std:: #endif +#ifdef __WXMSW__ + #ifdef _MSC_VER + #define wxVsprintf _vsnprintf + #endif +#else + #if defined ( HAVE_VSNPRINTF ) + #define wxVsprintf vsnprintf + #endif +#endif + +#ifndef wxVsprintf + #ifdef HAVE_VPRINTF + #define wxVsprintf(buffer,len,format,argptr) vsprintf(buffer,format, argptr) + #pragma message("Using sprintf() because no snprintf()-like function defined") + #else + #pragma error("No vsnprintf() or vsprintf() function available.") + #endif +#endif NAMESPACE istream& operator>>(NAMESPACE istream& is, wxString& WXUNUSED(str)) { @@ -932,19 +950,6 @@ int wxString::PrintfV(const char* pszFormat, va_list argptr) return iLen; #else -#ifdef __WXMSW__ - #ifdef _MSC_VER - #define wxVsprintf _vsnprintf - #endif -#else // guess that any Unix has snprintf() - feel free to insert additional - // platform/compiler tests here if this is not the case for you - #define wxVsprintf vsnprintf -#endif - -#ifndef wxVsprintf - #pragma message("Using sprintf() because no snprintf()-like function defined") - #define wxVsprintf vsprintf -#endif // static buffer to avoid dynamic memory allocation each time static char s_szScratch[1024];