Added detection of vsscanf and whether or not a prototype exists in headers.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52980 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
33
configure.in
33
configure.in
@@ -4027,7 +4027,7 @@ dnl
|
|||||||
dnl so we first check if the function is in the library
|
dnl so we first check if the function is in the library
|
||||||
dnl
|
dnl
|
||||||
dnl FIXME: replace this mess with WX_CHECK_FUNCS()
|
dnl FIXME: replace this mess with WX_CHECK_FUNCS()
|
||||||
AC_CHECK_FUNCS(snprintf vsnprintf)
|
AC_CHECK_FUNCS(snprintf vsnprintf vsscanf)
|
||||||
|
|
||||||
if test "$ac_cv_func_vsnprintf" = "yes"; then
|
if test "$ac_cv_func_vsnprintf" = "yes"; then
|
||||||
dnl yes it is -- now check if it is in the headers
|
dnl yes it is -- now check if it is in the headers
|
||||||
@@ -4164,6 +4164,37 @@ define HAVE_UNIX98_PRINTF as 1 in setup.h if it is available.])
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dnl the same as above but for vsscanf() now: it's not present in at least
|
||||||
|
dnl Solaris 9 headers for gcc-3.4 (due to fixinclude's processing of stdio.h)
|
||||||
|
if test "$ac_cv_func_vsscanf" = "yes"; then
|
||||||
|
AC_CACHE_CHECK([for vsscanf declaration], wx_cv_func_vsscanf_decl,
|
||||||
|
[
|
||||||
|
AC_TRY_COMPILE(
|
||||||
|
[
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#ifdef __MSL__
|
||||||
|
#if __MSL__ >= 0x6000
|
||||||
|
namespace std {}
|
||||||
|
using namespace std;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
],
|
||||||
|
[
|
||||||
|
char *buf, *parse;
|
||||||
|
vsscanf(buf, "%s", parse);
|
||||||
|
],
|
||||||
|
wx_cv_func_vsscanf_decl=yes,
|
||||||
|
wx_cv_func_vsscanf_decl=no
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
if test "$wx_cv_func_vsscanf_decl" = "yes"; then
|
||||||
|
AC_DEFINE(HAVE_VSSCANF_DECL)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if test "$wxUSE_UNICODE" = yes; then
|
if test "$wxUSE_UNICODE" = yes; then
|
||||||
|
|
||||||
dnl also look if we have wide char IO functions, notice that [f]putws are
|
dnl also look if we have wide char IO functions, notice that [f]putws are
|
||||||
|
@@ -19,8 +19,11 @@
|
|||||||
#include "wx/wxcrtbase.h"
|
#include "wx/wxcrtbase.h"
|
||||||
#include "wx/string.h"
|
#include "wx/string.h"
|
||||||
|
|
||||||
#if defined (__VISUALC__) || defined (__DMC__)
|
#ifndef __WX_SETUP_H__
|
||||||
#define HAVE_NO_VSSCANF 1
|
// For non-configure builds assume vsscanf is available, if not Visual C or DMC
|
||||||
|
#if !defined (__VISUALC__) && !defined (__DMC__)
|
||||||
|
#define HAVE_VSSCANF 1
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
@@ -31,8 +31,8 @@
|
|||||||
/* printf() family saga */
|
/* printf() family saga */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
For some systems [v]snprintf() exists in the system libraries but not in the
|
For some systems [v]snprintf()/vsscanf() exists in the system libraries but
|
||||||
headers, so we need to declare it ourselves to be able to use it.
|
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)
|
#if defined(HAVE_VSNPRINTF) && !defined(HAVE_VSNPRINTF_DECL)
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -52,6 +52,15 @@
|
|||||||
int snprintf(char *str, size_t size, const char *format, ...);
|
int snprintf(char *str, size_t size, const char *format, ...);
|
||||||
#endif /* !HAVE_SNPRINTF_DECL */
|
#endif /* !HAVE_SNPRINTF_DECL */
|
||||||
|
|
||||||
|
#if defined(HAVE_VSSCANF) && !defined(HAVE_VSSCANF_DECL)
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
#else
|
||||||
|
extern
|
||||||
|
#endif
|
||||||
|
int vsscanf(const char *str, const char *format, va_list ap);
|
||||||
|
#endif /* !HAVE_SNPRINTF_DECL */
|
||||||
|
|
||||||
/* Wrapper for vsnprintf if it's 3rd parameter is non-const. Note: the
|
/* Wrapper for vsnprintf if it's 3rd parameter is non-const. Note: the
|
||||||
* same isn't done for snprintf below, the builtin wxSnprintf_ is used
|
* same isn't done for snprintf below, the builtin wxSnprintf_ is used
|
||||||
* instead since it's already a simple wrapper */
|
* instead since it's already a simple wrapper */
|
||||||
|
@@ -896,6 +896,12 @@
|
|||||||
* with 'char*' for the 3rd parameter instead of 'const char*' */
|
* with 'char*' for the 3rd parameter instead of 'const char*' */
|
||||||
#undef HAVE_BROKEN_VSNPRINTF_DECL
|
#undef HAVE_BROKEN_VSNPRINTF_DECL
|
||||||
|
|
||||||
|
/* Define if you have vsscanf() */
|
||||||
|
#undef HAVE_VSSCANF
|
||||||
|
|
||||||
|
/* Define if you have vsscanf() declaration in the header */
|
||||||
|
#undef HAVE_VSSCANF_DECL
|
||||||
|
|
||||||
/* Define if you have usleep() */
|
/* Define if you have usleep() */
|
||||||
#undef HAVE_USLEEP
|
#undef HAVE_USLEEP
|
||||||
|
|
||||||
|
@@ -1290,7 +1290,7 @@ wchar_t *wxFgets(wchar_t *s, int size, FILE *stream)
|
|||||||
// wxScanf() and friends
|
// wxScanf() and friends
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifndef HAVE_NO_VSSCANF // __VISUALC__ and __DMC__ see wx/crt.h
|
#ifdef HAVE_VSSCANF // __VISUALC__ and __DMC__ see wx/crt.h
|
||||||
int wxVsscanf(const char *str, const char *format, va_list ap)
|
int wxVsscanf(const char *str, const char *format, va_list ap)
|
||||||
{ return wxCRT_VsscanfA(str, format, ap); }
|
{ return wxCRT_VsscanfA(str, format, ap); }
|
||||||
int wxVsscanf(const wchar_t *str, const wchar_t *format, va_list ap)
|
int wxVsscanf(const wchar_t *str, const wchar_t *format, va_list ap)
|
||||||
|
Reference in New Issue
Block a user