From 73d01dd659f82f2c53fd7cedcf0bbb8d47f70ab2 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Sun, 20 May 2007 00:01:06 +0000 Subject: Fix all compiler warnings from various build systems. Fix vsnprintf() implementation to properly handle long and long long ints. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5845 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/vsnprintf.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/vsnprintf.c') diff --git a/src/vsnprintf.c b/src/vsnprintf.c index 8d1752b91..184e1ed24 100644 --- a/src/vsnprintf.c +++ b/src/vsnprintf.c @@ -3,7 +3,7 @@ * * snprintf() and vsnprintf() functions for the Fast Light Tool Kit (FLTK). * - * Copyright 1998-2005 by Bill Spitzak and others. + * Copyright 1998-2007 by Bill Spitzak and others. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -108,6 +108,8 @@ int fl_vsnprintf(char* buffer, size_t bufsize, const char* format, va_list ap) { } } else prec = -1; + size = '\0'; + if (*format == 'l' && format[1] == 'l') { size = 'L'; if (tptr < (tformat + sizeof(tformat) - 2)) { @@ -159,7 +161,15 @@ int fl_vsnprintf(char* buffer, size_t bufsize, const char* format, va_list ap) { case 'x' : if ((width + 2) > sizeof(temp)) break; - sprintf(temp, tformat, va_arg(ap, int)); +#ifdef HAVE_LONg_LONG + if (size == 'L') + sprintf(temp, tformat, va_arg(ap, long long)); + else +#endif /* HAVE_LONG_LONG */ + if (size == 'l') + sprintf(temp, tformat, va_arg(ap, long)); + else + sprintf(temp, tformat, va_arg(ap, int)); bytes += strlen(temp); -- cgit v1.2.3