+#define wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN 512
+
+
+// wxVsnprintf() needs to use a *system* implementation of swnprintf()
+// in order to perform some internal tasks.
+// NB: we cannot just use wxSnprintf() because for some systems it maybe
+// implemented later in this file using wxVsnprintf() and that would
+// result in an endless recursion and thus in a stack overflow
+#if wxUSE_UNICODE
+
+ #if defined(__WINDOWS__)
+ // all compilers under Windows should have swprintf()
+ #define HAVE_SWPRINTF
+ #endif
+ #if defined(__WXWINCE__) || ( defined(__VISUALC__) && __VISUALC__ <= 1200 ) || defined(__GNUWIN32__)
+ #define HAVE_BROKEN_SWPRINTF_DECL
+ #endif
+
+
+ // problem: on some systems swprintf takes the 'max' argument while on others
+ // it doesn't
+ #if defined(HAVE_BROKEN_SWPRINTF_DECL)
+
+ // like when using sprintf(), since 'max' is not used, wxVsnprintf() should
+ // always ensure that 'buff' is big enough for all common needs
+ #define system_sprintf(buff, max, flags, data) \
+ ::swprintf(buff, flags, data)
+ #else
+
+ #if !defined(HAVE_SWPRINTF)
+ #error wxVsnprintf() needs a system swprintf() implementation!
+ #endif
+
+ #define system_sprintf(buff, max, flags, data) \
+ ::swprintf(buff, max, flags, data)
+ #endif
+
+#else
+
+ #if defined(HAVE_SNPRINTF)
+
+ #define system_sprintf(buff, max, flags, data) \
+ ::snprintf(buff, max, flags, data)
+
+ #else // NB: at least sprintf() should *always* be available
+
+ // since 'max' is not used in this case, wxVsnprintf() should always ensure
+ // that 'buff' is big enough for all common needs
+ // (see wxMAX_SVNPRINTF_FLAGBUFFER_LEN and wxMAX_SVNPRINTF_SCRATCHBUFFER_LEN)
+ #define system_sprintf(buff, max, flags, data) \
+ ::sprintf(buff, flags, data)
+
+ #endif
+#endif
+
+