diff -ru programs/fonttosfnt/util.c programs/fonttosfnt/util.c --- programs/fonttosfnt/util.c 2004-03-04 20:45:27.000000000 +0100 +++ programs/fonttosfnt/util.c 2004-03-17 16:26:18.000000000 +0100 @@ -80,18 +80,30 @@ return s; } -char* +static char* vsprintf_reliable(char *f, va_list args) { - int n, size = 12; + int n; + size_t size = 12; char *string; while(1) { + va_list args_copy; if(size > 4096) return NULL; string = malloc(size); if(!string) return NULL; - n = vsnprintf(string, size, f, args); +#ifdef va_copy + va_copy(args_copy, args); +#else +#ifdef __va_copy + __va_copy(args_copy, args); +#else +#error vsprintf_reliable: Note that args will be modified by vsnprintf on some architectures (for example on x86_64). +#endif +#endif + n = vsnprintf(string, size, f, args_copy); + va_end(args_copy); if(n >= 0 && n < size) return string; else if(n >= size) diff -ru programs/fonttosfnt/fonttosfnt.h programs/fonttosfnt/fonttosfnt.h --- programs/fonttosfnt/fonttosfnt.h 2004-03-04 18:48:48.000000000 +0100 +++ programs/fonttosfnt/fonttosfnt.h 2004-03-17 16:10:52.000000000 +0100 @@ -163,7 +172,6 @@ #define PROP_CARDINAL 3 char *sprintf_reliable(char *f, ...); -char *vsprintf_reliable(char *f, va_list args); char *makeUTF16(char *); unsigned makeName(char*); int macTime(int *, unsigned *);