Changed all (?) occurences where validation macros (IS_xxx) had

* include/libxml/parserInternals.h HTMLparser.c HTMLtree.c
  SAX2.c catalog.c debugXML.c entities.c parser.c relaxng.c
  testSAX.c tree.c valid.c xmlschemas.c xmlschemastypes.c
  xpath.c: Changed all (?) occurences where validation macros
  (IS_xxx) had single-byte arguments to use IS_xxx_CH instead
  (e.g. IS_BLANK changed to IS_BLANK_CH).  This gets rid of
  many warning messages on certain platforms, and also high-
  lights places in the library which may need to be enhanced
  for proper UTF8 handling.
diff --git a/ChangeLog b/ChangeLog
index cac20ff..8397133 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Sun Oct 19 00:15:38 HKT 2003 William Brack <wbrack@mmm.com.hk>
+
+	* include/libxml/parserInternals.h HTMLparser.c HTMLtree.c
+	  SAX2.c catalog.c debugXML.c entities.c parser.c relaxng.c
+	  testSAX.c tree.c valid.c xmlschemas.c xmlschemastypes.c
+	  xpath.c: Changed all (?) occurences where validation macros
+	  (IS_xxx) had single-byte arguments to use IS_xxx_CH instead
+	  (e.g. IS_BLANK changed to IS_BLANK_CH).  This gets rid of
+	  many warning messages on certain platforms, and also high-
+	  lights places in the library which may need to be enhanced
+	  for proper UTF8 handling.
+
 Sat Oct 18 20:34:18 HKT 2003 William Brack <wbrack@mmm.com.hk>
 
 	* genChRanges.py, chvalid.c, include/libxml/chvalid.h,
