Make snprintf() and vsnprintf() conform to C99.

This commit is contained in:
Keith Marshall
2007-08-25 13:49:37 +00:00
parent 80bed8e0a4
commit 01cd95204e
6 changed files with 41 additions and 26 deletions

View File

@@ -72,8 +72,8 @@ MATH_DISTFILES = \
STDIO_DISTFILES = \
fopen64.c fseeko64.c ftello64.c lseek64.c \
snprintf.c snwprintf.c vsnprintf.c vsnwprintf.c \
vfscanf.c vfwscanf.c vscanf.c vsscanf.c vswscanf.c vwscanf.c
vfscanf.c vfwscanf.c vscanf.c vsscanf.c vswscanf.c vwscanf.c \
snwprintf.c vsnwprintf.c
COMPLEX_DISTFILES = \
cabs.c cabsf.c cabsl.c cacos.c cacosf.c cacosl.c cacosh.c \
@@ -138,8 +138,8 @@ STDLIB_STUB_OBJS = \
_Exit.o
STDIO_OBJS = \
fopen64.o fseeko64.o ftello64.o lseek64.o \
snprintf.o vsnprintf.o snwprintf.o vsnwprintf.o \
vfscanf.o vfwscanf.o vscanf.o vsscanf.o vswscanf.o vwscanf.o
vfscanf.o vfwscanf.o vscanf.o vsscanf.o vswscanf.o vwscanf.o \
snwprintf.o vsnwprintf.o
MATH_OBJS = \
acosf.o acosl.o asinf.o asinl.o atan2f.o atan2l.o \
atanf.o atanl.o cbrt.o cbrtf.o cbrtl.o ceilf.o ceill.o \

View File

@@ -96,8 +96,16 @@ THIS SOFTWARE.
#include "gdtoa.h"
#define Snprintf __mingw_snprintf
#define Vsnprintf __mingw_vsnprintf
/*
* For a MinGW build, we provide the implementation dependent entries
* `__mingw_snprintf' and `__mingw_vsnprintf', then alias them to provide
* the C99 conforming implementations of `snprintf()' and `vsnprintf()'.
*/
# define Snprintf __mingw_snprintf
# define Vsnprintf __mingw_vsnprintf
int __cdecl snprintf()__attribute__((alias("__mingw_snprintf")));
int __cdecl vsnprintf()__attribute__((alias("__mingw_vsnprintf")));
static char* __ldtoa (long double ld, int mode, int ndig, int *decpt,

View File

@@ -1,13 +0,0 @@
#include <stdarg.h>
#include <stdio.h>
int snprintf(char* buffer, size_t n, const char* format, ...)
{
int retval;
va_list argptr;
va_start( argptr, format );
retval = _vsnprintf( buffer, n, format, argptr );
va_end( argptr );
return retval;
}

View File

@@ -1,5 +0,0 @@
#include <stdarg.h>
#include <stdio.h>
int vsnprintf (char* s, size_t n, const char* format, va_list arg)
{ return _vsnprintf ( s, n, format, arg); }