fixing bug 118559
diff --git a/ChangeLog b/ChangeLog
index c976d18..795e7bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+Thu Jul 31 22:44:33 HKT 2003 William Brack <wbrack@mmm.com.hk>
+
+ Working on bug 118559
+ * error.c: deleted unused variable
+ * parserInternals.c: deleted unneeded 'const' qualifier
+ * parser.c: changed variable type for enum temp storage
+ * xmlIO.c: changed debugging var to be inside #ifdef
+ * valid.c: removed unused variable
+ * HTMLparser.c: removed some unneeded 'const' qualifiers
+ * xpath.c: added some type casts, removed some unused vars
+ * xinclude.c: added one type cast
+ * nanohttp.c: repositioned some #ifdef to avoid unused var
+ * nanoftp.c: removed unused var
+
Wed Jul 30 14:57:55 EDT 2003 Daniel Veillard <daniel@veillard.com>
* HTMLparser.c: applied a patch from William Brack about
diff --git a/HTMLparser.c b/HTMLparser.c
index e16102d..85be52d 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -962,7 +962,7 @@
for (i = 0; i < (sizeof(html40ElementTable) /
sizeof(html40ElementTable[0]));i++) {
if (!xmlStrcasecmp(tag, BAD_CAST html40ElementTable[i].name))
- return((const htmlElemDescPtr) (const htmlElemDescPtr) (const htmlElemDescPtr) (const htmlElemDescPtr) (const htmlElemDescPtr) (const htmlElemDescPtr) (const htmlElemDescPtr) (const htmlElemDescPtr) (const htmlElemDescPtr) &html40ElementTable[i]);
+ return((htmlElemDescPtr) &html40ElementTable[i]);
}
return(NULL);
}
@@ -1688,7 +1688,7 @@
#ifdef DEBUG
xmlGenericError(xmlGenericErrorContext,"Found entity %s\n", name);
#endif
- return((const htmlEntityDescPtr) &html40EntitiesTable[i]);
+ return((htmlEntityDescPtr) &html40EntitiesTable[i]);
}
}
return(NULL);
@@ -1719,7 +1719,7 @@
#ifdef DEBUG
xmlGenericError(xmlGenericErrorContext,"Found entity %s\n", html40EntitiesTable[i].name);
#endif
- return((const htmlEntityDescPtr) &html40EntitiesTable[i]);
+ return((htmlEntityDescPtr) &html40EntitiesTable[i]);
}
#ifdef DEBUG
if (lv > html40EntitiesTable[i].value) {
@@ -4317,7 +4317,7 @@
* @first: the first char to lookup
* @next: the next char to lookup or zero
* @third: the next char to lookup or zero
- * @iscomment: flag to force checking inside comments
+ * @comment: flag to force checking inside comments
*
* Try to find if a sequence (first, next, third) or just (first next) or
* (first) is available in the input stream.
@@ -4331,7 +4331,7 @@
*/
static int
htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first,
- xmlChar next, xmlChar third, int iscomment) {
+ xmlChar next, xmlChar third, int comment) {
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) && !iscomment) {
+ if (!incomment && (base + 4 < len) && !comment) {
if ((buf[base] == '<') && (buf[base + 1] == '!') &&
(buf[base + 2] == '-') && (buf[base + 3] == '-')) {
incomment = 1;
diff --git a/error.c b/error.c
index f709bbd..2de45c8 100644
--- a/error.c
+++ b/error.c
@@ -350,7 +350,6 @@
char * str;
int len = xmlStrlen((const xmlChar *) msg);
static int had_info = 0;
- int need_context = 0;
if ((len > 1) && (msg[len - 2] != ':')) {
if (ctxt != NULL) {
@@ -363,7 +362,6 @@
}
}
xmlGenericError(xmlGenericErrorContext, "validity error: ");
- need_context = 1;
had_info = 0;
} else {
had_info = 1;
diff --git a/nanoftp.c b/nanoftp.c
index 1ed57fa..b6fd9a1 100644
--- a/nanoftp.c
+++ b/nanoftp.c
@@ -978,14 +978,13 @@
xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
char buf[200];
int len;
- int res;
snprintf(buf, sizeof(buf), "QUIT\r\n");
len = strlen(buf);
#ifdef DEBUG_FTP
xmlGenericError(xmlGenericErrorContext, "%s", buf); /* Just to be consistent, even though we know it can't have a % in it */
#endif
- res = send(ctxt->controlFd, buf, len, 0);
+ send(ctxt->controlFd, buf, len, 0);
return(0);
}
diff --git a/nanohttp.c b/nanohttp.c
index b645720..a3b4661 100644
--- a/nanohttp.c
+++ b/nanohttp.c
@@ -1214,9 +1214,11 @@
char *bp, *p;
int blen, ret;
int head;
- int xmt_bytes;
int nbRedirects = 0;
char *redirURL = NULL;
+#ifdef DEBUG_HTTP
+ int xmt_bytes;
+#endif
if (URL == NULL) return(NULL);
if (method == NULL) method = "GET";
@@ -1328,26 +1330,30 @@
ctxt->outptr = ctxt->out = bp;
ctxt->state = XML_NANO_HTTP_WRITE;
blen = strlen( ctxt->out );
- xmt_bytes = xmlNanoHTTPSend(ctxt, ctxt->out, blen );
#ifdef DEBUG_HTTP
+ xmt_bytes = xmlNanoHTTPSend(ctxt, ctxt->out, blen );
if ( xmt_bytes != blen )
xmlGenericError( xmlGenericErrorContext,
"xmlNanoHTTPMethodRedir: Only %d of %d %s %s\n",
xmt_bytes, blen,
"bytes of HTTP headers sent to host",
ctxt->hostname );
+#else
+ xmlNanoHTTPSend(ctxt, ctxt->out, blen );
#endif
if ( input != NULL ) {
+#ifdef DEBUG_HTTP
xmt_bytes = xmlNanoHTTPSend( ctxt, input, ilen );
-#ifdef DEBUG_HTTP
if ( xmt_bytes != ilen )
xmlGenericError( xmlGenericErrorContext,
"xmlNanoHTTPMethodRedir: Only %d of %d %s %s\n",
xmt_bytes, ilen,
"bytes of HTTP content sent to host",
ctxt->hostname );
+#else
+ xmlNanoHTTPSend( ctxt, input, ilen );
#endif
}
diff --git a/parser.c b/parser.c
index ede62d8..1291533 100644
--- a/parser.c
+++ b/parser.c
@@ -5111,7 +5111,7 @@
} else if ((RAW == 'I') && (NXT(1) == 'G') && (NXT(2) == 'N') &&
(NXT(3) == 'O') && (NXT(4) == 'R') && (NXT(5) == 'E')) {
int state;
- int instate;
+ xmlParserInputState instate;
int depth = 0;
SKIP(6);
diff --git a/parserInternals.c b/parserInternals.c
index 84d6eef..ace563d 100644
--- a/parserInternals.c
+++ b/parserInternals.c
@@ -2530,7 +2530,7 @@
unsigned long pos;
/* Find pos and check to see if node is already in the sequence */
- pos = xmlParserFindNodeInfoIndex(&ctxt->node_seq, (const xmlNodePtr)
+ pos = xmlParserFindNodeInfoIndex(&ctxt->node_seq, (xmlNodePtr)
info->node);
if (pos < ctxt->node_seq.length
&& ctxt->node_seq.buffer[pos].node == info->node) {
diff --git a/valid.c b/valid.c
index b99e8c5..d3dac10 100644
--- a/valid.c
+++ b/valid.c
@@ -624,7 +624,6 @@
*/
int
xmlValidBuildContentModel(xmlValidCtxtPtr ctxt, xmlElementPtr elem) {
- xmlAutomataStatePtr start;
if ((ctxt == NULL) || (elem == NULL))
return(0);
@@ -647,7 +646,7 @@
elem->name);
return(0);
}
- start = ctxt->state = xmlAutomataGetInitState(ctxt->am);
+ ctxt->state = xmlAutomataGetInitState(ctxt->am);
xmlValidBuildAContentModel(elem->content, ctxt, elem->name);
xmlAutomataSetFinalState(ctxt->am, ctxt->state);
elem->contModel = xmlAutomataCompile(ctxt->am);
diff --git a/xinclude.c b/xinclude.c
index 58d91ae..b2756c0 100644
--- a/xinclude.c
+++ b/xinclude.c
@@ -1436,7 +1436,7 @@
xmlChar *URL;
int i;
xmlChar *encoding = NULL;
- xmlCharEncoding enc = 0;
+ xmlCharEncoding enc = (xmlCharEncoding) 0;
/*
* Check the URL and remove any fragment identifier
diff --git a/xmlIO.c b/xmlIO.c
index ce5d466..8be3af4 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -720,20 +720,24 @@
*/
static void
xmlFreeZMemBuff( xmlZMemBuffPtr buff ) {
-
+
+#ifdef DEBUG_HTTP
int z_err;
+#endif
if ( buff == NULL )
return;
xmlFree( buff->zbuff );
- z_err = deflateEnd( &buff->zctrl );
#ifdef DEBUG_HTTP
+ z_err = deflateEnd( &buff->zctrl );
if ( z_err != Z_OK )
xmlGenericError( xmlGenericErrorContext,
"xmlFreeZMemBuff: Error releasing zlib context: %d\n",
z_err );
-#endif
+#else
+ deflateEnd( &buff->zctrl );
+#endif;
xmlFree( buff );
return;
diff --git a/xmllint.c b/xmllint.c
index df5e51f..a54732a 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -145,7 +145,6 @@
static int chkregister = 0;
static const char *output = NULL;
-
/*
* Internal timing routines to remove the necessity to have unix-specific
* function calls
@@ -755,6 +754,31 @@
}
#endif
#ifdef LIBXML_HTML_ENABLED
+ else if ((html) && (push)) {
+ FILE *f;
+
+ f = fopen(filename, "r");
+ if (f != NULL) {
+ int res, size = 3;
+ char chars[4096];
+ htmlParserCtxtPtr ctxt;
+
+ /* if (repeat) */
+ size = 4096;
+ res = fread(chars, 1, 4, f);
+ if (res > 0) {
+ ctxt = htmlCreatePushParserCtxt(NULL, NULL,
+ chars, res, filename, 0);
+ while ((res = fread(chars, 1, size, f)) > 0) {
+ htmlParseChunk(ctxt, chars, res, 0);
+ }
+ htmlParseChunk(ctxt, chars, 0, 1);
+ doc = ctxt->myDoc;
+ htmlFreeParserCtxt(ctxt);
+ }
+ fclose(f);
+ }
+ }
else if (html) {
doc = htmlParseFile(filename, NULL);
}
diff --git a/xpath.c b/xpath.c
index 16681b2..2e0c9eb 100644
--- a/xpath.c
+++ b/xpath.c
@@ -738,9 +738,9 @@
case XPATH_OP_SORT:
fprintf(output, "SORT"); break;
case XPATH_OP_COLLECT: {
- xmlXPathAxisVal axis = op->value;
- xmlXPathTestVal test = op->value2;
- xmlXPathTypeVal type = op->value3;
+ xmlXPathAxisVal axis = (xmlXPathAxisVal)op->value;
+ xmlXPathTestVal test = (xmlXPathTestVal)op->value2;
+ xmlXPathTypeVal type = (xmlXPathTypeVal)op->value3;
const xmlChar *prefix = op->value4;
const xmlChar *name = op->value5;
@@ -1945,7 +1945,7 @@
*/
static xmlNodeSetPtr
xmlXPathNodeSetMergeUnique(xmlNodeSetPtr val1, xmlNodeSetPtr val2) {
- int i, initNr;
+ int i;
if (val2 == NULL) return(val1);
if (val1 == NULL) {
@@ -1953,7 +1953,6 @@
}
/* @@ with_ns to check wether namespace nodes should be looked at @@ */
- initNr = val1->nodeNr;
for (i = 0;i < val2->nodeNr;i++) {
/*
@@ -7937,7 +7936,6 @@
xmlFree(name);
} else if (name != NULL) {
int len =xmlStrlen(name);
- int blank = 0;
while (NXT(len) != 0) {
@@ -7950,8 +7948,8 @@
lc = 1;
break;
} else if (IS_BLANK(NXT(len))) {
- /* skip to next */
- blank = 1;
+ /* ignore blanks */
+ ;
} else if (NXT(len) == ':') {
#ifdef DEBUG_STEP
xmlGenericError(xmlGenericErrorContext,
@@ -8377,8 +8375,8 @@
STRANGE;
return(NULL);
}
- *type = 0;
- *test = 0;
+ *type = (xmlXPathTypeVal) 0;
+ *test = (xmlXPathTestVal) 0;
*prefix = NULL;
SKIP_BLANKS;
@@ -8504,7 +8502,7 @@
*/
static xmlXPathAxisVal
xmlXPathIsAxisName(const xmlChar *name) {
- xmlXPathAxisVal ret = 0;
+ xmlXPathAxisVal ret = (xmlXPathAxisVal) 0;
switch (name[0]) {
case 'a':
if (xmlStrEqual(name, BAD_CAST "ancestor"))
@@ -8602,7 +8600,7 @@
xmlChar *name = NULL;
const xmlChar *prefix = NULL;
xmlXPathTestVal test;
- xmlXPathAxisVal axis = 0;
+ xmlXPathAxisVal axis = (xmlXPathAxisVal) 0;
xmlXPathTypeVal type;
int op1;
@@ -8832,9 +8830,9 @@
xmlXPathStepOpPtr op,
xmlNodePtr * first, xmlNodePtr * last)
{
- xmlXPathAxisVal axis = op->value;
- xmlXPathTestVal test = op->value2;
- xmlXPathTypeVal type = op->value3;
+ xmlXPathAxisVal axis = (xmlXPathAxisVal) op->value;
+ xmlXPathTestVal test = (xmlXPathTestVal) op->value2;
+ xmlXPathTypeVal type = (xmlXPathTypeVal) op->value3;
const xmlChar *prefix = op->value4;
const xmlChar *name = op->value5;
const xmlChar *URI = NULL;
@@ -9253,9 +9251,9 @@
xmlXPathStepOpPtr op, int indx,
xmlNodePtr * first, xmlNodePtr * last)
{
- xmlXPathAxisVal axis = op->value;
- xmlXPathTestVal test = op->value2;
- xmlXPathTypeVal type = op->value3;
+ xmlXPathAxisVal axis = (xmlXPathAxisVal) op->value;
+ xmlXPathTestVal test = (xmlXPathTestVal) op->value2;
+ xmlXPathTypeVal type = (xmlXPathTypeVal) op->value3;
const xmlChar *prefix = op->value4;
const xmlChar *name = op->value5;
const xmlChar *URI = NULL;