Author: metze Date: 2005-10-15 09:28:56 +0000 (Sat, 15 Oct 2005) New Revision: 11084
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=11084 Log: - allow hex numbers with 'a'...'f' digits to be parsed - parse hex numbers correct tridge: how could we submit this to the upstream appweb library? metze Modified: branches/SAMBA_4_0/source/lib/appweb/ejs/ejsLex.c branches/SAMBA_4_0/source/lib/appweb/mpr/var.c Changeset: Modified: branches/SAMBA_4_0/source/lib/appweb/ejs/ejsLex.c =================================================================== --- branches/SAMBA_4_0/source/lib/appweb/ejs/ejsLex.c 2005-10-15 09:25:43 UTC (rev 11083) +++ branches/SAMBA_4_0/source/lib/appweb/ejs/ejsLex.c 2005-10-15 09:28:56 UTC (rev 11084) @@ -633,12 +633,19 @@ 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 Modified: branches/SAMBA_4_0/source/lib/appweb/mpr/var.c =================================================================== --- branches/SAMBA_4_0/source/lib/appweb/mpr/var.c 2005-10-15 09:25:43 UTC (rev 11083) +++ branches/SAMBA_4_0/source/lib/appweb/mpr/var.c 2005-10-15 09:28:56 UTC (rev 11084) @@ -2015,7 +2015,7 @@ 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 @@ 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; }