Apply patch [ 1548750 ] wxVsnprintf() various fixes
Part II. c git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41093 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
34
configure.in
34
configure.in
@@ -4419,8 +4419,40 @@ define HAVE_UNIX98_PRINTF as 1 in setup.h if it is available.])
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if test "$wxUSE_UNICODE" = yes; then
|
if test "$wxUSE_UNICODE" = yes; then
|
||||||
|
|
||||||
|
dnl our wxVsnprintf() implementation needs to use the system swprintf() in Unicode
|
||||||
|
dnl builds so let's check if swprintf() is declared as C99 imposes:
|
||||||
|
dnl int swprintf(wchar_t *s, size_t n, const wchar_t *format, ...);
|
||||||
|
dnl or rather as:
|
||||||
|
dnl int swprintf(wchar_t *s, const wchar_t *format, ...);
|
||||||
|
AC_CHECK_FUNCS(swprintf)
|
||||||
|
|
||||||
|
if test "$ac_cv_func_swprintf" = "yes"; then
|
||||||
|
AC_CACHE_CHECK([if swprintf declaration is broken], wx_cv_func_broken_swprintf_decl,
|
||||||
|
[
|
||||||
|
AC_TRY_COMPILE(
|
||||||
|
[
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <wchar.h>
|
||||||
|
],
|
||||||
|
[
|
||||||
|
wchar_t *buf;
|
||||||
|
const wchar_t *fmt = L"test";
|
||||||
|
swprintf(buf, 10u, fmt);
|
||||||
|
],
|
||||||
|
wx_cv_func_broken_swprintf_decl=no,
|
||||||
|
wx_cv_func_broken_swprintf_decl=yes
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
if test "$wx_cv_func_broken_swprintf_decl" = "yes"; then
|
||||||
|
AC_DEFINE(HAVE_BROKEN_SWPRINTF_DECL)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
dnl also look if we have wide char IO functions
|
dnl also look if we have wide char IO functions
|
||||||
AC_CHECK_FUNCS(wputc wputchar putws fputws wprintf vswprintf)
|
AC_CHECK_FUNCS(wputc wputchar putws fputws wprintf vswprintf)
|
||||||
|
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Name: wx/wxchar.h
|
* Name: wx/wxchar.h
|
||||||
* Purpose: Declarations common to wx char/wchar_t usage (wide chars)
|
* Purpose: Declarations common to wx char/wchar_t usage (wide chars)
|
||||||
* Author: Joel Farley, Ove K<>ven
|
* Author: Joel Farley, Ove K<>en
|
||||||
* Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee
|
* Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee
|
||||||
* Created: 1998/06/12
|
* Created: 1998/06/12
|
||||||
* RCS-ID: $Id$
|
* RCS-ID: $Id$
|
||||||
* Copyright: (c) 1998-2002 Joel Farley, Ove K<>ven, Robert Roebling, Ron Lee
|
* Copyright: (c) 1998-2002 Joel Farley, Ove K<>en, Robert Roebling, Ron Lee
|
||||||
* Licence: wxWindows licence
|
* Licence: wxWindows licence
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -928,6 +928,17 @@ WXDLLIMPEXP_BASE bool wxOKlibc(); /* for internal use */
|
|||||||
#define wxVsnprintf_ vsnprintf
|
#define wxVsnprintf_ vsnprintf
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
// the only exception on Windows is VC++ 8.0; it provides a new family
|
||||||
|
// of printf() functions with positional parameter support which should
|
||||||
|
// behave mostly identic to our wxVsnprintf() implementation
|
||||||
|
#if defined(__VISUALC__) && __VISUALC__ >= 1400
|
||||||
|
#if wxUSE_UNICODE
|
||||||
|
#define wxVsnprintf_ _vsprintf_p
|
||||||
|
#else
|
||||||
|
#define wxVsnprintf_ _vswprintf_p
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif // !defined( wxVsnprintf_ ) && wxUSE_PRINTF_POS_PARAMS
|
#endif // !defined( wxVsnprintf_ ) && wxUSE_PRINTF_POS_PARAMS
|
||||||
|
|
||||||
|
@@ -1059,7 +1059,14 @@
|
|||||||
/* Define this if you have wprintf() and related functions */
|
/* Define this if you have wprintf() and related functions */
|
||||||
#undef HAVE_WPRINTF
|
#undef HAVE_WPRINTF
|
||||||
|
|
||||||
/* Define this if you have wprintf() and related functions */
|
/* Define this if you have swprintf() */
|
||||||
|
#undef HAVE_SWPRINTF
|
||||||
|
|
||||||
|
/* Define if you have a _broken_ swprintf() declaration in the header,
|
||||||
|
* without a 'size_t max' parameter as second argument */
|
||||||
|
#undef HAVE_BROKEN_SWPRINTF_DECL
|
||||||
|
|
||||||
|
/* Define this if you have vswprintf() and related functions */
|
||||||
#undef HAVE_VSWPRINTF
|
#undef HAVE_VSWPRINTF
|
||||||
|
|
||||||
/* Define this if you have _vsnwprintf */
|
/* Define this if you have _vsnwprintf */
|
||||||
|
Reference in New Issue
Block a user