small changes to syntax to get rid of compiler warnings. No changes to
* error.c HTMLparser.c testC14N.c testHTML.c testURI.c
xmlcatalog.c xmlmemory.c xmlreader.c xmlschemastypes.c
python/libxml.c include/libxml/xmlmemory.h: small changes
to syntax to get rid of compiler warnings. No changes
to logic.
diff --git a/ChangeLog b/ChangeLog
index d659abb..e0838c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Tue Aug 5 23:51:21 HKT 2003 William Brack <wbrack@mmm.com.hk>
+
+ * error.c HTMLparser.c testC14N.c testHTML.c testURI.c
+ xmlcatalog.c xmlmemory.c xmlreader.c xmlschemastypes.c
+ python/libxml.c include/libxml/xmlmemory.h: small changes
+ to syntax to get rid of compiler warnings. No changes
+ to logic.
+
Mon Aug 4 22:40:54 CEST 2003 Daniel Veillard <daniel@veillard.com>
* doc/libxml2-api.xml doc/html/*: rebuilt the API and docs.
diff --git a/HTMLparser.c b/HTMLparser.c
index d45eac2..0aa0041 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -4331,7 +4331,7 @@
*/
static int
htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first,
- xmlChar next, xmlChar third, int comment) {
+ xmlChar next, xmlChar third, int iscomment) {
int base, len;
htmlParserInputPtr in;
const xmlChar *buf;
@@ -4354,7 +4354,7 @@
if (third) len -= 2;
else if (next) len --;
for (;base < len;base++) {
- if (!incomment && (base + 4 < len) && !comment) {
+ if (!incomment && (base + 4 < len) && !iscomment) {
if ((buf[base] == '<') && (buf[base + 1] == '!') &&
(buf[base + 2] == '-') && (buf[base + 3] == '-')) {
incomment = 1;
diff --git a/error.c b/error.c
index 2de45c8..7071030 100644
--- a/error.c
+++ b/error.c
@@ -11,6 +11,7 @@
#include <stdarg.h>
#include <libxml/parser.h>
+#include <libxml/parserInternals.h> /* for char constants */
#include <libxml/xmlerror.h>
#include <libxml/xmlmemory.h>
#include <libxml/globals.h>
@@ -149,7 +150,7 @@
void
xmlParserPrintFileContext(xmlParserInputPtr input) {
const xmlChar *cur, *base;
- int n, col;
+ unsigned int n, col; /* GCC warns if signed, because compared with sizeof() */
xmlChar content[81]; /* space for 80 chars + line terminator */
xmlChar *ctnt;
@@ -157,21 +158,23 @@
cur = input->cur;
base = input->base;
/* skip backwards over any end-of-lines */
- while ((cur > base) && ((*cur == '\n') || (*cur == '\r'))) {
+ while ((cur > base) && ((*(cur) == '\n') || (*(cur) == '\r'))) {
cur--;
}
n = 0;
/* search backwards for beginning-of-line (to max buff size) */
- while ((n++ < sizeof(content)-1) && (cur > base) && (*cur != '\n') && (*cur != '\r'))
+ while ((n++ < (sizeof(content)-1)) && (cur > base) &&
+ (*(cur) != '\n') && (*(cur) != '\r'))
cur--;
- if ((*cur == '\n') || (*cur == '\r')) cur++;
+ if ((*(cur) == '\n') || (*(cur) == '\r')) cur++;
/* calculate the error position in terms of the current position */
col = input->cur - cur;
/* search forward for end-of-line (to max buff size) */
n = 0;
ctnt = content;
/* copy selected text to our buffer */
- while ((*cur != 0) && (*cur != '\n') && (*cur != '\r') && (n < sizeof(content)-1)) {
+ while ((*cur != 0) && (*(cur) != '\n') &&
+ (*(cur) != '\r') && (n < sizeof(content)-1)) {
*ctnt++ = *cur++;
n++;
}
@@ -183,8 +186,8 @@
ctnt = content;
/* (leave buffer space for pointer + line terminator) */
while ((n<col) && (n++ < sizeof(content)-2) && (*ctnt != 0)) {
- if (*ctnt!='\t')
- *ctnt = ' ';
+ if (*(ctnt) != '\t')
+ *(ctnt) = ' ';
*ctnt++;
}
*ctnt++ = '^';
diff --git a/include/libxml/xmlmemory.h b/include/libxml/xmlmemory.h
index f35ffff..16ec60f 100644
--- a/include/libxml/xmlmemory.h
+++ b/include/libxml/xmlmemory.h
@@ -121,7 +121,7 @@
int xmlInitMemory (void);
/*
- * Those are specific to the XML debug memory wrapper.
+ * These are specific to the XML debug memory wrapper.
*/
int xmlMemUsed (void);
void xmlMemDisplay (FILE *fp);
@@ -131,6 +131,11 @@
void * xmlMemRealloc (void *ptr,size_t size);
void xmlMemFree (void *ptr);
char * xmlMemoryStrdup (const char *str);
+void * xmlMallocLoc (size_t size, const char *file, int line);
+void * xmlReallocLoc (void *ptr, size_t size, const char *file, int line);
+void * xmlMallocAtomicLoc (size_t size, const char *file, int line);
+char * xmlMemStrdupLoc (const char *str, const char *file, int line);
+
#ifdef DEBUG_MEMORY_LOCATION
/**
diff --git a/python/libxml.c b/python/libxml.c
index ea0aed7..5edc039 100644
--- a/python/libxml.c
+++ b/python/libxml.c
@@ -469,7 +469,7 @@
if (result == NULL) {
Py_DECREF(ret);
} else if (URL != NULL) {
- result->filename = xmlStrdup((const xmlChar *)URL);
+ result->filename = (char *) xmlStrdup((const xmlChar *)URL);
result->directory = xmlParserGetDirectory((const char *) URL);
}
}
@@ -2690,7 +2690,7 @@
#endif
ctxt = PyrelaxNgValidCtxt_Get(pyobj_ctx);
- if (xmlRelaxNGGetValidErrors(ctxt, NULL, NULL, &pyCtxt) == -1)
+ if (xmlRelaxNGGetValidErrors(ctxt, NULL, NULL, (void **) &pyCtxt) == -1)
{
py_retval = libxml_intWrap(-1);
return(py_retval);
@@ -2736,7 +2736,7 @@
return(NULL);
ctxt = (xmlRelaxNGValidCtxtPtr) PyrelaxNgValidCtxt_Get(pyobj_ctxt);
- if (xmlRelaxNGGetValidErrors(ctxt, NULL, NULL, &pyCtxt) == 0)
+ if (xmlRelaxNGGetValidErrors(ctxt, NULL, NULL, (void **) &pyCtxt) == 0)
{
if (pyCtxt != NULL)
{
diff --git a/testC14N.c b/testC14N.c
index 951dce7..bdacc22 100644
--- a/testC14N.c
+++ b/testC14N.c
@@ -46,7 +46,7 @@
static xmlChar **parse_list(xmlChar *str);
-static void print_xpath_nodes(xmlNodeSetPtr nodes);
+/* static void print_xpath_nodes(xmlNodeSetPtr nodes); */
static int
test_c14n(const char* xml_filename, int with_comments, int exclusive,
@@ -313,6 +313,7 @@
return(xpath);
}
+/*
static void
print_xpath_nodes(xmlNodeSetPtr nodes) {
xmlNodePtr cur;
@@ -343,10 +344,7 @@
}
}
}
-
-
-
-
+*/
#else
#include <stdio.h>
diff --git a/testHTML.c b/testHTML.c
index ce780ce..e0e5d3d 100644
--- a/testHTML.c
+++ b/testHTML.c
@@ -376,7 +376,7 @@
outlen = sizeof output - 1;
htmlEncodeEntities(output, &outlen, att, &attlen, '\'');
output[outlen] = 0;
- fprintf(stdout, "%s", output);
+ fprintf(stdout, "%s", (char *) output);
att += attlen;
}
fprintf(stdout, "'");
diff --git a/testURI.c b/testURI.c
index 60abae0..aa0729d 100644
--- a/testURI.c
+++ b/testURI.c
@@ -35,7 +35,7 @@
if (escape != 0) {
parsed = xmlSaveUri(uri);
res = xmlURIEscape(parsed);
- printf("%s\n", res);
+ printf("%s\n", (char *) res);
} else {
xmlPrintURI(stdout, uri);
@@ -45,7 +45,7 @@
} else {
res = xmlBuildURI((xmlChar *)str, (xmlChar *) base);
if (res != NULL) {
- printf("%s\n", res);
+ printf("%s\n", (char *) res);
}
else
printf("::ERROR::\n");
diff --git a/xmlcatalog.c b/xmlcatalog.c
index 1830f5e..0e320fe 100644
--- a/xmlcatalog.c
+++ b/xmlcatalog.c
@@ -194,7 +194,7 @@
if (ans == NULL) {
printf("No entry for PUBLIC %s\n", argv[0]);
} else {
- printf("%s\n", ans);
+ printf("%s\n", (char *) ans);
xmlFree(ans);
}
}
@@ -206,7 +206,7 @@
if (ans == NULL) {
printf("No entry for SYSTEM %s\n", argv[0]);
} else {
- printf("%s\n", ans);
+ printf("%s\n", (char *) ans);
xmlFree(ans);
}
}
@@ -256,7 +256,7 @@
if (ans == NULL) {
printf("Resolver failed to find an answer\n");
} else {
- printf("%s\n", ans);
+ printf("%s\n", (char *) ans);
xmlFree(ans);
}
}
@@ -539,7 +539,7 @@
printf("No entry for PUBLIC %s\n", argv[i]);
exit_value = 4;
} else {
- printf("%s\n", ans);
+ printf("%s\n", (char *) ans);
xmlFree(ans);
}
} else {
@@ -549,7 +549,7 @@
printf("No entry for SYSTEM %s\n", argv[i]);
exit_value = 4;
} else {
- printf("%s\n", ans);
+ printf("%s\n", (char *) ans);
xmlFree(ans);
}
}
diff --git a/xmlmemory.c b/xmlmemory.c
index 38cb659..b4651fe 100644
--- a/xmlmemory.c
+++ b/xmlmemory.c
@@ -44,10 +44,6 @@
#include <libxml/xmlerror.h>
void xmlMallocBreakpoint(void);
-void * xmlMemMalloc(size_t size);
-void * xmlMemRealloc(void *ptr,size_t size);
-void xmlMemFree(void *ptr);
-char * xmlMemoryStrdup(const char *str);
/************************************************************************
* *
diff --git a/xmlreader.c b/xmlreader.c
index 2348af0..cdc4f9e 100644
--- a/xmlreader.c
+++ b/xmlreader.c
@@ -235,17 +235,12 @@
xmlTextReaderStartElement(void *ctx, const xmlChar *fullname,
const xmlChar **atts) {
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlParserCtxtPtr origctxt;
xmlTextReaderPtr reader = ctxt->_private;
#ifdef DEBUG_CALLBACKS
printf("xmlTextReaderStartElement(%s)\n", fullname);
#endif
if ((reader != NULL) && (reader->startElement != NULL)) {
- /*
- * when processing an entity, the context may have been changed
- */
- origctxt = reader->ctxt;
reader->startElement(ctx, fullname, atts);
if ((ctxt->node != NULL) && (ctxt->input != NULL) &&
(ctxt->input->cur != NULL) && (ctxt->input->cur[0] == '/') &&
@@ -266,18 +261,12 @@
static void
xmlTextReaderEndElement(void *ctx, const xmlChar *fullname) {
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlParserCtxtPtr origctxt;
xmlTextReaderPtr reader = ctxt->_private;
#ifdef DEBUG_CALLBACKS
printf("xmlTextReaderEndElement(%s)\n", fullname);
#endif
if ((reader != NULL) && (reader->endElement != NULL)) {
- /*
- * when processing an entity, the context may have been changed
- */
- origctxt = reader->ctxt;
-
reader->endElement(ctx, fullname);
}
}
@@ -294,7 +283,6 @@
xmlTextReaderCharacters(void *ctx, const xmlChar *ch, int len)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- xmlParserCtxtPtr origctxt;
xmlTextReaderPtr reader = ctxt->_private;
#ifdef DEBUG_CALLBACKS
@@ -302,10 +290,6 @@
#endif
if ((reader != NULL) && (reader->characters != NULL)) {
reader->characters(ctx, ch, len);
- /*
- * when processing an entity, the context may have been changed
- */
- origctxt = reader->ctxt;
}
}
diff --git a/xmlschemastypes.c b/xmlschemastypes.c
index 7bd8a6e..8103f7a 100644
--- a/xmlschemastypes.c
+++ b/xmlschemastypes.c
@@ -123,8 +123,8 @@
unsigned long hi;
unsigned int extra;
unsigned int sign:1;
- int frac:7;
- int total:8;
+ unsigned int frac:7;
+ unsigned int total:8;
};
typedef struct _xmlSchemaValQName xmlSchemaValQName;
@@ -1413,7 +1413,7 @@
goto return0;
case XML_SCHEMAS_DECIMAL: {
const xmlChar *cur = value, *tmp;
- int frac = 0, len, neg = 0;
+ unsigned int frac = 0, len, neg = 0;
unsigned long base = 0;
if (cur == NULL)
goto return1;