From: Matthias Clasen Date: Sun, 2 Nov 2003 00:54:02 +0000 (+0000) Subject: Fix 64bit printing for MSVC builds (#119292, Hans Breuer): X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=76433d5365b89f45c6ccd51e68c26ed3c59889bc;p=dana%2Fcg-glib.git Fix 64bit printing for MSVC builds (#119292, Hans Breuer): Sun Nov 2 01:47:31 2003 Matthias Clasen 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. --- diff --git a/ChangeLog b/ChangeLog index 16811ebd..3d5b55cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +Sun Nov 2 01:47:31 2003 Matthias Clasen + + 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 * glib/gmain.c (g_main_context_iterate): Set the diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 16811ebd..3d5b55cd 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,22 @@ +Sun Nov 2 01:47:31 2003 Matthias Clasen + + 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 * glib/gmain.c (g_main_context_iterate): Set the diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 16811ebd..3d5b55cd 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,22 @@ +Sun Nov 2 01:47:31 2003 Matthias Clasen + + 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 * glib/gmain.c (g_main_context_iterate): Set the diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 16811ebd..3d5b55cd 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,22 @@ +Sun Nov 2 01:47:31 2003 Matthias Clasen + + 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 * glib/gmain.c (g_main_context_iterate): Set the diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 16811ebd..3d5b55cd 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,22 @@ +Sun Nov 2 01:47:31 2003 Matthias Clasen + + 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 * glib/gmain.c (g_main_context_iterate): Set the diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 16811ebd..3d5b55cd 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,22 @@ +Sun Nov 2 01:47:31 2003 Matthias Clasen + + 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 * glib/gmain.c (g_main_context_iterate): Set the diff --git a/configure.in b/configure.in index 5db6be04..0ea2d1d9 100644 --- a/configure.in +++ b/configure.in @@ -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 diff --git a/glib/gnulib/README b/glib/gnulib/README index 0b23d6ca..78e09b94 100644 --- a/glib/gnulib/README +++ b/glib/gnulib/README @@ -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 diff --git a/glib/gnulib/printf-args.c b/glib/gnulib/printf-args.c index 364a5d7b..91ca6d83 100644 --- a/glib/gnulib/printf-args.c +++ b/glib/gnulib/printf-args.c @@ -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); diff --git a/glib/gnulib/printf-args.h b/glib/gnulib/printf-args.h index 35114a8f..08256756 100644 --- a/glib/gnulib/printf-args.h +++ b/glib/gnulib/printf-args.h @@ -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; diff --git a/glib/gnulib/printf-parse.c b/glib/gnulib/printf-parse.c index e511fc1d..961b0816 100644 --- a/glib/gnulib/printf-parse.c +++ b/glib/gnulib/printf-parse.c @@ -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; diff --git a/glib/gnulib/vasnprintf.c b/glib/gnulib/vasnprintf.c index 14a46218..dd9fca64 100644 --- a/glib/gnulib/vasnprintf.c +++ b/glib/gnulib/vasnprintf.c @@ -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: