moved vararg CRT functions wrappers to a new wxcrtvararg.h header

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45531 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2007-04-19 07:44:16 +00:00
parent cc4d99cfb7
commit e713a90b3f
5 changed files with 289 additions and 251 deletions

View File

@ -12,7 +12,8 @@
#ifndef _WX_BUFFER_H
#define _WX_BUFFER_H
#include "wx/wxchar.h"
#include "wx/chartype.h"
#include "wx/wxcrt.h"
#include <stdlib.h> // malloc() and free()

View File

@ -19,5 +19,6 @@
/* and wrappers for CRT functions: */
#include "wx/wxcrt.h"
#include "wx/wxcrtvararg.h"
#endif /* _WX_WXCHAR_H_ */

View File

@ -17,13 +17,6 @@
#include "wx/chartype.h"
#ifdef __cplusplus
#include "wx/strvararg.h"
#else
/* make the file compile without doing anything in C code: */
#define WX_DEFINE_VARARG_FUNC(rettype, name, impl)
#endif
#include <stdio.h> /* we use FILE below */
#if defined(HAVE_STRTOK_R) && defined(__DARWIN__) && defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS
@ -38,9 +31,6 @@
this one!
*/
/* Required for wxPrintf() etc */
#include <stdarg.h>
/* Almost all compiler have strdup(), but not quite all: CodeWarrior under Mac */
/* and VC++ for Windows CE don't provide it */
#if defined(__VISUALC__) && __VISUALC__ >= 1400
@ -154,39 +144,18 @@
#endif
#define wxFputc _fputtc
#define wxFputchar _fputtchar
WX_DEFINE_VARARG_FUNC(int, wxFprintf, _ftprintf)
#define wxFputs _fputts
#define wxFreopen _tfreopen
#define wxFscanf _ftscanf
#define wxGetc _gettc
#define wxGetchar _gettchar
#define wxGets _getts
#define wxPerror _tperror
WX_DEFINE_VARARG_FUNC(int, wxPrintf, _tprintf)
#define wxPutc(c,f) _puttc(WXWCHAR_T_CAST(c),f)
#define wxPutchar _puttchar
#define wxPuts _putts
#define wxScanf _tscanf
#if defined(__DMC__)
#if wxUSE_UNICODE
/* Digital Mars adds count to _stprintf (C99) so prototype conversion see wxchar.cpp */
int wxDoSprintf (wchar_t * __RESTRICT s, const wchar_t * __RESTRICT format, ... ) ;
WX_DEFINE_VARARG_FUNC(int, wxSprintf, wxDoSprintf)
#else
/* and there is a bug in D Mars tchar.h prior to 8.39.4n, so define as sprintf */
WX_DEFINE_VARARG_FUNC(int, wxSprintf, sprintf)
#endif
#else
WX_DEFINE_VARARG_FUNC(int, wxSprintf, _stprintf)
#endif
#define wxSscanf _stscanf
#define wxTmpnam _ttmpnam
#define wxUngetc _tungetc
#define wxVfprintf _vftprintf
#define wxVprintf _vtprintf
#define wxVsscanf _vstscanf
#define wxVsprintf _vstprintf
/* special case: these functions are missing under Win9x with Unicows so we */
/* have to implement them ourselves */
@ -554,23 +523,13 @@
#define wxFputc fputc
#define wxFputs fputs
#define wxFputchar fputchar
WX_DEFINE_VARARG_FUNC(int, wxFprintf, fprintf)
#define wxFscanf fscanf
#define wxGetc getc
#define wxGetchar getchar
#define wxGets gets
WX_DEFINE_VARARG_FUNC(int, wxPrintf, printf)
#define wxPutc putc
#define wxPutchar putchar
#define wxPuts puts
#define wxScanf scanf
WX_DEFINE_VARARG_FUNC(int, wxSprintf, sprintf)
#define wxSscanf sscanf
#define wxUngetc ungetc
#define wxVfprintf vfprintf
#define wxVprintf vprintf
#define wxVsscanf vsscanf
#define wxVsprintf vsprintf
/* stdlib.h functions */
#define wxAtof atof
@ -652,156 +611,6 @@ inline size_t wxStrlen(const wxChar *psz) { return psz ? wxStrlen_(psz) : 0; }
WXDLLIMPEXP_BASE bool wxOKlibc(); /* for internal use */
#endif
/* printf() family saga */
/*
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)
#ifdef __cplusplus
extern "C"
#else
extern
#endif
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
WXDLLIMPEXP_BASE int snprintf(char *str, size_t size, const char *format, ...);
#endif /* !HAVE_SNPRINTF_DECL */
/* 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
* instead since it's already a simple wrapper */
#if defined __cplusplus && defined HAVE_BROKEN_VSNPRINTF_DECL
inline int wx_fixed_vsnprintf(char *str, size_t size, const char *format, va_list ap)
{
return vsnprintf(str, size, (char*)format, ap);
}
#endif
/*
MinGW MSVCRT has non-standard vswprintf() (for MSVC compatibility
presumably) and normally _vsnwprintf() is used instead
*/
#if defined(HAVE_VSWPRINTF) && defined(__MINGW32__)
#undef HAVE_VSWPRINTF
#endif
#if wxUSE_PRINTF_POS_PARAMS
/*
The systems where vsnprintf() supports positional parameters should
define the HAVE_UNIX98_PRINTF symbol.
On systems which don't (e.g. Windows) we are forced to use
our wxVsnprintf() implementation.
*/
#if defined(HAVE_UNIX98_PRINTF)
#if wxUSE_UNICODE
#ifdef HAVE_VSWPRINTF
#define wxVsnprintf_ vswprintf
#endif
#else /* ASCII */
#ifdef HAVE_BROKEN_VSNPRINTF_DECL
#define wxVsnprintf_ wx_fixed_vsnprintf
#else
#define wxVsnprintf_ vsnprintf
#endif
#endif
#else /* !HAVE_UNIX98_PRINTF */
/*
The only compiler with positional parameters support under Windows
is VC++ 8.0 which provides a new xxprintf_p() functions family.
The 2003 PSDK includes a slightly earlier version of VC8 than the
main release and does not have the printf_p functions.
*/
#if defined _MSC_FULL_VER && _MSC_FULL_VER >= 140050727 && !defined __WXWINCE__
#if wxUSE_UNICODE
#define wxVsnprintf_ _vswprintf_p
#else
#define wxVsnprintf_ _vsprintf_p
#endif
#endif
#endif /* HAVE_UNIX98_PRINTF/!HAVE_UNIX98_PRINTF */
#else /* !wxUSE_PRINTF_POS_PARAMS */
/*
We always want to define safe snprintf() function to be used instead of
sprintf(). Some compilers already have it (or rather vsnprintf() which
we really need...), otherwise we implement it using our own printf()
code.
We define function with a trailing underscore here because the real one
is a wrapper around it as explained below
*/
/* first deal with TCHAR-aware compilers which have _vsntprintf */
#ifndef wxVsnprintf_
#if defined(__VISUALC__) || \
(defined(__BORLANDC__) && __BORLANDC__ >= 0x540)
#define wxSnprintf_ _sntprintf
#define wxVsnprintf_ _vsntprintf
WX_DEFINE_VARARG_FUNC(int, wxSnprintf_, _sntprintf)
#endif
#endif
/* if this didn't work, define it separately for Unicode and ANSI builds */
#ifndef wxVsnprintf_
#if wxUSE_UNICODE
#if defined(HAVE__VSNWPRINTF)
#define wxVsnprintf_ _vsnwprintf
#elif defined(HAVE_VSWPRINTF)
#define wxVsnprintf_ vswprintf
#elif defined(__WATCOMC__)
#define wxVsnprintf_ _vsnwprintf
WX_DEFINE_VARARG_FUNC(int, wxSnprintf_, _snwprintf)
#endif
#else /* ASCII */
/*
All versions of CodeWarrior supported by wxWidgets apparently
have both snprintf() and vsnprintf()
*/
#if defined(HAVE_SNPRINTF) \
|| defined(__MWERKS__) || defined(__WATCOMC__)
#ifndef HAVE_BROKEN_SNPRINTF_DECL
WX_DEFINE_VARARG_FUNC(int, wxSnprintf_, snprintf)
#endif
#endif
#if defined(HAVE_VSNPRINTF) \
|| defined(__MWERKS__) || defined(__WATCOMC__)
#ifdef HAVE_BROKEN_VSNPRINTF_DECL
#define wxVsnprintf_ wx_fixed_vsnprintf
#else
#define wxVsnprintf_ vsnprintf
#endif
#endif
#endif /* Unicode/ASCII */
#endif /* wxVsnprintf_ */
#endif /* wxUSE_PRINTF_POS_PARAMS/!wxUSE_PRINTF_POS_PARAMS */
#ifndef wxSnprintf_
/* no snprintf(), cook our own */
WXDLLIMPEXP_BASE int
wxDoSnprintf_(wxChar *buf, size_t len,
const wxChar *format, ...) ATTRIBUTE_PRINTF_3;
WX_DEFINE_VARARG_FUNC(int, wxSnprintf_, wxDoSnprintf_)
#endif
#ifndef wxVsnprintf_
/* no (suitable) vsnprintf(), cook our own */
WXDLLIMPEXP_BASE int
wxVsnprintf_(wxChar *buf, size_t len,
const wxChar *format, va_list argptr);
#define wxUSE_WXVSNPRINTF 1
#else
#define wxUSE_WXVSNPRINTF 0
#endif
#ifndef wxStrtoll
/* supply strtoll and strtoull, if needed */
WXDLLIMPEXP_BASE wxLongLong_t wxStrtoll(const wxChar* nptr, wxChar** endptr, int base);
@ -819,64 +628,6 @@ WXDLLIMPEXP_BASE bool wxOKlibc(); /* for internal use */
#define wxNEED_WPRINTF
#endif
/*
More Unicode complications: although both ANSI C and C++ define a number of
wide character functions such as wprintf(), not all environments have them.
Worse, those which do have different behaviours: under Windows, %s format
specifier changes its meaning in Unicode build and expects a Unicode string
while under Unix/POSIX it still means an ASCII string even for wprintf() and
%ls has to be used for wide strings.
We choose to always emulate Windows behaviour as more useful for us so even
if we have wprintf() we still must wrap it in a non trivial wxPrintf().
*/
#if defined(wxNEED_PRINTF_CONVERSION) || defined(wxNEED_WPRINTF)
/*
we need to implement all wide character printf and scanf functions
either because we don't have them at all or because they don't have the
semantics we need
*/
WX_DEFINE_VARARG_FUNC(int, wxScanf, wxDoScanf)
int wxDoScanf( const wxChar *format, ... ) ATTRIBUTE_PRINTF_1;
WX_DEFINE_VARARG_FUNC(int, wxSscanf, wxDoSscanf)
int wxDoSscanf( const wxChar *str, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2;
WX_DEFINE_VARARG_FUNC(int, wxFscanf, wxDoFscanf)
int wxDoFscanf( FILE *stream, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2;
WX_DEFINE_VARARG_FUNC(int, wxPrintf, wxDoPrintf)
int wxDoPrintf( const wxChar *format, ... ) ATTRIBUTE_PRINTF_1;
WX_DEFINE_VARARG_FUNC(int, wxSprintf, wxDoSprintf)
int wxDoSprintf( wxChar *str, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2;
WX_DEFINE_VARARG_FUNC(int, wxFprintf, wxDoFprintf)
int wxDoFprintf( FILE *stream, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2;
int wxVsscanf( const wxChar *str, const wxChar *format, va_list ap );
int wxVfprintf( FILE *stream, const wxChar *format, va_list ap );
int wxVprintf( const wxChar *format, va_list ap );
int wxVsprintf( wxChar *str, const wxChar *format, va_list ap );
#endif /* wxNEED_PRINTF_CONVERSION */
/* these 2 can be simply mapped to the versions with underscore at the end */
/* if we don't have to do the conversion */
/*
However, if we don't have any vswprintf() at all we don't need to redefine
anything as our own wxVsnprintf_() already behaves as needed.
*/
#if defined(wxNEED_PRINTF_CONVERSION) && defined(wxVsnprintf_)
WX_DEFINE_VARARG_FUNC(int, wxSnprintf, wxDoSnprintf)
int wxDoSnprintf( wxChar *str, size_t size, const wxChar *format, ... ) ATTRIBUTE_PRINTF_3;
int wxVsnprintf( wxChar *str, size_t size, const wxChar *format, va_list ap );
#else
#define wxSnprintf wxSnprintf_
#define wxVsnprintf wxVsnprintf_
#endif
/*
various functions which might not be available in libc and for which we
provide our own replacements in wxchar.cpp

284
include/wx/wxcrtvararg.h Normal file
View File

@ -0,0 +1,284 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/wxcrtvararg.h
// Purpose: Type-safe ANSI and Unicode builds compatible wrappers for
// printf(), scanf() and related CRT functions
// Author: Joel Farley, Ove Kåven
// Modified by: Vadim Zeitlin, Robert Roebling, Ron Lee
// Created: 2007-02-19
// RCS-ID: $Id$
// Copyright: (c) 2007 REA Elektronik GmbH
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_WXCRTVARARG_H_
#define _WX_WXCRTVARARG_H_
#include "wx/wxcrt.h"
#include "wx/strvararg.h"
/* Required for wxPrintf() etc */
#include <stdarg.h>
#ifdef wxHAVE_TCHAR_SUPPORT
WX_DEFINE_VARARG_FUNC(int, wxFprintf, _ftprintf)
WX_DEFINE_VARARG_FUNC(int, wxPrintf, _tprintf)
#define wxPutc(c,f) _puttc(WXWCHAR_T_CAST(c),f)
#define wxPutchar _puttchar
#define wxPuts _putts
#define wxScanf _tscanf /* FIXME-UTF8: not wrapped */
#if defined(__DMC__)
#if wxUSE_UNICODE
/* Digital Mars adds count to _stprintf (C99) so prototype conversion see wxchar.cpp */
int wxDoSprintf (wchar_t * __RESTRICT s, const wchar_t * __RESTRICT format, ... ) ;
WX_DEFINE_VARARG_FUNC(int, wxSprintf, wxDoSprintf)
#else
/* and there is a bug in D Mars tchar.h prior to 8.39.4n, so define
as sprintf */
WX_DEFINE_VARARG_FUNC(int, wxSprintf, sprintf)
#endif
#else
WX_DEFINE_VARARG_FUNC(int, wxSprintf, _stprintf)
#endif
/* FIXME-UTF8: not wrapped */
#define wxSscanf _stscanf
#define wxVfprintf _vftprintf
#define wxVprintf _vtprintf
#define wxVsscanf _vstscanf
#define wxVsprintf _vstprintf
#else /* !TCHAR-aware compilers */
#if !wxUSE_UNICODE /* ASCII */
WX_DEFINE_VARARG_FUNC(int, wxFprintf, fprintf)
#define wxFscanf fscanf
WX_DEFINE_VARARG_FUNC(int, wxPrintf, printf)
#define wxScanf scanf
WX_DEFINE_VARARG_FUNC(int, wxSprintf, sprintf)
#define wxSscanf sscanf
#define wxVfprintf vfprintf
#define wxVprintf vprintf
#define wxVsscanf vsscanf
#define wxVsprintf vsprintf
#endif /* ASCII */
#endif /* TCHAR-aware compilers/the others */
/* printf() family saga */
/*
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)
#ifdef __cplusplus
extern "C"
#else
extern
#endif
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
WXDLLIMPEXP_BASE int snprintf(char *str, size_t size, const char *format, ...);
#endif /* !HAVE_SNPRINTF_DECL */
/* 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
* instead since it's already a simple wrapper */
#if defined __cplusplus && defined HAVE_BROKEN_VSNPRINTF_DECL
inline int wx_fixed_vsnprintf(char *str, size_t size, const char *format, va_list ap)
{
return vsnprintf(str, size, (char*)format, ap);
}
#endif
/*
MinGW MSVCRT has non-standard vswprintf() (for MSVC compatibility
presumably) and normally _vsnwprintf() is used instead
*/
#if defined(HAVE_VSWPRINTF) && defined(__MINGW32__)
#undef HAVE_VSWPRINTF
#endif
#if wxUSE_PRINTF_POS_PARAMS
/*
The systems where vsnprintf() supports positional parameters should
define the HAVE_UNIX98_PRINTF symbol.
On systems which don't (e.g. Windows) we are forced to use
our wxVsnprintf() implementation.
*/
#if defined(HAVE_UNIX98_PRINTF)
#if wxUSE_UNICODE
#ifdef HAVE_VSWPRINTF
#define wxVsnprintf_ vswprintf
#endif
#else /* ASCII */
#ifdef HAVE_BROKEN_VSNPRINTF_DECL
#define wxVsnprintf_ wx_fixed_vsnprintf
#else
#define wxVsnprintf_ vsnprintf
#endif
#endif
#else /* !HAVE_UNIX98_PRINTF */
/*
The only compiler with positional parameters support under Windows
is VC++ 8.0 which provides a new xxprintf_p() functions family.
The 2003 PSDK includes a slightly earlier version of VC8 than the
main release and does not have the printf_p functions.
*/
#if defined _MSC_FULL_VER && _MSC_FULL_VER >= 140050727 && !defined __WXWINCE__
#if wxUSE_UNICODE
#define wxVsnprintf_ _vswprintf_p
#else
#define wxVsnprintf_ _vsprintf_p
#endif
#endif
#endif /* HAVE_UNIX98_PRINTF/!HAVE_UNIX98_PRINTF */
#else /* !wxUSE_PRINTF_POS_PARAMS */
/*
We always want to define safe snprintf() function to be used instead of
sprintf(). Some compilers already have it (or rather vsnprintf() which
we really need...), otherwise we implement it using our own printf()
code.
We define function with a trailing underscore here because the real one
is a wrapper around it as explained below
*/
/* first deal with TCHAR-aware compilers which have _vsntprintf */
#ifndef wxVsnprintf_
#if defined(__VISUALC__) || \
(defined(__BORLANDC__) && __BORLANDC__ >= 0x540)
#define wxSnprintf_ _sntprintf
#define wxVsnprintf_ _vsntprintf
WX_DEFINE_VARARG_FUNC(int, wxSnprintf_, _sntprintf)
#endif
#endif
/* if this didn't work, define it separately for Unicode and ANSI builds */
#ifndef wxVsnprintf_
#if wxUSE_UNICODE
#if defined(HAVE__VSNWPRINTF)
#define wxVsnprintf_ _vsnwprintf
#elif defined(HAVE_VSWPRINTF)
#define wxVsnprintf_ vswprintf
#elif defined(__WATCOMC__)
#define wxVsnprintf_ _vsnwprintf
WX_DEFINE_VARARG_FUNC(int, wxSnprintf_, _snwprintf)
#endif
#else /* ASCII */
/*
All versions of CodeWarrior supported by wxWidgets apparently
have both snprintf() and vsnprintf()
*/
#if defined(HAVE_SNPRINTF) \
|| defined(__MWERKS__) || defined(__WATCOMC__)
#ifndef HAVE_BROKEN_SNPRINTF_DECL
WX_DEFINE_VARARG_FUNC(int, wxSnprintf_, snprintf)
#endif
#endif
#if defined(HAVE_VSNPRINTF) \
|| defined(__MWERKS__) || defined(__WATCOMC__)
#ifdef HAVE_BROKEN_VSNPRINTF_DECL
#define wxVsnprintf_ wx_fixed_vsnprintf
#else
#define wxVsnprintf_ vsnprintf
#endif
#endif
#endif /* Unicode/ASCII */
#endif /* wxVsnprintf_ */
#endif /* wxUSE_PRINTF_POS_PARAMS/!wxUSE_PRINTF_POS_PARAMS */
#ifndef wxSnprintf_
/* no snprintf(), cook our own */
WXDLLIMPEXP_BASE int
wxDoSnprintf_(wxChar *buf, size_t len,
const wxChar *format, ...) ATTRIBUTE_PRINTF_3;
WX_DEFINE_VARARG_FUNC(int, wxSnprintf_, wxDoSnprintf_)
#endif
#ifndef wxVsnprintf_
/* no (suitable) vsnprintf(), cook our own */
WXDLLIMPEXP_BASE int
wxVsnprintf_(wxChar *buf, size_t len,
const wxChar *format, va_list argptr);
#define wxUSE_WXVSNPRINTF 1
#else
#define wxUSE_WXVSNPRINTF 0
#endif
/*
In Unicode mode we need to have all standard functions such as wprintf() and
so on but not all systems have them so use our own implementations in this
case.
*/
#if wxUSE_UNICODE && !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_WPRINTF)
#define wxNEED_WPRINTF
#endif
/*
More Unicode complications: although both ANSI C and C++ define a number of
wide character functions such as wprintf(), not all environments have them.
Worse, those which do have different behaviours: under Windows, %s format
specifier changes its meaning in Unicode build and expects a Unicode string
while under Unix/POSIX it still means an ASCII string even for wprintf() and
%ls has to be used for wide strings.
We choose to always emulate Windows behaviour as more useful for us so even
if we have wprintf() we still must wrap it in a non trivial wxPrintf().
*/
#if defined(wxNEED_PRINTF_CONVERSION) || defined(wxNEED_WPRINTF)
/*
we need to implement all wide character printf and scanf functions
either because we don't have them at all or because they don't have the
semantics we need
*/
WX_DEFINE_VARARG_FUNC(int, wxScanf, wxDoScanf)
int wxDoScanf( const wxChar *format, ... ) ATTRIBUTE_PRINTF_1;
WX_DEFINE_VARARG_FUNC(int, wxSscanf, wxDoSscanf)
int wxDoSscanf( const wxChar *str, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2;
WX_DEFINE_VARARG_FUNC(int, wxFscanf, wxDoFscanf)
int wxDoFscanf( FILE *stream, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2;
WX_DEFINE_VARARG_FUNC(int, wxPrintf, wxDoPrintf)
int wxDoPrintf( const wxChar *format, ... ) ATTRIBUTE_PRINTF_1;
WX_DEFINE_VARARG_FUNC(int, wxSprintf, wxDoSprintf)
int wxDoSprintf( wxChar *str, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2;
WX_DEFINE_VARARG_FUNC(int, wxFprintf, wxDoFprintf)
int wxDoFprintf( FILE *stream, const wxChar *format, ... ) ATTRIBUTE_PRINTF_2;
int wxVsscanf( const wxChar *str, const wxChar *format, va_list ap );
int wxVfprintf( FILE *stream, const wxChar *format, va_list ap );
int wxVprintf( const wxChar *format, va_list ap );
int wxVsprintf( wxChar *str, const wxChar *format, va_list ap );
#endif /* wxNEED_PRINTF_CONVERSION */
/* these 2 can be simply mapped to the versions with underscore at the end */
/* if we don't have to do the conversion */
/*
However, if we don't have any vswprintf() at all we don't need to redefine
anything as our own wxVsnprintf_() already behaves as needed.
*/
#if defined(wxNEED_PRINTF_CONVERSION) && defined(wxVsnprintf_)
WX_DEFINE_VARARG_FUNC(int, wxSnprintf, wxDoSnprintf)
int wxDoSnprintf( wxChar *str, size_t size, const wxChar *format, ... ) ATTRIBUTE_PRINTF_3;
int wxVsnprintf( wxChar *str, size_t size, const wxChar *format, va_list ap );
#else
#define wxSnprintf wxSnprintf_
#define wxVsnprintf wxVsnprintf_
#endif
#endif /* _WX_WXCRTVARARG_H_ */

View File

@ -37,7 +37,8 @@
/* must include this after ctype.h inclusion for CodeWarrior/Mac */
#include "wx/defs.h"
#include "wx/wxchar.h"
#include "wx/chartype.h"
#include "wx/wxcrt.h"
/*
* Do not insert extras between the "begin" and "end" lines -- this