summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1993-02-25 14:27:40 +0000
committerJim Meyering <jim@meyering.net>1993-02-25 14:27:40 +0000
commitbc18a8e7f735f4fef1cb2b781f7aef1e4ac86a43 (patch)
treefd80e9d3333b68a6e3d70380da301f3e049aa019
parentf7c04842b90b2984749e514b7e4637d05ee0f385 (diff)
downloadcoreutils-bc18a8e7f735f4fef1cb2b781f7aef1e4ac86a43.tar.xz
(print_s_char, print_s_short): Fix printing of signed chars and signed shorts.
-rw-r--r--src/od.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/od.c b/src/od.c
index 0e9161b26..b18189f57 100644
--- a/src/od.c
+++ b/src/od.c
@@ -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);
}