Fix 64bit printing for MSVC builds (#119292, Hans Breuer):

Sun Nov  2 01:47:31 2003  Matthias Clasen  <maclas@gmx.de>

	Fix 64bit printing for MSVC builds (#119292, Hans Breuer):

	* configure.in (HAVE_INT64_AND_I64): Define for MSVC to
	include support for printing __int64 with format %I64 in
	the gnulib printf wrappers.
	* glib/gnulib/printf-args.h (enum arg_type): Add TYPE_INT64
	and TYPE_UINT64.
	* glib/gnulib/printf-args.h (struct argument): Add a_int64 and
	a_uint64 members.
	* glib/gnulib/printf-args.c (printf_fetchargs): Support
	TYPE_INT64 and TYPE_UINT64.
	* glib/gnulib/printf-parse.c (printf_parse): Parse I64 format
	modifier and map formats to TYPE_INT64.
	* glib/gnulib/vasnprintf.c (vasnprintf): Print TYPE_INT64 with
	format modifier I64.
	* glib/gnulib/README: Document the __int64 support.
This commit is contained in:
Matthias Clasen 2003-11-02 00:54:02 +00:00 committed by Matthias Clasen
parent 3f1a49ea41
commit 76433d5365
12 changed files with 183 additions and 5 deletions

View File

@ -1,3 +1,22 @@
Sun Nov 2 01:47:31 2003 Matthias Clasen <maclas@gmx.de>
Fix 64bit printing for MSVC builds (#119292, Hans Breuer):
* configure.in (HAVE_INT64_AND_I64): Define for MSVC to
include support for printing __int64 with format %I64 in
the gnulib printf wrappers.
* glib/gnulib/printf-args.h (enum arg_type): Add TYPE_INT64
and TYPE_UINT64.
* glib/gnulib/printf-args.h (struct argument): Add a_int64 and
a_uint64 members.
* glib/gnulib/printf-args.c (printf_fetchargs): Support
TYPE_INT64 and TYPE_UINT64.
* glib/gnulib/printf-parse.c (printf_parse): Parse I64 format
modifier and map formats to TYPE_INT64.
* glib/gnulib/vasnprintf.c (vasnprintf): Print TYPE_INT64 with
format modifier I64.
* glib/gnulib/README: Document the __int64 support.
Sat Nov 1 08:45:38 2003 Owen Taylor <otaylor@redhat.com>
* glib/gmain.c (g_main_context_iterate): Set the

View File

@ -1,3 +1,22 @@
Sun Nov 2 01:47:31 2003 Matthias Clasen <maclas@gmx.de>
Fix 64bit printing for MSVC builds (#119292, Hans Breuer):
* configure.in (HAVE_INT64_AND_I64): Define for MSVC to
include support for printing __int64 with format %I64 in
the gnulib printf wrappers.
* glib/gnulib/printf-args.h (enum arg_type): Add TYPE_INT64
and TYPE_UINT64.
* glib/gnulib/printf-args.h (struct argument): Add a_int64 and
a_uint64 members.
* glib/gnulib/printf-args.c (printf_fetchargs): Support
TYPE_INT64 and TYPE_UINT64.
* glib/gnulib/printf-parse.c (printf_parse): Parse I64 format
modifier and map formats to TYPE_INT64.
* glib/gnulib/vasnprintf.c (vasnprintf): Print TYPE_INT64 with
format modifier I64.
* glib/gnulib/README: Document the __int64 support.
Sat Nov 1 08:45:38 2003 Owen Taylor <otaylor@redhat.com>
* glib/gmain.c (g_main_context_iterate): Set the

View File

@ -1,3 +1,22 @@
Sun Nov 2 01:47:31 2003 Matthias Clasen <maclas@gmx.de>
Fix 64bit printing for MSVC builds (#119292, Hans Breuer):
* configure.in (HAVE_INT64_AND_I64): Define for MSVC to
include support for printing __int64 with format %I64 in
the gnulib printf wrappers.
* glib/gnulib/printf-args.h (enum arg_type): Add TYPE_INT64
and TYPE_UINT64.
* glib/gnulib/printf-args.h (struct argument): Add a_int64 and
a_uint64 members.
* glib/gnulib/printf-args.c (printf_fetchargs): Support
TYPE_INT64 and TYPE_UINT64.
* glib/gnulib/printf-parse.c (printf_parse): Parse I64 format
modifier and map formats to TYPE_INT64.
* glib/gnulib/vasnprintf.c (vasnprintf): Print TYPE_INT64 with
format modifier I64.
* glib/gnulib/README: Document the __int64 support.
Sat Nov 1 08:45:38 2003 Owen Taylor <otaylor@redhat.com>
* glib/gmain.c (g_main_context_iterate): Set the

View File

@ -1,3 +1,22 @@
Sun Nov 2 01:47:31 2003 Matthias Clasen <maclas@gmx.de>
Fix 64bit printing for MSVC builds (#119292, Hans Breuer):
* configure.in (HAVE_INT64_AND_I64): Define for MSVC to
include support for printing __int64 with format %I64 in
the gnulib printf wrappers.
* glib/gnulib/printf-args.h (enum arg_type): Add TYPE_INT64
and TYPE_UINT64.
* glib/gnulib/printf-args.h (struct argument): Add a_int64 and
a_uint64 members.
* glib/gnulib/printf-args.c (printf_fetchargs): Support
TYPE_INT64 and TYPE_UINT64.
* glib/gnulib/printf-parse.c (printf_parse): Parse I64 format
modifier and map formats to TYPE_INT64.
* glib/gnulib/vasnprintf.c (vasnprintf): Print TYPE_INT64 with
format modifier I64.
* glib/gnulib/README: Document the __int64 support.
Sat Nov 1 08:45:38 2003 Owen Taylor <otaylor@redhat.com>
* glib/gmain.c (g_main_context_iterate): Set the

View File

@ -1,3 +1,22 @@
Sun Nov 2 01:47:31 2003 Matthias Clasen <maclas@gmx.de>
Fix 64bit printing for MSVC builds (#119292, Hans Breuer):
* configure.in (HAVE_INT64_AND_I64): Define for MSVC to
include support for printing __int64 with format %I64 in
the gnulib printf wrappers.
* glib/gnulib/printf-args.h (enum arg_type): Add TYPE_INT64
and TYPE_UINT64.
* glib/gnulib/printf-args.h (struct argument): Add a_int64 and
a_uint64 members.
* glib/gnulib/printf-args.c (printf_fetchargs): Support
TYPE_INT64 and TYPE_UINT64.
* glib/gnulib/printf-parse.c (printf_parse): Parse I64 format
modifier and map formats to TYPE_INT64.
* glib/gnulib/vasnprintf.c (vasnprintf): Print TYPE_INT64 with
format modifier I64.
* glib/gnulib/README: Document the __int64 support.
Sat Nov 1 08:45:38 2003 Owen Taylor <otaylor@redhat.com>
* glib/gmain.c (g_main_context_iterate): Set the

View File

@ -1,3 +1,22 @@
Sun Nov 2 01:47:31 2003 Matthias Clasen <maclas@gmx.de>
Fix 64bit printing for MSVC builds (#119292, Hans Breuer):
* configure.in (HAVE_INT64_AND_I64): Define for MSVC to
include support for printing __int64 with format %I64 in
the gnulib printf wrappers.
* glib/gnulib/printf-args.h (enum arg_type): Add TYPE_INT64
and TYPE_UINT64.
* glib/gnulib/printf-args.h (struct argument): Add a_int64 and
a_uint64 members.
* glib/gnulib/printf-args.c (printf_fetchargs): Support
TYPE_INT64 and TYPE_UINT64.
* glib/gnulib/printf-parse.c (printf_parse): Parse I64 format
modifier and map formats to TYPE_INT64.
* glib/gnulib/vasnprintf.c (vasnprintf): Print TYPE_INT64 with
format modifier I64.
* glib/gnulib/README: Document the __int64 support.
Sat Nov 1 08:45:38 2003 Owen Taylor <otaylor@redhat.com>
* glib/gmain.c (g_main_context_iterate): Set the

View File

@ -537,6 +537,7 @@ elif test x$ac_cv_sizeof___int64 = x8; then
glib_cv_long_long_format=I64
AC_MSG_RESULT(%${glib_cv_long_long_format}u)
AC_DEFINE(HAVE_LONG_LONG_FORMAT,1,[define if system printf can print long long])
AC_DEFINE(HAVE_INT64_AND_I64,1,[define to support printing __int64 with format I64])
fi
dnl long doubles were not used, and a portability problem

View File

@ -13,10 +13,16 @@ be found at:
http://www.gnu.org/software/gnulib/
They have been modified to include g-gnulib.h. vasnprintf.c has also
been modified to include support for long long printing if the system
printf doesn't. This code is protected by #ifndef HAVE_LON_LONG_FORMAT.
All files have been modified to include g-gnulib.h.
vasnprintf.c has also been modified to include support for long long
printing if the system printf doesn't. This code is protected by
#ifndef HAVE_LONG_LONG_FORMAT.
Code has been added to printf-args.[ch], printf-parse.c and vasnprintf.c
to support printing of __int64 values with the I64 format modifier. This
is protected by #ifdef HAVE_INT64_AND_I64.
The files
printf.h
@ -31,7 +37,7 @@ g_malloc and make sure that snprintf is only used if it implements
C99 return value semantics.
Matthias Clasen
July 28, 2003
November 1, 2003

View File

@ -68,6 +68,14 @@ printf_fetchargs (va_list args, arguments *a)
case TYPE_ULONGLONGINT:
ap->a.a_ulonglongint = va_arg (args, unsigned long long int);
break;
#endif
#ifdef HAVE_INT64_AND_I64
case TYPE_INT64:
ap->a.a_int64 = va_arg (args, __int64);
break;
case TYPE_UINT64:
ap->a.a_uint64 = va_arg (args, unsigned __int64);
break;
#endif
case TYPE_DOUBLE:
ap->a.a_double = va_arg (args, double);

View File

@ -48,6 +48,10 @@ typedef enum
#ifdef HAVE_LONG_LONG
TYPE_LONGLONGINT,
TYPE_ULONGLONGINT,
#endif
#ifdef HAVE_INT64_AND_I64
TYPE_INT64,
TYPE_UINT64,
#endif
TYPE_DOUBLE,
#ifdef HAVE_LONG_DOUBLE
@ -88,6 +92,10 @@ typedef struct
#ifdef HAVE_LONG_LONG
long long int a_longlongint;
unsigned long long int a_ulonglongint;
#endif
#ifdef HAVE_INT64_AND_I64
__int64 a_int64;
unsigned __int64 a_uint64;
#endif
float a_float;
double a_double;

View File

@ -286,6 +286,15 @@ printf_parse (const char *format, char_directives *d, arguments *a)
flags += 8;
cp++;
}
#ifdef HAVE_INT64_AND_I64
else if (cp[0] == 'I' &&
cp[1] == '6' &&
cp[2] == '4')
{
flags = 64;
cp += 3;
}
#endif
#ifdef HAVE_INTMAX_T
else if (*cp == 'j')
{
@ -342,6 +351,11 @@ printf_parse (const char *format, char_directives *d, arguments *a)
switch (c)
{
case 'd': case 'i':
#ifdef HAVE_INT64_AND_I64
if (flags == 64)
type = TYPE_INT64;
else
#endif
#ifdef HAVE_LONG_LONG
if (flags >= 16 || (flags & 4))
type = TYPE_LONGLONGINT;
@ -357,6 +371,11 @@ printf_parse (const char *format, char_directives *d, arguments *a)
type = TYPE_INT;
break;
case 'o': case 'u': case 'x': case 'X':
#ifdef HAVE_INT64_AND_I64
if (flags == 64)
type = TYPE_UINT64;
else
#endif
#ifdef HAVE_LONG_LONG
if (flags >= 16 || (flags & 4))
type = TYPE_ULONGLONGINT;

View File

@ -615,6 +615,14 @@ vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args)
switch (type)
{
#ifdef HAVE_INT64_AND_I64
case TYPE_INT64:
case TYPE_UINT64:
*p++ = 'I';
*p++ = '6';
*p++ = '4';
break;
#endif
#ifdef HAVE_LONG_LONG
case TYPE_LONGLONGINT:
case TYPE_ULONGLONGINT:
@ -769,6 +777,20 @@ vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args)
SNPRINTF_BUF (arg);
}
break;
#ifdef HAVE_INT64_AND_I64
case TYPE_INT64:
{
__int64 arg = a.arg[dp->arg_index].a.a_int64;
SNPRINTF_BUF (arg);
}
break;
case TYPE_UINT64:
{
unsigned __int64 arg = a.arg[dp->arg_index].a.a_uint64;
SNPRINTF_BUF (arg);
}
break;
#endif
#ifdef HAVE_LONG_LONG
#ifndef HAVE_LONG_LONG_FORMAT
case TYPE_LONGLONGINT: