234 lines
6.7 KiB
Diff
234 lines
6.7 KiB
Diff
From 1452dc5373e66a0752364d17ff9416b23e4e2268 Mon Sep 17 00:00:00 2001
|
|
From: Nick Wellnhofer <wellnhofer@aevum.de>
|
|
Date: Tue, 22 Feb 2022 19:57:12 +0100
|
|
Subject: [PATCH 1/3] Fix unused variable warnings with disabled features
|
|
|
|
---
|
|
SAX2.c | 65 +++++++++++++++++++++++++++++++++---------------------
|
|
encoding.c | 3 +++
|
|
parser.c | 4 ++++
|
|
tree.c | 3 +++
|
|
xmlIO.c | 3 +++
|
|
xmllint.c | 3 +++
|
|
xzlib.c | 8 +++++++
|
|
7 files changed, 64 insertions(+), 25 deletions(-)
|
|
|
|
diff --git a/SAX2.c b/SAX2.c
|
|
index ae6181c..8f27113 100644
|
|
--- a/SAX2.c
|
|
+++ b/SAX2.c
|
|
@@ -180,31 +180,6 @@ xmlWarnMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
|
NULL, 0, 0, msg, str1);
|
|
}
|
|
|
|
-/**
|
|
- * xmlNsErrMsg:
|
|
- * @ctxt: an XML parser context
|
|
- * @error: the error number
|
|
- * @msg: the error message
|
|
- * @str1: an error string
|
|
- * @str2: an error string
|
|
- *
|
|
- * Handle a namespace error
|
|
- */
|
|
-static void LIBXML_ATTR_FORMAT(3,0)
|
|
-xmlNsErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
|
- const char *msg, const xmlChar *str1, const xmlChar *str2)
|
|
-{
|
|
- if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
|
|
- (ctxt->instate == XML_PARSER_EOF))
|
|
- return;
|
|
- if (ctxt != NULL)
|
|
- ctxt->errNo = error;
|
|
- __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error,
|
|
- XML_ERR_ERROR, NULL, 0,
|
|
- (const char *) str1, (const char *) str2,
|
|
- NULL, 0, 0, msg, str1, str2);
|
|
-}
|
|
-
|
|
/**
|
|
* xmlNsWarnMsg:
|
|
* @ctxt: an XML parser context
|
|
@@ -709,6 +684,9 @@ xmlSAX2AttributeDecl(void *ctx, const xmlChar *elem, const xmlChar *fullname,
|
|
xmlAttributePtr attr;
|
|
xmlChar *name = NULL, *prefix = NULL;
|
|
|
|
+ /* Avoid unused variable warning if features are disabled. */
|
|
+ (void) attr;
|
|
+
|
|
if ((ctxt == NULL) || (ctxt->myDoc == NULL))
|
|
return;
|
|
|
|
@@ -776,6 +754,9 @@ xmlSAX2ElementDecl(void *ctx, const xmlChar * name, int type,
|
|
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
|
xmlElementPtr elem = NULL;
|
|
|
|
+ /* Avoid unused variable warning if features are disabled. */
|
|
+ (void) elem;
|
|
+
|
|
if ((ctxt == NULL) || (ctxt->myDoc == NULL))
|
|
return;
|
|
|
|
@@ -822,6 +803,9 @@ xmlSAX2NotationDecl(void *ctx, const xmlChar *name,
|
|
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
|
xmlNotationPtr nota = NULL;
|
|
|
|
+ /* Avoid unused variable warning if features are disabled. */
|
|
+ (void) nota;
|
|
+
|
|
if ((ctxt == NULL) || (ctxt->myDoc == NULL))
|
|
return;
|
|
|
|
@@ -1051,6 +1035,31 @@ xmlSAX2EndDocument(void *ctx)
|
|
}
|
|
|
|
#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
|
|
+/**
|
|
+ * xmlNsErrMsg:
|
|
+ * @ctxt: an XML parser context
|
|
+ * @error: the error number
|
|
+ * @msg: the error message
|
|
+ * @str1: an error string
|
|
+ * @str2: an error string
|
|
+ *
|
|
+ * Handle a namespace error
|
|
+ */
|
|
+static void LIBXML_ATTR_FORMAT(3,0)
|
|
+xmlNsErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
|
+ const char *msg, const xmlChar *str1, const xmlChar *str2)
|
|
+{
|
|
+ if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
|
|
+ (ctxt->instate == XML_PARSER_EOF))
|
|
+ return;
|
|
+ if (ctxt != NULL)
|
|
+ ctxt->errNo = error;
|
|
+ __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error,
|
|
+ XML_ERR_ERROR, NULL, 0,
|
|
+ (const char *) str1, (const char *) str2,
|
|
+ NULL, 0, 0, msg, str1, str2);
|
|
+}
|
|
+
|
|
/**
|
|
* xmlSAX2AttributeInternal:
|
|
* @ctx: the user data (XML parser context)
|
|
@@ -1144,6 +1153,9 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
|
|
xmlNsPtr nsret;
|
|
xmlChar *val;
|
|
|
|
+ /* Avoid unused variable warning if features are disabled. */
|
|
+ (void) nsret;
|
|
+
|
|
if (!ctxt->replaceEntities) {
|
|
ctxt->depth++;
|
|
val = xmlStringDecodeEntities(ctxt, value, XML_SUBSTITUTE_REF,
|
|
@@ -1206,6 +1218,9 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
|
|
xmlNsPtr nsret;
|
|
xmlChar *val;
|
|
|
|
+ /* Avoid unused variable warning if features are disabled. */
|
|
+ (void) nsret;
|
|
+
|
|
if (!ctxt->replaceEntities) {
|
|
ctxt->depth++;
|
|
val = xmlStringDecodeEntities(ctxt, value, XML_SUBSTITUTE_REF,
|
|
diff --git a/encoding.c b/encoding.c
|
|
index c14c9ff..ba03772 100644
|
|
--- a/encoding.c
|
|
+++ b/encoding.c
|
|
@@ -2784,6 +2784,9 @@ xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) {
|
|
int tofree = 0;
|
|
int i, handler_in_list = 0;
|
|
|
|
+ /* Avoid unused variable warning if features are disabled. */
|
|
+ (void) handler_in_list;
|
|
+
|
|
if (handler == NULL) return(-1);
|
|
if (handler->name == NULL) return(-1);
|
|
if (handlers != NULL) {
|
|
diff --git a/parser.c b/parser.c
|
|
index 0d5bcc1..0bdc252 100644
|
|
--- a/parser.c
|
|
+++ b/parser.c
|
|
@@ -1106,6 +1106,10 @@ xmlHasFeature(xmlFeature feature)
|
|
static void
|
|
xmlDetectSAX2(xmlParserCtxtPtr ctxt) {
|
|
xmlSAXHandlerPtr sax;
|
|
+
|
|
+ /* Avoid unused variable warning if features are disabled. */
|
|
+ (void) sax;
|
|
+
|
|
if (ctxt == NULL) return;
|
|
sax = ctxt->sax;
|
|
#ifdef LIBXML_SAX1_ENABLED
|
|
diff --git a/tree.c b/tree.c
|
|
index 0cf2483..4345eea 100644
|
|
--- a/tree.c
|
|
+++ b/tree.c
|
|
@@ -6542,6 +6542,9 @@ xmlGetPropNodeInternal(const xmlNode *node, const xmlChar *name,
|
|
{
|
|
xmlAttrPtr prop;
|
|
|
|
+ /* Avoid unused variable warning if features are disabled. */
|
|
+ (void) useDTD;
|
|
+
|
|
if ((node == NULL) || (node->type != XML_ELEMENT_NODE) || (name == NULL))
|
|
return(NULL);
|
|
|
|
diff --git a/xmlIO.c b/xmlIO.c
|
|
index 007144c..b716ed3 100644
|
|
--- a/xmlIO.c
|
|
+++ b/xmlIO.c
|
|
@@ -3821,6 +3821,9 @@ xmlParserGetDirectory(const char *filename) {
|
|
*/
|
|
xmlParserInputPtr
|
|
xmlCheckHTTPInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr ret) {
|
|
+ /* Avoid unused variable warning if features are disabled. */
|
|
+ (void) ctxt;
|
|
+
|
|
#ifdef LIBXML_HTTP_ENABLED
|
|
if ((ret != NULL) && (ret->buf != NULL) &&
|
|
(ret->buf->readcallback == xmlIOHTTPRead) &&
|
|
diff --git a/xmllint.c b/xmllint.c
|
|
index ee6bfdc..b314189 100644
|
|
--- a/xmllint.c
|
|
+++ b/xmllint.c
|
|
@@ -3853,6 +3853,9 @@ main(int argc, char **argv) {
|
|
xmlFreePattern(patternc);
|
|
#endif
|
|
|
|
+ /* Avoid unused label warning if features are disabled. */
|
|
+ goto error;
|
|
+
|
|
error:
|
|
xmlCleanupParser();
|
|
xmlMemoryDump();
|
|
diff --git a/xzlib.c b/xzlib.c
|
|
index 9a34738..62cb2b0 100644
|
|
--- a/xzlib.c
|
|
+++ b/xzlib.c
|
|
@@ -389,6 +389,10 @@ xz_head(xz_statep state)
|
|
int flags;
|
|
unsigned len;
|
|
|
|
+ /* Avoid unused variable warning if features are disabled. */
|
|
+ (void) flags;
|
|
+ (void) len;
|
|
+
|
|
/* allocate read buffers and inflate memory */
|
|
if (state->size == 0) {
|
|
/* allocate buffers */
|
|
@@ -536,6 +540,10 @@ xz_decomp(xz_statep state)
|
|
|
|
lzma_action action = LZMA_RUN;
|
|
|
|
+ /* Avoid unused variable warning if features are disabled. */
|
|
+ (void) crc;
|
|
+ (void) len;
|
|
+
|
|
/* fill output buffer up to end of deflate stream */
|
|
had = strm->avail_out;
|
|
do {
|
|
--
|
|
2.27.0
|
|
|