From 60e4dfac06889823f29620c497162bb3f02f83bc Mon Sep 17 00:00:00 2001 From: johanknol Date: Mon, 8 Oct 2001 11:34:37 +0000 Subject: [PATCH] fixed bug #468824 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1375 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/SDCCval.c | 50 ++++++++++++++++++++++---------------------------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/src/SDCCval.c b/src/SDCCval.c index 1d18f7ef..911cbf35 100644 --- a/src/SDCCval.c +++ b/src/SDCCval.c @@ -496,40 +496,34 @@ value *constVal (char *s) /param src Pointer to 'x' from start of hex character value */ -char hexEscape(char **src) - +unsigned char hexEscape(char **src) { -char *s ; -unsigned long value ; - -(*src)++ ; /* Skip over the 'x' */ -s = *src ; /* Save for error detection */ - -value = strtol (*src, src, 16); - -if (s == *src) - { - // no valid hex found - werror(E_INVALID_HEX); - } - -else - { - if (value > 255) - { - werror(W_ESC_SEQ_OOR_FOR_CHAR); + char *s ; + unsigned long value ; + + (*src)++ ; /* Skip over the 'x' */ + s = *src ; /* Save for error detection */ + + value = strtol (*src, src, 16); + + if (s == *src) { + // no valid hex found + werror(E_INVALID_HEX); + } else { + if (value > 255) { + werror(W_ESC_SEQ_OOR_FOR_CHAR); } } - -return (char) value; + return (char) value; } + /*------------------------------------------------------------------*/ /* octalEscape - process an octal constant of max three digits */ /* return the octal value, throw a warning for illegal octal */ /* adjust src to point at the last proccesed char */ /*------------------------------------------------------------------*/ -char octalEscape (char **str) { +unsigned char octalEscape (char **str) { int digits; unsigned value=0; @@ -818,20 +812,20 @@ charVal (char *s) case '5' : case '6' : case '7' : - SPEC_CVAL (val->type).v_int = octalEscape(&s); + SPEC_CVAL (val->type).v_uint = octalEscape(&s); break; case 'x': - SPEC_CVAL (val->type).v_int = hexEscape(&s) ; + SPEC_CVAL (val->type).v_uint = hexEscape(&s) ; break; default: - SPEC_CVAL (val->type).v_int = *s; + SPEC_CVAL (val->type).v_uint = (unsigned char)*s; break; } } else /* not a backslash */ - SPEC_CVAL (val->type).v_int = *s; + SPEC_CVAL (val->type).v_int = (unsigned char)*s; return val; } -- 2.30.2