added test for snprintf() which may not be present in system headers, treat it similarly to vsnprintf() instead of assuming that it's always there
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35270 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -781,7 +781,7 @@ WXDLLIMPEXP_BASE bool wxOKlibc(); /* for internal use */
|
||||
/* printf() family saga */
|
||||
|
||||
/*
|
||||
For some systems vsnprintf() exists in the system libraries but not in the
|
||||
For some systems [v]snprintf() exists in the system libraries but not in the
|
||||
headers, so we need to declare it ourselves to be able to use it.
|
||||
*/
|
||||
#if defined(HAVE_VSNPRINTF) && !defined(HAVE_VSNPRINTF_DECL)
|
||||
@@ -793,6 +793,15 @@ WXDLLIMPEXP_BASE bool wxOKlibc(); /* for internal use */
|
||||
int vsnprintf(char *str, size_t size, const char *format, va_list ap);
|
||||
#endif /* !HAVE_VSNPRINTF_DECL */
|
||||
|
||||
#if defined(HAVE_SNPRINTF) && !defined(HAVE_SNPRINTF_DECL)
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
int snprintf(char *str, size_t size, const char *format, ...);
|
||||
#endif /* !HAVE_SNPRINTF_DECL */
|
||||
|
||||
/*
|
||||
First of all, we always want to define safe snprintf() function to be used
|
||||
instead of sprintf(). Some compilers already have it (or rather vsnprintf()
|
||||
@@ -820,12 +829,13 @@ WXDLLIMPEXP_BASE bool wxOKlibc(); /* for internal use */
|
||||
#endif
|
||||
#else /* ASCII */
|
||||
/* all versions of CodeWarrior supported by wxWidgets apparently have */
|
||||
/* vsnprintf() */
|
||||
#if defined(HAVE_VSNPRINTF) || defined(__MWERKS__) || defined(__WATCOMC__)
|
||||
/* assume we have snprintf() too if we have vsnprintf() */
|
||||
#define wxVsnprintf_ vsnprintf
|
||||
/* both snprintf() and vsnprintf() */
|
||||
#ifdef HAVE_SNPRINTF || defined(__MWERKS__) || defined(__WATCOMC__)
|
||||
#define wxSnprintf_ snprintf
|
||||
#endif
|
||||
#if defined(HAVE_VSNPRINTF) || defined(__MWERKS__) || defined(__WATCOMC__)
|
||||
#define wxVsnprintf_ vsnprintf
|
||||
#endif
|
||||
#endif
|
||||
#endif /* wxVsnprintf_ not defined yet */
|
||||
|
||||
|
Reference in New Issue
Block a user