Commit 76e95df0 authored by William M. Brack's avatar William M. Brack
Browse files

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.
parent 196b3886
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> Sat Oct 18 20:34:18 HKT 2003 William Brack <wbrack@mmm.com.hk>
* genChRanges.py, chvalid.c, include/libxml/chvalid.h, * genChRanges.py, chvalid.c, include/libxml/chvalid.h,
......
...@@ -408,7 +408,7 @@ static int ...@@ -408,7 +408,7 @@ static int
htmlSkipBlankChars(xmlParserCtxtPtr ctxt) { htmlSkipBlankChars(xmlParserCtxtPtr ctxt) {
int res = 0; int res = 0;
while (IS_BLANK(*(ctxt->input->cur))) { while (IS_BLANK_CH(*(ctxt->input->cur))) {
if ((*ctxt->input->cur == 0) && if ((*ctxt->input->cur == 0) &&
(xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) { (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) {
xmlPopInput(ctxt); xmlPopInput(ctxt);
...@@ -1999,7 +1999,7 @@ static int areBlanks(htmlParserCtxtPtr ctxt, const xmlChar *str, int len) { ...@@ -1999,7 +1999,7 @@ static int areBlanks(htmlParserCtxtPtr ctxt, const xmlChar *str, int len) {
xmlNodePtr lastChild; xmlNodePtr lastChild;
for (j = 0;j < len;j++) 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 == 0) return(1);
if (CUR != '<') return(0); if (CUR != '<') return(0);
...@@ -2131,11 +2131,11 @@ htmlParseHTMLName(htmlParserCtxtPtr ctxt) { ...@@ -2131,11 +2131,11 @@ htmlParseHTMLName(htmlParserCtxtPtr ctxt) {
int i = 0; int i = 0;
xmlChar loc[HTML_PARSER_BUFFER_SIZE]; xmlChar loc[HTML_PARSER_BUFFER_SIZE];
if (!IS_LETTER(CUR) && (CUR != '_') && if (!IS_LETTER_CH(CUR) && (CUR != '_') &&
(CUR != ':')) return(NULL); (CUR != ':')) return(NULL);
while ((i < HTML_PARSER_BUFFER_SIZE) && while ((i < HTML_PARSER_BUFFER_SIZE) &&
((IS_LETTER(CUR)) || (IS_DIGIT(CUR)) || ((IS_LETTER_CH(CUR)) || (IS_DIGIT_CH(CUR)) ||
(CUR == ':') || (CUR == '-') || (CUR == '_'))) { (CUR == ':') || (CUR == '-') || (CUR == '_'))) {
if ((CUR >= 'A') && (CUR <= 'Z')) loc[i] = CUR + 0x20; if ((CUR >= 'A') && (CUR <= 'Z')) loc[i] = CUR + 0x20;
else loc[i] = CUR; else loc[i] = CUR;
...@@ -2261,7 +2261,7 @@ htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) { ...@@ -2261,7 +2261,7 @@ htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) {
*/ */
while ((CUR != 0) && (CUR != stop)) { while ((CUR != 0) && (CUR != stop)) {
if ((stop == 0) && (CUR == '>')) break; if ((stop == 0) && (CUR == '>')) break;
if ((stop == 0) && (IS_BLANK(CUR))) break; if ((stop == 0) && (IS_BLANK_CH(CUR))) break;
if (CUR == '&') { if (CUR == '&') {
if (NXT(1) == '#') { if (NXT(1) == '#') {
unsigned int c; unsigned int c;
...@@ -2474,9 +2474,9 @@ htmlParseSystemLiteral(htmlParserCtxtPtr ctxt) { ...@@ -2474,9 +2474,9 @@ htmlParseSystemLiteral(htmlParserCtxtPtr ctxt) {
if (CUR == '"') { if (CUR == '"') {
NEXT; NEXT;
q = CUR_PTR; q = CUR_PTR;
while ((IS_CHAR((unsigned int) CUR)) && (CUR != '"')) while ((IS_CHAR_CH(CUR)) && (CUR != '"'))
NEXT; NEXT;
if (!IS_CHAR((unsigned int) CUR)) { if (!IS_CHAR_CH(CUR)) {
htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED,
"Unfinished SystemLiteral\n", NULL, NULL); "Unfinished SystemLiteral\n", NULL, NULL);
} else { } else {
...@@ -2486,9 +2486,9 @@ htmlParseSystemLiteral(htmlParserCtxtPtr ctxt) { ...@@ -2486,9 +2486,9 @@ htmlParseSystemLiteral(htmlParserCtxtPtr ctxt) {
} else if (CUR == '\'') { } else if (CUR == '\'') {
NEXT; NEXT;
q = CUR_PTR; q = CUR_PTR;
while ((IS_CHAR((unsigned int) CUR)) && (CUR != '\'')) while ((IS_CHAR_CH(CUR)) && (CUR != '\''))
NEXT; NEXT;
if (!IS_CHAR((unsigned int) CUR)) { if (!IS_CHAR_CH(CUR)) {
htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED,
"Unfinished SystemLiteral\n", NULL, NULL); "Unfinished SystemLiteral\n", NULL, NULL);
} else { } else {
...@@ -2524,7 +2524,7 @@ htmlParsePubidLiteral(htmlParserCtxtPtr ctxt) { ...@@ -2524,7 +2524,7 @@ htmlParsePubidLiteral(htmlParserCtxtPtr ctxt) {
if (CUR == '"') { if (CUR == '"') {
NEXT; NEXT;
q = CUR_PTR; q = CUR_PTR;
while (IS_PUBIDCHAR(CUR)) NEXT; while (IS_PUBIDCHAR_CH(CUR)) NEXT;
if (CUR != '"') { if (CUR != '"') {
htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED,
"Unfinished PubidLiteral\n", NULL, NULL); "Unfinished PubidLiteral\n", NULL, NULL);
...@@ -2535,7 +2535,7 @@ htmlParsePubidLiteral(htmlParserCtxtPtr ctxt) { ...@@ -2535,7 +2535,7 @@ htmlParsePubidLiteral(htmlParserCtxtPtr ctxt) {
} else if (CUR == '\'') { } else if (CUR == '\'') {
NEXT; NEXT;
q = CUR_PTR; q = CUR_PTR;
while ((IS_PUBIDCHAR(CUR)) && (CUR != '\'')) while ((IS_PUBIDCHAR_CH(CUR)) && (CUR != '\''))
NEXT; NEXT;
if (CUR != '\'') { if (CUR != '\'') {
htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED,
...@@ -2581,7 +2581,7 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { ...@@ -2581,7 +2581,7 @@ htmlParseScript(htmlParserCtxtPtr ctxt) {
SHRINK; SHRINK;
cur = CUR; cur = CUR;
while (IS_CHAR((unsigned int) cur)) { while (IS_CHAR_CH(cur)) {
if ((cur == '<') && (NXT(1) == '!') && (NXT(2) == '-') && if ((cur == '<') && (NXT(1) == '!') && (NXT(2) == '-') &&
(NXT(3) == '-')) { (NXT(3) == '-')) {
if ((nbchar != 0) && (ctxt->sax != NULL) && (!ctxt->disableSAX)) { if ((nbchar != 0) && (ctxt->sax != NULL) && (!ctxt->disableSAX)) {
...@@ -2624,7 +2624,7 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { ...@@ -2624,7 +2624,7 @@ htmlParseScript(htmlParserCtxtPtr ctxt) {
NEXT; NEXT;
cur = CUR; cur = CUR;
} }
if (!(IS_CHAR((unsigned int) cur))) { if (!(IS_CHAR_CH(cur))) {
htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR,
"Invalid char in CDATA 0x%X\n", cur); "Invalid char in CDATA 0x%X\n", cur);
NEXT; NEXT;
...@@ -2738,7 +2738,7 @@ htmlParseExternalID(htmlParserCtxtPtr ctxt, xmlChar **publicID) { ...@@ -2738,7 +2738,7 @@ htmlParseExternalID(htmlParserCtxtPtr ctxt, xmlChar **publicID) {
(UPP(2) == 'S') && (UPP(3) == 'T') && (UPP(2) == 'S') && (UPP(3) == 'T') &&
(UPP(4) == 'E') && (UPP(5) == 'M')) { (UPP(4) == 'E') && (UPP(5) == 'M')) {
SKIP(6); SKIP(6);
if (!IS_BLANK(CUR)) { if (!IS_BLANK_CH(CUR)) {
htmlParseErr(ctxt, XML_ERR_SPACE_REQUIRED, htmlParseErr(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after 'SYSTEM'\n", NULL, NULL); "Space required after 'SYSTEM'\n", NULL, NULL);
} }
...@@ -2752,7 +2752,7 @@ htmlParseExternalID(htmlParserCtxtPtr ctxt, xmlChar **publicID) { ...@@ -2752,7 +2752,7 @@ htmlParseExternalID(htmlParserCtxtPtr ctxt, xmlChar **publicID) {
(UPP(2) == 'B') && (UPP(3) == 'L') && (UPP(2) == 'B') && (UPP(3) == 'L') &&
(UPP(4) == 'I') && (UPP(5) == 'C')) { (UPP(4) == 'I') && (UPP(5) == 'C')) {
SKIP(6); SKIP(6);
if (!IS_BLANK(CUR)) { if (!IS_BLANK_CH(CUR)) {
htmlParseErr(ctxt, XML_ERR_SPACE_REQUIRED, htmlParseErr(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after 'PUBLIC'\n", NULL, NULL); "Space required after 'PUBLIC'\n", NULL, NULL);
} }
...@@ -3199,7 +3199,7 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) { ...@@ -3199,7 +3199,7 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
"htmlParseStartTag: invalid element name\n", "htmlParseStartTag: invalid element name\n",
NULL, NULL); NULL, NULL);
/* Dump the bogus tag like browsers do */ /* Dump the bogus tag like browsers do */
while ((IS_CHAR((unsigned int) CUR)) && (CUR != '>')) while ((IS_CHAR_CH(CUR)) && (CUR != '>'))
NEXT; NEXT;
return; return;
} }
...@@ -3251,7 +3251,7 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) { ...@@ -3251,7 +3251,7 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
* (S Attribute)* S? * (S Attribute)* S?
*/ */
SKIP_BLANKS; SKIP_BLANKS;
while ((IS_CHAR((unsigned int) CUR)) && while ((IS_CHAR_CH(CUR)) &&
(CUR != '>') && (CUR != '>') &&
((CUR != '/') || (NXT(1) != '>'))) { ((CUR != '/') || (NXT(1) != '>'))) {
long cons = ctxt->nbChars; long cons = ctxt->nbChars;
...@@ -3314,8 +3314,8 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) { ...@@ -3314,8 +3314,8 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
xmlFree(attvalue); xmlFree(attvalue);
/* Dump the bogus attribute string up to the next blank or /* Dump the bogus attribute string up to the next blank or
* the end of the tag. */ * the end of the tag. */
while ((IS_CHAR((unsigned int) CUR)) && while ((IS_CHAR_CH(CUR)) &&
!(IS_BLANK(CUR)) && (CUR != '>') && !(IS_BLANK_CH(CUR)) && (CUR != '>') &&
((CUR != '/') || (NXT(1) != '>'))) ((CUR != '/') || (NXT(1) != '>')))
NEXT; NEXT;
} }
...@@ -3392,7 +3392,7 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt) ...@@ -3392,7 +3392,7 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt)
* We should definitely be at the ending "S? '>'" part * We should definitely be at the ending "S? '>'" part
*/ */
SKIP_BLANKS; SKIP_BLANKS;
if ((!IS_CHAR((unsigned int) CUR)) || (CUR != '>')) { if ((!IS_CHAR_CH(CUR)) || (CUR != '>')) {
htmlParseErr(ctxt, XML_ERR_GT_REQUIRED, htmlParseErr(ctxt, XML_ERR_GT_REQUIRED,
"End tag : expected '>'\n", NULL, NULL); "End tag : expected '>'\n", NULL, NULL);
} else } else
...@@ -3743,7 +3743,7 @@ htmlParseElement(htmlParserCtxtPtr ctxt) { ...@@ -3743,7 +3743,7 @@ htmlParseElement(htmlParserCtxtPtr ctxt) {
*/ */
currentNode = xmlStrdup(ctxt->name); currentNode = xmlStrdup(ctxt->name);
depth = ctxt->nameNr; depth = ctxt->nameNr;
while (IS_CHAR((unsigned int) CUR)) { while (IS_CHAR_CH(CUR)) {
oldptr = ctxt->input->cur; oldptr = ctxt->input->cur;
htmlParseContent(ctxt); htmlParseContent(ctxt);
if (oldptr==ctxt->input->cur) break; if (oldptr==ctxt->input->cur) break;
...@@ -3760,7 +3760,7 @@ htmlParseElement(htmlParserCtxtPtr ctxt) { ...@@ -3760,7 +3760,7 @@ htmlParseElement(htmlParserCtxtPtr ctxt) {
node_info.node = ctxt->node; node_info.node = ctxt->node;
xmlParserAddNodeInfo(ctxt, &node_info); xmlParserAddNodeInfo(ctxt, &node_info);
} }
if (!IS_CHAR((unsigned int) CUR)) { if (!IS_CHAR_CH(CUR)) {
htmlAutoCloseOnEnd(ctxt); htmlAutoCloseOnEnd(ctxt);
} }
...@@ -4335,7 +4335,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { ...@@ -4335,7 +4335,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
* Very first chars read from the document flow. * Very first chars read from the document flow.
*/ */
cur = in->cur[0]; cur = in->cur[0];
if (IS_BLANK(cur)) { if (IS_BLANK_CH(cur)) {
SKIP_BLANKS; SKIP_BLANKS;
if (in->buf == NULL) if (in->buf == NULL)
avail = in->length - (in->cur - in->base); avail = in->length - (in->cur - in->base);
...@@ -4467,7 +4467,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { ...@@ -4467,7 +4467,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
if (avail < 1) if (avail < 1)
goto done; goto done;
cur = in->cur[0]; cur = in->cur[0];
if (IS_BLANK(cur)) { if (IS_BLANK_CH(cur)) {
htmlParseCharData(ctxt); htmlParseCharData(ctxt);
goto done; goto done;
} }
...@@ -4623,7 +4623,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { ...@@ -4623,7 +4623,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
cur = in->cur[0]; cur = in->cur[0];
if ((cur != '<') && (cur != '&')) { if ((cur != '<') && (cur != '&')) {
if (ctxt->sax != NULL) { if (ctxt->sax != NULL) {
if (IS_BLANK(cur)) { if (IS_BLANK_CH(cur)) {
if (ctxt->sax->ignorableWhitespace != NULL) if (ctxt->sax->ignorableWhitespace != NULL)
ctxt->sax->ignorableWhitespace( ctxt->sax->ignorableWhitespace(
ctxt->userData, &cur, 1); ctxt->userData, &cur, 1);
......
...@@ -665,7 +665,7 @@ htmlAttrDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur, ...@@ -665,7 +665,7 @@ htmlAttrDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur,
xmlChar *escaped; xmlChar *escaped;
xmlChar *tmp = value; xmlChar *tmp = value;
while (IS_BLANK(*tmp)) tmp++; while (IS_BLANK_CH(*tmp)) tmp++;
escaped = xmlURIEscapeStr(tmp, BAD_CAST"@/:=?;#%&,+"); escaped = xmlURIEscapeStr(tmp, BAD_CAST"@/:=?;#%&,+");
if (escaped != NULL) { if (escaped != NULL) {
......
...@@ -1635,12 +1635,12 @@ xmlSAX2TextNode(xmlParserCtxtPtr ctxt, const xmlChar *str, int len) { ...@@ -1635,12 +1635,12 @@ xmlSAX2TextNode(xmlParserCtxtPtr ctxt, const xmlChar *str, int len) {
if ((len <= 3) && ((cur == '"') || (cur == '\'') || if ((len <= 3) && ((cur == '"') || (cur == '\'') ||
((cur == '<') && (str[len + 1] != '!')))) { ((cur == '<') && (str[len + 1] != '!')))) {
intern = xmlDictLookup(ctxt->dict, str, len); 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] != '!')) { (str[len + 1] != '!')) {
int i; int i;
for (i = 1;i < len;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); intern = xmlDictLookup(ctxt->dict, str, len);
} }
......
...@@ -2029,10 +2029,10 @@ xmlParseSGMLCatalogPubid(const xmlChar *cur, xmlChar **id) { ...@@ -2029,10 +2029,10 @@ xmlParseSGMLCatalogPubid(const xmlChar *cur, xmlChar **id) {
xmlCatalogErrMemory("allocating public ID"); xmlCatalogErrMemory("allocating public ID");
return(NULL); return(NULL);
} }
while (xmlIsPubidCharQ(*cur) || (*cur == '?')) { while (IS_PUBIDCHAR_CH(*cur) || (*cur == '?')) {
if ((*cur == stop) && (stop != ' ')) if ((*cur == stop) && (stop != ' '))
break; break;
if ((stop == ' ') && (IS_BLANK(*cur))) if ((stop == ' ') && (IS_BLANK_CH(*cur)))
break; break;
if (len + 1 >= size) { if (len + 1 >= size) {
size *= 2; size *= 2;
...@@ -2050,7 +2050,7 @@ xmlParseSGMLCatalogPubid(const xmlChar *cur, xmlChar **id) { ...@@ -2050,7 +2050,7 @@ xmlParseSGMLCatalogPubid(const xmlChar *cur, xmlChar **id) {
} }
buf[len] = 0; buf[len] = 0;
if (stop == ' ') { if (stop == ' ') {
if (!IS_BLANK(*cur)) { if (!IS_BLANK_CH(*cur)) {
xmlFree(buf); xmlFree(buf);
return(NULL); return(NULL);
} }
...@@ -2185,7 +2185,7 @@ xmlParseSGMLCatalog(xmlCatalogPtr catal, const xmlChar *value, ...@@ -2185,7 +2185,7 @@ xmlParseSGMLCatalog(xmlCatalogPtr catal, const xmlChar *value,
/* error */ /* error */
break; break;
} }
if (!IS_BLANK(*cur)) { if (!IS_BLANK_CH(*cur)) {
/* error */ /* error */
break; break;
} }
...@@ -2240,7 +2240,7 @@ xmlParseSGMLCatalog(xmlCatalogPtr catal, const xmlChar *value, ...@@ -2240,7 +2240,7 @@ xmlParseSGMLCatalog(xmlCatalogPtr catal, const xmlChar *value,
/* error */ /* error */
break; break;
} }
if (!IS_BLANK(*cur)) { if (!IS_BLANK_CH(*cur)) {
/* error */ /* error */
break; break;
} }
...@@ -2259,7 +2259,7 @@ xmlParseSGMLCatalog(xmlCatalogPtr catal, const xmlChar *value, ...@@ -2259,7 +2259,7 @@ xmlParseSGMLCatalog(xmlCatalogPtr catal, const xmlChar *value,
/* error */ /* error */
break; break;
} }
if (!IS_BLANK(*cur)) { if (!IS_BLANK_CH(*cur)) {
/* error */ /* error */
break; break;
} }
......
...@@ -52,7 +52,7 @@ xmlDebugDumpString(FILE * output, const xmlChar * str) ...@@ -52,7 +52,7 @@ xmlDebugDumpString(FILE * output, const xmlChar * str)
for (i = 0; i < 40; i++) for (i = 0; i < 40; i++)
if (str[i] == 0) if (str[i] == 0)
return; return;
else if (IS_BLANK(str[i])) else if (IS_BLANK_CH(str[i]))
fputc(' ', output); fputc(' ', output);
else if (str[i] >= 0x80) else if (str[i] >= 0x80)
fprintf(output, "#%X", str[i]); fprintf(output, "#%X", str[i]);
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <libxml/hash.h> #include <libxml/hash.h>
#include <libxml/entities.h> #include <libxml/entities.h>
#include <libxml/parser.h> #include <libxml/parser.h>
#include <libxml/parserInternals.h>
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
#include <libxml/globals.h> #include <libxml/globals.h>
...@@ -395,15 +396,6 @@ xmlGetDocEntity(xmlDocPtr doc, const xmlChar *name) { ...@@ -395,15 +396,6 @@ xmlGetDocEntity(xmlDocPtr doc, const xmlChar *name) {
return(xmlGetPredefinedEntity(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. * Macro used to grow the current buffer.
*/ */
...@@ -563,7 +555,7 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) { ...@@ -563,7 +555,7 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) {
cur += l; cur += l;
continue; continue;
} }
} else if (IS_CHAR((unsigned int) *cur)) { } else if (IS_BYTE_CHAR(*cur)) {
char buf[11], *ptr; char buf[11], *ptr;
snprintf(buf, sizeof(buf), "&#%d;", *cur); snprintf(buf, sizeof(buf), "&#%d;", *cur);
......
...@@ -72,6 +72,14 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; ...@@ -72,6 +72,14 @@ XMLPUBVAR unsigned int xmlParserMaxDepth;
*/ */
#define IS_CHAR(c) xmlIsCharQ(c) #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: * IS_BLANK:
* @c: an UNICODE value (int) * @c: an UNICODE value (int)
...@@ -82,6 +90,14 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; ...@@ -82,6 +90,14 @@ XMLPUBVAR unsigned int xmlParserMaxDepth;
*/ */
#define IS_BLANK(c) xmlIsBlankQ(c) #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: * IS_BASECHAR:
* @c: an UNICODE value (int) * @c: an UNICODE value (int)
...@@ -102,6 +118,14 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; ...@@ -102,6 +118,14 @@ XMLPUBVAR unsigned int xmlParserMaxDepth;
*/ */
#define IS_DIGIT(c) xmlIsDigitQ(c) #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: * IS_COMBINING:
* @c: an UNICODE value (int) * @c: an UNICODE value (int)
...@@ -112,6 +136,14 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; ...@@ -112,6 +136,14 @@ XMLPUBVAR unsigned int xmlParserMaxDepth;
*/ */
#define IS_COMBINING(c) xmlIsCombiningQ(c) #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: * IS_EXTENDER:
* @c: an UNICODE value (int) * @c: an UNICODE value (int)
...@@ -125,6 +157,14 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; ...@@ -125,6 +157,14 @@ XMLPUBVAR unsigned int xmlParserMaxDepth;
*/ */
#define IS_EXTENDER(c) xmlIsExtenderQ(c) #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: * IS_IDEOGRAPHIC:
* @c: an UNICODE value (int) * @c: an UNICODE value (int)
...@@ -147,7 +187,14 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; ...@@ -147,7 +187,14 @@ XMLPUBVAR unsigned int xmlParserMaxDepth;
*/ */
#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c)) #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: * IS_PUBIDCHAR:
* @c: an UNICODE value (int) * @c: an UNICODE value (int)
...@@ -159,6 +206,14 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; ...@@ -159,6 +206,14 @@ XMLPUBVAR unsigned int xmlParserMaxDepth;
*/ */
#define IS_PUBIDCHAR(c) xmlIsPubidCharQ(c) #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)
/**