This bug was introduced with my change of 2000-10-22 (textutils-2.0.8).
authorJim Meyering <jim@meyering.net>
Tue, 14 May 2002 21:31:42 +0000 (21:31 +0000)
committerJim Meyering <jim@meyering.net>
Tue, 14 May 2002 21:31:42 +0000 (21:31 +0000)
(ulonglong_t): Move declaration to precede new use.
[enum size_spec] (N_SIZE_SPECS): New member.
(width_bytes): Add initializer corresponding to ulonglong_t type.
(struct assert_width_bytes_matches_size_spec_decl): Declare.
Based on a patch from Tony Kocurko.

src/od.c

index 383d60d..0cc3b0c 100644 (file)
--- a/src/od.c
+++ b/src/od.c
@@ -66,6 +66,14 @@ typedef double LONG_DOUBLE;
 # define LDBL_DIG DBL_DIG
 #endif
 
+#if HAVE_UNSIGNED_LONG_LONG
+typedef unsigned long long ulonglong_t;
+#else
+/* This is just a place-holder to avoid a few `#if' directives.
+   In this case, the type isn't actually used.  */
+typedef unsigned long int ulonglong_t;
+#endif
+
 enum size_spec
   {
     NO_SIZE,
@@ -77,7 +85,8 @@ enum size_spec
     /* FIXME: add INTMAX support, too */
     FLOAT_SINGLE,
     FLOAT_DOUBLE,
-    FLOAT_LONG_DOUBLE
+    FLOAT_LONG_DOUBLE,
+    N_SIZE_SPECS
   };
 
 enum output_format
@@ -136,11 +145,20 @@ static const int width_bytes[] =
   sizeof (short int),
   sizeof (int),
   sizeof (long int),
+  sizeof (ulonglong_t),
   sizeof (float),
   sizeof (double),
   sizeof (LONG_DOUBLE)
 };
 
+/* Ensure that for each member of `enum size_spec' there is an
+   initializer in the width_bytes array.  */
+struct assert_width_bytes_matches_size_spec_decl
+{
+  int t1[sizeof width_bytes / sizeof width_bytes[0] - N_SIZE_SPECS];
+  int t2[N_SIZE_SPECS - sizeof width_bytes / sizeof width_bytes[0]];
+};
+
 /* Names for some non-printing characters.  */
 static const char *const charname[33] =
 {
@@ -231,14 +249,6 @@ static FILE *in_stream;
 /* If nonzero, at least one of the files we read was standard input.  */
 static int have_read_stdin;
 
-#if HAVE_UNSIGNED_LONG_LONG
-typedef unsigned long long ulonglong_t;
-#else
-/* This is just a place-holder to avoid a few `#if' directives.
-   In this case, the type isn't actually used.  */
-typedef unsigned long int ulonglong_t;
-#endif
-
 #define MAX_INTEGRAL_TYPE_SIZE sizeof (ulonglong_t)
 static enum size_spec integral_type_size[MAX_INTEGRAL_TYPE_SIZE + 1];