From b06c61455f86758511aa050a06ff1bbd33f8c3c3 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Mon, 27 Aug 2001 14:26:30 +0000 Subject: [PATCH] hum, restrict the integer usage gcc bug workaround to only gcc compilers * xpath.c: hum, restrict the integer usage gcc bug workaround to only gcc compilers so that other architecture don't get penalized by this limitation. * include/libxml/xpath.h: small typo fix from Heiko W. Rupp Daniel --- ChangeLog | 7 +++++++ include/libxml/xpath.h | 2 +- xpath.c | 16 ++++++++++++++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 61a09ac0..7996caaf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Mon Aug 27 16:24:47 CEST 2001 Daniel Veillard + + * xpath.c: hum, restrict the integer usage gcc bug workaround + to only gcc compilers so that other architecture don't get + penalized by this limitation. + * include/libxml/xpath.h: small typo fix from Heiko W. Rupp + Sun Aug 26 20:45:04 CEST 2001 Daniel Veillard * valid.c: fixed a Windows compiler warning (Chris Poblete) diff --git a/include/libxml/xpath.h b/include/libxml/xpath.h index 8479056e..088f6ff3 100644 --- a/include/libxml/xpath.h +++ b/include/libxml/xpath.h @@ -135,7 +135,7 @@ struct _xmlXPathVariable { * @ctxt: an XPath parser context * @nargs: the number of arguments passed to the function * - * an XPath evaluation function, the parameters are on thei XPath context stack + * an XPath evaluation function, the parameters are on the XPath context stack */ typedef void (*xmlXPathEvalFunc)(xmlXPathParserContextPtr ctxt, diff --git a/xpath.c b/xpath.c index 0dba1f02..062e6c62 100644 --- a/xpath.c +++ b/xpath.c @@ -6546,10 +6546,13 @@ xmlXPathStringEvalNumber(const xmlChar *str) { const xmlChar *cur = str; double ret = 0.0; double mult = 1; - int ok = 0, tmp = 0; + int ok = 0; int isneg = 0; int exponent = 0; int is_exponent_negative = 0; +#ifdef __GNUC__ + unsigned long tmp = 0; +#endif while (IS_BLANK(*cur)) cur++; if ((*cur != '.') && ((*cur < '0') || (*cur > '9')) && (*cur != '-')) { @@ -6559,8 +6562,10 @@ xmlXPathStringEvalNumber(const xmlChar *str) { isneg = 1; cur++; } + +#ifdef __GNUC__ /* - * tmp is a workaroudn against a gcc compiler bug + * tmp is a workaround against a gcc compiler bug */ while ((*cur >= '0') && (*cur <= '9')) { tmp = tmp * 10 + (*cur - '0'); @@ -6568,6 +6573,13 @@ xmlXPathStringEvalNumber(const xmlChar *str) { cur++; } ret = (double) tmp; +#else + while ((*cur >= '0') && (*cur <= '9')) { + ret = ret * 10 + (*cur - '0'); + ok = 1; + cur++; + } +#endif if (*cur == '.') { cur++;