mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-09 04:58:16 +03:00
Fix unused variable warnings with disabled features
This commit is contained in:
parent
4fd69f3e27
commit
c41bc10da3
65
SAX2.c
65
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,
|
||||
|
@ -2780,6 +2780,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) {
|
||||
|
4
parser.c
4
parser.c
@ -1104,6 +1104,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
|
||||
|
3
tree.c
3
tree.c
@ -6534,6 +6534,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);
|
||||
|
||||
|
3
xmlIO.c
3
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) &&
|
||||
|
@ -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();
|
||||
|
8
xzlib.c
8
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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user