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
diff --git a/ChangeLog b/ChangeLog
index dc4e049..52f799a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/DOCBparser.c b/DOCBparser.c
index 6e8a13d..83d177c 100644
--- a/DOCBparser.c
+++ b/DOCBparser.c
@@ -2917,9 +2917,9 @@
     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 @@
     } 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 @@
      * (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 @@
      * 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 @@
      */
     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 d07cd46..e7dcb34 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -2565,9 +2565,9 @@
     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 @@
     } 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 @@
 
     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 @@
 	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: 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 @@
      * (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 @@
 	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 @@
      * 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 @@
      */
     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 @@
        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 1886d53..67317f3 100644
--- a/entities.c
+++ b/entities.c
@@ -532,7 +532,7 @@
             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 @@
 		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 a4430b9..0e634d0 100644
--- a/parser.c
+++ b/parser.c
@@ -6714,7 +6714,7 @@
 
     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 @@
      */
     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 @@
      * 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 c17b344..1813b60 100644
--- a/relaxng.c
+++ b/relaxng.c
@@ -2029,13 +2029,13 @@
 	     * 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 @@
 		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 @@
 		    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 7a2dfbe..46f9f4c 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -459,13 +459,13 @@
 	     * 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 006dd90..7bd8a6e 100644
--- a/xmlschemastypes.c
+++ b/xmlschemastypes.c
@@ -1924,6 +1924,8 @@
             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 92d68de..50ad7ee 100644
--- a/xpath.c
+++ b/xpath.c
@@ -7560,9 +7560,9 @@
     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 @@
     } 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 @@
     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 @@
     } 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);