Commit b4c541b2 authored by Alexandre Julliard's avatar Alexandre Julliard

xml2: Import upstream release 2.11.5.

parent 13e02608
......@@ -1988,22 +1988,18 @@ xmlUconvWrapper(uconv_t *cd, int toUnicode, unsigned char *out, int *outlen,
ucnv_convertEx(cd->utf8, cd->uconv, &ucv_out, ucv_out + *outlen,
&ucv_in, ucv_in + *inlen, cd->pivot_buf,
&cd->pivot_source, &cd->pivot_target,
cd->pivot_buf + ICU_PIVOT_BUF_SIZE, 0, flush, &err);
cd->pivot_buf + ICU_PIVOT_BUF_SIZE, 0, 0, &err);
} else {
/* UTF-8 => UTF-16 => encoding */
ucnv_convertEx(cd->uconv, cd->utf8, &ucv_out, ucv_out + *outlen,
&ucv_in, ucv_in + *inlen, cd->pivot_buf,
&cd->pivot_source, &cd->pivot_target,
cd->pivot_buf + ICU_PIVOT_BUF_SIZE, 0, flush, &err);
cd->pivot_buf + ICU_PIVOT_BUF_SIZE, 0, 0, &err);
}
*inlen = ucv_in - (const char*) in;
*outlen = ucv_out - (char *) out;
if (U_SUCCESS(err)) {
/* reset pivot buf if this is the last call for input (flush==TRUE) */
if (flush)
cd->pivot_source = cd->pivot_target = cd->pivot_buf;
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)
......@@ -3830,4 +3826,3 @@ static int UTF8ToISO8859_16 (unsigned char* out, int *outlen,
#endif
#endif
......@@ -29,21 +29,21 @@ XMLPUBFUN void xmlCheckVersion(int version);
*
* the version string like "1.2.3"
*/
#define LIBXML_DOTTED_VERSION "2.11.4"
#define LIBXML_DOTTED_VERSION "2.11.5"
/**
* LIBXML_VERSION:
*
* the version number: 1.2.3 value is 10203
*/
#define LIBXML_VERSION 21104
#define LIBXML_VERSION 21105
/**
* LIBXML_VERSION_STRING:
*
* the version number string, 1.2.3 value is "10203"
*/
#define LIBXML_VERSION_STRING "21104"
#define LIBXML_VERSION_STRING "21105"
/**
* LIBXML_VERSION_EXTRA:
......@@ -58,7 +58,7 @@ XMLPUBFUN void xmlCheckVersion(int version);
* Macro to check that the libxml version in use is compatible with
* the version the software has been compiled against
*/
#define LIBXML_TEST_VERSION xmlCheckVersion(21104);
#define LIBXML_TEST_VERSION xmlCheckVersion(21105);
#ifndef VMS
#if 0
......@@ -522,5 +522,3 @@ XMLPUBFUN void xmlCheckVersion(int version);
}
#endif /* __cplusplus */
#endif
......@@ -1085,6 +1085,33 @@ xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
int ret;
if (ctxt == NULL) return(-1);
/*
* FIXME: The BOM shouldn't be skipped here, but in the parsing code.
*
* Note that we look for a decoded UTF-8 BOM when switching to UTF-16.
* This is mostly useless but Webkit/Chromium relies on this behavior.
* See https://bugs.chromium.org/p/chromium/issues/detail?id=1451026
*/
if ((ctxt->input != NULL) &&
(ctxt->input->consumed == 0) &&
(ctxt->input->cur != NULL) &&
(ctxt->input->cur == ctxt->input->base) &&
((enc == XML_CHAR_ENCODING_UTF8) ||
(enc == XML_CHAR_ENCODING_UTF16LE) ||
(enc == XML_CHAR_ENCODING_UTF16BE))) {
/*
* Errata on XML-1.0 June 20 2001
* Specific handling of the Byte Order Mark for
* UTF-8
*/
if ((ctxt->input->cur[0] == 0xEF) &&
(ctxt->input->cur[1] == 0xBB) &&
(ctxt->input->cur[2] == 0xBF)) {
ctxt->input->cur += 3;
}
}
switch (enc) {
case XML_CHAR_ENCODING_ERROR:
__xmlErrEncoding(ctxt, XML_ERR_UNKNOWN_ENCODING,
......@@ -1097,18 +1124,6 @@ xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
case XML_CHAR_ENCODING_UTF8:
/* default encoding, no conversion should be needed */
ctxt->charset = XML_CHAR_ENCODING_UTF8;
/*
* Errata on XML-1.0 June 20 2001
* Specific handling of the Byte Order Mark for
* UTF-8
*/
if ((ctxt->input != NULL) &&
(ctxt->input->cur[0] == 0xEF) &&
(ctxt->input->cur[1] == 0xBB) &&
(ctxt->input->cur[2] == 0xBF)) {
ctxt->input->cur += 3;
}
return(0);
case XML_CHAR_ENCODING_EBCDIC:
handler = xmlDetectEBCDIC(ctxt->input);
......@@ -1200,8 +1215,8 @@ xmlSwitchInputEncoding(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
/*
* Switching encodings during parsing is a really bad idea,
* but WebKit/Chromium switches from ISO-8859-1 to UTF-16 as soon as
* it finds Unicode characters with code points larger than 255.
* but Chromium can switch between ISO-8859-1 and UTF-16 before
* separate calls to xmlParseChunk.
*
* TODO: We should check whether the "raw" input buffer is empty and
* convert the old content using the old encoder.
......@@ -1222,6 +1237,10 @@ xmlSwitchInputEncoding(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
size_t processed, use, consumed;
/*
* FIXME: The BOM shouldn't be skipped here, but in the parsing code.
*/
/*
* Specific handling of the Byte Order Mark for
* UTF-16
*/
......@@ -2228,4 +2247,3 @@ xmlKeepBlanksDefault(int val) {
if (!val) xmlIndentTreeOutput = 1;
return(old);
}
......@@ -1052,7 +1052,7 @@ xmlCopyDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur) {
if (cur->c1 != NULL)
tmp->c1 = xmlCopyDocElementContent(doc,cur->c1);
if (tmp->c1 != NULL)
tmp->c1->parent = ret;
tmp->c1->parent = tmp;
prev = tmp;
cur = cur->c2;
}
......@@ -7153,4 +7153,3 @@ xmlValidGetValidElements(xmlNode *prev, xmlNode *next, const xmlChar **names,
return(nb_valid_elements);
}
#endif /* LIBXML_VALID_ENABLED */
......@@ -3204,7 +3204,7 @@ xmlXPathFormatNumber(double number, char buffer[], int buffersize)
/* Finally copy result back to caller */
size = strlen(work) + 1;
if (size > buffersize) {
work[buffersize - 1] = 0;
/*work[buffersize - 1] = 0;*/
size = buffersize;
}
memmove(buffer, work, size);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment