summaryrefslogtreecommitdiffstats
path: root/contrib/libs/libxml/parserInternals.c
diff options
context:
space:
mode:
authorsetser <[email protected]>2022-05-09 00:13:37 +0300
committersetser <[email protected]>2022-05-09 00:13:37 +0300
commite87e3fc8d0e04eb7ba3eee221bb91613b527ad85 (patch)
tree5279c128bdbdf902b9a08d9fae8e55b91910a553 /contrib/libs/libxml/parserInternals.c
parentf4f3e4024a1f32bd0bc3fa20239025a1b179e42d (diff)
Update libxml to 2.9.13
ref:f572491d236694e847142c36f0f5546c649e05d7
Diffstat (limited to 'contrib/libs/libxml/parserInternals.c')
-rw-r--r--contrib/libs/libxml/parserInternals.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/contrib/libs/libxml/parserInternals.c b/contrib/libs/libxml/parserInternals.c
index b00cd08ec27..c5c0b16dbe1 100644
--- a/contrib/libs/libxml/parserInternals.c
+++ b/contrib/libs/libxml/parserInternals.c
@@ -105,7 +105,7 @@ xmlCheckVersion(int version) {
/**
* xmlErrMemory:
* @ctxt: an XML parser context
- * @extra: extra informations
+ * @extra: extra information
*
* Handle a redefinition of attribute error
*/
@@ -165,7 +165,7 @@ __xmlErrEncoding(xmlParserCtxtPtr ctxt, xmlParserErrors xmlerr,
* xmlErrInternal:
* @ctxt: an XML parser context
* @msg: the error message
- * @str: error informations
+ * @str: error information
*
* Handle an internal error
*/
@@ -519,8 +519,6 @@ xmlNextChar(xmlParserCtxtPtr ctxt)
} else
/* 1-byte code */
ctxt->input->cur++;
-
- ctxt->nbChars++;
} else {
/*
* Assume it's a fixed length encoding (1) with
@@ -533,7 +531,6 @@ xmlNextChar(xmlParserCtxtPtr ctxt)
} else
ctxt->input->col++;
ctxt->input->cur++;
- ctxt->nbChars++;
}
if (*ctxt->input->cur == 0)
xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
@@ -677,7 +674,6 @@ xmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
}
if (*ctxt->input->cur == 0xD) {
if (ctxt->input->cur[1] == 0xA) {
- ctxt->nbChars++;
ctxt->input->cur++;
}
return(0xA);
@@ -693,7 +689,6 @@ xmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
*len = 1;
if (*ctxt->input->cur == 0xD) {
if (ctxt->input->cur[1] == 0xA) {
- ctxt->nbChars++;
ctxt->input->cur++;
}
return(0xA);
@@ -1158,6 +1153,11 @@ xmlSwitchInputEncodingInt(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
* Note: this is a bit dangerous, but that's what it
* takes to use nearly compatible signature for different
* encodings.
+ *
+ * FIXME: Encoders might buffer partial byte sequences, so
+ * this probably can't work. We should return an error and
+ * make sure that callers never try to switch the encoding
+ * twice.
*/
xmlCharEncCloseFunc(input->buf->encoder);
input->buf->encoder = handler;
@@ -1546,8 +1546,10 @@ xmlNewInputFromFile(xmlParserCtxtPtr ctxt, const char *filename) {
}
inputStream = xmlNewInputStream(ctxt);
- if (inputStream == NULL)
+ if (inputStream == NULL) {
+ xmlFreeParserInputBuffer(buf);
return(NULL);
+ }
inputStream->buf = buf;
inputStream = xmlCheckHTTPInput(ctxt, inputStream);
@@ -1748,7 +1750,6 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
ctxt->options |= XML_PARSE_NOENT;
}
ctxt->record_info = 0;
- ctxt->nbChars = 0;
ctxt->checkIndex = 0;
ctxt->inSubset = 0;
ctxt->errNo = XML_ERR_OK;
@@ -1877,7 +1878,7 @@ xmlNewParserCtxt(void)
/************************************************************************
* *
- * Handling of node informations *
+ * Handling of node information *
* *
************************************************************************/