summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--third_party/libxslt/README.chromium3
-rw-r--r--third_party/libxslt/libxslt/functions.c26
2 files changed, 23 insertions, 6 deletions
diff --git a/third_party/libxslt/README.chromium b/third_party/libxslt/README.chromium
index be4e44e..2dea87e 100644
--- a/third_party/libxslt/README.chromium
+++ b/third_party/libxslt/README.chromium
@@ -35,7 +35,8 @@ done ---
- Change the "Locale support" section to #if 0
- For good measure, change the LIBXSLT_DEFAULT_PLUGINS_PATH() define to "NULL"
-Current version: 1.1.26
+Current version: 1.1.26, plus the following patches:
+- A fix to get more compact generated IDs (http://git.gnome.org/browse/libxslt/commit/?id=ecb6bcb8d1b7e44842edde3929f412d46b40c89f)
To import a new snapshot of libxslt:
diff --git a/third_party/libxslt/libxslt/functions.c b/third_party/libxslt/libxslt/functions.c
index 4720c7a..de962f4 100644
--- a/third_party/libxslt/libxslt/functions.c
+++ b/third_party/libxslt/libxslt/functions.c
@@ -654,8 +654,9 @@ xsltFormatNumberFunction(xmlXPathParserContextPtr ctxt, int nargs)
void
xsltGenerateIdFunction(xmlXPathParserContextPtr ctxt, int nargs){
xmlNodePtr cur = NULL;
- unsigned long val;
- xmlChar str[20];
+ long val;
+ xmlChar str[30];
+ xmlDocPtr doc;
if (nargs == 0) {
cur = ctxt->context->node;
@@ -694,9 +695,24 @@ xsltGenerateIdFunction(xmlXPathParserContextPtr ctxt, int nargs){
* Okay this is ugly but should work, use the NodePtr address
* to forge the ID
*/
- val = (unsigned long)((char *)cur - (char *)0);
- val /= sizeof(xmlNode);
- sprintf((char *)str, "id%ld", val);
+ if (cur->type != XML_NAMESPACE_DECL)
+ doc = cur->doc;
+ else {
+ xmlNsPtr ns = (xmlNsPtr) cur;
+
+ if (ns->context != NULL)
+ doc = ns->context;
+ else
+ doc = ctxt->context->doc;
+
+ }
+
+ val = (long)((char *)cur - (char *)doc);
+ if (val >= 0) {
+ sprintf((char *)str, "idp%ld", val);
+ } else {
+ sprintf((char *)str, "idm%ld", -val);
+ }
valuePush(ctxt, xmlXPathNewString(str));
}