summaryrefslogtreecommitdiff
path: root/src/od.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2002-05-14 21:31:42 +0000
committerJim Meyering <jim@meyering.net>2002-05-14 21:31:42 +0000
commit24f18f089d9486c9e3d2ac846cd02507e7bb23b1 (patch)
tree94072b3ebddda3c3d7d8dc6bc0e2205ef74043d5 /src/od.c
parent61dd314ba42c6045eb341d7bfa3f250247b3e083 (diff)
downloadcoreutils-24f18f089d9486c9e3d2ac846cd02507e7bb23b1.tar.xz
This bug was introduced with my change of 2000-10-22 (textutils-2.0.8).
(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.
Diffstat (limited to 'src/od.c')
-rw-r--r--src/od.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/od.c b/src/od.c
index 383d60ded..0cc3b0c93 100644
--- 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];