summaryrefslogtreecommitdiffstats
path: root/third_party/libxslt
diff options
context:
space:
mode:
authorcevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-23 00:54:57 +0000
committercevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-23 00:54:57 +0000
commit8f30af7229df2cdc5aeaa9969feb27fb7535e059 (patch)
treecd17fa62a4cca5898b72b2b9a848d4da490ff46a /third_party/libxslt
parenta6d36cc6586a1d1c57a960be57827ba8de167fdb (diff)
downloadchromium_src-8f30af7229df2cdc5aeaa9969feb27fb7535e059.zip
chromium_src-8f30af7229df2cdc5aeaa9969feb27fb7535e059.tar.gz
chromium_src-8f30af7229df2cdc5aeaa9969feb27fb7535e059.tar.bz2
Apply change for less verbose ID lengths from upstream.
BUG=73716 TEST=none Review URL: http://codereview.chromium.org/6549014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75684 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/libxslt')
-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));
}