Fixed typo in xmlCharEncFirstLine pointed out by Mark Rowe (bug #440159)
* encoding.c: Fixed typo in xmlCharEncFirstLine pointed out
by Mark Rowe (bug #440159)
* include/libxml/xmlversion.h.in: Added check for definition of
_POSIX_C_SOURCE to avoid warnings on Apple OS/X (patch from
Wendy Doyle and Mark Rowe, bug #346675)
* schematron.c, testapi.c, tree.c, xmlIO.c, xmlsave.c: minor
changes to fix compilation warnings - no change to logic.
svn path=/trunk/; revision=3618
diff --git a/ChangeLog b/ChangeLog
index 4f8e95d..0c7a0d7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Tue May 22 08:59:48 PDT 2007 William Brack <wbrack@mmm.com.hk>
+
+ * encoding.c: Fixed typo in xmlCharEncFirstLine pointed out
+ by Mark Rowe (bug #440159)
+ * include/libxml/xmlversion.h.in: Added check for definition of
+ _POSIX_C_SOURCE to avoid warnings on Apple OS/X (patch from
+ Wendy Doyle and Mark Rowe, bug #346675)
+ * schematron.c, testapi.c, tree.c, xmlIO.c, xmlsave.c: minor
+ changes to fix compilation warnings - no change to logic.
+
Tue May 15 22:18:08 PDT 2007 William Brack <wbrack@mmm.com.hk>
* nanohttp.c: small enhancement to last fix, pointed out
diff --git a/encoding.c b/encoding.c
index ee33df1..002eeba 100644
--- a/encoding.c
+++ b/encoding.c
@@ -1761,19 +1761,20 @@
if (out == NULL) return(-1);
if (in == NULL) return(-1);
+ /* calculate space available */
written = out->size - out->use;
toconv = in->use;
- if (toconv * 2 >= written) {
- xmlBufferGrow(out, toconv);
- written = out->size - out->use - 1;
- }
-
/*
* echo '<?xml version="1.0" encoding="UCS4"?>' | wc -c => 38
* 45 chars should be sufficient to reach the end of the encoding
* declaration without going too far inside the document content.
*/
- written = 45;
+ if (toconv > 45)
+ toconv = 45;
+ if (toconv * 2 >= written) {
+ xmlBufferGrow(out, toconv);
+ written = out->size - out->use - 1;
+ }
if (handler->input != NULL) {
ret = handler->input(&out->content[out->use], &written,
diff --git a/include/libxml/xmlversion.h.in b/include/libxml/xmlversion.h.in
index 0967913..29cef74 100644
--- a/include/libxml/xmlversion.h.in
+++ b/include/libxml/xmlversion.h.in
@@ -91,7 +91,8 @@
* Whether the thread support is configured in
*/
#if @WITH_THREADS@
-#if defined(_REENTRANT) || defined(__MT__) || (_POSIX_C_SOURCE - 0 >= 199506L)
+#if defined(_REENTRANT) || defined(__MT__) || \
+ (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L))
#define LIBXML_THREAD_ENABLED
#endif
#endif
diff --git a/schematron.c b/schematron.c
index 0a90ff8..a2eabcc 100644
--- a/schematron.c
+++ b/schematron.c
@@ -714,6 +714,7 @@
xmlFree(ctxt);
}
+#if 0
/**
* xmlSchematronPushInclude:
* @ctxt: the schema parser context
@@ -782,6 +783,7 @@
return(xmlSchematronPopInclude(ctxt));
return(ret);
}
+#endif
/**
* xmlSchematronAddNamespace:
@@ -987,6 +989,7 @@
}
}
+#if 0
/**
* xmlSchematronLoadInclude:
* @ctxt: a schema validation context
@@ -1051,6 +1054,7 @@
xmlFree(URI);
return(ret);
}
+#endif
/**
* xmlSchematronParse:
diff --git a/testapi.c b/testapi.c
index 969fdd3..af71ac2 100644
--- a/testapi.c
+++ b/testapi.c
@@ -128,7 +128,7 @@
int blocks, mem;
/* access to the proxy can slow up regression tests a lot */
- putenv("http_proxy=");
+ putenv((char *) "http_proxy=");
memset(chartab, 0, sizeof(chartab));
strncpy((char *) chartab, " chartab\n", 20);
diff --git a/tree.c b/tree.c
index fe57921..432007e 100644
--- a/tree.c
+++ b/tree.c
@@ -4848,7 +4848,7 @@
fixed = xmlPathToURI(uri);
if (fixed != NULL) {
xmlSetNsProp(cur, ns, BAD_CAST "base", fixed);
- xmlFree(fixed);
+ xmlFree((xmlChar *)fixed);
} else {
xmlSetNsProp(cur, ns, BAD_CAST "base", uri);
}
diff --git a/xmlIO.c b/xmlIO.c
index f576d76..154fcf8 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -3638,7 +3638,7 @@
*
* Returns a new allocated URL, or NULL.
*/
-xmlChar *
+static xmlChar *
xmlResolveResourceFromCatalog(const char *URL, const char *ID,
xmlParserCtxtPtr ctxt) {
xmlChar *resource = NULL;
diff --git a/xmlsave.c b/xmlsave.c
index 231ee7b..b97327e 100644
--- a/xmlsave.c
+++ b/xmlsave.c
@@ -834,7 +834,6 @@
xmlCharEncodingOutputFunc oldescape = ctxt->escape;
xmlCharEncodingOutputFunc oldescapeAttr = ctxt->escapeAttr;
xmlOutputBufferPtr buf = ctxt->buf;
- xmlCharEncodingHandlerPtr handler = NULL;
xmlCharEncoding enc;
xmlInitParser();