From 76e95df05556c9610b564b14cf578c8f9e34c9c1 Mon Sep 17 00:00:00 2001 From: "William M. Brack" Date: Sat, 18 Oct 2003 16:20:14 +0000 Subject: [PATCH] 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. --- ChangeLog | 12 ++++ HTMLparser.c | 50 ++++++++-------- HTMLtree.c | 2 +- SAX2.c | 4 +- catalog.c | 12 ++-- debugXML.c | 2 +- entities.c | 12 +--- include/libxml/parserInternals.h | 57 +++++++++++++++++- parser.c | 100 ++++++++++++++++--------------- relaxng.c | 26 ++++---- testSAX.c | 2 +- tree.c | 18 +++--- valid.c | 16 ++--- xmlschemas.c | 14 ++--- xmlschemastypes.c | 46 +++++++------- xpath.c | 58 +++++++++--------- 16 files changed, 246 insertions(+), 185 deletions(-) diff --git a/ChangeLog b/ChangeLog index cac20ffb..83971332 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +Sun Oct 19 00:15:38 HKT 2003 William Brack + + * 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 * genChRanges.py, chvalid.c, include/libxml/chvalid.h, diff --git a/HTMLparser.c b/HTMLparser.c index 68c54cb5..881821a5 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -408,7 +408,7 @@ static int 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 @@ static int areBlanks(htmlParserCtxtPtr ctxt, const xmlChar *str, int len) { 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 @@ htmlParseHTMLName(htmlParserCtxtPtr ctxt) { 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 @@ htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) { */ 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 @@ htmlParseSystemLiteral(htmlParserCtxtPtr ctxt) { 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 @@ htmlParseSystemLiteral(htmlParserCtxtPtr ctxt) { } 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 @@ htmlParsePubidLiteral(htmlParserCtxtPtr ctxt) { 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 @@ htmlParsePubidLiteral(htmlParserCtxtPtr ctxt) { } 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 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { 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 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { 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 @@ htmlParseExternalID(htmlParserCtxtPtr ctxt, xmlChar **publicID) { (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 @@ htmlParseExternalID(htmlParserCtxtPtr ctxt, xmlChar **publicID) { (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(htmlParserCtxtPtr ctxt) { "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 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) { * (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 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) { 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 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt) * 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 @@ htmlParseElement(htmlParserCtxtPtr ctxt) { */ 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 @@ htmlParseElement(htmlParserCtxtPtr ctxt) { 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 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { * 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 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { 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 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { 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 11a61255..61287e68 100644 --- a/HTMLtree.c +++ b/HTMLtree.c @@ -665,7 +665,7 @@ htmlAttrDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur, 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 1bcd841b..3c64ac23 100644 --- a/SAX2.c +++ b/SAX2.c @@ -1635,12 +1635,12 @@ xmlSAX2TextNode(xmlParserCtxtPtr ctxt, const xmlChar *str, int len) { 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 89cb4cfd..7ec04a37 100644 --- a/catalog.c +++ b/catalog.c @@ -2029,10 +2029,10 @@ xmlParseSGMLCatalogPubid(const xmlChar *cur, xmlChar **id) { 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 @@ xmlParseSGMLCatalogPubid(const xmlChar *cur, xmlChar **id) { } buf[len] = 0; if (stop == ' ') { - if (!IS_BLANK(*cur)) { + if (!IS_BLANK_CH(*cur)) { xmlFree(buf); return(NULL); } @@ -2185,7 +2185,7 @@ xmlParseSGMLCatalog(xmlCatalogPtr catal, const xmlChar *value, /* error */ break; } - if (!IS_BLANK(*cur)) { + if (!IS_BLANK_CH(*cur)) { /* error */ break; } @@ -2240,7 +2240,7 @@ xmlParseSGMLCatalog(xmlCatalogPtr catal, const xmlChar *value, /* error */ break; } - if (!IS_BLANK(*cur)) { + if (!IS_BLANK_CH(*cur)) { /* error */ break; } @@ -2259,7 +2259,7 @@ xmlParseSGMLCatalog(xmlCatalogPtr catal, const xmlChar *value, /* error */ break; } - if (!IS_BLANK(*cur)) { + if (!IS_BLANK_CH(*cur)) { /* error */ break; } diff --git a/debugXML.c b/debugXML.c index 57a09fe8..f891be0b 100644 --- a/debugXML.c +++ b/debugXML.c @@ -52,7 +52,7 @@ xmlDebugDumpString(FILE * output, const xmlChar * str) 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 26848326..cac58232 100644 --- a/entities.c +++ b/entities.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -395,15 +396,6 @@ xmlGetDocEntity(xmlDocPtr doc, const xmlChar *name) { return(xmlGetPredefinedEntity(name)); } -/* - * [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. */ @@ -563,7 +555,7 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) { 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 f1585310..8b894297 100644 --- a/include/libxml/parserInternals.h +++ b/include/libxml/parserInternals.h @@ -72,6 +72,14 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; */ #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) @@ -82,6 +90,14 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; */ #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) @@ -102,6 +118,14 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; */ #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) @@ -112,6 +136,14 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; */ #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) @@ -125,6 +157,14 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; */ #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 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; */ #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) @@ -159,6 +206,14 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; */ #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 17b8b1c8..ccec4364 100644 --- a/parser.c +++ b/parser.c @@ -1284,7 +1284,7 @@ xmlSkipBlankChars(xmlParserCtxtPtr ctxt) { * 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 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) { */ 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 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) { } if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) && - (memcmp(CUR_PTR, "' || IS_BLANK (*in))) { + if (*cmp == 0 && (*in == '>' || IS_BLANK_CH (*in))) { /* success */ ctxt->input->cur = in; return (const xmlChar*) 1; @@ -3475,7 +3476,7 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) { } 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 @@ get_more: 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 @@ xmlParseExternalID(xmlParserCtxtPtr ctxt, xmlChar **publicID, int strict) { *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 @@ xmlParseExternalID(xmlParserCtxtPtr ctxt, xmlChar **publicID, int strict) { } } 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 @@ xmlParseExternalID(xmlParserCtxtPtr ctxt, xmlChar **publicID, int strict) { /* * 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 @@ xmlParseExternalID(xmlParserCtxtPtr ctxt, xmlChar **publicID, int strict) { 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 @@ xmlParseCatalogPI(xmlParserCtxtPtr ctxt, const xmlChar *catalog) { 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 @@ xmlParseCatalogPI(xmlParserCtxtPtr ctxt, const xmlChar *catalog) { 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 @@ xmlParseNotationDecl(xmlParserCtxtPtr ctxt) { 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 '') && (!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 @@ xmlParseDefaultDecl(xmlParserCtxtPtr ctxt, xmlChar **value) { 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 @@ int 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 @@ xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt) { xmlParserInputPtr input = ctxt->input; SKIP(9); - if (!IS_BLANK(CUR)) { + if (!IS_BLANK_CH(CUR)) { xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, "Space required after '') { - 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 @@ xmlParseElementDecl(xmlParserCtxtPtr ctxt) { 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 @@ xmlParseElementDecl(xmlParserCtxtPtr ctxt) { } 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 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) { 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 @@ xmlParseTextDecl(xmlParserCtxtPtr ctxt) { /* * We know that '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 @@ xmlParseReference(xmlParserCtxtPtr ctxt) { input = xmlNewEntityInputStream(ctxt, ent); xmlPushInput(ctxt, input); if ((ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY) && - (memcmp(CUR_PTR, "errNo == XML_ERR_UNSUPPORTED_ENCODING) { /* @@ -6459,7 +6461,7 @@ xmlParsePEReference(xmlParserCtxtPtr ctxt) xmlPushInput(ctxt, input); if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) && (memcmp(CUR_PTR, "errNo == XML_ERR_UNSUPPORTED_ENCODING) { @@ -6935,7 +6937,7 @@ failed: 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 @@ xmlParseQNameAndCompare(xmlParserCtxtPtr ctxt, xmlChar const *name, ++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 @@ failed: 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 @@ xmlParseXMLDecl(xmlParserCtxtPtr ctxt) { */ SKIP(5); - if (!IS_BLANK(RAW)) { + if (!IS_BLANK_CH(RAW)) { xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, "Blank needed after '')) { SKIP(2); return; @@ -8705,7 +8707,7 @@ xmlParseXMLDecl(xmlParserCtxtPtr ctxt) { /* * 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 @@ void xmlParseMisc(xmlParserCtxtPtr ctxt) { while (((RAW == '<') && (NXT(1) == '?')) || (memcmp(CUR_PTR, "