1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-27 18:50:07 +03:00

removed some warnings by casting xmlChar to unsigned int and a couple of

* 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.
* xmlschemastypes.c: fixes a segfault on empty hexBinary strings
Daniel
This commit is contained in:
Daniel Veillard 2003-07-15 13:34:05 +00:00
parent 3dc93a4243
commit 34ba387936
9 changed files with 58 additions and 45 deletions

View File

@ -1,3 +1,13 @@
Tue Jul 15 15:30:55 CEST 2003 Daniel Veillard <daniel@veillard.com>
* 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 <daniel@veillard.com>
* xmlschemastypes.c: fixes a segfault on empty hexBinary strings
Thu Jul 10 16:02:47 CEST 2003 Daniel Veillard <daniel@veillard.com>
* nanoftp.c nanohttp.c: cleanup patches from Peter Breitenlohner

View File

@ -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,

View File

@ -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);
}

View File

@ -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);

View File

@ -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,

View File

@ -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)

View File

@ -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;

View File

@ -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')) ||

16
xpath.c
View File

@ -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);