diff options
Diffstat (limited to 'source4/lib/appweb')
-rw-r--r-- | source4/lib/appweb/ejs/ejsLex.c | 19 | ||||
-rw-r--r-- | source4/lib/appweb/mpr/var.c | 4 |
2 files changed, 15 insertions, 8 deletions
diff --git a/source4/lib/appweb/ejs/ejsLex.c b/source4/lib/appweb/ejs/ejsLex.c index b4617a638e..b9a363cfc9 100644 --- a/source4/lib/appweb/ejs/ejsLex.c +++ b/source4/lib/appweb/ejs/ejsLex.c @@ -633,12 +633,19 @@ static int getLexicalToken(Ejs *ep, int state) break; } if (tolower(c) == 'x') { - if (tokenAddChar(ep, c) < 0) { - return EJS_TOK_ERR; - } - if ((c = inputGetc(ep)) < 0) { - break; - } + do { + if (tokenAddChar(ep, c) < 0) { + return EJS_TOK_ERR; + } + if ((c = inputGetc(ep)) < 0) { + break; + } + } while (isdigit(c) || (tolower(c) >= 'a' && tolower(c) <= 'f')); + + mprDestroyVar(&ep->tokenNumber); + ep->tokenNumber = mprParseVar(ep->token, type); + inputPutback(ep, c); + return EJS_TOK_NUMBER; } if (! isdigit(c)) { #if BLD_FEATURE_FLOATING_POINT diff --git a/source4/lib/appweb/mpr/var.c b/source4/lib/appweb/mpr/var.c index 09979156e8..011d668460 100644 --- a/source4/lib/appweb/mpr/var.c +++ b/source4/lib/appweb/mpr/var.c @@ -2015,7 +2015,7 @@ int64 mprParseInteger64(char *str) if (isdigit(c)) { num64 = (c - '0') + (num64 * radix); } else if (c >= 'a' && c <= 'f') { - num64 = (c - 'a') + (num64 * radix); + num64 = (c - ('a' - 10)) + (num64 * radix); } else { break; } @@ -2132,7 +2132,7 @@ int mprParseInteger(char *str) if (isdigit(c)) { num = (c - '0') + (num * radix); } else if (c >= 'a' && c <= 'f') { - num = (c - 'a') + (num * radix); + num = (c - ('a' - 10)) + (num * radix); } else { break; } |