Branch Coverage

third_party/modest/source/myhtml/tokenizer.c
Criterion Covered Total %
branch 158 472 33.4


line true false branch
32 0 145 if(tree->current_token_node == NULL)
55 142 6 if(myhtml->opt & MyHTML_OPTIONS_PARSE_MODE_SINGLE)
58 6 142 if((tree->flags & MyHTML_TREE_FLAGS_SINGLE_MODE) == 0)
60 6 0 if(tree->queue_entry == NULL) {
66 0 6 if(status)
79 145 3 if(tree->current_qnode == NULL) {
81 0 145 if(status)
87 4226 148 while (offset < html_length) {
98 145 3 if(tree->encoding_usereq == MyENCODING_UTF_16LE ||
99 0 145 tree->encoding_usereq == MyENCODING_UTF_16BE)
112 3 0 if(tree->stream_buffer == NULL) {
115 0 3 if(tree->stream_buffer == NULL)
120 0 3 if(status)
123 0 3 if(myhtml_stream_buffer_add_entry(tree->stream_buffer, (4096 * 4)) == NULL)
132 72 3 for (size_t i = 0; i < html_length; i++)
134 36 36 if(func(u_html[i], &stream_buffer->res) == MyENCODING_STATUS_OK)
136 0 36 if((stream_entry->length + 4) >= stream_entry->size)
143 0 0 if(stream_entry == NULL)
153 3 0 if((stream_entry->length - temp_curr_pos)) {
163 145 0 if(tree->incoming_buf)
173 0 145 if(myhtml_queue_add(tree, 0, tree->current_token_node) != MyHTML_STATUS_OK) {
181 6 139 if((tree->flags & MyHTML_TREE_FLAGS_SINGLE_MODE) == 0)
190 6 0 if(mythread_queue_list_get_count(tree->myhtml->thread_stream->context) == 0)
193 6 0 if(status == MyHTML_STATUS_OK)
212 17 0 if(ns == MyHTML_NAMESPACE_HTML) {
213 0 17 if(tag_idx == MyHTML_TAG_NOSCRIPT) {
214 0 0 if(tree->flags & MyHTML_TREE_FLAGS_SCRIPT) {
229 0 17 if(tree->fragment->token == NULL)
238 0 17 if(tag_idx == MyHTML_TAG_TEMPLATE)
249 0 0 if(tree->myhtml->thread_stream)
257 6 0 if(tree->myhtml->thread_stream)
260 6 0 if(tree->myhtml->thread_batch)
268 6 0 if(tree->myhtml->thread_stream)
271 6 0 if(tree->myhtml->thread_batch)
278 1685 0 if((tree->parse_flags & MyHTML_TREE_PARSE_FLAGS_WITHOUT_BUILD_TREE) == 0) {
279 1663 22 if(tree->flags & MyHTML_TREE_FLAGS_SINGLE_MODE)
284 22 0 if(token_node->tag_id == MyHTML_TAG_MATH ||
285 22 0 token_node->tag_id == MyHTML_TAG_SVG ||
286 0 22 token_node->tag_id == MyHTML_TAG_FRAMESET)
290 0 22 else if(tree->token_namespace && (token_node->type & MyHTML_TOKEN_TYPE_CLOSE) == 0) {
0 0 else if(tree->token_namespace && (token_node->type & MyHTML_TOKEN_TYPE_CLOSE) == 0) {
293 0 0 if(tag_ctx->data_parser != MyHTML_TOKENIZER_STATE_DATA)
308 1 750 if(html_offset < token_node->raw_length) {
316 751 0 if(tag_ctx) {
320 0 0 if(html_offset < token_node->raw_length) {
335 994 0 if(token_node->tag_id == MyHTML_TAG__UNDEF)
337 692 302 if(absolute_html_offset > token_node->raw_begin)
346 0 692 if(myhtml_queue_add(tree, tmp_begin, token_node) != MyHTML_STATUS_OK) {
359 376 375 if((token_node->type & MyHTML_TOKEN_TYPE_CLOSE) == 0)
361 0 376 if(token_node->tag_id == MyHTML_TAG_NOSCRIPT &&
362 0 0 (tree->flags & MyHTML_TREE_FLAGS_SCRIPT) == 0)
382 0 0 if(tree->tmp_tag_id == 0) {
387 0 0 if(prev_qnode && prev_qnode->args) {
0 0 if(prev_qnode && prev_qnode->args) {
390 0 0 else if(tree->fragment) {
395 0 0 while(html_offset < html_size)
397 0 0 if(html[html_offset] == '<')
415 0 0 if(html[html_offset] == '/')
429 0 0 if(mycore_tokenizer_chars_map[ (unsigned char)html[html_offset] ] == MyCORE_STRING_MAP_CHAR_A_Z_a_z)
445 0 0 if(token_node->tag_id != tree->tmp_tag_id)
456 0 0 if((token_node->raw_begin - 2) > tmp_begin)
490 0 0 while(html_offset < html_size)
492 0 0 if(mycore_tokenizer_chars_map[ (unsigned char)html[html_offset] ] == MyCORE_STRING_MAP_CHAR_WHITESPACE)
494 0 0 if(_myhtml_tokenizer_state_andata_end_tag_name(tree, token_node, html, &html_offset, tmp_begin, MyHTML_TOKEN_TYPE_RCDATA)) {
505 0 0 else if(html[html_offset] == '>')
507 0 0 if(_myhtml_tokenizer_state_andata_end_tag_name(tree, token_node, html, &html_offset, tmp_begin, MyHTML_TOKEN_TYPE_RCDATA)) {
513 0 0 if(myhtml_queue_add(tree, html_offset, token_node) != MyHTML_STATUS_OK) {
527 0 0 else if(html[html_offset] == '/')
529 0 0 if(_myhtml_tokenizer_state_andata_end_tag_name(tree, token_node, html, &html_offset, tmp_begin, MyHTML_TOKEN_TYPE_RCDATA)) {
540 0 0 else if (mycore_tokenizer_chars_map[ (unsigned char)html[html_offset] ] != MyCORE_STRING_MAP_CHAR_A_Z_a_z) {
558 0 0 if(tree->tmp_tag_id == 0) {
563 0 0 if(prev_qnode && prev_qnode->args) {
0 0 if(prev_qnode && prev_qnode->args) {
566 0 0 else if(tree->fragment) {
572 0 0 while(html_offset < html_size)
574 0 0 if(html[html_offset] == '<')
592 0 0 if(html[html_offset] == '/')
606 0 0 if(mycore_tokenizer_chars_map[ (unsigned char)html[html_offset] ] == MyCORE_STRING_MAP_CHAR_A_Z_a_z)
622 0 0 while(html_offset < html_size)
624 0 0 if(mycore_tokenizer_chars_map[ (unsigned char)html[html_offset] ] == MyCORE_STRING_MAP_CHAR_WHITESPACE)
626 0 0 if(_myhtml_tokenizer_state_andata_end_tag_name(tree, token_node, html, &html_offset, tmp_begin, MyHTML_TOKEN_TYPE_RAWTEXT)) {
635 0 0 else if(html[html_offset] == '>')
637 0 0 if(_myhtml_tokenizer_state_andata_end_tag_name(tree, token_node, html, &html_offset, tmp_begin, MyHTML_TOKEN_TYPE_RAWTEXT)) {
643 0 0 if(myhtml_queue_add(tree, html_offset, token_node) != MyHTML_STATUS_OK) {
655 0 0 else if(html[html_offset] == '/')
657 0 0 if(_myhtml_tokenizer_state_andata_end_tag_name(tree, token_node, html, &html_offset, tmp_begin, MyHTML_TOKEN_TYPE_RAWTEXT)) {
666 0 0 else if (mycore_tokenizer_chars_map[ (unsigned char)html[html_offset] ] != MyCORE_STRING_MAP_CHAR_A_Z_a_z) {
686 0 0 if((token_node->type & MyHTML_TOKEN_TYPE_PLAINTEXT) == 0)
696 0 0 if(myhtml_queue_add(tree, html_size, token_node) != MyHTML_STATUS_OK) {
710 0 0 if((token_node->type & MyHTML_TOKEN_TYPE_CDATA) == 0)
713 0 0 while(html_offset < html_size)
715 0 0 if(html[html_offset] == '>')
718 0 0 if(html_offset < 2)
723 0 0 if(tagname[0] == ']' && tagname[1] == ']')
0 0 if(tagname[0] == ']' && tagname[1] == ']')
728 0 0 if(token_node->raw_length) {
731 0 0 if(myhtml_queue_add(tree, html_offset, token_node) != MyHTML_STATUS_OK) {
758 5140 72 while(html_offset < html_size)
760 849 4291 if(html[html_offset] == '<')
769 0 4291 else if(html[html_offset] == '\0' && (token_node->type & MyHTML_TOKEN_TYPE_NULL) == 0) {
0 0 else if(html[html_offset] == '\0' && (token_node->type & MyHTML_TOKEN_TYPE_NULL) == 0) {
775 2202 2089 else if(token_node->type & MyHTML_TOKEN_TYPE_WHITESPACE &&
776 290 1912 mycore_tokenizer_chars_map[ (unsigned char)html[html_offset] ] != MyCORE_STRING_MAP_CHAR_WHITESPACE) {
793 377 472 if(mycore_tokenizer_chars_map[ (unsigned char)html[html_offset] ] == MyCORE_STRING_MAP_CHAR_A_Z_a_z)
796 0 377 if(token_node == NULL) {
805 97 375 else if(html[html_offset] == '!')
808 0 97 if(token_node == NULL) {
818 375 0 else if(html[html_offset] == '/')
823 0 0 else if(html[html_offset] == '?')
829 0 0 if(token_node == NULL) {
855 375 0 if(mycore_tokenizer_chars_map[ (unsigned char)html[html_offset] ] == MyCORE_STRING_MAP_CHAR_A_Z_a_z)
858 0 375 if(token_node == NULL) {
868 0 0 else if(html[html_offset] == '>')
881 0 0 if(token_node == NULL) {
900 0 97 if((token_node->raw_begin + 2) > (html_size + tree->global_offset)) {
908 61 36 if(tagname[0] == '-' && tagname[1] == '-')
61 0 if(tagname[0] == '-' && tagname[1] == '-')
920 0 36 if((token_node->raw_begin + 7) > (html_size + tree->global_offset)) {
927 36 0 if(mycore_strncasecmp(tagname, "DOCTYPE", 7) == 0)
940 0 0 if(strncmp(tagname, "[CDATA[", 7) == 0) {
941 0 0 if(tree->current_qnode->prev && tree->current_qnode->prev->args)
0 0 if(tree->current_qnode->prev && tree->current_qnode->prev->args)
946 0 0 if(adjusted_current_node &&
947 0 0 adjusted_current_node->ns != MyHTML_NAMESPACE_HTML)
975 2448 2 while(html_offset < html_size)
977 118 2330 if(mycore_tokenizer_chars_map[ (unsigned char)html[html_offset] ] == MyCORE_STRING_MAP_CHAR_WHITESPACE)
987 0 2330 else if(html[html_offset] == '/')
997 633 1697 else if(html[html_offset] == '>')
1008 0 633 if(myhtml_queue_add(tree, html_offset, token_node) != MyHTML_STATUS_OK) {
1028 0 0 if(html[html_offset] == '>') {
1037 0 0 if(myhtml_queue_add(tree, html_offset, token_node) != MyHTML_STATUS_OK) {
1056 149 0 myhtml_parser_skip_whitespace()
149 0 myhtml_parser_skip_whitespace()
149 0 myhtml_parser_skip_whitespace()
149 0 myhtml_parser_skip_whitespace()
0 149 myhtml_parser_skip_whitespace()
0 0 myhtml_parser_skip_whitespace()
0 0 myhtml_parser_skip_whitespace()
0 0 myhtml_parser_skip_whitespace()
0 0 myhtml_parser_skip_whitespace()
0 0 myhtml_parser_skip_whitespace()
0 0 myhtml_parser_skip_whitespace()
1058 0 149 if(html_offset >= html_size) {
1062 1 148 if(html[html_offset] == '>')
1070 0 1 if(myhtml_queue_add(tree, html_offset, token_node) != MyHTML_STATUS_OK) {
1075 1 147 else if(html[html_offset] == '/') {
1081 117 30 myhtml_parser_queue_set_attr(tree, token_node)
1088 0 147 if(html[html_offset] == '=') {
1107 997 0 while(html_offset < html_size)
1109 991 6 if(myhtml_whithspace(html[html_offset], ==, ||))
991 0 if(myhtml_whithspace(html[html_offset], ==, ||))
991 0 if(myhtml_whithspace(html[html_offset], ==, ||))
991 0 if(myhtml_whithspace(html[html_offset], ==, ||))
0 991 if(myhtml_whithspace(html[html_offset], ==, ||))
1117 147 844 else if(html[html_offset] == '=')
1125 0 844 else if(html[html_offset] == '>')
1134 0 0 if(myhtml_queue_add(tree, html_offset, token_node) != MyHTML_STATUS_OK) {
1140 0 0 if(tree->attr_current == NULL) {
1147 0 844 else if(html[html_offset] == '/')
1155 0 0 if(tree->attr_current == NULL) {
1176 6 0 while(html_offset < html_size)
1178 0 6 if(html[html_offset] == '=')
1185 0 6 else if(html[html_offset] == '>')
1193 0 0 if(myhtml_queue_add(tree, html_offset, token_node) != MyHTML_STATUS_OK) {
1199 0 0 if(tree->attr_current == NULL) {
1206 6 0 else if(html[html_offset] == '"' || html[html_offset] == '\'' || html[html_offset] == '<')
6 0 else if(html[html_offset] == '"' || html[html_offset] == '\'' || html[html_offset] == '<')
0 6 else if(html[html_offset] == '"' || html[html_offset] == '\'' || html[html_offset] == '<')
1209 0 0 if(tree->attr_current == NULL) {
1214 0 0 myhtml_parser_queue_set_attr(tree, token_node)
1224 6 0 else if(myhtml_whithspace(html[html_offset], !=, &&))
6 0 else if(myhtml_whithspace(html[html_offset], !=, &&))
6 0 else if(myhtml_whithspace(html[html_offset], !=, &&))
6 0 else if(myhtml_whithspace(html[html_offset], !=, &&))
6 0 else if(myhtml_whithspace(html[html_offset], !=, &&))
1227 0 6 if(tree->attr_current == NULL) {
1232 0 6 myhtml_parser_queue_set_attr(tree, token_node)
1255 147 0 while(html_offset < html_size)
1257 0 147 if(html[html_offset] == '>') {
1267 0 0 if(myhtml_queue_add(tree, html_offset, token_node) != MyHTML_STATUS_OK) {
1273 0 0 if(tree->attr_current == NULL) {
1280 147 0 else if(myhtml_whithspace(html[html_offset], !=, &&))
147 0 else if(myhtml_whithspace(html[html_offset], !=, &&))
147 0 else if(myhtml_whithspace(html[html_offset], !=, &&))
147 0 else if(myhtml_whithspace(html[html_offset], !=, &&))
147 0 else if(myhtml_whithspace(html[html_offset], !=, &&))
1282 147 0 if(html[html_offset] == '"') {
1286 0 0 else if(html[html_offset] == '\'') {
1313 967 0 while(html_offset < html_size)
1315 147 820 if(html[html_offset] == '"')
1320 0 147 if(tree->attr_current == NULL) {
1345 0 0 while(html_offset < html_size)
1347 0 0 if(html[html_offset] == '\'')
1352 0 0 if(tree->attr_current == NULL) {
1375 0 0 while(html_offset < html_size)
1377 0 0 if(myhtml_whithspace(html[html_offset], ==, ||))
0 0 if(myhtml_whithspace(html[html_offset], ==, ||))
0 0 if(myhtml_whithspace(html[html_offset], ==, ||))
0 0 if(myhtml_whithspace(html[html_offset], ==, ||))
0 0 if(myhtml_whithspace(html[html_offset], ==, ||))
1384 0 0 if(tree->attr_current == NULL) {
1392 0 0 else if(html[html_offset] == '>') {
1404 0 0 if(myhtml_queue_add(tree, html_offset, token_node) != MyHTML_STATUS_OK) {
1410 0 0 if(tree->attr_current == NULL) {
1426 117 30 if(myhtml_whithspace(html[html_offset], ==, ||)) {
117 0 if(myhtml_whithspace(html[html_offset], ==, ||)) {
117 0 if(myhtml_whithspace(html[html_offset], ==, ||)) {
117 0 if(myhtml_whithspace(html[html_offset], ==, ||)) {
0 117 if(myhtml_whithspace(html[html_offset], ==, ||)) {
1430 0 117 else if(html[html_offset] == '/') {
1434 117 0 else if(html[html_offset] == '>') {
1441 0 117 if(myhtml_queue_add(tree, html_offset, token_node) != MyHTML_STATUS_OK) {
1461 0 61 if(html[html_offset] == '-')
1465 0 61 else if(html[html_offset] == '>')
1472 0 0 if(myhtml_queue_add(tree, html_offset, token_node) != MyHTML_STATUS_OK) {
1494 0 0 if(html[html_offset] == '-')
1498 0 0 else if(html[html_offset] == '>')
1505 0 0 if(myhtml_queue_add(tree, html_offset, token_node) != MyHTML_STATUS_OK) {
1527 1038 0 while(html_offset < html_size)
1529 61 977 if(html[html_offset] == '-')
1544 61 0 if(html[html_offset] == '-')
1559 61 0 if(html[html_offset] == '>')
1563 61 0 if(token_node->raw_length >= 2)
1572 0 61 if(myhtml_queue_add(tree, html_offset, token_node) != MyHTML_STATUS_OK) {
1579 0 0 else if(html[html_offset] == '!') {
1583 0 0 else if(html[html_offset] == '-') {
1596 0 0 if(html[html_offset] == '>')
1598 0 0 if(((tree->global_offset + html_offset) - 3) >= token_node->raw_begin) {
1605 0 0 if(myhtml_queue_add(tree, html_offset, token_node) != MyHTML_STATUS_OK) {
1616 0 0 if(myhtml_queue_add(tree, html_offset, token_node) != MyHTML_STATUS_OK) {
1624 0 0 else if(html[html_offset] == '-') {
1645 0 0 while(html_offset < html_size)
1647 0 0 if(html[html_offset] == '>')
1655 0 0 if(myhtml_queue_add(tree, html_offset, token_node) != MyHTML_STATUS_OK) {
1686 0 115 if(myhtml->parse_state_func == NULL)
1920 115 0 if(myhtml->parse_state_func)