diff --git a/ChangeLog b/ChangeLog index dc4e0491..52f799a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Tue Jul 15 15:30:55 CEST 2003 Daniel Veillard + + * DOCBparser.c HTMLparser.c entities.c parser.c relaxng.c + xmlschemas.c xpath.c: removed some warnings by casting xmlChar + to unsigned int and a couple of others. + +Fri Jul 11 16:44:22 CEST 2003 Daniel Veillard + + * xmlschemastypes.c: fixes a segfault on empty hexBinary strings + Thu Jul 10 16:02:47 CEST 2003 Daniel Veillard * nanoftp.c nanohttp.c: cleanup patches from Peter Breitenlohner diff --git a/DOCBparser.c b/DOCBparser.c index 6e8a13da..83d177c9 100644 --- a/DOCBparser.c +++ b/DOCBparser.c @@ -2917,9 +2917,9 @@ docbParseSystemLiteral(docbParserCtxtPtr ctxt) { if (CUR == '"') { NEXT; q = CUR_PTR; - while ((IS_CHAR(CUR)) && (CUR != '"')) + while ((IS_CHAR((unsigned int) CUR)) && (CUR != '"')) NEXT; - if (!IS_CHAR(CUR)) { + if (!IS_CHAR((unsigned int) CUR)) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Unfinished SystemLiteral\n"); ctxt->wellFormed = 0; @@ -2930,9 +2930,9 @@ docbParseSystemLiteral(docbParserCtxtPtr ctxt) { } else if (CUR == '\'') { NEXT; q = CUR_PTR; - while ((IS_CHAR(CUR)) && (CUR != '\'')) + while ((IS_CHAR((unsigned int) CUR)) && (CUR != '\'')) NEXT; - if (!IS_CHAR(CUR)) { + if (!IS_CHAR((unsigned int) CUR)) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Unfinished SystemLiteral\n"); ctxt->wellFormed = 0; @@ -3724,7 +3724,7 @@ docbParseStartTag(docbParserCtxtPtr ctxt) { * (S Attribute)* S? */ SKIP_BLANKS; - while ((IS_CHAR(CUR)) && + while ((IS_CHAR((unsigned int) CUR)) && (CUR != '>') && ((CUR != '/') || (NXT(1) != '>'))) { long cons = ctxt->nbChars; @@ -3870,7 +3870,7 @@ docbParseEndTag(docbParserCtxtPtr ctxt) { * We should definitely be at the ending "S? '>'" part */ SKIP_BLANKS; - if ((!IS_CHAR(CUR)) || (CUR != '>')) { + if ((!IS_CHAR((unsigned int) CUR)) || (CUR != '>')) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "End tag : expected '>'\n"); ctxt->wellFormed = 0; @@ -4323,12 +4323,12 @@ docbParseElement(docbParserCtxtPtr ctxt) { */ currentNode = xmlStrdup(ctxt->name); depth = ctxt->nameNr; - while (IS_CHAR(CUR)) { + while (IS_CHAR((unsigned int) CUR)) { docbParseContent(ctxt); if (ctxt->nameNr < depth) break; } - if (!IS_CHAR(CUR)) { + if (!IS_CHAR((unsigned int) CUR)) { /************ if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, diff --git a/HTMLparser.c b/HTMLparser.c index d07cd460..e7dcb344 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -2565,9 +2565,9 @@ htmlParseSystemLiteral(htmlParserCtxtPtr ctxt) { if (CUR == '"') { NEXT; q = CUR_PTR; - while ((IS_CHAR(CUR)) && (CUR != '"')) + while ((IS_CHAR((unsigned int) CUR)) && (CUR != '"')) NEXT; - if (!IS_CHAR(CUR)) { + if (!IS_CHAR((unsigned int) CUR)) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Unfinished SystemLiteral\n"); ctxt->wellFormed = 0; @@ -2578,9 +2578,9 @@ htmlParseSystemLiteral(htmlParserCtxtPtr ctxt) { } else if (CUR == '\'') { NEXT; q = CUR_PTR; - while ((IS_CHAR(CUR)) && (CUR != '\'')) + while ((IS_CHAR((unsigned int) CUR)) && (CUR != '\'')) NEXT; - if (!IS_CHAR(CUR)) { + if (!IS_CHAR((unsigned int) CUR)) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Unfinished SystemLiteral\n"); ctxt->wellFormed = 0; @@ -2679,7 +2679,7 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { SHRINK; cur = CUR; - while (IS_CHAR(cur)) { + while (IS_CHAR((unsigned int) cur)) { if ((cur == '<') && (NXT(1) == '!') && (NXT(2) == '-') && (NXT(3) == '-')) { if ((nbchar != 0) && (ctxt->sax != NULL) && (!ctxt->disableSAX)) { @@ -2722,7 +2722,7 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { NEXT; cur = CUR; } - if (!(IS_CHAR(cur))) { + if (!(IS_CHAR((unsigned int) cur))) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Invalid char in CDATA 0x%X\n", cur); @@ -3319,7 +3319,7 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) { "htmlParseStartTag: invalid element name\n"); ctxt->wellFormed = 0; /* Dump the bogus tag like browsers do */ - while ((IS_CHAR(CUR)) && (CUR != '>')) + while ((IS_CHAR((unsigned int) CUR)) && (CUR != '>')) NEXT; return; } @@ -3377,7 +3377,7 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) { * (S Attribute)* S? */ SKIP_BLANKS; - while ((IS_CHAR(CUR)) && + while ((IS_CHAR((unsigned int) CUR)) && (CUR != '>') && ((CUR != '/') || (NXT(1) != '>'))) { long cons = ctxt->nbChars; @@ -3436,8 +3436,9 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) { else { /* Dump the bogus attribute string up to the next blank or * the end of the tag. */ - while ((IS_CHAR(CUR)) && !(IS_BLANK(CUR)) && (CUR != '>') - && ((CUR != '/') || (NXT(1) != '>'))) + while ((IS_CHAR((unsigned int) CUR)) && + !(IS_BLANK(CUR)) && (CUR != '>') && + ((CUR != '/') || (NXT(1) != '>'))) NEXT; } @@ -3514,7 +3515,7 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt) { * We should definitely be at the ending "S? '>'" part */ SKIP_BLANKS; - if ((!IS_CHAR(CUR)) || (CUR != '>')) { + if ((!IS_CHAR((unsigned int) CUR)) || (CUR != '>')) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "End tag : expected '>'\n"); ctxt->wellFormed = 0; @@ -3931,7 +3932,7 @@ htmlParseElement(htmlParserCtxtPtr ctxt) { */ currentNode = xmlStrdup(ctxt->name); depth = ctxt->nameNr; - while (IS_CHAR(CUR)) { + while (IS_CHAR((unsigned int) CUR)) { oldptr = ctxt->input->cur; htmlParseContent(ctxt); if (oldptr==ctxt->input->cur) break; @@ -3948,7 +3949,7 @@ htmlParseElement(htmlParserCtxtPtr ctxt) { node_info.node = ctxt->node; xmlParserAddNodeInfo(ctxt, &node_info); } - if (!IS_CHAR(CUR)) { + if (!IS_CHAR((unsigned int) CUR)) { htmlAutoCloseOnEnd(ctxt); } diff --git a/entities.c b/entities.c index 1886d530..67317f3c 100644 --- a/entities.c +++ b/entities.c @@ -532,7 +532,7 @@ xmlEncodeEntities(xmlDocPtr doc, const xmlChar *input) { ptr = buf; while (*ptr != 0) *out++ = *ptr++; #endif - } else if (IS_CHAR(*cur)) { + } else if (IS_CHAR((unsigned int) *cur)) { char buf[10], *ptr; snprintf(buf, sizeof(buf), "&#%d;", *cur); @@ -731,7 +731,7 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) { cur += l; continue; } - } else if (IS_CHAR(*cur)) { + } else if (IS_CHAR((unsigned int) *cur)) { char buf[10], *ptr; snprintf(buf, sizeof(buf), "&#%d;", *cur); diff --git a/parser.c b/parser.c index a4430b9e..0e634d04 100644 --- a/parser.c +++ b/parser.c @@ -6714,7 +6714,7 @@ xmlParseStartTag(xmlParserCtxtPtr ctxt) { while ((RAW != '>') && ((RAW != '/') || (NXT(1) != '>')) && - (IS_CHAR(RAW))) { + (IS_CHAR((unsigned int) RAW))) { const xmlChar *q = CUR_PTR; unsigned int cons = ctxt->input->consumed; @@ -6870,7 +6870,7 @@ xmlParseEndTagInternal(xmlParserCtxtPtr ctxt, int line) { */ GROW; SKIP_BLANKS; - if ((!IS_CHAR(RAW)) || (RAW != '>')) { + if ((!IS_CHAR((unsigned int) RAW)) || (RAW != '>')) { ctxt->errNo = XML_ERR_GT_REQUIRED; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "End tag : expected '>'\n"); @@ -7274,7 +7274,7 @@ xmlParseElement(xmlParserCtxtPtr ctxt) { * Parse the content of the element: */ xmlParseContent(ctxt); - if (!IS_CHAR(RAW)) { + if (!IS_CHAR((unsigned int) RAW)) { ctxt->errNo = XML_ERR_TAG_NOT_FINISHED; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, diff --git a/relaxng.c b/relaxng.c index c17b3448..1813b601 100644 --- a/relaxng.c +++ b/relaxng.c @@ -2029,13 +2029,13 @@ xmlRelaxNGValidErrorContext(xmlRelaxNGValidCtxtPtr ctxt, xmlNodePtr node, * Try to find contextual informations to report */ if (node->type == XML_ELEMENT_NODE) { - line = (int) node->content; + line = (long) node->content; } else if ((node->prev != NULL) && (node->prev->type == XML_ELEMENT_NODE)) { - line = (int) node->prev->content; + line = (long) node->prev->content; } else if ((node->parent != NULL) && (node->parent->type == XML_ELEMENT_NODE)) { - line = (int) node->parent->content; + line = (long) node->parent->content; } if ((node->doc != NULL) && (node->doc->URL != NULL)) file = node->doc->URL; @@ -4113,7 +4113,7 @@ xmlRelaxNGComputeInterleaves(xmlRelaxNGDefinePtr def, if ((*tmp)->type == XML_RELAXNG_TEXT) { res = xmlHashAddEntry2(partitions->triage, BAD_CAST "#text", NULL, - (void *)(i + 1)); + (void *)(long)(i + 1)); if (res != 0) is_determinist = -1; } else if (((*tmp)->type == XML_RELAXNG_ELEMENT) && @@ -4121,22 +4121,22 @@ xmlRelaxNGComputeInterleaves(xmlRelaxNGDefinePtr def, if (((*tmp)->ns == NULL) || ((*tmp)->ns[0] == 0)) res = xmlHashAddEntry2(partitions->triage, (*tmp)->name, NULL, - (void *)(i + 1)); + (void *)(long)(i + 1)); else res = xmlHashAddEntry2(partitions->triage, (*tmp)->name, (*tmp)->ns, - (void *)(i + 1)); + (void *)(long)(i + 1)); if (res != 0) is_determinist = -1; } else if ((*tmp)->type == XML_RELAXNG_ELEMENT) { if (((*tmp)->ns == NULL) || ((*tmp)->ns[0] == 0)) res = xmlHashAddEntry2(partitions->triage, BAD_CAST "#any", NULL, - (void *)(i + 1)); + (void *)(long)(i + 1)); else res = xmlHashAddEntry2(partitions->triage, BAD_CAST "#any", (*tmp)->ns, - (void *)(i + 1)); + (void *)(long)(i + 1)); if ((*tmp)->nameClass != NULL) is_determinist = 2; if (res != 0) diff --git a/xmlschemas.c b/xmlschemas.c index 7a2dfbe1..46f9f4c9 100644 --- a/xmlschemas.c +++ b/xmlschemas.c @@ -459,13 +459,13 @@ xmlSchemaErrorContext(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, * Try to find contextual informations to report */ if (node->type == XML_ELEMENT_NODE) { - line = (int) node->content; + line = (long) node->content; } else if ((node->prev != NULL) && (node->prev->type == XML_ELEMENT_NODE)) { - line = (int) node->prev->content; + line = (long) node->prev->content; } else if ((node->parent != NULL) && (node->parent->type == XML_ELEMENT_NODE)) { - line = (int) node->parent->content; + line = (long) node->parent->content; } if ((node->doc != NULL) && (node->doc->URL != NULL)) file = node->doc->URL; diff --git a/xmlschemastypes.c b/xmlschemastypes.c index 006dd90d..7bd8a6eb 100644 --- a/xmlschemastypes.c +++ b/xmlschemastypes.c @@ -1924,6 +1924,8 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar *value, unsigned long lo = 0, mi = 0, hi = 0; unsigned long *base; + if (cur == NULL) + goto return1; tmp = cur; while (((*tmp >= '0') && (*tmp <= '9')) || ((*tmp >= 'A') && (*tmp <= 'F')) || diff --git a/xpath.c b/xpath.c index 92d68de7..50ad7eea 100644 --- a/xpath.c +++ b/xpath.c @@ -7560,9 +7560,9 @@ xmlXPathParseLiteral(xmlXPathParserContextPtr ctxt) { if (CUR == '"') { NEXT; q = CUR_PTR; - while ((IS_CHAR(CUR)) && (CUR != '"')) + while ((IS_CHAR((unsigned int) CUR)) && (CUR != '"')) NEXT; - if (!IS_CHAR(CUR)) { + if (!IS_CHAR((unsigned int) CUR)) { XP_ERROR0(XPATH_UNFINISHED_LITERAL_ERROR); } else { ret = xmlStrndup(q, CUR_PTR - q); @@ -7571,9 +7571,9 @@ xmlXPathParseLiteral(xmlXPathParserContextPtr ctxt) { } else if (CUR == '\'') { NEXT; q = CUR_PTR; - while ((IS_CHAR(CUR)) && (CUR != '\'')) + while ((IS_CHAR((unsigned int) CUR)) && (CUR != '\'')) NEXT; - if (!IS_CHAR(CUR)) { + if (!IS_CHAR((unsigned int) CUR)) { XP_ERROR0(XPATH_UNFINISHED_LITERAL_ERROR); } else { ret = xmlStrndup(q, CUR_PTR - q); @@ -7604,9 +7604,9 @@ xmlXPathCompLiteral(xmlXPathParserContextPtr ctxt) { if (CUR == '"') { NEXT; q = CUR_PTR; - while ((IS_CHAR(CUR)) && (CUR != '"')) + while ((IS_CHAR((unsigned int) CUR)) && (CUR != '"')) NEXT; - if (!IS_CHAR(CUR)) { + if (!IS_CHAR((unsigned int) CUR)) { XP_ERROR(XPATH_UNFINISHED_LITERAL_ERROR); } else { ret = xmlStrndup(q, CUR_PTR - q); @@ -7615,9 +7615,9 @@ xmlXPathCompLiteral(xmlXPathParserContextPtr ctxt) { } else if (CUR == '\'') { NEXT; q = CUR_PTR; - while ((IS_CHAR(CUR)) && (CUR != '\'')) + while ((IS_CHAR((unsigned int) CUR)) && (CUR != '\'')) NEXT; - if (!IS_CHAR(CUR)) { + if (!IS_CHAR((unsigned int) CUR)) { XP_ERROR(XPATH_UNFINISHED_LITERAL_ERROR); } else { ret = xmlStrndup(q, CUR_PTR - q);