From 4b0755c68b0182809a7db5b6ab1478cb2767abfb Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Mon, 25 Sep 2000 14:26:28 +0000 Subject: [PATCH] - HTMLparser.c parser.c tree.c tree.h: Avoiding a few warning when compiling with MSC Daniel --- ChangeLog | 5 +++++ HTMLparser.c | 7 ++++--- include/libxml/tree.h | 4 ++-- parser.c | 6 +++--- tree.c | 36 ++++++++++++++++++++---------------- tree.h | 4 ++-- 6 files changed, 36 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 876f7814..ab3c1f98 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Sep 25 16:23:41 CEST 2000 Daniel Veillard + + * HTMLparser.c parser.c tree.c tree.h: Avoiding a few warning + when compiling with MSC + Sun Sep 24 20:32:52 CEST 2000 Daniel Veillard * xpath.c: patch for normalize-string() substring-before(), diff --git a/HTMLparser.c b/HTMLparser.c index a0719eb6..2bafa72c 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -1254,8 +1254,8 @@ htmlEntityValueLookup(int value) { for (i = 0;i < (sizeof(html40EntitiesTable)/ sizeof(html40EntitiesTable[0]));i++) { - if (html40EntitiesTable[i].value >= value) { - if (html40EntitiesTable[i].value > value) + if ((unsigned int) html40EntitiesTable[i].value >= value) { + if ((unsigned int) html40EntitiesTable[i].value > value) break; #ifdef DEBUG fprintf(stderr,"Found entity %s\n", html40EntitiesTable[i].name); @@ -2862,7 +2862,8 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) { } } else if (nbatts + 4 > maxatts) { maxatts *= 2; - atts = (const xmlChar **) xmlRealloc(atts, maxatts * sizeof(xmlChar *)); + atts = (const xmlChar **) xmlRealloc((void *) atts, + maxatts * sizeof(xmlChar *)); if (atts == NULL) { fprintf(stderr, "realloc of %ld byte failed\n", maxatts * (long)sizeof(xmlChar *)); diff --git a/include/libxml/tree.h b/include/libxml/tree.h index 27834bb9..2a14d1d2 100644 --- a/include/libxml/tree.h +++ b/include/libxml/tree.h @@ -397,9 +397,9 @@ void xmlBufferCat (xmlBufferPtr buf, void xmlBufferCCat (xmlBufferPtr buf, const char *str); int xmlBufferShrink (xmlBufferPtr buf, - int len); + unsigned int len); int xmlBufferGrow (xmlBufferPtr buf, - int len); + unsigned int len); void xmlBufferEmpty (xmlBufferPtr buf); const xmlChar* xmlBufferContent (const xmlBufferPtr buf); int xmlBufferUse (const xmlBufferPtr buf); diff --git a/parser.c b/parser.c index b9abb73a..33a3dce1 100644 --- a/parser.c +++ b/parser.c @@ -5842,8 +5842,8 @@ xmlParseStartTag(xmlParserCtxtPtr ctxt) { } } else if (nbatts + 4 > maxatts) { maxatts *= 2; - atts = (const xmlChar **) xmlRealloc(atts, - maxatts * sizeof(xmlChar *)); + atts = (const xmlChar **) xmlRealloc((void *) atts, + maxatts * sizeof(xmlChar *)); if (atts == NULL) { fprintf(stderr, "realloc of %ld byte failed\n", maxatts * (long)sizeof(xmlChar *)); @@ -5895,7 +5895,7 @@ failed: if (atts != NULL) { for (i = 0;i < nbatts;i++) xmlFree((xmlChar *) atts[i]); - xmlFree(atts); + xmlFree((void *) atts); } return(name); } diff --git a/tree.c b/tree.c index b261e560..015c10c0 100644 --- a/tree.c +++ b/tree.c @@ -3969,7 +3969,7 @@ xmlBufferEmpty(xmlBufferPtr buf) { * Returns the number of xmlChar removed, or -1 in case of failure. */ int -xmlBufferShrink(xmlBufferPtr buf, int len) { +xmlBufferShrink(xmlBufferPtr buf, unsigned int len) { if (len == 0) return(0); if (len > buf->use) return(-1); @@ -3990,7 +3990,7 @@ xmlBufferShrink(xmlBufferPtr buf, int len) { * Returns the new available space or -1 in case of error */ int -xmlBufferGrow(xmlBufferPtr buf, int len) { +xmlBufferGrow(xmlBufferPtr buf, unsigned int len) { int size; xmlChar *newbuf; @@ -4069,26 +4069,29 @@ xmlBufferLength(const xmlBufferPtr buf) /** * xmlBufferResize: * @buf: the buffer to resize - * @len: the desired size + * @size: the desired size * - * Resize a buffer to accomodate minimum size of . + * Resize a buffer to accomodate minimum size of @size. * * Returns 0 in case of problems, 1 otherwise */ int -xmlBufferResize(xmlBufferPtr buf, int size) +xmlBufferResize(xmlBufferPtr buf, unsigned int size) { - int newSize = (buf->size ? buf->size*2 : size);/*take care of empty case*/ + unsigned int newSize; xmlChar* rebuf = NULL; + /*take care of empty case*/ + newSize = (buf->size ? buf->size*2 : size); + /* Don't resize if we don't have to */ - if(size < buf->size) + if (size < buf->size) return 1; /* figure out new size */ - switch(buf->alloc){ + switch (buf->alloc){ case XML_BUFFER_ALLOC_DOUBLEIT: - while(size > newSize) newSize *= 2; + while (size > newSize) newSize *= 2; break; case XML_BUFFER_ALLOC_EXACT: newSize = size+10; @@ -4112,6 +4115,7 @@ xmlBufferResize(xmlBufferPtr buf, int size) return 1; } + /** * xmlBufferAdd: * @buf: the buffer to dump @@ -4123,7 +4127,7 @@ xmlBufferResize(xmlBufferPtr buf, int size) */ void xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len) { - int needSize; + unsigned int needSize; if (str == NULL) { #ifdef DEBUG_BUFFER @@ -4145,8 +4149,8 @@ xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len) { if (len <= 0) return; needSize = buf->use + len + 2; - if(needSize > buf->size){ - if(!xmlBufferResize(buf, needSize)){ + if (needSize > buf->size){ + if (!xmlBufferResize(buf, needSize)){ fprintf(stderr, "xmlBufferAdd : out of memory!\n"); return; } @@ -4168,7 +4172,7 @@ xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len) { */ void xmlBufferAddHead(xmlBufferPtr buf, const xmlChar *str, int len) { - int needSize; + unsigned int needSize; if (str == NULL) { #ifdef DEBUG_BUFFER @@ -4190,8 +4194,8 @@ xmlBufferAddHead(xmlBufferPtr buf, const xmlChar *str, int len) { if (len <= 0) return; needSize = buf->use + len + 2; - if(needSize > buf->size){ - if(!xmlBufferResize(buf, needSize)){ + if (needSize > buf->size){ + if (!xmlBufferResize(buf, needSize)){ fprintf(stderr, "xmlBufferAddHead : out of memory!\n"); return; } @@ -4235,7 +4239,7 @@ xmlBufferCCat(xmlBufferPtr buf, const char *str) { } for (cur = str;*cur != 0;cur++) { if (buf->use + 10 >= buf->size) { - if(!xmlBufferResize(buf, buf->use+10)){ + if (!xmlBufferResize(buf, buf->use+10)){ fprintf(stderr, "xmlBufferCCat : out of memory!\n"); return; } diff --git a/tree.h b/tree.h index 27834bb9..2a14d1d2 100644 --- a/tree.h +++ b/tree.h @@ -397,9 +397,9 @@ void xmlBufferCat (xmlBufferPtr buf, void xmlBufferCCat (xmlBufferPtr buf, const char *str); int xmlBufferShrink (xmlBufferPtr buf, - int len); + unsigned int len); int xmlBufferGrow (xmlBufferPtr buf, - int len); + unsigned int len); void xmlBufferEmpty (xmlBufferPtr buf); const xmlChar* xmlBufferContent (const xmlBufferPtr buf); int xmlBufferUse (const xmlBufferPtr buf);