mirror of
https://github.com/GNOME/libxml2.git
synced 2025-02-05 17:39:40 +08:00
- HTMLparser.c parser.c tree.c tree.h: Avoiding a few warning
when compiling with MSC Daniel
This commit is contained in:
parent
46057e141c
commit
4b0755c68b
@ -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>
|
Sun Sep 24 20:32:52 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
|
||||||
|
|
||||||
* xpath.c: patch for normalize-string() substring-before(),
|
* xpath.c: patch for normalize-string() substring-before(),
|
||||||
|
@ -1254,8 +1254,8 @@ htmlEntityValueLookup(int value) {
|
|||||||
|
|
||||||
for (i = 0;i < (sizeof(html40EntitiesTable)/
|
for (i = 0;i < (sizeof(html40EntitiesTable)/
|
||||||
sizeof(html40EntitiesTable[0]));i++) {
|
sizeof(html40EntitiesTable[0]));i++) {
|
||||||
if (html40EntitiesTable[i].value >= value) {
|
if ((unsigned int) html40EntitiesTable[i].value >= value) {
|
||||||
if (html40EntitiesTable[i].value > value)
|
if ((unsigned int) html40EntitiesTable[i].value > value)
|
||||||
break;
|
break;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr,"Found entity %s\n", html40EntitiesTable[i].name);
|
fprintf(stderr,"Found entity %s\n", html40EntitiesTable[i].name);
|
||||||
@ -2862,7 +2862,8 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
|
|||||||
}
|
}
|
||||||
} else if (nbatts + 4 > maxatts) {
|
} else if (nbatts + 4 > maxatts) {
|
||||||
maxatts *= 2;
|
maxatts *= 2;
|
||||||
atts = (const xmlChar **) xmlRealloc(atts, maxatts * sizeof(xmlChar *));
|
atts = (const xmlChar **) xmlRealloc((void *) atts,
|
||||||
|
maxatts * sizeof(xmlChar *));
|
||||||
if (atts == NULL) {
|
if (atts == NULL) {
|
||||||
fprintf(stderr, "realloc of %ld byte failed\n",
|
fprintf(stderr, "realloc of %ld byte failed\n",
|
||||||
maxatts * (long)sizeof(xmlChar *));
|
maxatts * (long)sizeof(xmlChar *));
|
||||||
|
@ -397,9 +397,9 @@ void xmlBufferCat (xmlBufferPtr buf,
|
|||||||
void xmlBufferCCat (xmlBufferPtr buf,
|
void xmlBufferCCat (xmlBufferPtr buf,
|
||||||
const char *str);
|
const char *str);
|
||||||
int xmlBufferShrink (xmlBufferPtr buf,
|
int xmlBufferShrink (xmlBufferPtr buf,
|
||||||
int len);
|
unsigned int len);
|
||||||
int xmlBufferGrow (xmlBufferPtr buf,
|
int xmlBufferGrow (xmlBufferPtr buf,
|
||||||
int len);
|
unsigned int len);
|
||||||
void xmlBufferEmpty (xmlBufferPtr buf);
|
void xmlBufferEmpty (xmlBufferPtr buf);
|
||||||
const xmlChar* xmlBufferContent (const xmlBufferPtr buf);
|
const xmlChar* xmlBufferContent (const xmlBufferPtr buf);
|
||||||
int xmlBufferUse (const xmlBufferPtr buf);
|
int xmlBufferUse (const xmlBufferPtr buf);
|
||||||
|
6
parser.c
6
parser.c
@ -5842,8 +5842,8 @@ xmlParseStartTag(xmlParserCtxtPtr ctxt) {
|
|||||||
}
|
}
|
||||||
} else if (nbatts + 4 > maxatts) {
|
} else if (nbatts + 4 > maxatts) {
|
||||||
maxatts *= 2;
|
maxatts *= 2;
|
||||||
atts = (const xmlChar **) xmlRealloc(atts,
|
atts = (const xmlChar **) xmlRealloc((void *) atts,
|
||||||
maxatts * sizeof(xmlChar *));
|
maxatts * sizeof(xmlChar *));
|
||||||
if (atts == NULL) {
|
if (atts == NULL) {
|
||||||
fprintf(stderr, "realloc of %ld byte failed\n",
|
fprintf(stderr, "realloc of %ld byte failed\n",
|
||||||
maxatts * (long)sizeof(xmlChar *));
|
maxatts * (long)sizeof(xmlChar *));
|
||||||
@ -5895,7 +5895,7 @@ failed:
|
|||||||
|
|
||||||
if (atts != NULL) {
|
if (atts != NULL) {
|
||||||
for (i = 0;i < nbatts;i++) xmlFree((xmlChar *) atts[i]);
|
for (i = 0;i < nbatts;i++) xmlFree((xmlChar *) atts[i]);
|
||||||
xmlFree(atts);
|
xmlFree((void *) atts);
|
||||||
}
|
}
|
||||||
return(name);
|
return(name);
|
||||||
}
|
}
|
||||||
|
36
tree.c
36
tree.c
@ -3969,7 +3969,7 @@ xmlBufferEmpty(xmlBufferPtr buf) {
|
|||||||
* Returns the number of xmlChar removed, or -1 in case of failure.
|
* Returns the number of xmlChar removed, or -1 in case of failure.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xmlBufferShrink(xmlBufferPtr buf, int len) {
|
xmlBufferShrink(xmlBufferPtr buf, unsigned int len) {
|
||||||
if (len == 0) return(0);
|
if (len == 0) return(0);
|
||||||
if (len > buf->use) return(-1);
|
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
|
* Returns the new available space or -1 in case of error
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xmlBufferGrow(xmlBufferPtr buf, int len) {
|
xmlBufferGrow(xmlBufferPtr buf, unsigned int len) {
|
||||||
int size;
|
int size;
|
||||||
xmlChar *newbuf;
|
xmlChar *newbuf;
|
||||||
|
|
||||||
@ -4069,26 +4069,29 @@ xmlBufferLength(const xmlBufferPtr buf)
|
|||||||
/**
|
/**
|
||||||
* xmlBufferResize:
|
* xmlBufferResize:
|
||||||
* @buf: the buffer to resize
|
* @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
|
* Returns 0 in case of problems, 1 otherwise
|
||||||
*/
|
*/
|
||||||
int
|
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;
|
xmlChar* rebuf = NULL;
|
||||||
|
|
||||||
|
/*take care of empty case*/
|
||||||
|
newSize = (buf->size ? buf->size*2 : size);
|
||||||
|
|
||||||
/* Don't resize if we don't have to */
|
/* Don't resize if we don't have to */
|
||||||
if(size < buf->size)
|
if (size < buf->size)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* figure out new size */
|
/* figure out new size */
|
||||||
switch(buf->alloc){
|
switch (buf->alloc){
|
||||||
case XML_BUFFER_ALLOC_DOUBLEIT:
|
case XML_BUFFER_ALLOC_DOUBLEIT:
|
||||||
while(size > newSize) newSize *= 2;
|
while (size > newSize) newSize *= 2;
|
||||||
break;
|
break;
|
||||||
case XML_BUFFER_ALLOC_EXACT:
|
case XML_BUFFER_ALLOC_EXACT:
|
||||||
newSize = size+10;
|
newSize = size+10;
|
||||||
@ -4112,6 +4115,7 @@ xmlBufferResize(xmlBufferPtr buf, int size)
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xmlBufferAdd:
|
* xmlBufferAdd:
|
||||||
* @buf: the buffer to dump
|
* @buf: the buffer to dump
|
||||||
@ -4123,7 +4127,7 @@ xmlBufferResize(xmlBufferPtr buf, int size)
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len) {
|
xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len) {
|
||||||
int needSize;
|
unsigned int needSize;
|
||||||
|
|
||||||
if (str == NULL) {
|
if (str == NULL) {
|
||||||
#ifdef DEBUG_BUFFER
|
#ifdef DEBUG_BUFFER
|
||||||
@ -4145,8 +4149,8 @@ xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len) {
|
|||||||
if (len <= 0) return;
|
if (len <= 0) return;
|
||||||
|
|
||||||
needSize = buf->use + len + 2;
|
needSize = buf->use + len + 2;
|
||||||
if(needSize > buf->size){
|
if (needSize > buf->size){
|
||||||
if(!xmlBufferResize(buf, needSize)){
|
if (!xmlBufferResize(buf, needSize)){
|
||||||
fprintf(stderr, "xmlBufferAdd : out of memory!\n");
|
fprintf(stderr, "xmlBufferAdd : out of memory!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -4168,7 +4172,7 @@ xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len) {
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
xmlBufferAddHead(xmlBufferPtr buf, const xmlChar *str, int len) {
|
xmlBufferAddHead(xmlBufferPtr buf, const xmlChar *str, int len) {
|
||||||
int needSize;
|
unsigned int needSize;
|
||||||
|
|
||||||
if (str == NULL) {
|
if (str == NULL) {
|
||||||
#ifdef DEBUG_BUFFER
|
#ifdef DEBUG_BUFFER
|
||||||
@ -4190,8 +4194,8 @@ xmlBufferAddHead(xmlBufferPtr buf, const xmlChar *str, int len) {
|
|||||||
if (len <= 0) return;
|
if (len <= 0) return;
|
||||||
|
|
||||||
needSize = buf->use + len + 2;
|
needSize = buf->use + len + 2;
|
||||||
if(needSize > buf->size){
|
if (needSize > buf->size){
|
||||||
if(!xmlBufferResize(buf, needSize)){
|
if (!xmlBufferResize(buf, needSize)){
|
||||||
fprintf(stderr, "xmlBufferAddHead : out of memory!\n");
|
fprintf(stderr, "xmlBufferAddHead : out of memory!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -4235,7 +4239,7 @@ xmlBufferCCat(xmlBufferPtr buf, const char *str) {
|
|||||||
}
|
}
|
||||||
for (cur = str;*cur != 0;cur++) {
|
for (cur = str;*cur != 0;cur++) {
|
||||||
if (buf->use + 10 >= buf->size) {
|
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");
|
fprintf(stderr, "xmlBufferCCat : out of memory!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
4
tree.h
4
tree.h
@ -397,9 +397,9 @@ void xmlBufferCat (xmlBufferPtr buf,
|
|||||||
void xmlBufferCCat (xmlBufferPtr buf,
|
void xmlBufferCCat (xmlBufferPtr buf,
|
||||||
const char *str);
|
const char *str);
|
||||||
int xmlBufferShrink (xmlBufferPtr buf,
|
int xmlBufferShrink (xmlBufferPtr buf,
|
||||||
int len);
|
unsigned int len);
|
||||||
int xmlBufferGrow (xmlBufferPtr buf,
|
int xmlBufferGrow (xmlBufferPtr buf,
|
||||||
int len);
|
unsigned int len);
|
||||||
void xmlBufferEmpty (xmlBufferPtr buf);
|
void xmlBufferEmpty (xmlBufferPtr buf);
|
||||||
const xmlChar* xmlBufferContent (const xmlBufferPtr buf);
|
const xmlChar* xmlBufferContent (const xmlBufferPtr buf);
|
||||||
int xmlBufferUse (const xmlBufferPtr buf);
|
int xmlBufferUse (const xmlBufferPtr buf);
|
||||||
|
Loading…
Reference in New Issue
Block a user