diff options
-rw-r--r-- | cc.h | 2 | ||||
-rw-r--r-- | expr.c | 9 | ||||
-rw-r--r-- | map.c | 2 | ||||
-rw-r--r-- | qbe.c | 4 | ||||
-rw-r--r-- | util.h | 4 |
5 files changed, 11 insertions, 10 deletions
@@ -331,7 +331,7 @@ struct expr { double f; } constant; struct { - char *data; + unsigned char *data; size_t size; } string; struct { @@ -363,10 +363,10 @@ isodigit(int c) return '0' <= c && c <= '8'; } -static int +static unsigned unescape(char **p) { - int c; + unsigned c; char *s = *p; if (*s == '\\') { @@ -397,7 +397,7 @@ unescape(char **p) while (isodigit(*++s)); } } else { - c = *s++; + c = (unsigned char)*s++; } *p = s; return c; @@ -456,7 +456,8 @@ primaryexpr(struct scope *s) struct expr *e; struct decl *d; struct type *t; - char *src, *dst, *end; + char *src, *end; + unsigned char *dst; int base; switch (tok.kind) { @@ -24,7 +24,7 @@ hash(const void *ptr, size_t len) } void -mapkey(struct mapkey *k, const char *s, size_t n) +mapkey(struct mapkey *k, const void *s, size_t n) { k->str = s; k->len = n; @@ -1275,7 +1275,7 @@ dataitem(struct expr *expr, uint64_t size) { struct decl *decl; size_t i; - char c; + unsigned c; switch (expr->kind) { case EXPRUNARY: @@ -1309,7 +1309,7 @@ dataitem(struct expr *expr, uint64_t size) if (isprint(c) && c != '"' && c != '\\') putchar(c); else - printf("\\%03hho", c); + printf("\\%03o", c); } fputc('"', stdout); if (i < size) @@ -9,7 +9,7 @@ struct array { struct mapkey { uint64_t hash; - const char *str; + const void *str; size_t len; }; @@ -47,7 +47,7 @@ void *arraylast(struct array *, size_t); /* map */ -void mapkey(struct mapkey *, const char *, size_t); +void mapkey(struct mapkey *, const void *, size_t); struct map *mkmap(size_t); void delmap(struct map *, void(void *)); void **mapput(struct map *, struct mapkey *); |