[hackers] [scc] [cc1] Fix lower case hexadecimal numbers || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Wed, 11 May 2016 12:23:45 +0200 (CEST)

commit 91c841038b2cc8dcd84bd6dc6415453062e245b5
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Wed May 11 11:54:29 2016 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Wed May 11 12:19:27 2016 +0200

    [cc1] Fix lower case hexadecimal numbers
    
    We were using the strchr approach to convert from a hexadecimal
    number to a quantity, but we only had upper case digits in our
    array, so something like 0x7fff will generate a very weird number

diff --git a/cc1/lex.c b/cc1/lex.c
index d21640a..bcd707a 100644
--- a/cc1/lex.c
+++ b/cc1/lex.c
_AT_@ -274,7 +274,7 @@ readint(char *s, int base, int sign, Symbol *sym)
 
         for (u = 0; isxdigit(c = *s++); u = u*base + val) {
                 static char letters[] = "0123456789ABCDEF";
- val = strchr(letters, c) - letters;
+ val = strchr(letters, toupper(c)) - letters;
         repeat:
                 if (u <= max/base && u*base <= max - val)
                         continue;
Received on Wed May 11 2016 - 12:23:45 CEST

This archive was generated by hypermail 2.3.0 : Wed May 11 2016 - 12:24:13 CEST