Fix 64bit printing for MSVC builds (#119292, Hans Breuer):
authorMatthias Clasen <maclas@gmx.de>
Sun, 2 Nov 2003 00:54:02 +0000 (00:54 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Sun, 2 Nov 2003 00:54:02 +0000 (00:54 +0000)
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.

12 files changed:
ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
configure.in
glib/gnulib/README
glib/gnulib/printf-args.c
glib/gnulib/printf-args.h
glib/gnulib/printf-parse.c
glib/gnulib/vasnprintf.c

index 16811eb..3d5b55c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 16811eb..3d5b55c 100644 (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
index 16811eb..3d5b55c 100644 (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
index 16811eb..3d5b55c 100644 (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
index 16811eb..3d5b55c 100644 (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
index 16811eb..3d5b55c 100644 (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
index 5db6be0..0ea2d1d 100644 (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
index 0b23d6c..78e09b9 100644 (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
 
 
 
index 364a5d7..91ca6d8 100644 (file)
@@ -69,6 +69,14 @@ printf_fetchargs (va_list args, arguments *a)
        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);
        break;
index 35114a8..0825675 100644 (file)
@@ -49,6 +49,10 @@ typedef enum
   TYPE_LONGLONGINT,
   TYPE_ULONGLONGINT,
 #endif
+#ifdef HAVE_INT64_AND_I64
+  TYPE_INT64,
+  TYPE_UINT64,
+#endif
   TYPE_DOUBLE,
 #ifdef HAVE_LONG_DOUBLE
   TYPE_LONGDOUBLE,
@@ -89,6 +93,10 @@ typedef struct
     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;
 #ifdef HAVE_LONG_DOUBLE
index e511fc1..961b081 100644 (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;
index 14a4621..dd9fca6 100644 (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: