diff --git a/ChangeLog b/ChangeLog index c976d18b..795e7bc2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Thu Jul 31 22:44:33 HKT 2003 William Brack + + 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 * HTMLparser.c: applied a patch from William Brack about diff --git a/HTMLparser.c b/HTMLparser.c index e16102d4..85be52db 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -962,7 +962,7 @@ htmlTagLookup(const xmlChar *tag) { 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 @@ htmlEntityLookup(const xmlChar *name) { #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 @@ htmlEntityValueLookup(unsigned int value) { #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 @@ htmlCreateDocParserCtxt(xmlChar *cur, const char *encoding ATTRIBUTE_UNUSED) { * @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 @@ htmlCreateDocParserCtxt(xmlChar *cur, const char *encoding ATTRIBUTE_UNUSED) { */ 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 @@ htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first, 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 f709bbd0..2de45c88 100644 --- a/error.c +++ b/error.c @@ -350,7 +350,6 @@ xmlParserValidityError(void *ctx, const char *msg, ...) 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 @@ xmlParserValidityError(void *ctx, const char *msg, ...) } } xmlGenericError(xmlGenericErrorContext, "validity error: "); - need_context = 1; had_info = 0; } else { had_info = 1; diff --git a/nanoftp.c b/nanoftp.c index 1ed57fac..b6fd9a11 100644 --- a/nanoftp.c +++ b/nanoftp.c @@ -978,14 +978,13 @@ xmlNanoFTPQuit(void *ctx) { 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 b6457205..a3b4661e 100644 --- a/nanohttp.c +++ b/nanohttp.c @@ -1214,9 +1214,11 @@ xmlNanoHTTPMethodRedir(const char *URL, const char *method, const char *input, 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 @@ retry: 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 ede62d80..1291533c 100644 --- a/parser.c +++ b/parser.c @@ -5111,7 +5111,7 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) { } 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 84d6eef8..ace563d3 100644 --- a/parserInternals.c +++ b/parserInternals.c @@ -2530,7 +2530,7 @@ xmlParserAddNodeInfo(xmlParserCtxtPtr ctxt, 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 b99e8c5a..d3dac10d 100644 --- a/valid.c +++ b/valid.c @@ -624,7 +624,6 @@ xmlValidBuildAContentModel(xmlElementContentPtr content, */ int xmlValidBuildContentModel(xmlValidCtxtPtr ctxt, xmlElementPtr elem) { - xmlAutomataStatePtr start; if ((ctxt == NULL) || (elem == NULL)) return(0); @@ -647,7 +646,7 @@ xmlValidBuildContentModel(xmlValidCtxtPtr ctxt, xmlElementPtr elem) { 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 58d91aea..b2756c04 100644 --- a/xinclude.c +++ b/xinclude.c @@ -1436,7 +1436,7 @@ xmlXIncludeLoadTxt(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) { 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 ce5d4667..8be3af4a 100644 --- a/xmlIO.c +++ b/xmlIO.c @@ -720,20 +720,24 @@ append_reverse_ulong( xmlZMemBuff * buff, unsigned long data ) { */ 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 df5e51fa..a54732ab 100644 --- a/xmllint.c +++ b/xmllint.c @@ -145,7 +145,6 @@ static int stream = 0; 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 @@ static void parseAndPrintFile(char *filename) { } #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 16681b2b..2e0c9ebf 100644 --- a/xpath.c +++ b/xpath.c @@ -738,9 +738,9 @@ xmlXPathDebugDumpStepOp(FILE *output, xmlXPathCompExprPtr comp, 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 @@ xmlXPathNodeSetMerge(xmlNodeSetPtr val1, xmlNodeSetPtr val2) { */ static xmlNodeSetPtr xmlXPathNodeSetMergeUnique(xmlNodeSetPtr val1, xmlNodeSetPtr val2) { - int i, initNr; + int i; if (val2 == NULL) return(val1); if (val1 == NULL) { @@ -1953,7 +1953,6 @@ xmlXPathNodeSetMergeUnique(xmlNodeSetPtr val1, xmlNodeSetPtr val2) { } /* @@ 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 @@ xmlXPathCompPathExpr(xmlXPathParserContextPtr ctxt) { xmlFree(name); } else if (name != NULL) { int len =xmlStrlen(name); - int blank = 0; while (NXT(len) != 0) { @@ -7950,8 +7948,8 @@ xmlXPathCompPathExpr(xmlXPathParserContextPtr ctxt) { 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 @@ xmlXPathCompNodeTest(xmlXPathParserContextPtr ctxt, xmlXPathTestVal *test, STRANGE; return(NULL); } - *type = 0; - *test = 0; + *type = (xmlXPathTypeVal) 0; + *test = (xmlXPathTestVal) 0; *prefix = NULL; SKIP_BLANKS; @@ -8504,7 +8502,7 @@ xmlXPathCompNodeTest(xmlXPathParserContextPtr ctxt, xmlXPathTestVal *test, */ 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 @@ xmlXPathCompStep(xmlXPathParserContextPtr ctxt) { xmlChar *name = NULL; const xmlChar *prefix = NULL; xmlXPathTestVal test; - xmlXPathAxisVal axis = 0; + xmlXPathAxisVal axis = (xmlXPathAxisVal) 0; xmlXPathTypeVal type; int op1; @@ -8832,9 +8830,9 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, 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 @@ xmlXPathNodeCollectAndTestNth(xmlXPathParserContextPtr ctxt, 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;