aboutsummaryrefslogtreecommitdiff
path: root/bfd/srec.c
diff options
context:
space:
mode:
authorJohn Gilmore <gnu@cygnus>1992-10-15 09:44:59 +0000
committerJohn Gilmore <gnu@cygnus>1992-10-15 09:44:59 +0000
commit5f9ca9603825b26fca8625e98e34e75aa599f26f (patch)
treed5b5adf2cecc2c3c0bb325af699c3f1bb983ce36 /bfd/srec.c
parentf8e01940189dfd4a06f8818d4442ce6d39fd9539 (diff)
downloadgdb-5f9ca9603825b26fca8625e98e34e75aa599f26f.zip
gdb-5f9ca9603825b26fca8625e98e34e75aa599f26f.tar.gz
gdb-5f9ca9603825b26fca8625e98e34e75aa599f26f.tar.bz2
* aout-adobe.c, aoutf1.h, aoutx.h, bout.c coff-m68k.c, coff-z8k.c,
coffcode.h, elf.c, libaout.h, libbfd.h, srec.c: Lint.
Diffstat (limited to 'bfd/srec.c')
-rw-r--r--bfd/srec.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/bfd/srec.c b/bfd/srec.c
index 6f3081a..fd63066 100644
--- a/bfd/srec.c
+++ b/bfd/srec.c
@@ -76,20 +76,20 @@ DESCRIPTION
#include "sysdep.h"
#include "libbfd.h"
-static char digs[] = "0123456789ABCDEF";
+/* Macros for converting between hex and binary */
-/* Horrible ascii dependent macros for converting between hex and
- binary */
+static const char digs[] = "0123456789ABCDEF";
+
+static char hex_value[1 + (unsigned char)~0];
-#define CHARS_IN_SET 256
-static char hex_value[CHARS_IN_SET];
#define NOT_HEX 20
-#define NIBBLE(x) hex_value[x]
+#define NIBBLE(x) hex_value[(unsigned char)(x)]
#define HEX(buffer) ((NIBBLE((buffer)[0])<<4) + NIBBLE((buffer)[1]))
-#define TOHEX(d,x, ch) \
-d[1] = digs[(x) & 0xf]; \
-d[0] = digs[((x)>>4)&0xf]; ch += (x & 0xff);
-#define ISHEX(x) (hex_value[x] != NOT_HEX)
+#define TOHEX(d, x, ch) \
+ d[1] = digs[(x) & 0xf]; \
+ d[0] = digs[((x)>>4)&0xf]; \
+ ch += ((x) & 0xff);
+#define ISHEX(x) (hex_value[(unsigned char)(x)] != NOT_HEX)
@@ -104,7 +104,7 @@ DEFUN_VOID(srec_init)
inited = true;
- for (i = 0; i < CHARS_IN_SET; i++)
+ for (i = 0; i < sizeof (hex_value); i++)
{
hex_value[i] = NOT_HEX;
}
@@ -429,7 +429,6 @@ void DEFUN(srec_write_record,(abfd, type, address, data, end),
{
TOHEX(dst, *src, check_sum);
dst+=2;
-
}
/* Fill in the length */