diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-16 19:33:57 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-16 19:33:57 +0000 |
commit | a850e9592bb1a8c43275116ff565c91b4b1cb66b (patch) | |
tree | e2f9e64fbcfdb87a7693dcb9250e66082290cc5f /third_party/libxml/patches | |
parent | efa0151b9f7a4389a86334ef75fa0ce138c9778e (diff) | |
download | chromium_src-a850e9592bb1a8c43275116ff565c91b4b1cb66b.zip chromium_src-a850e9592bb1a8c43275116ff565c91b4b1cb66b.tar.gz chromium_src-a850e9592bb1a8c43275116ff565c91b4b1cb66b.tar.bz2 |
Update libxml to 2.7.7.
In doing so, I recreated all the patches and organized them under
a patches/ subdirectory.
BUG=32197
Review URL: http://codereview.chromium.org/2951008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52725 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/libxml/patches')
-rw-r--r-- | third_party/libxml/patches/LoadLibraryA | 16 | ||||
-rw-r--r-- | third_party/libxml/patches/icu | 453 | ||||
-rw-r--r-- | third_party/libxml/patches/icu-configure | 28 | ||||
-rw-r--r-- | third_party/libxml/patches/icu-win32 | 68 | ||||
-rw-r--r-- | third_party/libxml/patches/libxml-disable-autodetect | 38 | ||||
-rw-r--r-- | third_party/libxml/patches/win32-clobber-makefile | 19 | ||||
-rw-r--r-- | third_party/libxml/patches/xmlregexp-bogus-cast | 15 |
7 files changed, 637 insertions, 0 deletions
diff --git a/third_party/libxml/patches/LoadLibraryA b/third_party/libxml/patches/LoadLibraryA new file mode 100644 index 0000000..89fff15 --- /dev/null +++ b/third_party/libxml/patches/LoadLibraryA @@ -0,0 +1,16 @@ +Change 'LoadLibrary' to 'LoadLibraryA' (used with 'const char*' as an +argument) + +Index: libxml/xmlmodule.c +=================================================================== +--- libxml.orig/xmlmodule.c 2010-07-09 14:17:46.959288280 -0700 ++++ libxml/xmlmodule.c 2010-07-09 14:17:55.419051003 -0700 +@@ -300,7 +300,7 @@ + static void * + xmlModulePlatformOpen(const char *name) + { +- return LoadLibrary(name); ++ return LoadLibraryA(name); + } + + /* diff --git a/third_party/libxml/patches/icu b/third_party/libxml/patches/icu new file mode 100644 index 0000000..4503f92 --- /dev/null +++ b/third_party/libxml/patches/icu @@ -0,0 +1,453 @@ +Add code support for ICU. + +diff --git a/third_party/libxml/encoding.c b/third_party/libxml/encoding.c +index b86a547..0f41df9 100644 +--- a/third_party/libxml/encoding.c ++++ b/third_party/libxml/encoding.c +@@ -58,7 +58,7 @@ static xmlCharEncodingAliasPtr xmlCharEncodingAliases = NULL; + static int xmlCharEncodingAliasesNb = 0; + static int xmlCharEncodingAliasesMax = 0; + +-#ifdef LIBXML_ICONV_ENABLED ++#if defined(LIBXML_ICONV_ENABLED) || defined(LIBXML_ICU_ENABLED) + #if 0 + #define DEBUG_ENCODING /* Define this to get encoding traces */ + #endif +@@ -97,6 +97,54 @@ xmlEncodingErr(xmlParserErrors error, const char *msg, const char *val) + NULL, 0, val, NULL, NULL, 0, 0, msg, val); + } + ++#ifdef LIBXML_ICU_ENABLED ++static uconv_t* ++openIcuConverter(const char* name, int toUnicode) ++{ ++ UErrorCode status = U_ZERO_ERROR; ++ uconv_t *conv = (uconv_t *) xmlMalloc(sizeof(uconv_t)); ++ if (conv == NULL) ++ return NULL; ++ ++ conv->uconv = ucnv_open(name, &status); ++ if (U_FAILURE(status)) ++ goto error; ++ ++ status = U_ZERO_ERROR; ++ if (toUnicode) { ++ ucnv_setToUCallBack(conv->uconv, UCNV_TO_U_CALLBACK_STOP, ++ NULL, NULL, NULL, &status); ++ } ++ else { ++ ucnv_setFromUCallBack(conv->uconv, UCNV_FROM_U_CALLBACK_STOP, ++ NULL, NULL, NULL, &status); ++ } ++ if (U_FAILURE(status)) ++ goto error; ++ ++ status = U_ZERO_ERROR; ++ conv->utf8 = ucnv_open("UTF-8", &status); ++ if (U_SUCCESS(status)) ++ return conv; ++ ++error: ++ if (conv->uconv) ++ ucnv_close(conv->uconv); ++ xmlFree(conv); ++ return NULL; ++} ++ ++static void ++closeIcuConverter(uconv_t *conv) ++{ ++ if (conv != NULL) { ++ ucnv_close(conv->uconv); ++ ucnv_close(conv->utf8); ++ xmlFree(conv); ++ } ++} ++#endif /* LIBXML_ICU_ENABLED */ ++ + /************************************************************************ + * * + * Conversions To/From UTF8 encoding * +@@ -1306,7 +1354,11 @@ xmlNewCharEncodingHandler(const char *name, + #ifdef LIBXML_ICONV_ENABLED + handler->iconv_in = NULL; + handler->iconv_out = NULL; +-#endif /* LIBXML_ICONV_ENABLED */ ++#endif ++#ifdef LIBXML_ICU_ENABLED ++ handler->uconv_in = NULL; ++ handler->uconv_out = NULL; ++#endif + + /* + * registers and returns the handler. +@@ -1371,7 +1423,7 @@ xmlInitCharEncodingHandlers(void) { + xmlNewCharEncodingHandler("ASCII", asciiToUTF8, NULL); + xmlNewCharEncodingHandler("US-ASCII", asciiToUTF8, NULL); + #endif /* LIBXML_OUTPUT_ENABLED */ +-#ifndef LIBXML_ICONV_ENABLED ++#if !defined(LIBXML_ICONV_ENABLED) && !defined(LIBXML_ICU_ENABLED) + #ifdef LIBXML_ISO8859X_ENABLED + xmlRegisterCharEncodingHandlersISO8859x (); + #endif +@@ -1578,6 +1630,10 @@ xmlFindCharEncodingHandler(const char *name) { + xmlCharEncodingHandlerPtr enc; + iconv_t icv_in, icv_out; + #endif /* LIBXML_ICONV_ENABLED */ ++#ifdef LIBXML_ICU_ENABLED ++ xmlCharEncodingHandlerPtr enc; ++ uconv_t *ucv_in, *ucv_out; ++#endif /* LIBXML_ICU_ENABLED */ + char upper[100]; + int i; + +@@ -1647,6 +1703,35 @@ xmlFindCharEncodingHandler(const char *name) { + "iconv : problems with filters for '%s'\n", name); + } + #endif /* LIBXML_ICONV_ENABLED */ ++#ifdef LIBXML_ICU_ENABLED ++ /* check whether icu can handle this */ ++ ucv_in = openIcuConverter(name, 1); ++ ucv_out = openIcuConverter(name, 0); ++ if (ucv_in != NULL && ucv_out != NULL) { ++ enc = (xmlCharEncodingHandlerPtr) ++ xmlMalloc(sizeof(xmlCharEncodingHandler)); ++ if (enc == NULL) { ++ closeIcuConverter(ucv_in); ++ closeIcuConverter(ucv_out); ++ return(NULL); ++ } ++ enc->name = xmlMemStrdup(name); ++ enc->input = NULL; ++ enc->output = NULL; ++ enc->uconv_in = ucv_in; ++ enc->uconv_out = ucv_out; ++#ifdef DEBUG_ENCODING ++ xmlGenericError(xmlGenericErrorContext, ++ "Found ICU converter handler for encoding %s\n", name); ++#endif ++ return enc; ++ } else if (ucv_in != NULL || ucv_out != NULL) { ++ closeIcuConverter(ucv_in); ++ closeIcuConverter(ucv_out); ++ xmlEncodingErr(XML_ERR_INTERNAL_ERROR, ++ "ICU converter : problems with filters for '%s'\n", name); ++ } ++#endif /* LIBXML_ICU_ENABLED */ + + #ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, +@@ -1737,6 +1822,75 @@ xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen, + + /************************************************************************ + * * ++ * ICU based generic conversion functions * ++ * * ++ ************************************************************************/ ++ ++#ifdef LIBXML_ICU_ENABLED ++/** ++ * xmlUconvWrapper: ++ * @cd: ICU uconverter data structure ++ * @toUnicode : non-zero if toUnicode. 0 otherwise. ++ * @out: a pointer to an array of bytes to store the result ++ * @outlen: the length of @out ++ * @in: a pointer to an array of ISO Latin 1 chars ++ * @inlen: the length of @in ++ * ++ * Returns 0 if success, or ++ * -1 by lack of space, or ++ * -2 if the transcoding fails (for *in is not valid utf8 string or ++ * the result of transformation can't fit into the encoding we want), or ++ * -3 if there the last byte can't form a single output char. ++ * ++ * The value of @inlen after return is the number of octets consumed ++ * as the return value is positive, else unpredictable. ++ * The value of @outlen after return is the number of ocetes consumed. ++ */ ++static int ++xmlUconvWrapper(uconv_t *cd, int toUnicode, unsigned char *out, int *outlen, ++ const unsigned char *in, int *inlen) { ++ const char *ucv_in = (const char *) in; ++ char *ucv_out = (char *) out; ++ UErrorCode err = U_ZERO_ERROR; ++ ++ if ((out == NULL) || (outlen == NULL) || (inlen == NULL) || (in == NULL)) { ++ if (outlen != NULL) *outlen = 0; ++ return(-1); ++ } ++ ++ /* ++ * TODO(jungshik) ++ * 1. is ucnv_convert(To|From)Algorithmic better? ++ * 2. had we better use an explicit pivot buffer? ++ * 3. error returned comes from 'fromUnicode' only even ++ * when toUnicode is true ! ++ */ ++ if (toUnicode) { ++ /* encoding => UTF-16 => UTF-8 */ ++ ucnv_convertEx(cd->utf8, cd->uconv, &ucv_out, ucv_out + *outlen, ++ &ucv_in, ucv_in + *inlen, NULL, NULL, NULL, NULL, ++ 0, TRUE, &err); ++ } else { ++ /* UTF-8 => UTF-16 => encoding */ ++ ucnv_convertEx(cd->uconv, cd->utf8, &ucv_out, ucv_out + *outlen, ++ &ucv_in, ucv_in + *inlen, NULL, NULL, NULL, NULL, ++ 0, TRUE, &err); ++ } ++ *inlen = ucv_in - (const char*) in; ++ *outlen = ucv_out - (char *) out; ++ if (U_SUCCESS(err)) ++ return 0; ++ if (err == U_BUFFER_OVERFLOW_ERROR) ++ return -1; ++ if (err == U_INVALID_CHAR_FOUND || err == U_ILLEGAL_CHAR_FOUND) ++ return -2; ++ /* if (err == U_TRUNCATED_CHAR_FOUND) */ ++ return -3; ++} ++#endif /* LIBXML_ICU_ENABLED */ ++ ++/************************************************************************ ++ * * + * The real API used by libxml for on-the-fly conversion * + * * + ************************************************************************/ +@@ -1810,6 +1964,16 @@ xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out, + if (ret == -1) ret = -3; + } + #endif /* LIBXML_ICONV_ENABLED */ ++#ifdef LIBXML_ICU_ENABLED ++ else if (handler->uconv_in != NULL) { ++ ret = xmlUconvWrapper(handler->uconv_in, 1, &out->content[out->use], ++ &written, in->content, &toconv); ++ xmlBufferShrink(in, toconv); ++ out->use += written; ++ out->content[out->use] = 0; ++ if (ret == -1) ret = -3; ++ } ++#endif /* LIBXML_ICU_ENABLED */ + #ifdef DEBUG_ENCODING + switch (ret) { + case 0: +@@ -1915,6 +2079,17 @@ xmlCharEncInFunc(xmlCharEncodingHandler * handler, xmlBufferPtr out, + ret = -3; + } + #endif /* LIBXML_ICONV_ENABLED */ ++#ifdef LIBXML_ICU_ENABLED ++ else if (handler->uconv_in != NULL) { ++ ret = xmlUconvWrapper(handler->uconv_in, 1, &out->content[out->use], ++ &written, in->content, &toconv); ++ xmlBufferShrink(in, toconv); ++ out->use += written; ++ out->content[out->use] = 0; ++ if (ret == -1) ++ ret = -3; ++ } ++#endif /* LIBXML_ICU_ENABLED */ + switch (ret) { + case 0: + #ifdef DEBUG_ENCODING +@@ -2015,6 +2190,15 @@ retry: + out->content[out->use] = 0; + } + #endif /* LIBXML_ICONV_ENABLED */ ++#ifdef LIBXML_ICU_ENABLED ++ else if (handler->uconv_out != NULL) { ++ ret = xmlUconvWrapper(handler->uconv_out, 0, ++ &out->content[out->use], ++ &written, NULL, &toconv); ++ out->use += written; ++ out->content[out->use] = 0; ++ } ++#endif /* LIBXML_ICU_ENABLED */ + #ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, + "initialized encoder\n"); +@@ -2061,6 +2245,26 @@ retry: + } + } + #endif /* LIBXML_ICONV_ENABLED */ ++#ifdef LIBXML_ICU_ENABLED ++ else if (handler->uconv_out != NULL) { ++ ret = xmlUconvWrapper(handler->uconv_out, 0, ++ &out->content[out->use], ++ &written, in->content, &toconv); ++ xmlBufferShrink(in, toconv); ++ out->use += written; ++ writtentot += written; ++ out->content[out->use] = 0; ++ if (ret == -1) { ++ if (written > 0) { ++ /* ++ * Can be a limitation of iconv ++ */ ++ goto retry; ++ } ++ ret = -3; ++ } ++ } ++#endif /* LIBXML_ICU_ENABLED */ + else { + xmlEncodingErr(XML_I18N_NO_OUTPUT, + "xmlCharEncOutFunc: no output function !\n", NULL); +@@ -2173,6 +2377,22 @@ xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) { + xmlFree(handler); + } + #endif /* LIBXML_ICONV_ENABLED */ ++#ifdef LIBXML_ICU_ENABLED ++ if ((handler->uconv_out != NULL) || (handler->uconv_in != NULL)) { ++ if (handler->name != NULL) ++ xmlFree(handler->name); ++ handler->name = NULL; ++ if (handler->uconv_out != NULL) { ++ closeIcuConverter(handler->uconv_out); ++ handler->uconv_out = NULL; ++ } ++ if (handler->uconv_in != NULL) { ++ closeIcuConverter(handler->uconv_in); ++ handler->uconv_in = NULL; ++ } ++ xmlFree(handler); ++ } ++#endif + #ifdef DEBUG_ENCODING + if (ret) + xmlGenericError(xmlGenericErrorContext, +@@ -2248,6 +2468,22 @@ xmlByteConsumed(xmlParserCtxtPtr ctxt) { + cur += toconv; + } while (ret == -2); + #endif ++#ifdef LIBXML_ICU_ENABLED ++ } else if (handler->uconv_out != NULL) { ++ do { ++ toconv = in->end - cur; ++ written = 32000; ++ ret = xmlUconvWrapper(handler->uconv_out, 0, &convbuf[0], ++ &written, cur, &toconv); ++ if (ret < 0) { ++ if (written > 0) ++ ret = -2; ++ else ++ return(-1); ++ } ++ unused += written; ++ cur += toconv; ++ } while (ret == -2); + } else { + /* could not find a converter */ + return(-1); +@@ -2259,8 +2495,9 @@ xmlByteConsumed(xmlParserCtxtPtr ctxt) { + } + return(in->consumed + (in->cur - in->base)); + } ++#endif + +-#ifndef LIBXML_ICONV_ENABLED ++#if !defined(LIBXML_ICONV_ENABLED) && !defined(LIBXML_ICU_ENABLED) + #ifdef LIBXML_ISO8859X_ENABLED + + /** +diff --git a/third_party/libxml/include/libxml/encoding.h b/third_party/libxml/include/libxml/encoding.h +index c74b25f..b5f8b48 100644 +--- a/third_party/libxml/include/libxml/encoding.h ++++ b/third_party/libxml/include/libxml/encoding.h +@@ -26,6 +26,24 @@ + + #ifdef LIBXML_ICONV_ENABLED + #include <iconv.h> ++#else ++#ifdef LIBXML_ICU_ENABLED ++#include <unicode/ucnv.h> ++#if 0 ++/* Forward-declare UConverter here rather than pulling in <unicode/ucnv.h> ++ * to prevent unwanted ICU symbols being exposed to users of libxml2. ++ * One particular case is Qt4 conflicting on UChar32. ++ */ ++#include <stdint.h> ++struct UConverter; ++typedef struct UConverter UConverter; ++#ifdef _MSC_VER ++typedef wchar_t UChar; ++#else ++typedef uint16_t UChar; ++#endif ++#endif ++#endif + #endif + #ifdef __cplusplus + extern "C" { +@@ -125,6 +143,13 @@ typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen, + * Block defining the handlers for non UTF-8 encodings. + * If iconv is supported, there are two extra fields. + */ ++#ifdef LIBXML_ICU_ENABLED ++struct _uconv_t { ++ UConverter *uconv; /* for conversion between an encoding and UTF-16 */ ++ UConverter *utf8; /* for conversion between UTF-8 and UTF-16 */ ++}; ++typedef struct _uconv_t uconv_t; ++#endif + + typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler; + typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr; +@@ -136,6 +161,10 @@ struct _xmlCharEncodingHandler { + iconv_t iconv_in; + iconv_t iconv_out; + #endif /* LIBXML_ICONV_ENABLED */ ++#ifdef LIBXML_ICU_ENABLED ++ uconv_t *uconv_in; ++ uconv_t *uconv_out; ++#endif /* LIBXML_ICU_ENABLED */ + }; + + #ifdef __cplusplus +diff --git a/third_party/libxml/include/libxml/parser.h b/third_party/libxml/include/libxml/parser.h +index dd79c42..3580b63 100644 +--- a/third_party/libxml/include/libxml/parser.h ++++ b/third_party/libxml/include/libxml/parser.h +@@ -1222,6 +1222,7 @@ typedef enum { + XML_WITH_DEBUG_MEM = 29, + XML_WITH_DEBUG_RUN = 30, + XML_WITH_ZLIB = 31, ++ XML_WITH_ICU = 32, + XML_WITH_NONE = 99999 /* just to be sure of allocation size */ + } xmlFeature; + +diff --git a/third_party/libxml/include/libxml/xmlversion.h.in b/third_party/libxml/include/libxml/xmlversion.h.in +index 4739f3a..de310ab 100644 +--- a/third_party/libxml/include/libxml/xmlversion.h.in ++++ b/third_party/libxml/include/libxml/xmlversion.h.in +@@ -269,6 +269,15 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); + #endif + + /** ++ * LIBXML_ICU_ENABLED: ++ * ++ * Whether icu support is available ++ */ ++#if @WITH_ICU@ ++#define LIBXML_ICU_ENABLED ++#endif ++ ++/** + * LIBXML_ISO8859X_ENABLED: + * + * Whether ISO-8859-* support is made available in case iconv is not +diff --git a/third_party/libxml/parser.c b/third_party/libxml/parser.c +index 85e7599..3ba2a06 100644 +--- a/third_party/libxml/parser.c ++++ b/third_party/libxml/parser.c +@@ -954,6 +954,12 @@ xmlHasFeature(xmlFeature feature) + #else + return(0); + #endif ++ case XML_WITH_ICU: ++#ifdef LIBXML_ICU_ENABLED ++ return(1); ++#else ++ return(0); ++#endif + default: + break; + } diff --git a/third_party/libxml/patches/icu-configure b/third_party/libxml/patches/icu-configure new file mode 100644 index 0000000..f7e2395 --- /dev/null +++ b/third_party/libxml/patches/icu-configure @@ -0,0 +1,28 @@ +Modifications to configure.in: +- set the WITH_ICU flag unconditionally +- only output files we use + +Index: libxml/configure.in +=================================================================== +--- libxml.orig/configure.in 2010-07-09 15:00:21.600113911 -0700 ++++ libxml/configure.in 2010-07-09 15:02:50.299108047 -0700 +@@ -1229,6 +1229,9 @@ + fi + AC_SUBST(WITH_OUTPUT) + ++WITH_ICU=1 ++AC_SUBST(WITH_ICU) ++ + WITH_ICONV=0 + if test "$with_iconv" = "no" ; then + echo Disabling ICONV support +@@ -1456,7 +1459,7 @@ + ln -s Copyright COPYING + + # keep on one line for cygwin c.f. #130896 +-AC_OUTPUT(libxml2.spec:libxml.spec.in Makefile include/Makefile include/libxml/Makefile doc/Makefile doc/examples/Makefile doc/devhelp/Makefile example/Makefile python/Makefile python/tests/Makefile xstc/Makefile include/libxml/xmlversion.h xml2-config libxml-2.0.pc libxml-2.0-uninstalled.pc python/setup.py) ++AC_OUTPUT(include/libxml/xmlversion.h xml2-config) + +-chmod +x xml2-config python/setup.py ++chmod +x xml2-config + echo Done configuring diff --git a/third_party/libxml/patches/icu-win32 b/third_party/libxml/patches/icu-win32 new file mode 100644 index 0000000..2ea8f21 --- /dev/null +++ b/third_party/libxml/patches/icu-win32 @@ -0,0 +1,68 @@ +diff --git a/third_party/libxml/win32/Makefile.msvc b/third_party/libxml/win32/Makefile.msvc +index 2409905..253c46e 100644 +--- a/third_party/libxml/win32/Makefile.msvc ++++ b/third_party/libxml/win32/Makefile.msvc +@@ -71,6 +71,9 @@ LIBS = $(LIBS) wsock32.lib ws2_32.lib + !if "$(WITH_ICONV)" == "1" + LIBS = $(LIBS) iconv.lib + !endif ++!if "$(WITH_ICU)" == "1" ++LIBS = $(LIBS) icu.lib ++!endif + !if "$(WITH_ZLIB)" == "1" + LIBS = $(LIBS) zdll.lib + !endif +diff --git a/third_party/libxml/win32/configure.js b/third_party/libxml/win32/configure.js +index e71d2af..75def3f 100644 +--- a/third_party/libxml/win32/configure.js ++++ b/third_party/libxml/win32/configure.js +@@ -40,6 +40,7 @@ var withXpath = true; + var withXptr = true; + var withXinclude = true; + var withIconv = true; ++var withIcu = false; + var withIso8859x = false; + var withZlib = false; + var withDebug = true; +@@ -124,6 +125,7 @@ function usage() + txt += " xptr: Enable XPointer support (" + (withXptr? "yes" : "no") + ")\n"; + txt += " xinclude: Enable XInclude support (" + (withXinclude? "yes" : "no") + ")\n"; + txt += " iconv: Enable iconv support (" + (withIconv? "yes" : "no") + ")\n"; ++ txt += " icu: Enable icu support (" + (withIcu? "yes" : "no") + ")\n"; + txt += " iso8859x: Enable ISO8859X support (" + (withIso8859x? "yes" : "no") + ")\n"; + txt += " zlib: Enable zlib support (" + (withZlib? "yes" : "no") + ")\n"; + txt += " xml_debug: Enable XML debbugging module (" + (withDebug? "yes" : "no") + ")\n"; +@@ -233,6 +235,7 @@ function discoverVersion() + vf.WriteLine("WITH_XPTR=" + (withXptr? "1" : "0")); + vf.WriteLine("WITH_XINCLUDE=" + (withXinclude? "1" : "0")); + vf.WriteLine("WITH_ICONV=" + (withIconv? "1" : "0")); ++ vf.WriteLine("WITH_ICU=" + (withIcu? "1" : "0")); + vf.WriteLine("WITH_ISO8859X=" + (withIso8859x? "1" : "0")); + vf.WriteLine("WITH_ZLIB=" + (withZlib? "1" : "0")); + vf.WriteLine("WITH_DEBUG=" + (withDebug? "1" : "0")); +@@ -319,6 +322,8 @@ function configureLibxml() + of.WriteLine(s.replace(/\@WITH_XINCLUDE\@/, withXinclude? "1" : "0")); + } else if (s.search(/\@WITH_ICONV\@/) != -1) { + of.WriteLine(s.replace(/\@WITH_ICONV\@/, withIconv? "1" : "0")); ++ } else if (s.search(/\@WITH_ICU\@/) != -1) { ++ of.WriteLine(s.replace(/\@WITH_ICU\@/, withIcu? "1" : "0")); + } else if (s.search(/\@WITH_ISO8859X\@/) != -1) { + of.WriteLine(s.replace(/\@WITH_ISO8859X\@/, withIso8859x? "1" : "0")); + } else if (s.search(/\@WITH_ZLIB\@/) != -1) { +@@ -462,6 +467,8 @@ for (i = 0; (i < WScript.Arguments.length) && (error == 0); i++) { + withXinclude = strToBool(arg.substring(opt.length + 1, arg.length)); + else if (opt == "iconv") + withIconv = strToBool(arg.substring(opt.length + 1, arg.length)); ++ else if (opt == "icu") ++ withIcu = strToBool(arg.substring(opt.length + 1, arg.length)); + else if (opt == "iso8859x") + withIso8859x = strToBool(arg.substring(opt.length + 1, arg.length)); + else if (opt == "zlib") +@@ -646,6 +653,7 @@ txtOut += " XPath support: " + boolToStr(withXpath) + "\n"; + txtOut += " XPointer support: " + boolToStr(withXptr) + "\n"; + txtOut += " XInclude support: " + boolToStr(withXinclude) + "\n"; + txtOut += " iconv support: " + boolToStr(withIconv) + "\n"; ++txtOut += " icu support: " + boolToStr(withIcu) + "\n"; + txtOut += " iso8859x support: " + boolToStr(withIso8859x) + "\n"; + txtOut += " zlib support: " + boolToStr(withZlib) + "\n"; + txtOut += " Debugging module: " + boolToStr(withDebug) + "\n"; diff --git a/third_party/libxml/patches/libxml-disable-autodetect b/third_party/libxml/patches/libxml-disable-autodetect new file mode 100644 index 0000000..c37d41a --- /dev/null +++ b/third_party/libxml/patches/libxml-disable-autodetect @@ -0,0 +1,38 @@ +See comment below inline in the patch. +It'd be nice to fix this properly but that will require upstream WebKit +changes; for now, we can just patch out some code to keep behavior as it +was before. + +diff --git a/third_party/libxml/parser.c b/third_party/libxml/parser.c +index 3ba2a06..4a3cde5 100644 +--- a/third_party/libxml/parser.c ++++ b/third_party/libxml/parser.c +@@ -11545,6 +11545,20 @@ xmldecl_done: + int cur = ctxt->input->cur - ctxt->input->base; + int res; + ++ /* Chromium note: commenting out the following block of code is a gory ++ * hack, meant to partially undo ++ * http://git.gnome.org/browse/libxml2/commit/?id=a6c76a ++ * ++ * WebKit and libxml disagree about who is responsible for the ++ * document encoding. ++ * ++ * This bug: ++ * https://bugs.webkit.org/show_bug.cgi?id=30508 ++ * has links to test cases, libxml bug reports, and mailing list threads ++ * arguing about it; for now, though, we can just undo the change that ++ * caused libxml to regress. ++ */ ++#if 0 + /* + * Specific handling if we autodetected an encoding, we should not + * push more than the first line ... which depend on the encoding +@@ -11580,6 +11594,7 @@ xmldecl_done: + remain = 0; + } + } ++#endif + res =xmlParserInputBufferPush(ctxt->input->buf, size, chunk); + if (res < 0) { + ctxt->errNo = XML_PARSER_EOF; diff --git a/third_party/libxml/patches/win32-clobber-makefile b/third_party/libxml/patches/win32-clobber-makefile new file mode 100644 index 0000000..2f7fbb4 --- /dev/null +++ b/third_party/libxml/patches/win32-clobber-makefile @@ -0,0 +1,19 @@ +Index: libxml/win32/configure.js +=================================================================== +--- libxml.orig/win32/configure.js 2010-07-09 14:56:07.769093841 -0700 ++++ libxml/win32/configure.js 2010-07-09 15:36:48.590268611 -0700 +@@ -611,7 +611,13 @@ + makefile = ".\\Makefile.mingw"; + else if (compiler == "bcb") + makefile = ".\\Makefile.bcb"; +-fso.CopyFile(makefile, ".\\Makefile", true); ++var new_makefile = ".\\Makefile"; ++var f = fso.FileExists(new_makefile); ++if (f) { ++ var t = fso.GetFile(new_makefile); ++ t.Attributes = 0; ++} ++fso.CopyFile(makefile, new_makefile, true); + WScript.Echo("Created Makefile."); + // Create the config.h. + var confighsrc = "..\\include\\win32config.h"; diff --git a/third_party/libxml/patches/xmlregexp-bogus-cast b/third_party/libxml/patches/xmlregexp-bogus-cast new file mode 100644 index 0000000..aaebfaa --- /dev/null +++ b/third_party/libxml/patches/xmlregexp-bogus-cast @@ -0,0 +1,15 @@ +Change bogus '(unsigned long)' cast to '(unsigned short)' + +Index: libxml/xmlregexp.c +=================================================================== +--- libxml.orig/xmlregexp.c 2010-07-09 14:16:36.990430641 -0700 ++++ libxml/xmlregexp.c 2010-07-09 14:16:40.939742007 -0700 +@@ -6470,7 +6470,7 @@ + if (name != NULL) { + value += 30 * (*name); + while ((ch = *name++) != 0) { +- value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); ++ value = value ^ ((value << 5) + (value >> 3) + (unsigned short)ch); + } + } + return (value); |