summaryrefslogtreecommitdiffstats
path: root/src/xxd/xxd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xxd/xxd.c')
-rw-r--r--src/xxd/xxd.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/xxd/xxd.c b/src/xxd/xxd.c
index c90bc027e8..26f8d8365d 100644
--- a/src/xxd/xxd.c
+++ b/src/xxd/xxd.c
@@ -96,8 +96,8 @@
# include <unistd.h>
#endif
#include <stdlib.h>
-#include <string.h> /* for strncmp() */
-#include <ctype.h> /* for isalnum() */
+#include <string.h>
+#include <ctype.h>
#include <limits.h>
#if __MWERKS__ && !defined(BEBOX)
# include <unix.h> /* for fdopen() on MAC */
@@ -208,7 +208,7 @@ char hexxa[] = "0123456789abcdef0123456789ABCDEF", *hexx = hexxa;
#define HEX_BITS 3 /* not hex a dump, but bits: 01111001 */
#define HEX_LITTLEENDIAN 4
-#define CONDITIONAL_CAPITALIZE(c) (capitalize ? toupper((int)c) : c)
+#define CONDITIONAL_CAPITALIZE(c) (capitalize ? toupper((unsigned char)(c)) : (c))
#define COLOR_PROLOGUE \
l[c++] = '\033'; \
@@ -952,9 +952,9 @@ main(int argc, char *argv[])
if (varname != NULL)
{
- FPRINTF_OR_DIE((fpo, "unsigned char %s", isdigit((int)varname[0]) ? "__" : ""));
+ FPRINTF_OR_DIE((fpo, "unsigned char %s", isdigit((unsigned char)varname[0]) ? "__" : ""));
for (e = 0; (c = varname[e]) != 0; e++)
- putc_or_die(isalnum(c) ? CONDITIONAL_CAPITALIZE(c) : '_', fpo);
+ putc_or_die(isalnum((unsigned char)c) ? CONDITIONAL_CAPITALIZE(c) : '_', fpo);
fputs_or_die("[] = {\n", fpo);
}
@@ -972,9 +972,9 @@ main(int argc, char *argv[])
if (varname != NULL)
{
fputs_or_die("};\n", fpo);
- FPRINTF_OR_DIE((fpo, "unsigned int %s", isdigit((int)varname[0]) ? "__" : ""));
+ FPRINTF_OR_DIE((fpo, "unsigned int %s", isdigit((unsigned char)varname[0]) ? "__" : ""));
for (e = 0; (c = varname[e]) != 0; e++)
- putc_or_die(isalnum(c) ? CONDITIONAL_CAPITALIZE(c) : '_', fpo);
+ putc_or_die(isalnum((unsigned char)c) ? CONDITIONAL_CAPITALIZE(c) : '_', fpo);
FPRINTF_OR_DIE((fpo, "_%s = %d;\n", capitalize ? "LEN" : "len", p));
}