diff --git a/HTMLparser.c b/HTMLparser.c
index 68c54cb..881821a 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -408,7 +408,7 @@
 htmlSkipBlankChars(xmlParserCtxtPtr ctxt) {
     int res = 0;
 
-    while (IS_BLANK(*(ctxt->input->cur))) {
+    while (IS_BLANK_CH(*(ctxt->input->cur))) {
 	if ((*ctxt->input->cur == 0) &&
 	    (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) {
 		xmlPopInput(ctxt);
@@ -1999,7 +1999,7 @@
     xmlNodePtr lastChild;
 
     for (j = 0;j < len;j++)
-        if (!(IS_BLANK(str[j]))) return(0);
+        if (!(IS_BLANK_CH(str[j]))) return(0);
 
     if (CUR == 0) return(1);
     if (CUR != '<') return(0);
@@ -2131,11 +2131,11 @@
     int i = 0;
     xmlChar loc[HTML_PARSER_BUFFER_SIZE];
 
-    if (!IS_LETTER(CUR) && (CUR != '_') &&
+    if (!IS_LETTER_CH(CUR) && (CUR != '_') &&
         (CUR != ':')) return(NULL);
 
     while ((i < HTML_PARSER_BUFFER_SIZE) &&
-           ((IS_LETTER(CUR)) || (IS_DIGIT(CUR)) ||
+           ((IS_LETTER_CH(CUR)) || (IS_DIGIT_CH(CUR)) ||
 	   (CUR == ':') || (CUR == '-') || (CUR == '_'))) {
 	if ((CUR >= 'A') && (CUR <= 'Z')) loc[i] = CUR + 0x20;
         else loc[i] = CUR;
@@ -2261,7 +2261,7 @@
      */
     while ((CUR != 0) && (CUR != stop)) {
 	if ((stop == 0) && (CUR == '>')) break;
-	if ((stop == 0) && (IS_BLANK(CUR))) break;
+	if ((stop == 0) && (IS_BLANK_CH(CUR))) break;
         if (CUR == '&') {
 	    if (NXT(1) == '#') {
 		unsigned int c;
@@ -2474,9 +2474,9 @@
     if (CUR == '"') {
         NEXT;
 	q = CUR_PTR;
-	while ((IS_CHAR((unsigned int) CUR)) && (CUR != '"'))
+	while ((IS_CHAR_CH(CUR)) && (CUR != '"'))
 	    NEXT;
-	if (!IS_CHAR((unsigned int) CUR)) {
+	if (!IS_CHAR_CH(CUR)) {
 	    htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED,
 			 "Unfinished SystemLiteral\n", NULL, NULL);
 	} else {
@@ -2486,9 +2486,9 @@
     } else if (CUR == '\'') {
         NEXT;
 	q = CUR_PTR;
-	while ((IS_CHAR((unsigned int) CUR)) && (CUR != '\''))
+	while ((IS_CHAR_CH(CUR)) && (CUR != '\''))
 	    NEXT;
-	if (!IS_CHAR((unsigned int) CUR)) {
+	if (!IS_CHAR_CH(CUR)) {
 	    htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED,
 			 "Unfinished SystemLiteral\n", NULL, NULL);
 	} else {
@@ -2524,7 +2524,7 @@
     if (CUR == '"') {
         NEXT;
 	q = CUR_PTR;
-	while (IS_PUBIDCHAR(CUR)) NEXT;
+	while (IS_PUBIDCHAR_CH(CUR)) NEXT;
 	if (CUR != '"') {
 	    htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED,
 	                 "Unfinished PubidLiteral\n", NULL, NULL);
@@ -2535,7 +2535,7 @@
     } else if (CUR == '\'') {
         NEXT;
 	q = CUR_PTR;
-	while ((IS_PUBIDCHAR(CUR)) && (CUR != '\''))
+	while ((IS_PUBIDCHAR_CH(CUR)) && (CUR != '\''))
 	    NEXT;
 	if (CUR != '\'') {
 	    htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED,
@@ -2581,7 +2581,7 @@
 
     SHRINK;
     cur = CUR;
-    while (IS_CHAR((unsigned int) cur)) {
+    while (IS_CHAR_CH(cur)) {
 	if ((cur == '<') && (NXT(1) == '!') && (NXT(2) == '-') &&
 	    (NXT(3) == '-')) {
 	    if ((nbchar != 0) && (ctxt->sax != NULL) && (!ctxt->disableSAX)) {
@@ -2624,7 +2624,7 @@
 	NEXT;
 	cur = CUR;
     }
-    if (!(IS_CHAR((unsigned int) cur))) {
+    if (!(IS_CHAR_CH(cur))) {
 	htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR,
 	                "Invalid char in CDATA 0x%X\n", cur);
 	NEXT;
@@ -2738,7 +2738,7 @@
          (UPP(2) == 'S') && (UPP(3) == 'T') &&
 	 (UPP(4) == 'E') && (UPP(5) == 'M')) {
         SKIP(6);
-	if (!IS_BLANK(CUR)) {
+	if (!IS_BLANK_CH(CUR)) {
 	    htmlParseErr(ctxt, XML_ERR_SPACE_REQUIRED,
 	                 "Space required after 'SYSTEM'\n", NULL, NULL);
 	}
@@ -2752,7 +2752,7 @@
 	       (UPP(2) == 'B') && (UPP(3) == 'L') &&
 	       (UPP(4) == 'I') && (UPP(5) == 'C')) {
         SKIP(6);
-	if (!IS_BLANK(CUR)) {
+	if (!IS_BLANK_CH(CUR)) {
 	    htmlParseErr(ctxt, XML_ERR_SPACE_REQUIRED,
 	                 "Space required after 'PUBLIC'\n", NULL, NULL);
 	}
@@ -3199,7 +3199,7 @@
 	             "htmlParseStartTag: invalid element name\n",
 		     NULL, NULL);
 	/* Dump the bogus tag like browsers do */
-	while ((IS_CHAR((unsigned int) CUR)) && (CUR != '>'))
+	while ((IS_CHAR_CH(CUR)) && (CUR != '>'))
 	    NEXT;
         return;
     }
@@ -3251,7 +3251,7 @@
      * (S Attribute)* S?
      */
     SKIP_BLANKS;
-    while ((IS_CHAR((unsigned int) CUR)) &&
+    while ((IS_CHAR_CH(CUR)) &&
            (CUR != '>') && 
 	   ((CUR != '/') || (NXT(1) != '>'))) {
 	long cons = ctxt->nbChars;
@@ -3314,8 +3314,8 @@
 	        xmlFree(attvalue);
 	    /* Dump the bogus attribute string up to the next blank or
 	     * the end of the tag. */
-	    while ((IS_CHAR((unsigned int) CUR)) &&
-	           !(IS_BLANK(CUR)) && (CUR != '>') &&
+	    while ((IS_CHAR_CH(CUR)) &&
+	           !(IS_BLANK_CH(CUR)) && (CUR != '>') &&
 		   ((CUR != '/') || (NXT(1) != '>')))
 		NEXT;
 	}
@@ -3392,7 +3392,7 @@
      * We should definitely be at the ending "S? '>'" part
      */
     SKIP_BLANKS;
-    if ((!IS_CHAR((unsigned int) CUR)) || (CUR != '>')) {
+    if ((!IS_CHAR_CH(CUR)) || (CUR != '>')) {
         htmlParseErr(ctxt, XML_ERR_GT_REQUIRED,
 	             "End tag : expected '>'\n", NULL, NULL);
     } else
@@ -3743,7 +3743,7 @@
      */
     currentNode = xmlStrdup(ctxt->name);
     depth = ctxt->nameNr;
-    while (IS_CHAR((unsigned int) CUR)) {
+    while (IS_CHAR_CH(CUR)) {
 	oldptr = ctxt->input->cur;
 	htmlParseContent(ctxt);
 	if (oldptr==ctxt->input->cur) break;
@@ -3760,7 +3760,7 @@
        node_info.node = ctxt->node;
        xmlParserAddNodeInfo(ctxt, &node_info);
     }
-    if (!IS_CHAR((unsigned int) CUR)) {
+    if (!IS_CHAR_CH(CUR)) {
 	htmlAutoCloseOnEnd(ctxt);
     }
 
@@ -4335,7 +4335,7 @@
 		 * Very first chars read from the document flow.
 		 */
 		cur = in->cur[0];
-		if (IS_BLANK(cur)) {
+		if (IS_BLANK_CH(cur)) {
 		    SKIP_BLANKS;
 		    if (in->buf == NULL)
 			avail = in->length - (in->cur - in->base);
@@ -4467,7 +4467,7 @@
 		if (avail < 1)
 		    goto done;
 		cur = in->cur[0];
-		if (IS_BLANK(cur)) {
+		if (IS_BLANK_CH(cur)) {
 		    htmlParseCharData(ctxt);
 		    goto done;
 		}
@@ -4623,7 +4623,7 @@
 		    cur = in->cur[0];
 		    if ((cur != '<') && (cur != '&')) {
 			if (ctxt->sax != NULL) {
-			    if (IS_BLANK(cur)) {
+			    if (IS_BLANK_CH(cur)) {
 				if (ctxt->sax->ignorableWhitespace != NULL)
 				    ctxt->sax->ignorableWhitespace(
 					    ctxt->userData, &cur, 1);
diff --git a/HTMLtree.c b/HTMLtree.c
index 11a6125..61287e6 100644
--- a/HTMLtree.c
+++ b/HTMLtree.c
@@ -665,7 +665,7 @@
 		xmlChar *escaped;
 		xmlChar *tmp = value;
 
-		while (IS_BLANK(*tmp)) tmp++;
+		while (IS_BLANK_CH(*tmp)) tmp++;
 
 		escaped = xmlURIEscapeStr(tmp, BAD_CAST"@/:=?;#%&,+");
 		if (escaped != NULL) {
diff --git a/SAX2.c b/SAX2.c
index 1bcd841..3c64ac2 100644
--- a/SAX2.c
+++ b/SAX2.c
@@ -1635,12 +1635,12 @@
 	if ((len <= 3) && ((cur == '"') || (cur == '\'') ||
 	    ((cur == '<') && (str[len + 1] != '!')))) {
 	    intern = xmlDictLookup(ctxt->dict, str, len);
-	} else if (IS_BLANK(*str) && (len < 60) && (cur == '<') &&
+	} else if (IS_BLANK_CH(*str) && (len < 60) && (cur == '<') &&
 	           (str[len + 1] != '!')) {
 	    int i;
 
 	    for (i = 1;i < len;i++) {
-		if (!IS_BLANK(*str)) goto skip;
+		if (!IS_BLANK_CH(*str)) goto skip;
 	    }
 	    intern = xmlDictLookup(ctxt->dict, str, len);
 	}
diff --git a/catalog.c b/catalog.c
index 89cb4cf..7ec04a3 100644
--- a/catalog.c
+++ b/catalog.c
@@ -2029,10 +2029,10 @@
         xmlCatalogErrMemory("allocating public ID");
 	return(NULL);
     }
-    while (xmlIsPubidCharQ(*cur) || (*cur == '?')) {
+    while (IS_PUBIDCHAR_CH(*cur) || (*cur == '?')) {
 	if ((*cur == stop) && (stop != ' '))
 	    break;
-	if ((stop == ' ') && (IS_BLANK(*cur)))
+	if ((stop == ' ') && (IS_BLANK_CH(*cur)))
 	    break;
 	if (len + 1 >= size) {
 	    size *= 2;
@@ -2050,7 +2050,7 @@
     }
     buf[len] = 0;
     if (stop == ' ') {
-	if (!IS_BLANK(*cur)) {
+	if (!IS_BLANK_CH(*cur)) {
 	    xmlFree(buf);
 	    return(NULL);
 	}
@@ -2185,7 +2185,7 @@
 		/* error */
 		break;
 	    }
-	    if (!IS_BLANK(*cur)) {
+	    if (!IS_BLANK_CH(*cur)) {
 		/* error */
 		break;
 	    }
@@ -2240,7 +2240,7 @@
 			/* error */
 			break;
 		    }
-		    if (!IS_BLANK(*cur)) {
+		    if (!IS_BLANK_CH(*cur)) {
 			/* error */
 			break;
 		    }
@@ -2259,7 +2259,7 @@
 			/* error */
 			break;
 		    }
-		    if (!IS_BLANK(*cur)) {
+		    if (!IS_BLANK_CH(*cur)) {
 			/* error */
 			break;
 		    }
diff --git a/debugXML.c b/debugXML.c
index 57a09fe..f891be0 100644
--- a/debugXML.c
+++ b/debugXML.c
@@ -52,7 +52,7 @@
     for (i = 0; i < 40; i++)
         if (str[i] == 0)
             return;
-        else if (IS_BLANK(str[i]))
+        else if (IS_BLANK_CH(str[i]))
             fputc(' ', output);
         else if (str[i] >= 0x80)
             fprintf(output, "#%X", str[i]);
diff --git a/entities.c b/entities.c
index 2684832..cac5823 100644
--- a/entities.c
+++ b/entities.c
@@ -17,6 +17,7 @@
 #include <libxml/hash.h>
 #include <libxml/entities.h>
 #include <libxml/parser.h>
+#include <libxml/parserInternals.h>
 #include <libxml/xmlerror.h>
 #include <libxml/globals.h>
 
@@ -396,15 +397,6 @@
 }
 
 /*
- * [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]
- *                  | [#x10000-#x10FFFF]
- * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
- */
-#define IS_CHAR(c)							\
-    (((c) == 0x09) || ((c) == 0x0a) || ((c) == 0x0d) ||			\
-     (((c) >= 0x20) && ((c) != 0xFFFE) && ((c) != 0xFFFF)))
-
-/*
  * Macro used to grow the current buffer.
  */
 #define growBufferReentrant() {						\
@@ -563,7 +555,7 @@
 		cur += l;
 		continue;
 	    }
-	} else if (IS_CHAR((unsigned int) *cur)) {
+	} else if (IS_BYTE_CHAR(*cur)) {
 	    char buf[11], *ptr;
 
 	    snprintf(buf, sizeof(buf), "&#%d;", *cur);
diff --git a/include/libxml/parserInternals.h b/include/libxml/parserInternals.h
index f158531..8b89429 100644
--- a/include/libxml/parserInternals.h
+++ b/include/libxml/parserInternals.h
@@ -73,6 +73,14 @@
 #define IS_CHAR(c)   xmlIsCharQ(c)
 
 /**
+ * IS_CHAR_CH:
+ * @c: an xmlChar (usually an unsigned char)
+ *
+ * Behaves like IS_CHAR on single-byte value
+ */
+#define IS_CHAR_CH(c)  xmlIsChar_ch(c)
+
+/**
  * IS_BLANK:
  * @c:  an UNICODE value (int)
  *
@@ -83,6 +91,14 @@
 #define IS_BLANK(c)  xmlIsBlankQ(c)
 
 /**
+ * IS_BLANK_CH:
+ * @c:  an xmlChar value (normally unsigned char)
+ *
+ * Behaviour same as IS_BLANK
+ */
+#define IS_BLANK_CH(c)  xmlIsBlank_ch(c)
+
+/**
  * IS_BASECHAR:
  * @c:  an UNICODE value (int)
  *
@@ -103,6 +119,14 @@
 #define IS_DIGIT(c) xmlIsDigitQ(c)
 
 /**
+ * IS_DIGIT_CH:
+ * @c:  an xmlChar value (usually an unsigned char)
+ *
+ * Behaves like IS_DIGIT but with a single byte argument
+ */
+#define IS_DIGIT_CH(c)  xmlIsDigit_ch(c)
+
+/**
  * IS_COMBINING:
  * @c:  an UNICODE value (int)
  *
@@ -113,6 +137,14 @@
 #define IS_COMBINING(c) xmlIsCombiningQ(c)
 
 /**
+ * IS_COMBINING_CH:
+ * @c:  an xmlChar (usually an unsigned char)
+ *
+ * Always false (all combining chars > 0xff)
+ */
+#define IS_COMBINING_CH(c) 0 
+
+/**
  * IS_EXTENDER:
  * @c:  an UNICODE value (int)
  *
@@ -126,6 +158,14 @@
 #define IS_EXTENDER(c) xmlIsExtenderQ(c)
 
 /**
+ * IS_EXTENDER_CH:
+ * @c:  an xmlChar value (usually an unsigned char)
+ *
+ * Behaves like IS_EXTENDER but with a single-byte argument
+ */
+#define IS_EXTENDER_CH(c)  xmlIsExtender_ch(c)
+
+/**
  * IS_IDEOGRAPHIC:
  * @c:  an UNICODE value (int)
  *
@@ -147,7 +187,14 @@
  */
 #define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c))
 
-
+/**
+ * IS_LETTER_CH:
+ * @c:  an xmlChar value (normally unsigned char)
+ *
+ * Macro behaves like IS_LETTER, but only check base chars
+ *
+ */
+#define IS_LETTER_CH(c) xmlIsBaseChar_ch(c)
 /**
  * IS_PUBIDCHAR:
  * @c:  an UNICODE value (int)
@@ -160,6 +207,14 @@
 #define IS_PUBIDCHAR(c)	xmlIsPubidCharQ(c)
 
 /**
+ * IS_PUBIDCHAR_CH:
+ * @c:  an xmlChar value (normally unsigned char)
+ *
+ * Same as IS_PUBIDCHAR but for single-byte value
+ */
+#define IS_PUBIDCHAR_CH(c) xmlIsPubidChar_ch(c)
+
+/**
  * SKIP_EOL:
  * @p:  and UTF8 string pointer
  *
diff --git a/parser.c b/parser.c
index 17b8b1c..ccec436 100644
--- a/parser.c
+++ b/parser.c
@@ -1284,7 +1284,7 @@
 	 * if we are in the document content, go really fast
 	 */
 	cur = ctxt->input->cur;
-	while (IS_BLANK(*cur)) {
+	while (IS_BLANK_CH(*cur)) {
 	    if (*cur == '\n') {
 		ctxt->input->line++; ctxt->input->col = 1;
 	    }
@@ -1687,7 +1687,7 @@
 	     */
 	    if ((ctxt->external == 0) && (ctxt->inputNr == 1))
 		return;
-	    if (IS_BLANK(NXT(1)) || NXT(1) == 0)
+	    if (IS_BLANK_CH(NXT(1)) || NXT(1) == 0)
 		return;
             break;
         case XML_PARSER_IGNORE:
@@ -1774,7 +1774,8 @@
 		    }
 
 		    if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) &&
-			(memcmp(CUR_PTR, "<?xml", 5) == 0) && (IS_BLANK(NXT(5)))) {
+			(memcmp(CUR_PTR, "<?xml", 5) == 0) && 
+				(IS_BLANK_CH(NXT(5)))) {
 			xmlParseTextDecl(ctxt);
 		    }
 		} else {
@@ -2500,7 +2501,7 @@
      * Check that the string is made of blanks
      */
     for (i = 0;i < len;i++)
-        if (!(IS_BLANK(str[i]))) return(0);
+        if (!(IS_BLANK_CH(str[i]))) return(0);
 
     /*
      * Look if the element is mixed content in the DTD if available
@@ -2785,7 +2786,7 @@
     	++in;
 	++cmp;
     }
-    if (*cmp == 0 && (*in == '>' || IS_BLANK (*in))) {
+    if (*cmp == 0 && (*in == '>' || IS_BLANK_CH (*in))) {
     	/* success */
 	ctxt->input->cur = in;
 	return (const xmlChar*) 1;
@@ -3475,7 +3476,7 @@
     }
     ctxt->instate = XML_PARSER_PUBLIC_LITERAL;
     cur = CUR;
-    while ((IS_PUBIDCHAR(cur)) && (cur != stop)) { /* checked */
+    while ((IS_PUBIDCHAR_CH(cur)) && (cur != stop)) { /* checked */
 	if (len + 1 >= size) {
 	    size *= 2;
 	    buf = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
@@ -3567,7 +3568,7 @@
 	    if (nbchar > 0) {
 		if ((ctxt->sax->ignorableWhitespace !=
 		     ctxt->sax->characters) &&
-		    (IS_BLANK(*ctxt->input->cur))) {
+		    (IS_BLANK_CH(*ctxt->input->cur))) {
 		    const xmlChar *tmp = ctxt->input->cur;
 		    ctxt->input->cur = in;
 
@@ -3719,7 +3720,7 @@
     *publicID = NULL;
     if (memcmp(CUR_PTR, "SYSTEM", 6) == 0) {
         SKIP(6);
-	if (!IS_BLANK(CUR)) {
+	if (!IS_BLANK_CH(CUR)) {
 	    xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
 	                   "Space required after 'SYSTEM'\n");
 	}
@@ -3730,7 +3731,7 @@
         }
     } else if (memcmp(CUR_PTR, "PUBLIC", 6) == 0) {
         SKIP(6);
-	if (!IS_BLANK(CUR)) {
+	if (!IS_BLANK_CH(CUR)) {
 	    xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
 		    "Space required after 'PUBLIC'\n");
 	}
@@ -3743,7 +3744,7 @@
 	    /*
 	     * We don't handle [83] so "S SystemLiteral" is required.
 	     */
-	    if (!IS_BLANK(CUR)) {
+	    if (!IS_BLANK_CH(CUR)) {
 		xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
 			"Space required after the Public Identifier\n");
 	    }
@@ -3757,9 +3758,9 @@
 	    GROW;
 
 	    ptr = CUR_PTR;
-	    if (!IS_BLANK(*ptr)) return(NULL);
+	    if (!IS_BLANK_CH(*ptr)) return(NULL);
 	    
-	    while (IS_BLANK(*ptr)) ptr++; /* TODO: dangerous, fix ! */
+	    while (IS_BLANK_CH(*ptr)) ptr++; /* TODO: dangerous, fix ! */
 	    if ((*ptr != '\'') && (*ptr != '"')) return(NULL);
 	}
         SKIP_BLANKS;
@@ -3944,16 +3945,16 @@
     xmlChar marker;
 
     tmp = catalog;
-    while (IS_BLANK(*tmp)) tmp++;
+    while (IS_BLANK_CH(*tmp)) tmp++;
     if (xmlStrncmp(tmp, BAD_CAST"catalog", 7))
 	goto error;
     tmp += 7;
-    while (IS_BLANK(*tmp)) tmp++;
+    while (IS_BLANK_CH(*tmp)) tmp++;
     if (*tmp != '=') {
 	return;
     }
     tmp++;
-    while (IS_BLANK(*tmp)) tmp++;
+    while (IS_BLANK_CH(*tmp)) tmp++;
     marker = *tmp;
     if ((marker != '\'') && (marker != '"'))
 	goto error;
@@ -3964,7 +3965,7 @@
 	goto error;
     URL = xmlStrndup(base, tmp - base);
     tmp++;
-    while (IS_BLANK(*tmp)) tmp++;
+    while (IS_BLANK_CH(*tmp)) tmp++;
     if (*tmp != 0)
 	goto error;
 
@@ -4140,7 +4141,7 @@
 	xmlParserInputPtr input = ctxt->input;
 	SHRINK;
 	SKIP(10);
-	if (!IS_BLANK(CUR)) {
+	if (!IS_BLANK_CH(CUR)) {
 	    xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
 			   "Space required after '<!NOTATION'\n");
 	    return;
@@ -4152,7 +4153,7 @@
 	    xmlFatalErr(ctxt, XML_ERR_NOTATION_NOT_STARTED, NULL);
 	    return;
 	}
-	if (!IS_BLANK(CUR)) {
+	if (!IS_BLANK_CH(CUR)) {
 	    xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
 		     "Space required after the NOTATION name'\n");
 	    return;
@@ -4348,14 +4349,14 @@
 			xmlFreeURI(uri);
 		    }
 		}
-		if ((RAW != '>') && (!IS_BLANK(CUR))) {
+		if ((RAW != '>') && (!IS_BLANK_CH(CUR))) {
 		    xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
 				   "Space required before 'NDATA'\n");
 		}
 		SKIP_BLANKS;
 		if (memcmp(CUR_PTR, "NDATA", 5) == 0) {
 		    SKIP(5);
-		    if (!IS_BLANK(CUR)) {
+		    if (!IS_BLANK_CH(CUR)) {
 			xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
 				       "Space required after 'NDATA'\n");
 		    }
@@ -4482,7 +4483,7 @@
     if (memcmp(CUR_PTR, "#FIXED", 6) == 0) {
 	SKIP(6);
 	val = XML_ATTRIBUTE_FIXED;
-	if (!IS_BLANK(CUR)) {
+	if (!IS_BLANK_CH(CUR)) {
 	    xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
 			   "Space required after '#FIXED'\n");
 	}
@@ -4623,7 +4624,7 @@
 xmlParseEnumeratedType(xmlParserCtxtPtr ctxt, xmlEnumerationPtr *tree) {
     if (memcmp(CUR_PTR, "NOTATION", 8) == 0) {
 	SKIP(8);
-	if (!IS_BLANK(CUR)) {
+	if (!IS_BLANK_CH(CUR)) {
 	    xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
 			   "Space required after 'NOTATION'\n");
 	    return(0);
@@ -4735,7 +4736,7 @@
 	xmlParserInputPtr input = ctxt->input;
 
 	SKIP(9);
-	if (!IS_BLANK(CUR)) {
+	if (!IS_BLANK_CH(CUR)) {
 	    xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
 		                 "Space required after '<!ATTLIST'\n");
 	}
@@ -4763,7 +4764,7 @@
 		break;
 	    }
 	    GROW;
-	    if (!IS_BLANK(CUR)) {
+	    if (!IS_BLANK_CH(CUR)) {
 		xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
 		        "Space required after the attribute name\n");
                 if (defaultValue != NULL)
@@ -4780,7 +4781,7 @@
 	    }
 
 	    GROW;
-	    if (!IS_BLANK(CUR)) {
+	    if (!IS_BLANK_CH(CUR)) {
 		xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
 			       "Space required after the attribute type\n");
                 if (defaultValue != NULL)
@@ -4802,7 +4803,7 @@
 
 	    GROW;
             if (RAW != '>') {
-		if (!IS_BLANK(CUR)) {
+		if (!IS_BLANK_CH(CUR)) {
 		    xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
 			"Space required after the attribute default value\n");
 		    if (defaultValue != NULL)
@@ -5294,7 +5295,7 @@
 	xmlParserInputPtr input = ctxt->input;
 
 	SKIP(9);
-	if (!IS_BLANK(CUR)) {
+	if (!IS_BLANK_CH(CUR)) {
 	    xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
 		           "Space required after 'ELEMENT'\n");
 	}
@@ -5307,7 +5308,7 @@
 	}
 	while ((RAW == 0) && (ctxt->inputNr > 1))
 	    xmlPopInput(ctxt);
-	if (!IS_BLANK(CUR)) {
+	if (!IS_BLANK_CH(CUR)) {
 	    xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
 			   "Space required after the element name\n");
 	}
@@ -5410,7 +5411,7 @@
 
 	    if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {
 		xmlParseConditionalSections(ctxt);
-	    } else if (IS_BLANK(CUR)) {
+	    } else if (IS_BLANK_CH(CUR)) {
 		NEXT;
 	    } else if (RAW == '%') {
 		xmlParsePEReference(ctxt);
@@ -5576,14 +5577,14 @@
     /*
      * We know that '<?xml' is here.
      */
-    if ((memcmp(CUR_PTR, "<?xml", 5) == 0) && (IS_BLANK(NXT(5)))) {
+    if ((memcmp(CUR_PTR, "<?xml", 5) == 0) && (IS_BLANK_CH(NXT(5)))) {
 	SKIP(5);
     } else {
 	xmlFatalErr(ctxt, XML_ERR_XMLDECL_NOT_STARTED, NULL);
 	return;
     }
 
-    if (!IS_BLANK(CUR)) {
+    if (!IS_BLANK_CH(CUR)) {
 	xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
 		       "Space needed after '<?xml'\n");
     }
@@ -5596,7 +5597,7 @@
     if (version == NULL)
 	version = xmlCharStrdup(XML_DEFAULT_VERSION);
     else {
-	if (!IS_BLANK(CUR)) {
+	if (!IS_BLANK_CH(CUR)) {
 	    xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
 		           "Space needed here\n");
 	}
@@ -5665,14 +5666,14 @@
     ctxt->external = 1;
     while (((RAW == '<') && (NXT(1) == '?')) ||
            ((RAW == '<') && (NXT(1) == '!')) ||
-	   (RAW == '%') || IS_BLANK(CUR)) {
+	   (RAW == '%') || IS_BLANK_CH(CUR)) {
 	const xmlChar *check = CUR_PTR;
 	unsigned int cons = ctxt->input->consumed;
 
 	GROW;
         if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {
 	    xmlParseConditionalSections(ctxt);
-	} else if (IS_BLANK(CUR)) {
+	} else if (IS_BLANK_CH(CUR)) {
 	    NEXT;
 	} else if (RAW == '%') {
             xmlParsePEReference(ctxt);
@@ -6002,7 +6003,8 @@
 		    input = xmlNewEntityInputStream(ctxt, ent);
 		    xmlPushInput(ctxt, input);
 		    if ((ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY) &&
-			(memcmp(CUR_PTR, "<?xml", 5) == 0) && (IS_BLANK(NXT(5)))) {
+			(memcmp(CUR_PTR, "<?xml", 5) == 0) &&
+				(IS_BLANK_CH(NXT(5)))) {
 			xmlParseTextDecl(ctxt);
 			if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
 			    /*
@@ -6459,7 +6461,7 @@
                         xmlPushInput(ctxt, input);
                         if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) &&
 			    (memcmp(CUR_PTR, "<?xml", 5) == 0) &&
-			    (IS_BLANK(NXT(5)))) {
+			    (IS_BLANK_CH(NXT(5)))) {
                             xmlParseTextDecl(ctxt);
                             if (ctxt->errNo ==
                                 XML_ERR_UNSUPPORTED_ENCODING) {
@@ -6935,7 +6937,7 @@
 	GROW
 	if ((RAW == '>') || (((RAW == '/') && (NXT(1) == '>'))))
 	    break;
-	if (!IS_BLANK(RAW)) {
+	if (!IS_BLANK_CH(RAW)) {
 	    xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
 			   "attributes construct error\n");
 	}
@@ -7276,7 +7278,7 @@
 	    ++in;
 	    ++cmp;
 	}
-	if (*cmp == 0 && (*in == '>' || IS_BLANK (*in))) {
+	if (*cmp == 0 && (*in == '>' || IS_BLANK_CH (*in))) {
 	    /* success */
 	    ctxt->input->cur = in;
 	    return((const xmlChar*) 1);
@@ -7745,7 +7747,7 @@
 	if (ctxt->input->base != base) goto base_changed;
 	if ((RAW == '>') || (((RAW == '/') && (NXT(1) == '>'))))
 	    break;
-	if (!IS_BLANK(RAW)) {
+	if (!IS_BLANK_CH(RAW)) {
 	    xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
 			   "attributes construct error\n");
 	}
@@ -8658,7 +8660,7 @@
      */
     SKIP(5);
 
-    if (!IS_BLANK(RAW)) {
+    if (!IS_BLANK_CH(RAW)) {
 	xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
 	               "Blank needed after '<?xml'\n");
     }
@@ -8687,7 +8689,7 @@
     /*
      * We may have the encoding declaration
      */
-    if (!IS_BLANK(RAW)) {
+    if (!IS_BLANK_CH(RAW)) {
         if ((RAW == '?') && (NXT(1) == '>')) {
 	    SKIP(2);
 	    return;
@@ -8705,7 +8707,7 @@
     /*
      * We may have the standalone status.
      */
-    if ((ctxt->input->encoding != NULL) && (!IS_BLANK(RAW))) {
+    if ((ctxt->input->encoding != NULL) && (!IS_BLANK_CH(RAW))) {
         if ((RAW == '?') && (NXT(1) == '>')) {
 	    SKIP(2);
 	    return;
@@ -8742,10 +8744,10 @@
 xmlParseMisc(xmlParserCtxtPtr ctxt) {
     while (((RAW == '<') && (NXT(1) == '?')) ||
            (memcmp(CUR_PTR, "<!--", 4) == 0) ||
-           IS_BLANK(CUR)) {
+           IS_BLANK_CH(CUR)) {
         if ((RAW == '<') && (NXT(1) == '?')) {
 	    xmlParsePI(ctxt);
-	} else if (IS_BLANK(CUR)) {
+	} else if (IS_BLANK_CH(CUR)) {
 	    NEXT;
 	} else
 	    xmlParseComment(ctxt);
@@ -8813,7 +8815,7 @@
      * Check for the XMLDecl in the Prolog.
      */
     GROW;
-    if ((memcmp(CUR_PTR, "<?xml", 5) == 0) && (IS_BLANK(NXT(5)))) {
+    if ((memcmp(CUR_PTR, "<?xml", 5) == 0) && (IS_BLANK_CH(NXT(5)))) {
 
 	/*
 	 * Note that we will switch encoding on the fly.
@@ -8970,7 +8972,7 @@
      * Check for the XMLDecl in the Prolog.
      */
     GROW;
-    if ((memcmp(CUR_PTR, "<?xml", 5) == 0) && (IS_BLANK(NXT(5)))) {
+    if ((memcmp(CUR_PTR, "<?xml", 5) == 0) && (IS_BLANK_CH(NXT(5)))) {
 
 	/*
 	 * Note that we will switch encoding on the fly.
@@ -9328,7 +9330,7 @@
 		    if ((ctxt->input->cur[2] == 'x') &&
 			(ctxt->input->cur[3] == 'm') &&
 			(ctxt->input->cur[4] == 'l') &&
-			(IS_BLANK(ctxt->input->cur[5]))) {
+			(IS_BLANK_CH(ctxt->input->cur[5]))) {
 			ret += 5;
 #ifdef DEBUG_PUSH
 			xmlGenericError(xmlGenericErrorContext,
@@ -10591,7 +10593,7 @@
     /*
      * Parse a possible text declaration first
      */
-    if ((memcmp(CUR_PTR, "<?xml", 5) == 0) && (IS_BLANK(NXT(5)))) {
+    if ((memcmp(CUR_PTR, "<?xml", 5) == 0) && (IS_BLANK_CH(NXT(5)))) {
 	xmlParseTextDecl(ctxt);
     }
 
@@ -10789,7 +10791,7 @@
     /*
      * Parse a possible text declaration first
      */
-    if ((memcmp(CUR_PTR, "<?xml", 5) == 0) && (IS_BLANK(NXT(5)))) {
+    if ((memcmp(CUR_PTR, "<?xml", 5) == 0) && (IS_BLANK_CH(NXT(5)))) {
 	xmlParseTextDecl(ctxt);
     }
 
diff --git a/relaxng.c b/relaxng.c
index f3ce7f5..056aaf7 100644
--- a/relaxng.c
+++ b/relaxng.c
@@ -3363,7 +3363,7 @@
     if (str == NULL)
         return (1);
     while (*str != 0) {
-        if (!(IS_BLANK(*str)))
+        if (!(IS_BLANK_CH(*str)))
             return (0);
         str++;
     }
@@ -6669,16 +6669,16 @@
     if (value == NULL)
         return;
 
-    while (IS_BLANK(*cur))
+    while (IS_BLANK_CH(*cur))
         cur++;
     if (cur == start) {
         do {
-            while ((*cur != 0) && (!IS_BLANK(*cur)))
+            while ((*cur != 0) && (!IS_BLANK_CH(*cur)))
                 cur++;
             if (*cur == 0)
                 return;
             start = cur;
-            while (IS_BLANK(*cur))
+            while (IS_BLANK_CH(*cur))
                 cur++;
             if (*cur == 0) {
                 *start = 0;
@@ -6687,14 +6687,14 @@
         } while (1);
     } else {
         do {
-            while ((*cur != 0) && (!IS_BLANK(*cur)))
+            while ((*cur != 0) && (!IS_BLANK_CH(*cur)))
                 *start++ = *cur++;
             if (*cur == 0) {
                 *start = 0;
                 return;
             }
             /* don't try to normalize the inner spaces */
-            while (IS_BLANK(*cur))
+            while (IS_BLANK_CH(*cur))
                 cur++;
             if (*cur == 0) {
                 *start = 0;
@@ -8100,7 +8100,7 @@
 #endif
 
     while (*data != 0) {
-        if (!IS_BLANK(*data))
+        if (!IS_BLANK_CH(*data))
             break;
         data++;
     }
@@ -8279,11 +8279,11 @@
         return (NULL);
     }
     p = ret;
-    while (IS_BLANK(*str))
+    while (IS_BLANK_CH(*str))
         str++;
     while (*str != 0) {
-        if (IS_BLANK(*str)) {
-            while (IS_BLANK(*str))
+        if (IS_BLANK_CH(*str)) {
+            while (IS_BLANK_CH(*str))
                 str++;
             if (*str == 0)
                 break;
@@ -8445,7 +8445,7 @@
                 if ((value != NULL) && (value[0] != 0)) {
                     int idx = 0;
 
-                    while (IS_BLANK(value[idx]))
+                    while (IS_BLANK_CH(value[idx]))
                         idx++;
                     if (value[idx] != 0)
                         ret = -1;
@@ -8556,13 +8556,13 @@
                 }
                 cur = val;
                 while (*cur != 0) {
-                    if (IS_BLANK(*cur)) {
+                    if (IS_BLANK_CH(*cur)) {
                         *cur = 0;
                         cur++;
 #ifdef DEBUG_LIST
                         nb_values++;
 #endif
-                        while (IS_BLANK(*cur))
+                        while (IS_BLANK_CH(*cur))
                             *cur++ = 0;
                     } else
                         cur++;
diff --git a/testSAX.c b/testSAX.c
index 8634b51..71686ea 100644
--- a/testSAX.c
+++ b/testSAX.c
@@ -755,7 +755,7 @@
 	    else
 		fprintf(stdout, ", %s='", attributes[i]);
 	    fprintf(stdout, "%.4s...', %d", attributes[i + 3],
-		    attributes[i + 4] - attributes[i + 3]);
+		    (int)(attributes[i + 4] - attributes[i + 3]));
 	}
     }
     fprintf(stdout, ")\n");
diff --git a/tree.c b/tree.c
index 0eccfbd..b612ffd 100644
--- a/tree.c
+++ b/tree.c
@@ -349,7 +349,7 @@
      * First quick algorithm for ASCII range
      */
     if (space)
-	while (IS_BLANK(*cur)) cur++;
+	while (IS_BLANK_CH(*cur)) cur++;
     if (((*cur >= 'a') && (*cur <= 'z')) || ((*cur >= 'A') && (*cur <= 'Z')) ||
 	(*cur == '_'))
 	cur++;
@@ -361,7 +361,7 @@
 	   (*cur == '_') || (*cur == '-') || (*cur == '.'))
 	cur++;
     if (space)
-	while (IS_BLANK(*cur)) cur++;
+	while (IS_BLANK_CH(*cur)) cur++;
     if (*cur == 0)
 	return(0);
 
@@ -418,7 +418,7 @@
      * First quick algorithm for ASCII range
      */
     if (space)
-	while (IS_BLANK(*cur)) cur++;
+	while (IS_BLANK_CH(*cur)) cur++;
     if (((*cur >= 'a') && (*cur <= 'z')) || ((*cur >= 'A') && (*cur <= 'Z')) ||
 	(*cur == '_'))
 	cur++;
@@ -444,7 +444,7 @@
 	    cur++;
     }
     if (space)
-	while (IS_BLANK(*cur)) cur++;
+	while (IS_BLANK_CH(*cur)) cur++;
     if (*cur == 0)
 	return(0);
 
@@ -514,7 +514,7 @@
      * First quick algorithm for ASCII range
      */
     if (space)
-	while (IS_BLANK(*cur)) cur++;
+	while (IS_BLANK_CH(*cur)) cur++;
     if (((*cur >= 'a') && (*cur <= 'z')) || ((*cur >= 'A') && (*cur <= 'Z')) ||
 	(*cur == '_') || (*cur == ':'))
 	cur++;
@@ -526,7 +526,7 @@
 	   (*cur == '_') || (*cur == '-') || (*cur == '.') || (*cur == ':'))
 	cur++;
     if (space)
-	while (IS_BLANK(*cur)) cur++;
+	while (IS_BLANK_CH(*cur)) cur++;
     if (*cur == 0)
 	return(0);
 
@@ -581,7 +581,7 @@
      * First quick algorithm for ASCII range
      */
     if (space)
-	while (IS_BLANK(*cur)) cur++;
+	while (IS_BLANK_CH(*cur)) cur++;
     if (((*cur >= 'a') && (*cur <= 'z')) ||
         ((*cur >= 'A') && (*cur <= 'Z')) ||
         ((*cur >= '0') && (*cur <= '9')) ||
@@ -595,7 +595,7 @@
 	   (*cur == '_') || (*cur == '-') || (*cur == '.') || (*cur == ':'))
 	cur++;
     if (space)
-	while (IS_BLANK(*cur)) cur++;
+	while (IS_BLANK_CH(*cur)) cur++;
     if (*cur == 0)
 	return(0);
 
@@ -6232,7 +6232,7 @@
     if (node->content == NULL) return(1);
     cur = node->content;
     while (*cur != 0) {
-	if (!IS_BLANK(*cur)) return(0);
+	if (!IS_BLANK_CH(*cur)) return(0);
 	cur++;
     }
 
diff --git a/valid.c b/valid.c
index 5630c6c..bfa34b2 100644
--- a/valid.c
+++ b/valid.c
@@ -3512,7 +3512,7 @@
 	    cur = dup;
 	    while (*cur != 0) {
 		nam = cur;
-		while ((*cur != 0) && (!IS_BLANK(*cur))) cur++;
+		while ((*cur != 0) && (!IS_BLANK_CH(*cur))) cur++;
 		save = *cur;
 		*cur = 0;
 		ent = xmlGetDocEntity(doc, nam);
@@ -3532,7 +3532,7 @@
 		if (save == 0)
 		    break;
 		*cur = save;
-		while (IS_BLANK(*cur)) cur++;
+		while (IS_BLANK_CH(*cur)) cur++;
 	    }
 	    xmlFree(dup);
 	    break;
@@ -5463,7 +5463,7 @@
 			int i;
 
 			for (i = 0;i < len;i++) {
-			    if (!IS_BLANK(data[i])) {
+			    if (!IS_BLANK_CH(data[i])) {
 				xmlErrValidNode(ctxt, state->node,
 						XML_DTD_CONTENT_MODEL,
 	   "Element %s content does not follow the DTD, Text not allowed\n",
@@ -5764,7 +5764,7 @@
 		    if (child->type == XML_TEXT_NODE) {
 			const xmlChar *content = child->content;
 
-			while (IS_BLANK(*content))
+			while (IS_BLANK_CH(*content))
 			    content++;
 			if (*content == 0) {
 			    xmlErrValidNode(ctxt, elem,
@@ -6070,7 +6070,7 @@
 	cur = dup;
 	while (*cur != 0) {
 	    str = cur;
-	    while ((*cur != 0) && (!IS_BLANK(*cur))) cur++;
+	    while ((*cur != 0) && (!IS_BLANK_CH(*cur))) cur++;
 	    save = *cur;
 	    *cur = 0;
 	    id = xmlGetID(ctxt->doc, str);
@@ -6083,7 +6083,7 @@
 	    if (save == 0)
 		break;
 	    *cur = save;
-	    while (IS_BLANK(*cur)) cur++;
+	    while (IS_BLANK_CH(*cur)) cur++;
 	}
 	xmlFree(dup);
     } else if (attr->atype == XML_ATTRIBUTE_IDREF) {
@@ -6106,7 +6106,7 @@
 	cur = dup;
 	while (*cur != 0) {
 	    str = cur;
-	    while ((*cur != 0) && (!IS_BLANK(*cur))) cur++;
+	    while ((*cur != 0) && (!IS_BLANK_CH(*cur))) cur++;
 	    save = *cur;
 	    *cur = 0;
 	    id = xmlGetID(ctxt->doc, str);
@@ -6119,7 +6119,7 @@
 	    if (save == 0)
 		break;
 	    *cur = save;
-	    while (IS_BLANK(*cur)) cur++;
+	    while (IS_BLANK_CH(*cur)) cur++;
 	}
 	xmlFree(dup);
     }
diff --git a/xmlschemas.c b/xmlschemas.c
index 76c41af..7c6c5fb 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -889,7 +889,7 @@
     if (str == NULL)
         return (1);
     while (*str != 0) {
-        if (!(IS_BLANK(*str)))
+        if (!(IS_BLANK_CH(*str)))
             return (0);
         str++;
     }
@@ -1269,13 +1269,13 @@
     }
 
     cur = val;
-    while (IS_BLANK(*cur))
+    while (IS_BLANK_CH(*cur))
         cur++;
     while ((*cur >= '0') && (*cur <= '9')) {
         ret = ret * 10 + (*cur - '0');
         cur++;
     }
-    while (IS_BLANK(*cur))
+    while (IS_BLANK_CH(*cur))
         cur++;
     if (*cur != 0) {
         xmlSchemaPErr(ctxt, node, XML_SCHEMAP_INVALID_MAXOCCURS,
@@ -1307,13 +1307,13 @@
         return (1);
 
     cur = val;
-    while (IS_BLANK(*cur))
+    while (IS_BLANK_CH(*cur))
         cur++;
     while ((*cur >= '0') && (*cur <= '9')) {
         ret = ret * 10 + (*cur - '0');
         cur++;
     }
-    while (IS_BLANK(*cur))
+    while (IS_BLANK_CH(*cur))
         cur++;
     if (*cur != 0) {
         xmlSchemaPErr(ctxt, node, XML_SCHEMAP_INVALID_MINOCCURS,
@@ -4549,10 +4549,10 @@
         }
         cur = value;
         do {
-            while (IS_BLANK(*cur))
+            while (IS_BLANK_CH(*cur))
                 cur++;
             end = cur;
-            while ((*end != 0) && (!(IS_BLANK(*end))))
+            while ((*end != 0) && (!(IS_BLANK_CH(*end))))
                 end++;
             if (end == cur)
                 break;
diff --git a/xmlschemastypes.c b/xmlschemastypes.c
index 4830924..dd859b7 100644
--- a/xmlschemastypes.c
+++ b/xmlschemastypes.c
@@ -1250,12 +1250,12 @@
     const xmlChar *start = value, *end, *f;
 
     if (value == NULL) return(NULL);
-    while ((*start != 0) && (IS_BLANK(*start))) start++;
+    while ((*start != 0) && (IS_BLANK_CH(*start))) start++;
     end = start;
     while (*end != 0) end++;
     f = end;
     end--;
-    while ((end > start) && (IS_BLANK(*end))) end--;
+    while ((end > start) && (IS_BLANK_CH(*end))) end--;
     end++;
     if ((start == value) && (f == end)) return(NULL);
     return(xmlStrndup(start, end - start));
@@ -1276,10 +1276,10 @@
     int col = 0;
 
     if (value == NULL) return(NULL);
-    while ((*start != 0) && (IS_BLANK(*start))) start++;
+    while ((*start != 0) && (IS_BLANK_CH(*start))) start++;
     end = start;
     while (*end != 0) {
-	if ((*end == ' ') && (IS_BLANK(end[1]))) {
+	if ((*end == ' ') && (IS_BLANK_CH(end[1]))) {
 	    col = end - start;
 	    break;
 	} else if ((*end == 0xa) || (*end == 0x9) || (*end == 0xd)) {
@@ -1291,7 +1291,7 @@
     if (col == 0) {
 	f = end;
 	end--;
-	while ((end > start) && (IS_BLANK(*end))) end--;
+	while ((end > start) && (IS_BLANK_CH(*end))) end--;
 	end++;
 	if ((start == value) && (f == end)) return(NULL);
 	return(xmlStrndup(start, end - start));
@@ -1301,9 +1301,9 @@
     g = (xmlChar *) (start + col);
     end = g;
     while (*end != 0) {
-	if (IS_BLANK(*end)) {
+	if (IS_BLANK_CH(*end)) {
 	    end++;
-	    while (IS_BLANK(*end)) end++;
+	    while (IS_BLANK_CH(*end)) end++;
 	    if (*end != 0)
 		*g++ = ' ';
 	} else
@@ -1344,16 +1344,16 @@
     /*
      * Split the list
      */
-    while (IS_BLANK(*cur)) *cur++ = 0;
+    while (IS_BLANK_CH(*cur)) *cur++ = 0;
     while (*cur != 0) {
-	if (IS_BLANK(*cur)) {
+	if (IS_BLANK_CH(*cur)) {
 	    *cur = 0;
 	    cur++;
-	    while (IS_BLANK(*cur)) *cur++ = 0;
+	    while (IS_BLANK_CH(*cur)) *cur++ = 0;
 	} else {
 	    nb_values++;
 	    cur++;
-	    while ((*cur != 0) && (!IS_BLANK(*cur))) cur++;
+	    while ((*cur != 0) && (!IS_BLANK_CH(*cur))) cur++;
 	}
     }
     if (nb_values == 0) {
@@ -1686,7 +1686,7 @@
         case XML_SCHEMAS_TOKEN:{
                 const xmlChar *cur = value;
 
-                if (IS_BLANK(*cur))
+                if (IS_BLANK_CH(*cur))
                     goto return1;
 
                 while (*cur != 0) {
@@ -3093,16 +3093,16 @@
     utf1 = x->value.str;
     utf2 = y->value.str;
     
-    while (IS_BLANK(*utf1)) utf1++;
-    while (IS_BLANK(*utf2)) utf2++;
+    while (IS_BLANK_CH(*utf1)) utf1++;
+    while (IS_BLANK_CH(*utf2)) utf2++;
     while ((*utf1 != 0) && (*utf2 != 0)) {
-	if (IS_BLANK(*utf1)) {
-	    if (!IS_BLANK(*utf2)) {
+	if (IS_BLANK_CH(*utf1)) {
+	    if (!IS_BLANK_CH(*utf2)) {
 		tmp = *utf1 - *utf2;
 		return(tmp);
 	    }
-	    while (IS_BLANK(*utf1)) utf1++;
-	    while (IS_BLANK(*utf2)) utf2++;
+	    while (IS_BLANK_CH(*utf1)) utf1++;
+	    while (IS_BLANK_CH(*utf2)) utf2++;
 	} else {
 	    tmp = *utf1++ - *utf2++;
 	    if (tmp < 0)
@@ -3112,12 +3112,12 @@
 	}
     }
     if (*utf1 != 0) {
-	while (IS_BLANK(*utf1)) utf1++;
+	while (IS_BLANK_CH(*utf1)) utf1++;
 	if (*utf1 != 0)
 	    return(1);
     }
     if (*utf2 != 0) {
-	while (IS_BLANK(*utf2)) utf2++;
+	while (IS_BLANK_CH(*utf2)) utf2++;
 	if (*utf2 != 0)
 	    return(-1);
     }
@@ -3374,7 +3374,7 @@
     if (value == NULL)
 	return(-1);
     utf = value;
-    while (IS_BLANK(*utf)) utf++;
+    while (IS_BLANK_CH(*utf)) utf++;
     while (*utf != 0) {
 	if (utf[0] & 0x80) {
 	    if ((utf[1] & 0xc0) != 0x80)
@@ -3392,8 +3392,8 @@
 	    } else {
 		utf += 2;
 	    }
-	} else if (IS_BLANK(*utf)) {
-	    while (IS_BLANK(*utf)) utf++;
+	} else if (IS_BLANK_CH(*utf)) {
+	    while (IS_BLANK_CH(*utf)) utf++;
 	    if (*utf == 0)
 		break;
 	} else {
diff --git a/xpath.c b/xpath.c
index 90312db..d0c0a3c 100644
--- a/xpath.c
+++ b/xpath.c
@@ -1263,7 +1263,7 @@
 #define NEXTL(l)  ctxt->cur += l
 
 #define SKIP_BLANKS 							\
-    while (IS_BLANK(*(ctxt->cur))) NEXT
+    while (IS_BLANK_CH(*(ctxt->cur))) NEXT
 
 #define CURRENT (*ctxt->cur)
 #define NEXT ((*ctxt->cur) ?  ctxt->cur++: ctxt->cur)
@@ -5994,9 +5994,9 @@
 
     ret = xmlXPathNodeSetCreate(NULL);
 
-    while (IS_BLANK(*cur)) cur++;
+    while (IS_BLANK_CH(*cur)) cur++;
     while (*cur != 0) {
-	while ((!IS_BLANK(*cur)) && (*cur != 0))
+	while ((!IS_BLANK_CH(*cur)) && (*cur != 0))
 	    cur++;
 
         ID = xmlStrndup(ids, cur - ids);
@@ -6017,7 +6017,7 @@
 	    xmlFree(ID);
 	}
 
-	while (IS_BLANK(*cur)) cur++;
+	while (IS_BLANK_CH(*cur)) cur++;
 	ids = cur;
     }
     return(ret);
@@ -6715,13 +6715,13 @@
   if (target && source) {
     
     /* Skip leading whitespaces */
-    while (IS_BLANK(*source))
+    while (IS_BLANK_CH(*source))
       source++;
   
     /* Collapse intermediate whitespaces, and skip trailing whitespaces */
     blank = 0;
     while (*source) {
-      if (IS_BLANK(*source)) {
+      if (IS_BLANK_CH(*source)) {
 	blank = 0x20;
       } else {
 	if (blank) {
@@ -7440,7 +7440,7 @@
     double temp;
 #endif
     if (cur == NULL) return(0);
-    while (IS_BLANK(*cur)) cur++;
+    while (IS_BLANK_CH(*cur)) cur++;
     if ((*cur != '.') && ((*cur < '0') || (*cur > '9')) && (*cur != '-')) {
         return(xmlXPathNAN);
     }
@@ -7502,7 +7502,7 @@
 	cur++;
       }
     }
-    while (IS_BLANK(*cur)) cur++;
+    while (IS_BLANK_CH(*cur)) cur++;
     if (*cur != 0) return(xmlXPathNAN);
     if (isneg) ret = -ret;
     if (is_exponent_negative) exponent = -exponent;
@@ -7608,9 +7608,9 @@
     if (CUR == '"') {
         NEXT;
 	q = CUR_PTR;
-	while ((IS_CHAR((unsigned int) CUR)) && (CUR != '"'))
+	while ((IS_CHAR_CH(CUR)) && (CUR != '"'))
 	    NEXT;
-	if (!IS_CHAR((unsigned int) CUR)) {
+	if (!IS_CHAR_CH(CUR)) {
 	    XP_ERROR0(XPATH_UNFINISHED_LITERAL_ERROR);
 	} else {
 	    ret = xmlStrndup(q, CUR_PTR - q);
@@ -7619,9 +7619,9 @@
     } else if (CUR == '\'') {
         NEXT;
 	q = CUR_PTR;
-	while ((IS_CHAR((unsigned int) CUR)) && (CUR != '\''))
+	while ((IS_CHAR_CH(CUR)) && (CUR != '\''))
 	    NEXT;
-	if (!IS_CHAR((unsigned int) CUR)) {
+	if (!IS_CHAR_CH(CUR)) {
 	    XP_ERROR0(XPATH_UNFINISHED_LITERAL_ERROR);
 	} else {
 	    ret = xmlStrndup(q, CUR_PTR - q);
@@ -7652,9 +7652,9 @@
     if (CUR == '"') {
         NEXT;
 	q = CUR_PTR;
-	while ((IS_CHAR((unsigned int) CUR)) && (CUR != '"'))
+	while ((IS_CHAR_CH(CUR)) && (CUR != '"'))
 	    NEXT;
-	if (!IS_CHAR((unsigned int) CUR)) {
+	if (!IS_CHAR_CH(CUR)) {
 	    XP_ERROR(XPATH_UNFINISHED_LITERAL_ERROR);
 	} else {
 	    ret = xmlStrndup(q, CUR_PTR - q);
@@ -7663,9 +7663,9 @@
     } else if (CUR == '\'') {
         NEXT;
 	q = CUR_PTR;
-	while ((IS_CHAR((unsigned int) CUR)) && (CUR != '\''))
+	while ((IS_CHAR_CH(CUR)) && (CUR != '\''))
 	    NEXT;
-	if (!IS_CHAR((unsigned int) CUR)) {
+	if (!IS_CHAR_CH(CUR)) {
 	    XP_ERROR(XPATH_UNFINISHED_LITERAL_ERROR);
 	} else {
 	    ret = xmlStrndup(q, CUR_PTR - q);
@@ -7831,7 +7831,7 @@
 	}
 	NEXT;
 	SKIP_BLANKS;
-    } else if (IS_DIGIT(CUR) || (CUR == '.' && IS_DIGIT(NXT(1)))) {
+    } else if (IS_DIGIT_CH(CUR) || (CUR == '.' && IS_DIGIT_CH(NXT(1)))) {
 	xmlXPathCompNumber(ctxt);
     } else if ((CUR == '\'') || (CUR == '"')) {
 	xmlXPathCompLiteral(ctxt);
@@ -7893,26 +7893,26 @@
     int len = 0;
 
     SKIP_BLANKS;
-    if (!IS_LETTER(CUR) && (CUR != '_') &&
+    if (!IS_LETTER_CH(CUR) && (CUR != '_') &&
         (CUR != ':')) {
 	return(NULL);
     }
 
-    while ((IS_LETTER(NXT(len))) || (IS_DIGIT(NXT(len))) ||
+    while ((IS_LETTER_CH(NXT(len))) || (IS_DIGIT_CH(NXT(len))) ||
            (NXT(len) == '.') || (NXT(len) == '-') ||
 	   (NXT(len) == '_') || (NXT(len) == ':') || 
-	   (IS_COMBINING(NXT(len))) ||
-	   (IS_EXTENDER(NXT(len)))) {
+	   (IS_COMBINING_CH(NXT(len))) ||
+	   (IS_EXTENDER_CH(NXT(len)))) {
 	buf[len] = NXT(len);
 	len++;
 	if (len >= XML_MAX_NAMELEN) {
 	    xmlGenericError(xmlGenericErrorContext, 
 	       "xmlScanName: reached XML_MAX_NAMELEN limit\n");
-	    while ((IS_LETTER(NXT(len))) || (IS_DIGIT(NXT(len))) ||
+	    while ((IS_LETTER_CH(NXT(len))) || (IS_DIGIT_CH(NXT(len))) ||
 		   (NXT(len) == '.') || (NXT(len) == '-') ||
 		   (NXT(len) == '_') || (NXT(len) == ':') || 
-		   (IS_COMBINING(NXT(len))) ||
-		   (IS_EXTENDER(NXT(len))))
+		   (IS_COMBINING_CH(NXT(len))) ||
+		   (IS_EXTENDER_CH(NXT(len))))
 		 len++;
 	    break;
 	}
@@ -7944,8 +7944,8 @@
     xmlChar *name = NULL; /* we may have to preparse a name to find out */
 
     SKIP_BLANKS;
-    if ((CUR == '$') || (CUR == '(') || (IS_DIGIT(CUR)) ||
-        (CUR == '\'') || (CUR == '"') || (CUR == '.' && IS_DIGIT(NXT(1)))) {
+    if ((CUR == '$') || (CUR == '(') || (IS_DIGIT_CH(CUR)) ||
+        (CUR == '\'') || (CUR == '"') || (CUR == '.' && IS_DIGIT_CH(NXT(1)))) {
 	lc = 0;
     } else if (CUR == '*') {
 	/* relative or absolute location path */
@@ -7993,7 +7993,7 @@
 #endif
 		    lc = 1;
 		    break;
-		} else if (IS_BLANK(NXT(len))) {
+		} else if (IS_BLANK_CH(NXT(len))) {
 		    /* ignore blanks */
 		    ;
 		} else if (NXT(len) == ':') {
@@ -8441,7 +8441,7 @@
 	XP_ERROR0(XPATH_EXPR_ERROR);
     }
 
-    blanks = IS_BLANK(CUR);
+    blanks = IS_BLANK_CH(CUR);
     SKIP_BLANKS;
     if (CUR == '(') {
 	NEXT;
@@ -8839,7 +8839,7 @@
 		NEXT;
 		SKIP_BLANKS;
 		if ((CUR != 0 ) &&
-		    ((IS_LETTER(CUR)) || (CUR == '_') || (CUR == '.') ||
+		    ((IS_LETTER_CH(CUR)) || (CUR == '_') || (CUR == '.') ||
 		     (CUR == '@') || (CUR == '*')))
 		    xmlXPathCompRelativeLocationPath(ctxt);
 	    }