]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed the vsprintf() problem once and for all
authorKarsten Ballüder <ballueder@usa.net>
Wed, 25 Nov 1998 12:13:54 +0000 (12:13 +0000)
committerKarsten Ballüder <ballueder@usa.net>
Wed, 25 Nov 1998 12:13:54 +0000 (12:13 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1048 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/string.cpp

index cb949eb6886d14ce11dad67a5f769df73f35a2da..e4ff09bf0f02605e9a9ac1ef3b14329870a5eeb8 100644 (file)
@@ -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];