1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-31 06:50:06 +03:00

parser: Don't detect encoding in xmlCtxtResetPush

The encoding will be detected in xmlParseTryOrFinish.
This commit is contained in:
Nick Wellnhofer 2023-08-08 15:19:36 +02:00
parent 3a64f39448
commit d9ec182b65

View File

@ -14340,15 +14340,11 @@ xmlCtxtResetPush(xmlParserCtxtPtr ctxt, const char *chunk,
{
xmlParserInputPtr inputStream;
xmlParserInputBufferPtr buf;
xmlCharEncoding enc = XML_CHAR_ENCODING_NONE;
if (ctxt == NULL)
return(1);
if ((encoding == NULL) && (chunk != NULL) && (size >= 4))
enc = xmlDetectCharEncoding((const xmlChar *) chunk, size);
buf = xmlAllocParserInputBuffer(enc);
buf = xmlAllocParserInputBuffer(XML_CHAR_ENCODING_NONE);
if (buf == NULL)
return(1);
@ -14413,8 +14409,6 @@ xmlCtxtResetPush(xmlParserCtxtPtr ctxt, const char *chunk,
xmlFatalErrMsgStr(ctxt, XML_ERR_UNSUPPORTED_ENCODING,
"Unsupported encoding %s\n", BAD_CAST encoding);
}
} else if (enc != XML_CHAR_ENCODING_NONE) {
xmlSwitchEncoding(ctxt, enc);
}
return(0);