| 3087 | */ |
| 3088 | |
| 3089 | static void |
| 3090 | htmlParseCharDataInternal(htmlParserCtxtPtr ctxt, int readahead) { |
| 3091 | xmlChar buf[HTML_PARSER_BIG_BUFFER_SIZE + 6]; |
| 3092 | int nbchar = 0; |
| 3093 | int cur, l; |
| 3094 | |
| 3095 | if (readahead) |
| 3096 | buf[nbchar++] = readahead; |
| 3097 | |
| 3098 | cur = CUR_CHAR(l); |
| 3099 | while ((cur != '<') && |
| 3100 | (cur != '&') && |
| 3101 | (cur != 0) && |
| 3102 | (!PARSER_STOPPED(ctxt))) { |
| 3103 | if (!(IS_CHAR(cur))) { |
| 3104 | htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, |
| 3105 | "Invalid char in CDATA 0x%X\n", cur); |
| 3106 | } else { |
| 3107 | COPY_BUF(l,buf,nbchar,cur); |
| 3108 | } |
| 3109 | NEXTL(l); |
| 3110 | if (nbchar >= HTML_PARSER_BIG_BUFFER_SIZE) { |
| 3111 | buf[nbchar] = 0; |
| 3112 | |
| 3113 | /* |
| 3114 | * Ok the segment is to be consumed as chars. |
| 3115 | */ |
| 3116 | if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) { |
| 3117 | if (areBlanks(ctxt, buf, nbchar)) { |
| 3118 | if (ctxt->keepBlanks) { |
| 3119 | if (ctxt->sax->characters != NULL) |
| 3120 | ctxt->sax->characters(ctxt->userData, buf, nbchar); |
| 3121 | } else { |
| 3122 | if (ctxt->sax->ignorableWhitespace != NULL) |
| 3123 | ctxt->sax->ignorableWhitespace(ctxt->userData, |
| 3124 | buf, nbchar); |
| 3125 | } |
| 3126 | } else { |
| 3127 | htmlCheckParagraph(ctxt); |
| 3128 | if (ctxt->sax->characters != NULL) |
| 3129 | ctxt->sax->characters(ctxt->userData, buf, nbchar); |
| 3130 | } |
| 3131 | } |
| 3132 | nbchar = 0; |
| 3133 | SHRINK; |
| 3134 | } |
| 3135 | cur = CUR_CHAR(l); |
| 3136 | } |
| 3137 | if (nbchar != 0) { |
| 3138 | buf[nbchar] = 0; |
| 3139 | |
| 3140 | /* |
| 3141 | * Ok the segment is to be consumed as chars. |
| 3142 | */ |
| 3143 | if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) { |
| 3144 | if (areBlanks(ctxt, buf, nbchar)) { |
| 3145 | if (ctxt->keepBlanks) { |
| 3146 | if (ctxt->sax->characters != NULL) |
no test coverage detected