diff options
author | Jim Meyering <jim@meyering.net> | 1993-02-25 14:27:40 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1993-02-25 14:27:40 +0000 |
commit | bc18a8e7f735f4fef1cb2b781f7aef1e4ac86a43 (patch) | |
tree | fd80e9d3333b68a6e3d70380da301f3e049aa019 | |
parent | f7c04842b90b2984749e514b7e4637d05ee0f385 (diff) | |
download | coreutils-bc18a8e7f735f4fef1cb2b781f7aef1e4ac86a43.tar.xz |
(print_s_char, print_s_short): Fix printing of signed chars and signed shorts.
-rw-r--r-- | src/od.c | 10 |
1 files changed, 2 insertions, 8 deletions
@@ -402,10 +402,7 @@ print_s_char (n_bytes, block, fmt_string) int i; for (i = n_bytes; i > 0; i--) { - int tmp = (unsigned) *(const unsigned char *) block; - if (tmp > SCHAR_MAX) - tmp = (SCHAR_MAX - tmp); - assert (tmp <= SCHAR_MAX); + int tmp = (unsigned) *(const signed char *) block; printf (fmt_string, tmp, (i == 1 ? '\n' : ' ')); block += sizeof (unsigned char); } @@ -435,10 +432,7 @@ print_s_short (n_bytes, block, fmt_string) int i; for (i = n_bytes / sizeof (unsigned short); i > 0; i--) { - int tmp = (unsigned) *(const unsigned short *) block; - if (tmp > SHRT_MAX) - tmp = (SHRT_MAX - tmp); - assert (tmp <= SHRT_MAX); + int tmp = (unsigned) *(const signed short *) block; printf (fmt_string, tmp, (i == 1 ? '\n' : ' ')); block += sizeof (unsigned short); } |