aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/libxml/xmlIO.c
diff options
context:
space:
mode:
authorsetser <setser@yandex-team.ru>2022-05-09 00:13:37 +0300
committersetser <setser@yandex-team.ru>2022-05-09 00:13:37 +0300
commite87e3fc8d0e04eb7ba3eee221bb91613b527ad85 (patch)
tree5279c128bdbdf902b9a08d9fae8e55b91910a553 /contrib/libs/libxml/xmlIO.c
parentf4f3e4024a1f32bd0bc3fa20239025a1b179e42d (diff)
downloadydb-e87e3fc8d0e04eb7ba3eee221bb91613b527ad85.tar.gz
Update libxml to 2.9.13
ref:f572491d236694e847142c36f0f5546c649e05d7
Diffstat (limited to 'contrib/libs/libxml/xmlIO.c')
-rw-r--r--contrib/libs/libxml/xmlIO.c41
1 files changed, 35 insertions, 6 deletions
diff --git a/contrib/libs/libxml/xmlIO.c b/contrib/libs/libxml/xmlIO.c
index 7921e793a0..0898158851 100644
--- a/contrib/libs/libxml/xmlIO.c
+++ b/contrib/libs/libxml/xmlIO.c
@@ -224,7 +224,7 @@ __xmlIOWin32UTF8ToWChar(const char *u8String)
/**
* xmlIOErrMemory:
- * @extra: extra informations
+ * @extra: extra information
*
* Handle an out of memory condition
*/
@@ -238,7 +238,7 @@ xmlIOErrMemory(const char *extra)
* __xmlIOErr:
* @code: the error number
* @
- * @extra: extra informations
+ * @extra: extra information
*
* Handle an I/O error
*/
@@ -416,7 +416,7 @@ __xmlIOErr(int domain, int code, const char *extra)
/**
* xmlIOErr:
* @code: the error number
- * @extra: extra informations
+ * @extra: extra information
*
* Handle an I/O error
*/
@@ -429,7 +429,7 @@ xmlIOErr(int code, const char *extra)
/**
* __xmlLoaderErr:
* @ctx: the parser context
- * @extra: extra informations
+ * @extra: extra information
*
* Handle a resource access error
*/
@@ -560,6 +560,33 @@ xmlCleanupOutputCallbacks(void)
xmlOutputCallbackNr = 0;
xmlOutputCallbackInitialized = 0;
}
+
+/**
+ * xmlPopOutputCallbacks:
+ *
+ * Remove the top output callbacks from the output stack. This includes the
+ * compiled-in I/O.
+ *
+ * Returns the number of output callback registered or -1 in case of error.
+ */
+int
+xmlPopOutputCallbacks(void)
+{
+ if (!xmlOutputCallbackInitialized)
+ return(-1);
+
+ if (xmlOutputCallbackNr <= 0)
+ return(-1);
+
+ xmlOutputCallbackNr--;
+ xmlOutputCallbackTable[xmlOutputCallbackNr].matchcallback = NULL;
+ xmlOutputCallbackTable[xmlOutputCallbackNr].opencallback = NULL;
+ xmlOutputCallbackTable[xmlOutputCallbackNr].writecallback = NULL;
+ xmlOutputCallbackTable[xmlOutputCallbackNr].closecallback = NULL;
+
+ return(xmlOutputCallbackNr);
+}
+
#endif /* LIBXML_OUTPUT_ENABLED */
/************************************************************************
@@ -2708,6 +2735,8 @@ __xmlOutputBufferCreateFilename(const char *URI,
ret->writecallback = xmlGzfileWrite;
ret->closecallback = xmlGzfileClose;
}
+ else
+ xmlGzfileClose(context);
return(ret);
}
}
@@ -3377,7 +3406,7 @@ xmlOutputBufferWrite(xmlOutputBufferPtr out, int len, const char *buf) {
if (out->writecallback)
nbchars = xmlBufUse(out->conv);
else
- nbchars = ret;
+ nbchars = ret >= 0 ? ret : 0;
} else {
ret = xmlBufAdd(out->buffer, (const xmlChar *) buf, chunk);
if (ret != 0)
@@ -3575,7 +3604,7 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str,
if (out->writecallback)
nbchars = xmlBufUse(out->conv);
else
- nbchars = ret;
+ nbchars = ret >= 0 ? ret : 0;
} else {
ret = escaping(xmlBufEnd(out->buffer), &chunk, str, &cons);
if ((ret < 0) || (chunk == 0)) /* chunk==0 => nothing done */