Okay this is scary but it is just adding a configure option to disable
* HTMLtree.c SAX2.c c14n.c catalog.c configure.in debugXML.c
encoding.c entities.c nanoftp.c nanohttp.c parser.c relaxng.c
testAutomata.c testC14N.c testHTML.c testRegexp.c testRelax.c
testSchemas.c testXPath.c threads.c tree.c valid.c xmlIO.c
xmlcatalog.c xmllint.c xmlmemory.c xmlreader.c xmlschemas.c
example/gjobread.c include/libxml/HTMLtree.h include/libxml/c14n.h
include/libxml/catalog.h include/libxml/debugXML.h
include/libxml/entities.h include/libxml/nanohttp.h
include/libxml/relaxng.h include/libxml/tree.h
include/libxml/valid.h include/libxml/xmlIO.h
include/libxml/xmlschemas.h include/libxml/xmlversion.h.in
include/libxml/xpathInternals.h python/libxml.c:
Okay this is scary but it is just adding a configure option
to disable output, this touches most of the files.
Daniel
diff --git a/ChangeLog b/ChangeLog
index d1ba77f..8c8942e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+Mon Sep 29 15:15:08 CEST 2003 Daniel Veillard <daniel@veillard.com>
+
+ * HTMLtree.c SAX2.c c14n.c catalog.c configure.in debugXML.c
+ encoding.c entities.c nanoftp.c nanohttp.c parser.c relaxng.c
+ testAutomata.c testC14N.c testHTML.c testRegexp.c testRelax.c
+ testSchemas.c testXPath.c threads.c tree.c valid.c xmlIO.c
+ xmlcatalog.c xmllint.c xmlmemory.c xmlreader.c xmlschemas.c
+ example/gjobread.c include/libxml/HTMLtree.h include/libxml/c14n.h
+ include/libxml/catalog.h include/libxml/debugXML.h
+ include/libxml/entities.h include/libxml/nanohttp.h
+ include/libxml/relaxng.h include/libxml/tree.h
+ include/libxml/valid.h include/libxml/xmlIO.h
+ include/libxml/xmlschemas.h include/libxml/xmlversion.h.in
+ include/libxml/xpathInternals.h python/libxml.c:
+ Okay this is scary but it is just adding a configure option
+ to disable output, this touches most of the files.
+
Mon Sep 29 12:53:56 CEST 2003 Daniel Veillard <daniel@veillard.com>
* xmlmemory.c: better fix, avoids breaking the python bindings
diff --git a/HTMLtree.c b/HTMLtree.c
index 7571731..41ce1ee 100644
--- a/HTMLtree.c
+++ b/HTMLtree.c
@@ -315,6 +315,7 @@
return 0;
}
+#ifdef LIBXML_OUTPUT_ENABLED
/************************************************************************
* *
* Dumping HTML tree content to a simple buffer *
@@ -1135,6 +1136,6 @@
return(htmlSaveFileFormat(filename, cur, encoding, 1));
}
-
+#endif /* LIBXML_OUTPUT_ENABLED */
#endif /* LIBXML_HTML_ENABLED */
diff --git a/SAX2.c b/SAX2.c
index 261842f..450db5b 100644
--- a/SAX2.c
+++ b/SAX2.c
@@ -871,7 +871,7 @@
*/
static void
xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
- const xmlChar *value, const xmlChar *prefix)
+ const xmlChar *value, const xmlChar *prefix ATTRIBUTE_UNUSED)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlAttrPtr ret;
diff --git a/c14n.c b/c14n.c
index 89589ca..620c9a3 100644
--- a/c14n.c
+++ b/c14n.c
@@ -12,6 +12,7 @@
#define IN_LIBXML
#include "libxml.h"
#ifdef LIBXML_C14N_ENABLED
+#ifdef LIBXML_OUTPUT_ENABLED
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
@@ -1927,4 +1928,5 @@
*out++ = 0;
return (buffer);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
#endif /* LIBXML_C14N_ENABLED */
diff --git a/catalog.c b/catalog.c
index d307bf4..6ff22a1 100644
--- a/catalog.c
+++ b/catalog.c
@@ -374,6 +374,7 @@
* *
************************************************************************/
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlCatalogDumpEntry:
* @entry: the
@@ -587,6 +588,7 @@
return(ret);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/************************************************************************
* *
@@ -2682,6 +2684,7 @@
return(ret);
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlACatalogDump:
* @catal: a Catalog
@@ -2701,6 +2704,7 @@
(xmlHashScanner) xmlCatalogDumpEntry, out);
}
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlACatalogAdd:
@@ -3097,6 +3101,7 @@
return(ret);
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlCatalogDump:
* @out: the file.
@@ -3113,6 +3118,7 @@
xmlACatalogDump(xmlDefaultCatalog, out);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlCatalogAdd:
diff --git a/configure.in b/configure.in
index 57bafa0..7b74776 100644
--- a/configure.in
+++ b/configure.in
@@ -527,8 +527,20 @@
LDFLAGS=${_ldflags}
fi
-AC_SUBST(WITH_FTP)
-AC_SUBST(FTP_OBJ)
+AC_ARG_WITH(output,
+[ --with-output add the serialization support (on)])
+if test "$with_minimum" = "yes" -a "$with_output" = ""
+then
+ with_output=no
+fi
+if test "$with_output" = "no" ; then
+ echo Disabling serialization/saving support
+ WITH_OUTPUT=0
+else
+ WITH_OUTPUT=1
+fi
+AC_SUBST(WITH_OUTPUT)
+
AC_ARG_WITH(ftp,
[ --with-ftp add the FTP support (on)])
if test "$with_minimum" = "yes" -a "$with_ftp" = ""
diff --git a/debugXML.c b/debugXML.c
index 6109711..57a09fe 100644
--- a/debugXML.c
+++ b/debugXML.c
@@ -1346,6 +1346,7 @@
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlShellPrintNodeCtxt:
* @ctxt : a non-null shell context
@@ -1386,6 +1387,7 @@
{
xmlShellPrintNodeCtxt(NULL, node);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlShellPrintXPathResultCtxt:
@@ -1397,20 +1399,18 @@
static void
xmlShellPrintXPathResultCtxt(xmlShellCtxtPtr ctxt,xmlXPathObjectPtr list)
{
- int i = 0;
if (!ctxt)
return;
if (list != NULL) {
switch (list->type) {
case XPATH_NODESET:{
+#ifdef LIBXML_OUTPUT_ENABLED
int indx;
if (list->nodesetval) {
for (indx = 0; indx < list->nodesetval->nodeNr;
indx++) {
- if (i > 0)
- fprintf(stderr, " -------\n");
xmlShellPrintNodeCtxt(ctxt,
list->nodesetval->nodeTab[indx]);
}
@@ -1419,6 +1419,10 @@
"Empty node set\n");
}
break;
+#else
+ xmlGenericError(xmlGenericErrorContext,
+ "Node set\n");
+#endif /* LIBXML_OUTPUT_ENABLED */
}
case XPATH_BOOLEAN:
xmlGenericError(xmlGenericErrorContext,
@@ -1664,6 +1668,7 @@
return (0);
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlShellCat:
* @ctxt: the shell context
@@ -1707,6 +1712,7 @@
fprintf(ctxt->output, "\n");
return (0);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlShellLoad:
@@ -1761,6 +1767,7 @@
return (0);
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlShellWrite:
* @ctxt: the shell context
@@ -1887,6 +1894,7 @@
}
return (0);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlShellValidate:
@@ -2178,18 +2186,22 @@
#endif /* LIBXML_XPATH_ENABLED */
fprintf(ctxt->output, "\tpwd display current working directory\n");
fprintf(ctxt->output, "\tquit leave shell\n");
+#ifdef LIBXML_OUTPUT_ENABLED
fprintf(ctxt->output, "\tsave [name] save this document to name or the original name\n");
- fprintf(ctxt->output, "\tvalidate check the document for errors\n");
fprintf(ctxt->output, "\twrite [name] write the current node to the filename\n");
+#endif /* LIBXML_OUTPUT_ENABLED */
+ fprintf(ctxt->output, "\tvalidate check the document for errors\n");
fprintf(ctxt->output, "\tgrep string search for a string in the subtree\n");
} else if (!strcmp(command, "validate")) {
xmlShellValidate(ctxt, arg, NULL, NULL);
} else if (!strcmp(command, "load")) {
xmlShellLoad(ctxt, arg, NULL, NULL);
+#ifdef LIBXML_OUTPUT_ENABLED
} else if (!strcmp(command, "save")) {
xmlShellSave(ctxt, arg, NULL, NULL);
} else if (!strcmp(command, "write")) {
xmlShellWrite(ctxt, arg, NULL, NULL);
+#endif /* LIBXML_OUTPUT_ENABLED */
} else if (!strcmp(command, "grep")) {
xmlShellGrep(ctxt, arg, ctxt->node, NULL);
} else if (!strcmp(command, "free")) {
@@ -2389,6 +2401,7 @@
}
ctxt->pctxt->node = NULL;
}
+#ifdef LIBXML_OUTPUT_ENABLED
} else if (!strcmp(command, "cat")) {
if (arg[0] == 0) {
xmlShellCat(ctxt, NULL, ctxt->node, NULL);
@@ -2466,6 +2479,7 @@
}
ctxt->pctxt->node = NULL;
}
+#endif /* LIBXML_OUTPUT_ENABLED */
} else {
xmlGenericError(xmlGenericErrorContext,
"Unknown command %s\n", command);
diff --git a/encoding.c b/encoding.c
index 25f8cc3..302cf56 100644
--- a/encoding.c
+++ b/encoding.c
@@ -512,6 +512,7 @@
return(0);
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* UTF8Toascii:
* @out: a pointer to an array of bytes to store the result
@@ -594,6 +595,7 @@
*inlen = processed - instart;
return(0);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* isolat1ToUTF8:
@@ -683,6 +685,7 @@
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* UTF8Toisolat1:
* @out: a pointer to an array of bytes to store the result
@@ -770,6 +773,7 @@
*inlen = processed - instart;
return(0);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* UTF16LEToUTF8:
@@ -859,6 +863,7 @@
return(0);
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* UTF8ToUTF16LE:
* @outb: a pointer to an array of bytes to store the result
@@ -978,6 +983,7 @@
*inlen = processed - instart;
return(0);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* UTF16BEToUTF8:
@@ -1071,6 +1077,7 @@
return(0);
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* UTF8ToUTF16BE:
* @outb: a pointer to an array of bytes to store the result
@@ -1187,6 +1194,7 @@
*inlen = processed - instart;
return(0);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/************************************************************************
* *
@@ -1673,6 +1681,7 @@
return;
}
xmlNewCharEncodingHandler("UTF-8", UTF8ToUTF8, UTF8ToUTF8);
+#ifdef LIBXML_OUTPUT_ENABLED
xmlUTF16LEHandler =
xmlNewCharEncodingHandler("UTF-16LE", UTF16LEToUTF8, UTF8ToUTF16LE);
xmlUTF16BEHandler =
@@ -1683,6 +1692,15 @@
#ifdef LIBXML_HTML_ENABLED
xmlNewCharEncodingHandler("HTML", NULL, UTF8ToHtml);
#endif
+#else
+ xmlUTF16LEHandler =
+ xmlNewCharEncodingHandler("UTF-16LE", UTF16LEToUTF8, NULL);
+ xmlUTF16BEHandler =
+ xmlNewCharEncodingHandler("UTF-16BE", UTF16BEToUTF8, NULL);
+ xmlNewCharEncodingHandler("ISO-8859-1", isolat1ToUTF8, NULL);
+ xmlNewCharEncodingHandler("ASCII", asciiToUTF8, NULL);
+ xmlNewCharEncodingHandler("US-ASCII", asciiToUTF8, NULL);
+#endif /* LIBXML_OUTPUT_ENABLED */
#ifndef LIBXML_ICONV_ENABLED
#ifdef LIBXML_ISO8859X_ENABLED
xmlRegisterCharEncodingHandlersISO8859x ();
diff --git a/entities.c b/entities.c
index ae6fe48..85f0d18 100644
--- a/entities.c
+++ b/entities.c
@@ -754,6 +754,7 @@
return(xmlHashCopy(table, (xmlHashCopier) xmlCopyEntity));
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlDumpEntityDecl:
* @buf: An XML buffer.
@@ -851,3 +852,4 @@
xmlDumpEntitiesTable(xmlBufferPtr buf, xmlEntitiesTablePtr table) {
xmlHashScan(table, (xmlHashScanner)xmlDumpEntityDecl, buf);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
diff --git a/example/gjobread.c b/example/gjobread.c
index 599ece8..a447959 100644
--- a/example/gjobread.c
+++ b/example/gjobread.c
@@ -240,8 +240,10 @@
fprintf(stderr,"document of the wrong type, was '%s', Jobs expected",
cur->name);
fprintf(stderr,"xmlDocDump follows\n");
+#ifdef LIBXML_OUTPUT_ENABLED
xmlDocDump ( stderr, doc );
fprintf(stderr,"xmlDocDump finished\n");
+#endif /* LIBXML_OUTPUT_ENABLED */
xmlFreeDoc(doc);
free(ret);
return(NULL);
diff --git a/include/libxml/HTMLtree.h b/include/libxml/HTMLtree.h
index c40df38..832c7c8 100644
--- a/include/libxml/HTMLtree.h
+++ b/include/libxml/HTMLtree.h
@@ -68,6 +68,7 @@
XMLPUBFUN int XMLCALL
htmlSetMetaEncoding (htmlDocPtr doc,
const xmlChar *encoding);
+#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
htmlDocDumpMemory (xmlDocPtr cur,
xmlChar **mem,
@@ -117,16 +118,16 @@
xmlDocPtr cur,
const char *encoding,
int format);
-
-XMLPUBFUN int XMLCALL
- htmlIsBooleanAttr (const xmlChar *name);
XMLPUBFUN void XMLCALL
htmlNodeDumpOutput (xmlOutputBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur,
const char *encoding);
+#endif /* LIBXML_OUTPUT_ENABLED */
+XMLPUBFUN int XMLCALL
+ htmlIsBooleanAttr (const xmlChar *name);
#ifdef __cplusplus
diff --git a/include/libxml/c14n.h b/include/libxml/c14n.h
index a2d9aed..8a78929 100644
--- a/include/libxml/c14n.h
+++ b/include/libxml/c14n.h
@@ -11,6 +11,7 @@
*/
#ifndef __XML_C14N_H__
#define __XML_C14N_H__
+#ifdef LIBXML_OUTPUT_ENABLED
#ifdef __cplusplus
extern "C" {
@@ -92,5 +93,6 @@
}
#endif /* __cplusplus */
+#endif /* LIBXML_OUTPUT_ENABLED */
#endif /* __XML_C14N_H__ */
diff --git a/include/libxml/catalog.h b/include/libxml/catalog.h
index 689e7ce..c8a5ac3 100644
--- a/include/libxml/catalog.h
+++ b/include/libxml/catalog.h
@@ -91,9 +91,11 @@
XMLPUBFUN xmlChar * XMLCALL
xmlACatalogResolveURI (xmlCatalogPtr catal,
const xmlChar *URI);
+#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlACatalogDump (xmlCatalogPtr catal,
FILE *out);
+#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN void XMLCALL
xmlFreeCatalog (xmlCatalogPtr catal);
XMLPUBFUN int XMLCALL
@@ -110,8 +112,10 @@
xmlLoadCatalogs (const char *paths);
XMLPUBFUN void XMLCALL
xmlCatalogCleanup (void);
+#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlCatalogDump (FILE *out);
+#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN xmlChar * XMLCALL
xmlCatalogResolve (const xmlChar *pubID,
const xmlChar *sysID);
diff --git a/include/libxml/debugXML.h b/include/libxml/debugXML.h
index f71e670..58211eb 100644
--- a/include/libxml/debugXML.h
+++ b/include/libxml/debugXML.h
@@ -148,6 +148,7 @@
char *filename,
xmlNodePtr node,
xmlNodePtr node2);
+#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN int XMLCALL
xmlShellWrite (xmlShellCtxtPtr ctxt,
char *filename,
@@ -158,6 +159,7 @@
char *filename,
xmlNodePtr node,
xmlNodePtr node2);
+#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN int XMLCALL
xmlShellValidate (xmlShellCtxtPtr ctxt,
char *dtd,
diff --git a/include/libxml/entities.h b/include/libxml/entities.h
index 6355863..515913d 100644
--- a/include/libxml/entities.h
+++ b/include/libxml/entities.h
@@ -110,12 +110,14 @@
xmlCopyEntitiesTable (xmlEntitiesTablePtr table);
XMLPUBFUN void XMLCALL
xmlFreeEntitiesTable (xmlEntitiesTablePtr table);
+#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlDumpEntitiesTable (xmlBufferPtr buf,
xmlEntitiesTablePtr table);
XMLPUBFUN void XMLCALL
xmlDumpEntityDecl (xmlBufferPtr buf,
xmlEntityPtr ent);
+#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN void XMLCALL
xmlCleanupPredefinedEntities(void);
diff --git a/include/libxml/nanohttp.h b/include/libxml/nanohttp.h
index 8897fda..87990aa 100644
--- a/include/libxml/nanohttp.h
+++ b/include/libxml/nanohttp.h
@@ -56,9 +56,11 @@
xmlNanoHTTPRead (void *ctx,
void *dest,
int len);
+#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN int XMLCALL
xmlNanoHTTPSave (void *ctxt,
const char *filename);
+#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN void XMLCALL
xmlNanoHTTPClose (void *ctx);
#ifdef __cplusplus
diff --git a/include/libxml/relaxng.h b/include/libxml/relaxng.h
index 2129eea..25fea44 100644
--- a/include/libxml/relaxng.h
+++ b/include/libxml/relaxng.h
@@ -103,12 +103,14 @@
xmlRelaxNGParse (xmlRelaxNGParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlRelaxNGFree (xmlRelaxNGPtr schema);
+#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlRelaxNGDump (FILE *output,
xmlRelaxNGPtr schema);
XMLPUBFUN void XMLCALL
xmlRelaxNGDumpTree (FILE * output,
xmlRelaxNGPtr schema);
+#endif /* LIBXML_OUTPUT_ENABLED */
/*
* Interfaces for validating
*/
diff --git a/include/libxml/tree.h b/include/libxml/tree.h
index 686364f..4165627 100644
--- a/include/libxml/tree.h
+++ b/include/libxml/tree.h
@@ -533,13 +533,6 @@
/*
* Variables.
*/
-#if 0
-LIBXML_DLL_IMPORT extern int oldXMLWDcompatibility;/* maintain compatibility with old WD */
-LIBXML_DLL_IMPORT extern int xmlIndentTreeOutput; /* try to indent the tree dumps */
-LIBXML_DLL_IMPORT extern xmlBufferAllocationScheme xmlBufferAllocScheme; /* alloc scheme to use */
-LIBXML_DLL_IMPORT extern int xmlSaveNoEmptyTags; /* save empty tags as <empty></empty> */
-LIBXML_DLL_IMPORT extern int xmlDefaultBufferSize; /* default buffer size */
-#endif
/*
* Some helper functions
@@ -961,6 +954,7 @@
xmlReconciliateNs (xmlDocPtr doc,
xmlNodePtr tree);
+#ifdef LIBXML_OUTPUT_ENABLED
/*
* Saving.
*/
@@ -1037,6 +1031,7 @@
xmlDocPtr cur,
const char *encoding);
+#endif /* LIBXML_OUTPUT_ENABLED */
/*
* XHTML
*/
diff --git a/include/libxml/valid.h b/include/libxml/valid.h
index 46b36da..cb7ff2c 100644
--- a/include/libxml/valid.h
+++ b/include/libxml/valid.h
@@ -145,12 +145,14 @@
xmlCopyNotationTable (xmlNotationTablePtr table);
XMLPUBFUN void XMLCALL
xmlFreeNotationTable (xmlNotationTablePtr table);
+#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlDumpNotationDecl (xmlBufferPtr buf,
xmlNotationPtr nota);
XMLPUBFUN void XMLCALL
xmlDumpNotationTable (xmlBufferPtr buf,
xmlNotationTablePtr table);
+#endif /* LIBXML_OUTPUT_ENABLED */
/* Element Content */
XMLPUBFUN xmlElementContentPtr XMLCALL
@@ -183,12 +185,14 @@
xmlCopyElementTable (xmlElementTablePtr table);
XMLPUBFUN void XMLCALL
xmlFreeElementTable (xmlElementTablePtr table);
+#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlDumpElementTable (xmlBufferPtr buf,
xmlElementTablePtr table);
XMLPUBFUN void XMLCALL
xmlDumpElementDecl (xmlBufferPtr buf,
xmlElementPtr elem);
+#endif /* LIBXML_OUTPUT_ENABLED */
/* Enumeration */
XMLPUBFUN xmlEnumerationPtr XMLCALL
@@ -213,12 +217,14 @@
xmlCopyAttributeTable (xmlAttributeTablePtr table);
XMLPUBFUN void XMLCALL
xmlFreeAttributeTable (xmlAttributeTablePtr table);
+#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlDumpAttributeTable (xmlBufferPtr buf,
xmlAttributeTablePtr table);
XMLPUBFUN void XMLCALL
xmlDumpAttributeDecl (xmlBufferPtr buf,
xmlAttributePtr attr);
+#endif /* LIBXML_OUTPUT_ENABLED */
/* IDs */
XMLPUBFUN xmlIDPtr XMLCALL
diff --git a/include/libxml/xmlIO.h b/include/libxml/xmlIO.h
index 244c950..a212f8e 100644
--- a/include/libxml/xmlIO.h
+++ b/include/libxml/xmlIO.h
@@ -62,6 +62,7 @@
*/
typedef int (*xmlInputCloseCallback) (void * context);
+#ifdef LIBXML_OUTPUT_ENABLED
/*
* Those are the functions and datatypes for the library output
* I/O structures.
@@ -107,6 +108,7 @@
* Returns 0 or -1 in case of error
*/
typedef int (*xmlOutputCloseCallback) (void * context);
+#endif /* LIBXML_OUTPUT_ENABLED */
#ifdef __cplusplus
}
@@ -133,6 +135,7 @@
};
+#ifdef LIBXML_OUTPUT_ENABLED
struct _xmlOutputBuffer {
void* context;
xmlOutputWriteCallback writecallback;
@@ -144,14 +147,13 @@
xmlBufferPtr conv; /* if encoder != NULL buffer for output */
int written; /* total number of byte written */
};
+#endif /* LIBXML_OUTPUT_ENABLED */
/*
* Interfaces for input
*/
XMLPUBFUN void XMLCALL
xmlCleanupInputCallbacks (void);
-XMLPUBFUN void XMLCALL
- xmlCleanupOutputCallbacks (void);
XMLPUBFUN void XMLCALL
xmlRegisterDefaultInputCallbacks (void);
@@ -198,10 +200,13 @@
xmlInputOpenCallback openFunc,
xmlInputReadCallback readFunc,
xmlInputCloseCallback closeFunc);
+#ifdef LIBXML_OUTPUT_ENABLED
/*
* Interfaces for output
*/
XMLPUBFUN void XMLCALL
+ xmlCleanupOutputCallbacks (void);
+XMLPUBFUN void XMLCALL
xmlRegisterDefaultOutputCallbacks(void);
XMLPUBFUN xmlOutputBufferPtr XMLCALL
xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder);
@@ -243,6 +248,7 @@
xmlOutputOpenCallback openFunc,
xmlOutputWriteCallback writeFunc,
xmlOutputCloseCallback closeFunc);
+#endif /* LIBXML_OUTPUT_ENABLED */
/* This function only exists if HTTP support built into the library */
#ifdef LIBXML_HTTP_ENABLED
diff --git a/include/libxml/xmlschemas.h b/include/libxml/xmlschemas.h
index 1175144..0e563f4 100644
--- a/include/libxml/xmlschemas.h
+++ b/include/libxml/xmlschemas.h
@@ -88,9 +88,11 @@
xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlSchemaFree (xmlSchemaPtr schema);
+#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlSchemaDump (FILE *output,
xmlSchemaPtr schema);
+#endif /* LIBXML_OUTPUT_ENABLED */
/*
* Interfaces for validating
*/
diff --git a/include/libxml/xmlversion.h.in b/include/libxml/xmlversion.h.in
index ef1a335..61b45ca 100644
--- a/include/libxml/xmlversion.h.in
+++ b/include/libxml/xmlversion.h.in
@@ -84,6 +84,15 @@
#endif
/**
+ * LIBXML_OUTPUT_ENABLED:
+ *
+ * Whether the serialization/saving support is configured in
+ */
+#if @WITH_OUTPUT@
+#define LIBXML_OUTPUT_ENABLED
+#endif
+
+/**
* LIBXML_FTP_ENABLED:
*
* Whether the FTP support is configured in
diff --git a/include/libxml/xpathInternals.h b/include/libxml/xpathInternals.h
index d74b9dd..6b9e996 100644
--- a/include/libxml/xpathInternals.h
+++ b/include/libxml/xpathInternals.h
@@ -377,6 +377,7 @@
int line,
int no);
+#ifdef LIBXML_DEBUG_ENABLED
XMLPUBFUN void XMLCALL
xmlXPathDebugDumpObject (FILE *output,
xmlXPathObjectPtr cur,
@@ -385,7 +386,7 @@
xmlXPathDebugDumpCompExpr(FILE *output,
xmlXPathCompExprPtr comp,
int depth);
-
+#endif
/**
* NodeSet handling.
*/
diff --git a/nanoftp.c b/nanoftp.c
index 43ac8ac..b6043a0 100644
--- a/nanoftp.c
+++ b/nanoftp.c
@@ -90,13 +90,16 @@
* A couple portability macros
*/
#ifndef _WINSOCKAPI_
+#ifndef __BEOS__
#define closesocket(s) close(s)
+#endif
#define SOCKET int
#endif
#if defined(VMS) || defined(__VMS)
#define SOCKLEN_T unsigned int
#endif
+
#define FTP_COMMAND_OK 200
#define FTP_SYNTAX_ERROR 500
#define FTP_GET_PASSWD 331
diff --git a/nanohttp.c b/nanohttp.c
index 15cc94d..5072d37 100644
--- a/nanohttp.c
+++ b/nanohttp.c
@@ -95,7 +95,9 @@
* A couple portability macros
*/
#ifndef _WINSOCKAPI_
+#ifndef __BEOS__
#define closesocket(s) close(s)
+#endif
#define SOCKET int
#endif
@@ -922,6 +924,7 @@
if ( FD_ISSET(s, &wfd) ) {
SOCKLEN_T len;
len = sizeof(status);
+#ifdef SO_ERROR
if (getsockopt(s, SOL_SOCKET, SO_ERROR, (char*)&status, &len) < 0 ) {
/* Solaris error code */
xmlGenericError( xmlGenericErrorContext,
@@ -930,6 +933,7 @@
strerror( socket_errno( ) ) );
return (-1);
}
+#endif
if ( status ) {
closesocket(s);
errno = status;
@@ -1510,6 +1514,7 @@
return(0);
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlNanoHTTPSave:
* @ctxt: the HTTP context
@@ -1546,6 +1551,7 @@
xmlNanoHTTPClose(ctxt);
return(0);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlNanoHTTPReturnCode:
diff --git a/parser.c b/parser.c
index 746d2b0..438dd3c 100644
--- a/parser.c
+++ b/parser.c
@@ -11974,7 +11974,9 @@
xmlInitializePredefinedEntities();
xmlDefaultSAXHandlerInit();
xmlRegisterDefaultInputCallbacks();
+#ifdef LIBXML_OUTPUT_ENABLED
xmlRegisterDefaultOutputCallbacks();
+#endif /* LIBXML_OUTPUT_ENABLED */
#ifdef LIBXML_HTML_ENABLED
htmlInitAutoClose();
htmlDefaultSAXHandlerInit();
diff --git a/python/libxml.c b/python/libxml.c
index cd71ff1..6f3ca8b 100644
--- a/python/libxml.c
+++ b/python/libxml.c
@@ -319,6 +319,7 @@
return(0);
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlOutputBufferCreatePythonFile:
* @file: a PyFile_Type
@@ -368,6 +369,7 @@
py_retval = libxml_xmlOutputBufferPtrWrap(buffer);
return(py_retval);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
@@ -1056,7 +1058,10 @@
NULL, /* TODO pythonGetParameterEntity, */
pythonCdataBlock,
pythonExternalSubset,
- 1
+ 1,
+ NULL, /* TODO mograte to SAX2 */
+ NULL,
+ NULL
};
/************************************************************************
@@ -2299,6 +2304,7 @@
return (py_retval);
}
+#ifdef LIBXML_OUTPUT_ENABLED
/************************************************************************
* *
* Serialization front-end *
@@ -2524,6 +2530,7 @@
}
return (PyInt_FromLong((long) len));
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/************************************************************************
* *
@@ -2773,9 +2780,11 @@
{(char *) "type", libxml_type, METH_VARARGS, NULL},
{(char *) "doc", libxml_doc, METH_VARARGS, NULL},
{(char *) "xmlNewNode", libxml_xmlNewNode, METH_VARARGS, NULL},
+#ifdef LIBXML_OUTPUT_ENABLED
{(char *) "serializeNode", libxml_serializeNode, METH_VARARGS, NULL},
{(char *) "saveNodeTo", libxml_saveNodeTo, METH_VARARGS, NULL},
{(char *) "outputBufferCreate", libxml_xmlCreateOutputBuffer, METH_VARARGS, NULL},
+#endif /* LIBXML_OUTPUT_ENABLED */
{(char *) "inputBufferCreate", libxml_xmlCreateInputBuffer, METH_VARARGS, NULL},
{(char *) "setEntityLoader", libxml_xmlSetEntityLoader, METH_VARARGS, NULL},
{(char *)"xmlRegisterErrorHandler", libxml_xmlRegisterErrorHandler, METH_VARARGS, NULL },
@@ -2807,7 +2816,9 @@
return;
/* XXX xmlInitParser does much more than this */
xmlInitGlobals();
+#ifdef LIBXML_OUTPUT_ENABLED
xmlRegisterDefaultOutputCallbacks();
+#endif /* LIBXML_OUTPUT_ENABLED */
xmlRegisterDefaultInputCallbacks();
m = Py_InitModule((char *) "libxml2mod", libxmlMethods);
initialized = 1;
diff --git a/relaxng.c b/relaxng.c
index b1c2e00..ad15718 100644
--- a/relaxng.c
+++ b/relaxng.c
@@ -7405,6 +7405,7 @@
return(0);
}
+#ifdef LIBXML_OUTPUT_ENABLED
/************************************************************************
* *
* Dump back a compiled form *
@@ -7635,6 +7636,7 @@
xmlDocDump(output, schema->doc);
}
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/************************************************************************
* *
diff --git a/testAutomata.c b/testAutomata.c
index 747d13e..07be2cc 100644
--- a/testAutomata.c
+++ b/testAutomata.c
@@ -300,7 +300,7 @@
#else
#include <stdio.h>
-int main(int argc, char **argv) {
+int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
printf("%s : Automata support not compiled in\n", argv[0]);
return(0);
}
diff --git a/testC14N.c b/testC14N.c
index bdacc22..6a36a68 100644
--- a/testC14N.c
+++ b/testC14N.c
@@ -7,7 +7,7 @@
* Author: Aleksey Sanin <aleksey@aleksey.com>
*/
#include "libxml.h"
-#if defined(LIBXML_C14N_ENABLED)
+#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
#include <stdio.h>
#include <string.h>
@@ -348,8 +348,8 @@
#else
#include <stdio.h>
-int main(int argc, char **argv) {
- printf("%s : XPath/Canonicalization support not compiled in\n", argv[0]);
+int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
+ printf("%s : XPath/Canonicalization and output support not compiled in\n", argv[0]);
return(0);
}
#endif /* LIBXML_C14N_ENABLED */
diff --git a/testHTML.c b/testHTML.c
index 8123324..4067fd4 100644
--- a/testHTML.c
+++ b/testHTML.c
@@ -742,6 +742,7 @@
xmlFreeDoc(tmp);
}
+#ifdef LIBXML_OUTPUT_ENABLED
/*
* print it.
*/
@@ -761,6 +762,7 @@
htmlDocDump(stdout, doc);
#endif
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/*
* free it.
@@ -839,7 +841,7 @@
}
#else /* !LIBXML_HTML_ENABLED */
#include <stdio.h>
-int main(int argc, char **argv) {
+int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
printf("%s : HTML support not compiled in\n", argv[0]);
return(0);
}
diff --git a/testRegexp.c b/testRegexp.c
index c0a5cbc..7f34414 100644
--- a/testRegexp.c
+++ b/testRegexp.c
@@ -151,7 +151,7 @@
#else
#include <stdio.h>
-int main(int argc, char **argv) {
+int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
printf("%s : Regexp support not compiled in\n", argv[0]);
return(0);
}
diff --git a/testRelax.c b/testRelax.c
index c930b51..dee4715 100644
--- a/testRelax.c
+++ b/testRelax.c
@@ -123,12 +123,14 @@
files = -1;
break;
}
+#ifdef LIBXML_OUTPUT_ENABLED
#ifdef LIBXML_DEBUG_ENABLED
if (debug)
xmlRelaxNGDump(stdout, schema);
#endif
if (tree)
xmlRelaxNGDumpTree(stdout, schema);
+#endif /* LIBXML_OUTPUT_ENABLED */
} else {
xmlDocPtr doc;
@@ -185,7 +187,7 @@
#else
#include <stdio.h>
-int main(int argc, char **argv) {
+int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
printf("%s : RelaxNG support not compiled in\n", argv[0]);
return(0);
}
diff --git a/testSchemas.c b/testSchemas.c
index 54e36d0..2702518 100644
--- a/testSchemas.c
+++ b/testSchemas.c
@@ -114,10 +114,12 @@
schema = xmlSchemaParse(ctxt);
xmlSchemaFreeParserCtxt(ctxt);
}
+#ifdef LIBXML_OUTPUT_ENABLED
#ifdef LIBXML_DEBUG_ENABLED
if (debug)
xmlSchemaDump(stdout, schema);
#endif
+#endif /* LIBXML_OUTPUT_ENABLED */
} else {
xmlDocPtr doc;
@@ -173,7 +175,7 @@
#else
#include <stdio.h>
-int main(int argc, char **argv) {
+int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
printf("%s : Schemas support not compiled in\n", argv[0]);
return(0);
}
diff --git a/testXPath.c b/testXPath.c
index 8d13808..bdb7358 100644
--- a/testXPath.c
+++ b/testXPath.c
@@ -220,7 +220,7 @@
}
#else
#include <stdio.h>
-int main(int argc, char **argv) {
+int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
printf("%s : XPath/Debug support not compiled in\n", argv[0]);
return(0);
}
diff --git a/threads.c b/threads.c
index c646449..b51caa2 100644
--- a/threads.c
+++ b/threads.c
@@ -99,7 +99,9 @@
#endif /* HAVE_WIN32_THREADS */
static xmlRMutexPtr xmlLibraryLock = NULL;
+#ifdef LIBXML_THREAD_ENABLED
static void xmlOnceInit(void);
+#endif
/**
* xmlNewMutex:
@@ -527,6 +529,7 @@
#endif
}
+#ifdef LIBXML_THREAD_ENABLED
/**
* xmlOnceInit
*
@@ -550,6 +553,7 @@
mainthread = GetCurrentThreadId();
#endif
}
+#endif
/**
* DllMain:
diff --git a/tree.c b/tree.c
index b372e43..8dd86d6 100644
--- a/tree.c
+++ b/tree.c
@@ -6789,6 +6789,7 @@
}
+#ifdef LIBXML_OUTPUT_ENABLED
/************************************************************************
* *
* Dumping XML tree content to a simple buffer *
@@ -7567,6 +7568,7 @@
}
}
}
+#endif /* LIBXML_OUTPUT_ENABLED */
#ifdef LIBXML_HTML_ENABLED
/************************************************************************
@@ -7615,6 +7617,7 @@
return(0);
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xhtmlIsEmpty:
* @node: the node
@@ -8059,8 +8062,10 @@
xmlOutputBufferWriteString(buf, (const char *)cur->name);
xmlOutputBufferWriteString(buf, ">");
}
+#endif /* LIBXML_OUTPUT_ENABLED */
#endif
+#ifdef LIBXML_OUTPUT_ENABLED
/************************************************************************
* *
* Saving functions front-ends *
@@ -8211,61 +8216,6 @@
}
/**
- * xmlGetDocCompressMode:
- * @doc: the document
- *
- * get the compression ratio for a document, ZLIB based
- * Returns 0 (uncompressed) to 9 (max compression)
- */
-int
-xmlGetDocCompressMode (xmlDocPtr doc) {
- if (doc == NULL) return(-1);
- return(doc->compression);
-}
-
-/**
- * xmlSetDocCompressMode:
- * @doc: the document
- * @mode: the compression ratio
- *
- * set the compression ratio for a document, ZLIB based
- * Correct values: 0 (uncompressed) to 9 (max compression)
- */
-void
-xmlSetDocCompressMode (xmlDocPtr doc, int mode) {
- if (doc == NULL) return;
- if (mode < 0) doc->compression = 0;
- else if (mode > 9) doc->compression = 9;
- else doc->compression = mode;
-}
-
-/**
- * xmlGetCompressMode:
- *
- * get the default compression mode used, ZLIB based.
- * Returns 0 (uncompressed) to 9 (max compression)
- */
-int
-xmlGetCompressMode(void)
-{
- return (xmlCompressMode);
-}
-
-/**
- * xmlSetCompressMode:
- * @mode: the compression ratio
- *
- * set the default compression mode used, ZLIB based
- * Correct values: 0 (uncompressed) to 9 (max compression)
- */
-void
-xmlSetCompressMode(int mode) {
- if (mode < 0) xmlCompressMode = 0;
- else if (mode > 9) xmlCompressMode = 9;
- else xmlCompressMode = mode;
-}
-
-/**
* xmlDocFormatDump:
* @f: the FILE*
* @cur: the document
@@ -8463,3 +8413,60 @@
return(xmlSaveFormatFileEnc(filename, cur, NULL, 0));
}
+#endif /* LIBXML_OUTPUT_ENABLED */
+
+/**
+ * xmlGetDocCompressMode:
+ * @doc: the document
+ *
+ * get the compression ratio for a document, ZLIB based
+ * Returns 0 (uncompressed) to 9 (max compression)
+ */
+int
+xmlGetDocCompressMode (xmlDocPtr doc) {
+ if (doc == NULL) return(-1);
+ return(doc->compression);
+}
+
+/**
+ * xmlSetDocCompressMode:
+ * @doc: the document
+ * @mode: the compression ratio
+ *
+ * set the compression ratio for a document, ZLIB based
+ * Correct values: 0 (uncompressed) to 9 (max compression)
+ */
+void
+xmlSetDocCompressMode (xmlDocPtr doc, int mode) {
+ if (doc == NULL) return;
+ if (mode < 0) doc->compression = 0;
+ else if (mode > 9) doc->compression = 9;
+ else doc->compression = mode;
+}
+
+/**
+ * xmlGetCompressMode:
+ *
+ * get the default compression mode used, ZLIB based.
+ * Returns 0 (uncompressed) to 9 (max compression)
+ */
+int
+xmlGetCompressMode(void)
+{
+ return (xmlCompressMode);
+}
+
+/**
+ * xmlSetCompressMode:
+ * @mode: the compression ratio
+ *
+ * set the default compression mode used, ZLIB based
+ * Correct values: 0 (uncompressed) to 9 (max compression)
+ */
+void
+xmlSetCompressMode(int mode) {
+ if (mode < 0) xmlCompressMode = 0;
+ else if (mode > 9) xmlCompressMode = 9;
+ else xmlCompressMode = mode;
+}
+
diff --git a/valid.c b/valid.c
index b1555a8..7ebd686 100644
--- a/valid.c
+++ b/valid.c
@@ -827,6 +827,7 @@
xmlFree(cur);
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlDumpElementContent:
* @buf: An XML buffer
@@ -910,6 +911,7 @@
xmlElementContentPtr content ATTRIBUTE_UNUSED,
int glob ATTRIBUTE_UNUSED) {
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlSnprintfElementContent:
@@ -1065,7 +1067,8 @@
* Returns NULL if not, otherwise the entity
*/
xmlElementPtr
-xmlAddElementDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *name,
+xmlAddElementDecl(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED,
+ xmlDtdPtr dtd, const xmlChar *name,
xmlElementTypeVal type,
xmlElementContentPtr content) {
xmlElementPtr ret;
@@ -1312,6 +1315,7 @@
(xmlHashCopier) xmlCopyElement));
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlDumpElementDecl:
* @buf: the XML buffer output
@@ -1381,6 +1385,7 @@
xmlDumpElementTable(xmlBufferPtr buf, xmlElementTablePtr table) {
xmlHashScan(table, (xmlHashScanner) xmlDumpElementDecl, buf);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlCreateEnumeration:
@@ -1447,6 +1452,7 @@
return(ret);
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlDumpEnumeration:
* @buf: the XML buffer output
@@ -1466,6 +1472,7 @@
xmlDumpEnumeration(buf, cur->next);
}
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlCreateAttributeTable:
@@ -1605,7 +1612,8 @@
* Returns NULL if not new, otherwise the attribute decl
*/
xmlAttributePtr
-xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *elem,
+xmlAddAttributeDecl(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED,
+ xmlDtdPtr dtd, const xmlChar *elem,
const xmlChar *name, const xmlChar *ns,
xmlAttributeType type, xmlAttributeDefault def,
const xmlChar *defaultValue, xmlEnumerationPtr tree) {
@@ -1858,6 +1866,7 @@
(xmlHashCopier) xmlCopyAttribute));
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlDumpAttributeDecl:
* @buf: the XML buffer output
@@ -1949,6 +1958,7 @@
xmlDumpAttributeTable(xmlBufferPtr buf, xmlAttributeTablePtr table) {
xmlHashScan(table, (xmlHashScanner) xmlDumpAttributeDecl, buf);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/************************************************************************
* *
@@ -2124,6 +2134,7 @@
(xmlHashCopier) xmlCopyNotation));
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlDumpNotationDecl:
* @buf: the XML buffer output
@@ -2160,6 +2171,7 @@
xmlDumpNotationTable(xmlBufferPtr buf, xmlNotationTablePtr table) {
xmlHashScan(table, (xmlHashScanner) xmlDumpNotationDecl, buf);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/************************************************************************
* *
diff --git a/xmlIO.c b/xmlIO.c
index 7992f18..c1eb358 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -105,6 +105,7 @@
static int xmlInputCallbackNr = 0;
static int xmlInputCallbackInitialized = 0;
+#ifdef LIBXML_OUTPUT_ENABLED
/*
* Output I/O callback sets
*/
@@ -120,6 +121,7 @@
static xmlOutputCallback xmlOutputCallbackTable[MAX_OUTPUT_CALLBACK];
static int xmlOutputCallbackNr = 0;
static int xmlOutputCallbackInitialized = 0;
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
@@ -162,6 +164,7 @@
xmlInputCallbackInitialized = 0;
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlCleanupOutputCallbacks:
*
@@ -186,6 +189,7 @@
xmlOutputCallbackNr = 0;
xmlOutputCallbackInitialized = 0;
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/************************************************************************
* *
@@ -245,6 +249,7 @@
return(read((int) (long) context, &buffer[0], len));
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlFdWrite:
* @context: the I/O context
@@ -259,6 +264,7 @@
xmlFdWrite (void * context, const char * buffer, int len) {
return(write((int) (long) context, &buffer[0], len));
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlFdClose:
@@ -356,6 +362,7 @@
return retval;
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlFileOpenW:
* @filename: the URI for matching
@@ -396,6 +403,7 @@
fd = fopen(path, "wb");
return((void *) fd);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlFileRead:
@@ -412,6 +420,7 @@
return(fread(&buffer[0], 1, len, (FILE *) context));
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlFileWrite:
* @context: the I/O context
@@ -430,6 +439,7 @@
return(items * len);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlFileClose:
@@ -549,6 +559,7 @@
return retval;
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlGzfileOpenW:
* @filename: the URI for matching
@@ -592,6 +603,7 @@
fd = gzopen(path, mode);
return((void *) fd);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlGzfileRead:
@@ -608,6 +620,7 @@
return(gzread((gzFile) context, &buffer[0], len));
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlGzfileWrite:
* @context: the I/O context
@@ -622,6 +635,7 @@
xmlGzfileWrite (void * context, const char * buffer, int len) {
return(gzwrite((gzFile) context, (char *) &buffer[0], len));
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlGzfileClose:
@@ -642,6 +656,7 @@
* *
************************************************************************/
+#ifdef LIBXML_OUTPUT_ENABLED
typedef struct xmlIOHTTPWriteCtxt_
{
int compression;
@@ -974,8 +989,10 @@
return ( zlgth );
}
+#endif /* LIBXML_OUTPUT_ENABLED */
#endif /* HAVE_ZLIB_H */
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlFreeHTTPWriteCtxt
* @ctxt: Context to cleanup
@@ -1006,6 +1023,7 @@
xmlFree( ctxt );
return;
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
@@ -1036,6 +1054,7 @@
return(xmlNanoHTTPOpen(filename, NULL));
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlIOHTTPOpenW:
* @post_uri: The destination URI for the document
@@ -1099,7 +1118,9 @@
return (ctxt);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlIOHTTPDfltOpenW
* @post_uri: The destination URI for this document.
@@ -1114,6 +1135,7 @@
xmlIOHTTPDfltOpenW( const char * post_uri ) {
return ( xmlIOHTTPOpenW( post_uri, 0 ) );
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlIOHTTPRead:
@@ -1130,6 +1152,7 @@
return(xmlNanoHTTPRead(context, &buffer[0], len));
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlIOHTTPWrite
* @context: previously opened writing context
@@ -1173,6 +1196,7 @@
return ( len );
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
@@ -1189,6 +1213,7 @@
return 0;
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlIOHTTCloseWrite
* @context: The I/O context
@@ -1345,6 +1370,7 @@
xmlIOHTTPClosePost( void * ctxt ) {
return ( xmlIOHTTPCloseWrite( ctxt, "POST" ) );
}
+#endif /* LIBXML_OUTPUT_ENABLED */
#endif /* LIBXML_HTTP_ENABLED */
@@ -1438,6 +1464,7 @@
return(xmlInputCallbackNr++);
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlRegisterOutputCallbacks:
* @matchFunc: the xmlOutputMatchCallback
@@ -1463,6 +1490,7 @@
xmlOutputCallbackInitialized = 1;
return(xmlOutputCallbackNr++);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlRegisterDefaultInputCallbacks:
@@ -1494,6 +1522,7 @@
xmlInputCallbackInitialized = 1;
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlRegisterDefaultOutputCallbacks:
*
@@ -1554,6 +1583,7 @@
return;
}
#endif
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlAllocParserInputBuffer:
@@ -1593,6 +1623,7 @@
return(ret);
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlAllocOutputBuffer:
* @encoder: the encoding converter or NULL
@@ -1634,6 +1665,7 @@
return(ret);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlFreeParserInputBuffer:
@@ -1663,6 +1695,7 @@
xmlFree(in);
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlOutputBufferClose:
* @out: a buffered output
@@ -1700,6 +1733,7 @@
xmlFree(out);
return( ( err_rc == 0 ) ? written : err_rc );
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlParserInputBufferCreateFilename:
@@ -1770,6 +1804,7 @@
return(ret);
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlOutputBufferCreateFilename:
* @URI: a C string containing the URI or filename
@@ -1788,7 +1823,7 @@
xmlOutputBufferPtr
xmlOutputBufferCreateFilename(const char *URI,
xmlCharEncodingHandlerPtr encoder,
- int compression) {
+ int compression ATTRIBUTE_UNUSED) {
xmlOutputBufferPtr ret;
int i = 0;
void *context = NULL;
@@ -1899,6 +1934,7 @@
}
return(ret);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlParserInputBufferCreateFile:
@@ -1929,6 +1965,7 @@
return(ret);
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlOutputBufferCreateFile:
* @file: a FILE*
@@ -1957,6 +1994,7 @@
return(ret);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlParserInputBufferCreateFd:
@@ -2059,6 +2097,7 @@
return(ret);
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlOutputBufferCreateFd:
* @fd: a file descriptor number
@@ -2084,6 +2123,7 @@
return(ret);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlParserInputBufferCreateIO:
@@ -2114,6 +2154,7 @@
return(ret);
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlOutputBufferCreateIO:
* @iowrite: an I/O write function
@@ -2143,6 +2184,7 @@
return(ret);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlParserInputBufferPush:
@@ -2320,6 +2362,7 @@
return(-1);
}
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlOutputBufferWrite:
* @out: a buffered parser output
@@ -2497,6 +2540,7 @@
#endif
return(ret);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlParserGetDirectory:
diff --git a/xmlcatalog.c b/xmlcatalog.c
index 44c8e63..6e614ce 100644
--- a/xmlcatalog.c
+++ b/xmlcatalog.c
@@ -29,7 +29,7 @@
#include <libxml/parser.h>
#include <libxml/globals.h>
-#ifdef LIBXML_CATALOG_ENABLED
+#if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
static int shell = 0;
static int sgml = 0;
static int noout = 0;
@@ -580,8 +580,8 @@
return(exit_value);
}
#else
-int main(int argc, char **argv) {
- fprintf(stderr, "libxml was not compiled with catalog support\n");
+int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
+ fprintf(stderr, "libxml was not compiled with catalog and output support\n");
return(1);
}
#endif
diff --git a/xmllint.c b/xmllint.c
index 92d5547..60bbdb1 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -102,8 +102,14 @@
static int copy = 0;
static int recovery = 0;
static int noent = 0;
+static int noblanks = 0;
static int noout = 0;
static int nowrap = 0;
+#ifdef LIBXML_OUTPUT_ENABLED
+static int format = 0;
+static const char *output = NULL;
+static int compress = 0;
+#endif /* LIBXML_OUTPUT_ENABLED */
#ifdef LIBXML_VALID_ENABLED
static int valid = 0;
static int postvalid = 0;
@@ -118,7 +124,6 @@
#endif
static int repeat = 0;
static int insert = 0;
-static int compress = 0;
#ifdef LIBXML_HTML_ENABLED
static int html = 0;
#endif
@@ -127,8 +132,6 @@
#ifdef HAVE_SYS_MMAN_H
static int memory = 0;
#endif
-static int noblanks = 0;
-static int format = 0;
static int testIO = 0;
static char *encoding = NULL;
#ifdef LIBXML_XINCLUDE_ENABLED
@@ -147,7 +150,6 @@
static int stream = 0;
static int chkregister = 0;
static int sax1 = 0;
-static const char *output = NULL;
static int options = 0;
/*
@@ -983,6 +985,7 @@
}
}else
#endif /* LIBXML_VALID_ENABLED */
+#ifdef LIBXML_OUTPUT_ENABLED
if (noout == 0) {
/*
* print it.
@@ -1062,6 +1065,7 @@
}
#endif
}
+#endif /* LIBXML_OUTPUT_ENABLED */
#ifdef LIBXML_VALID_ENABLED
/*
@@ -1278,7 +1282,11 @@
static void usage(const char *name) {
printf("Usage : %s [options] XMLfiles ...\n", name);
+#ifdef LIBXML_OUTPUT_ENABLED
printf("\tParse the XML files and output the result of the parsing\n");
+#else
+ printf("\tParse the XML files\n");
+#endif /* LIBXML_OUTPUT_ENABLED */
printf("\t--version : display the version of the XML library used\n");
#ifdef LIBXML_DEBUG_ENABLED
printf("\t--debug : dump a debug tree of the in-memory document\n");
@@ -1304,9 +1312,11 @@
printf("\t--output file or -o file: save to a given file\n");
printf("\t--repeat : repeat 100 times, for timing or profiling\n");
printf("\t--insert : ad-hoc test for valid insertions\n");
+#ifdef LIBXML_OUTPUT_ENABLED
#ifdef HAVE_ZLIB_H
printf("\t--compress : turn on gzip compression of output\n");
#endif
+#endif /* LIBXML_OUTPUT_ENABLED */
#ifdef LIBXML_HTML_ENABLED
printf("\t--html : use the HTML parser\n");
#endif
@@ -1317,10 +1327,13 @@
printf("\t--nowarning : do not emit warnings from parser/validator\n");
printf("\t--noblanks : drop (ignorable?) blanks spaces\n");
printf("\t--nocdata : replace cdata section with text nodes\n");
- printf("\t--nsclean : remove redundant namespace declarations\n");
+#ifdef LIBXML_OUTPUT_ENABLED
printf("\t--format : reformat/reindent the input\n");
- printf("\t--testIO : test user I/O support\n");
printf("\t--encode encoding : output in the given encoding\n");
+ printf("\t--dropdtd : remove the DOCTYPE of the input docs\n");
+#endif /* LIBXML_OUTPUT_ENABLED */
+ printf("\t--nsclean : remove redundant namespace declarations\n");
+ printf("\t--testIO : test user I/O support\n");
#ifdef LIBXML_CATALOG_ENABLED
printf("\t--catalogs : use SGML catalogs from $SGML_CATALOG_FILES\n");
printf("\t otherwise XML Catalogs starting from \n");
@@ -1333,7 +1346,6 @@
#endif
printf("\t--loaddtd : fetch external DTD\n");
printf("\t--dtdattr : loaddtd + populate the tree with inherited attributes \n");
- printf("\t--dropdtd : remove the DOCTYPE of the input docs\n");
printf("\t--stream : use the streaming interface to process very large files\n");
printf("\t--chkregister : verify the node registration code\n");
#ifdef LIBXML_SCHEMAS_ENABLED
@@ -1411,24 +1423,26 @@
} else if ((!strcmp(argv[i], "-noout")) ||
(!strcmp(argv[i], "--noout")))
noout++;
+#ifdef LIBXML_OUTPUT_ENABLED
else if ((!strcmp(argv[i], "-o")) ||
(!strcmp(argv[i], "-output")) ||
(!strcmp(argv[i], "--output"))) {
i++;
output = argv[i];
}
+#endif /* LIBXML_OUTPUT_ENABLED */
else if ((!strcmp(argv[i], "-htmlout")) ||
(!strcmp(argv[i], "--htmlout")))
htmlout++;
+ else if ((!strcmp(argv[i], "-nowrap")) ||
+ (!strcmp(argv[i], "--nowrap")))
+ nowrap++;
#ifdef LIBXML_HTML_ENABLED
else if ((!strcmp(argv[i], "-html")) ||
(!strcmp(argv[i], "--html"))) {
html++;
}
#endif /* LIBXML_HTML_ENABLED */
- else if ((!strcmp(argv[i], "-nowrap")) ||
- (!strcmp(argv[i], "--nowrap")))
- nowrap++;
else if ((!strcmp(argv[i], "-loaddtd")) ||
(!strcmp(argv[i], "--loaddtd"))) {
loaddtd++;
@@ -1496,6 +1510,7 @@
/* options |= XML_PARSE_XINCLUDE; */
}
#endif
+#ifdef LIBXML_OUTPUT_ENABLED
#ifdef HAVE_ZLIB_H
else if ((!strcmp(argv[i], "-compress")) ||
(!strcmp(argv[i], "--compress"))) {
@@ -1503,6 +1518,7 @@
xmlSetCompressMode(9);
}
#endif
+#endif /* LIBXML_OUTPUT_ENABLED */
else if ((!strcmp(argv[i], "-nowarning")) ||
(!strcmp(argv[i], "--nowarning"))) {
xmlGetWarningsDefaultValue = 0;
@@ -1548,7 +1564,9 @@
else if ((!strcmp(argv[i], "-format")) ||
(!strcmp(argv[i], "--format"))) {
noblanks++;
+#ifdef LIBXML_OUTPUT_ENABLED
format++;
+#endif /* LIBXML_OUTPUT_ENABLED */
xmlKeepBlanksDefault(0);
}
else if ((!strcmp(argv[i], "-stream")) ||
diff --git a/xmlmemory.c b/xmlmemory.c
index f61724f..2059ef4 100644
--- a/xmlmemory.c
+++ b/xmlmemory.c
@@ -668,7 +668,9 @@
#endif
}
+#ifdef MEM_LIST
static FILE *xmlMemoryDumpFile = NULL;
+#endif
/**
* xmlMemShow:
diff --git a/xmlreader.c b/xmlreader.c
index e7b5639..2900a4c 100644
--- a/xmlreader.c
+++ b/xmlreader.c
@@ -764,6 +764,7 @@
return(0);
}
+#ifdef LIBXML_REGEXP_ENABLED
/**
* xmlTextReaderValidatePush:
* @reader: the xmlTextReaderPtr used
@@ -771,8 +772,7 @@
* Push the current node for validation
*/
static void
-xmlTextReaderValidatePush(xmlTextReaderPtr reader) {
-#ifdef LIBXML_REGEXP_ENABLED
+xmlTextReaderValidatePush(xmlTextReaderPtr reader ATTRIBUTE_UNUSED) {
xmlNodePtr node = reader->node;
if ((reader->validate == XML_TEXTREADER_VALIDATE_DTD) &&
@@ -820,7 +820,6 @@
reader->rngValidErrors++;
#endif
}
-#endif /* LIBXML_REGEXP_ENABLED */
}
/**
@@ -834,7 +833,6 @@
static void
xmlTextReaderValidateCData(xmlTextReaderPtr reader,
const xmlChar *data, int len) {
-#ifdef LIBXML_REGEXP_ENABLED
if ((reader->validate == XML_TEXTREADER_VALIDATE_DTD) &&
(reader->ctxt != NULL) && (reader->ctxt->validate == 1)) {
reader->ctxt->valid &= xmlValidatePushCData(&reader->ctxt->vctxt,
@@ -850,7 +848,6 @@
reader->rngValidErrors++;
#endif
}
-#endif /* LIBXML_REGEXP_ENABLED */
}
/**
@@ -861,7 +858,6 @@
*/
static void
xmlTextReaderValidatePop(xmlTextReaderPtr reader) {
-#ifdef LIBXML_REGEXP_ENABLED
xmlNodePtr node = reader->node;
if ((reader->validate == XML_TEXTREADER_VALIDATE_DTD) &&
@@ -898,8 +894,8 @@
reader->rngValidErrors++;
#endif
}
-#endif /* LIBXML_REGEXP_ENABLED */
}
+
/**
* xmlTextReaderValidateEntity:
* @reader: the xmlTextReaderPtr used
@@ -910,7 +906,6 @@
*/
static void
xmlTextReaderValidateEntity(xmlTextReaderPtr reader) {
-#ifdef LIBXML_REGEXP_ENABLED
xmlNodePtr oldnode = reader->node;
xmlNodePtr node = reader->node;
xmlParserCtxtPtr ctxt = reader->ctxt;
@@ -941,6 +936,7 @@
break;
node = node->next;
}
+#ifdef LIBXML_REGEXP_ENABLED
} else if (node->type == XML_ELEMENT_NODE) {
reader->node = node;
xmlTextReaderValidatePush(reader);
@@ -948,6 +944,7 @@
(node->type == XML_CDATA_SECTION_NODE)) {
xmlTextReaderValidateCData(reader, node->content,
xmlStrlen(node->content));
+#endif
}
/*
@@ -991,8 +988,8 @@
} while ((node != NULL) && (node != oldnode));
} while ((node != NULL) && (node != oldnode));
reader->node = oldnode;
-#endif /* LIBXML_REGEXP_ENABLED */
}
+#endif /* LIBXML_REGEXP_ENABLED */
/**
@@ -1155,9 +1152,11 @@
reader->state = XML_TEXTREADER_END;
goto node_found;
}
+#ifdef LIBXML_REGEXP_ENABLED
if ((reader->validate) &&
(reader->node->type == XML_ELEMENT_NODE))
xmlTextReaderValidatePop(reader);
+#endif /* LIBXML_REGEXP_ENABLED */
reader->node = reader->node->next;
reader->state = XML_TEXTREADER_ELEMENT;
@@ -1183,8 +1182,10 @@
reader->state = XML_TEXTREADER_END;
goto node_found;
}
+#ifdef LIBXML_REGEXP_ENABLED
if ((reader->validate) && (reader->node->type == XML_ELEMENT_NODE))
xmlTextReaderValidatePop(reader);
+#endif /* LIBXML_REGEXP_ENABLED */
reader->node = reader->node->parent;
if ((reader->node == NULL) ||
(reader->node->type == XML_DOCUMENT_NODE) ||
@@ -1249,10 +1250,12 @@
xmlTextReaderEntPush(reader, reader->node);
reader->node = reader->node->children->children;
}
+#ifdef LIBXML_REGEXP_ENABLED
} else if ((reader->node != NULL) &&
(reader->node->type == XML_ENTITY_REF_NODE) &&
(reader->ctxt != NULL) && (reader->validate)) {
xmlTextReaderValidateEntity(reader);
+#endif /* LIBXML_REGEXP_ENABLED */
}
if ((reader->node != NULL) &&
(reader->node->type == XML_ENTITY_DECL) &&
diff --git a/xmlschemas.c b/xmlschemas.c
index 46f9f4c..2912861 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -512,6 +512,7 @@
* *
************************************************************************/
+#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlSchemaElementDump:
* @elem: an element
@@ -741,6 +742,7 @@
xmlHashScanFull(schema->elemDecl,
(xmlHashScannerFull) xmlSchemaElementDump, output);
}
+#endif /* LIBXML_OUTPUT_ENABLED */
/************************************************************************
* *