- HTMLparser.c parser.c tree.c tree.h: Avoiding a few warning
when compiling with MSC
Daniel
diff --git a/ChangeLog b/ChangeLog
index 876f781..ab3c1f9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Sep 25 16:23:41 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
+
+ * 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 <Daniel.Veillard@w3.org>
* xpath.c: patch for normalize-string() substring-before(),
diff --git a/HTMLparser.c b/HTMLparser.c
index a0719eb..2bafa72 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -1254,8 +1254,8 @@
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 @@
}
} 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 27834bb..2a14d1d 100644
--- a/include/libxml/tree.h
+++ b/include/libxml/tree.h
@@ -397,9 +397,9 @@
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 b9abb73..33a3dce 100644
--- a/parser.c
+++ b/parser.c
@@ -5842,8 +5842,8 @@
}
} 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 @@
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 b261e56..015c10c 100644
--- a/tree.c
+++ b/tree.c
@@ -3969,7 +3969,7 @@
* 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 @@
* 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 @@
/**
* xmlBufferResize:
* @buf: the buffer to resize
- * @len: the desired size
+ * @size: the desired size
*
- * Resize a buffer to accomodate minimum size of <len>.
+ * 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 @@
return 1;
}
+
/**
* xmlBufferAdd:
* @buf: the buffer to dump
@@ -4123,7 +4127,7 @@
*/
void
xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len) {
- int needSize;
+ unsigned int needSize;
if (str == NULL) {
#ifdef DEBUG_BUFFER
@@ -4145,8 +4149,8 @@
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 @@
*/
void
xmlBufferAddHead(xmlBufferPtr buf, const xmlChar *str, int len) {
- int needSize;
+ unsigned int needSize;
if (str == NULL) {
#ifdef DEBUG_BUFFER
@@ -4190,8 +4194,8 @@
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 @@
}
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 27834bb..2a14d1d 100644
--- a/tree.h
+++ b/tree.h
@@ -397,9 +397,9 @@
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);