1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-21 14:53:44 +03:00

fixed the bug in lang() as raised by Elliotte Rusty Harold added a

* xpath.c: fixed the bug in lang() as raised by Elliotte Rusty Harold
* result/XPath/tests/langsimple test/XPath/tests/langsimple
  test/XPath/docs/lang: added a regression test
Daniel
This commit is contained in:
Daniel Veillard
2005-04-06 14:09:08 +00:00
parent 6056ae93d3
commit 4ddaa56d7a
5 changed files with 90 additions and 4 deletions

10
xpath.c
View File

@@ -7092,8 +7092,8 @@ xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs) {
*/
void
xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs) {
xmlXPathObjectPtr val;
const xmlChar *theLang;
xmlXPathObjectPtr val = NULL;
const xmlChar *theLang = NULL;
const xmlChar *lang;
int ret = 0;
int i;
@@ -7108,10 +7108,12 @@ xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs) {
for (i = 0;lang[i] != 0;i++)
if (toupper(lang[i]) != toupper(theLang[i]))
goto not_equal;
ret = 1;
if ((theLang[i] == 0) || (theLang[i] == '-'))
ret = 1;
}
not_equal:
xmlFree((void *)theLang);
if (theLang != NULL)
xmlFree((void *)theLang);
xmlXPathFreeObject(val);
valuePush(ctxt, xmlXPathNewBoolean(ret));
}