Branch Coverage

third_party/modest/source/myhtml/myhtml.c
Criterion Covered Total %
branch 238 628 37.9


line true false branch
27 115 0 if(myhtml->marker)
33 115 0 if(myhtml->marker)
40 108 7 if(count == 0) {
48 0 7 if(myhtml->thread_stream == NULL)
53 0 7 if(*status)
61 108 7 if(count == 0) {
69 0 7 if(myhtml->thread_stream == NULL) {
76 0 7 if(*status)
87 0 115 if(myhtml_stream_create(myhtml, &status, stream_count, 0)) {
92 0 115 if(myhtml_batch_create(myhtml, &status, batch_count, stream_count)) {
114 0 115 if(status)
126 0 115 if(status)
129 0 115 if(thread_count == 0) {
135 0 108 if((status = myhtml_create_stream_and_batch(myhtml, 0, 0)))
141 0 0 if((status = myhtml_create_stream_and_batch(myhtml, 1, 0)))
151 0 7 if(thread_count < 2)
154 0 7 if((status = myhtml_create_stream_and_batch(myhtml, 1, (thread_count - 1))))
161 0 7 if(status)
164 7 7 for(size_t i = 0; i < myhtml->thread_batch->entries_size; i++) {
167 0 7 if(status)
182 0 115 if(status)
197 0 115 if(myhtml == NULL)
203 7 108 if(myhtml->thread_stream) {
206 7 0 if(queue_list)
211 7 0 if(myhtml->thread_batch)
214 7 0 if(queue_list)
221 115 0 if(myhtml->insertion_func)
231 0 126 if(tree->flags & MyHTML_TREE_FLAGS_PARSE_END) {
238 0 126 if(status)
246 0 17 if(tree->flags & MyHTML_TREE_FLAGS_PARSE_END) {
250 0 17 if(tag_id == 0)
253 0 17 if(ns == 0)
256 0 17 if(myhtml_tokenizer_fragment_init(tree, tag_id, ns) == NULL)
262 0 17 if(status)
270 0 0 if(tree->flags & MyHTML_TREE_FLAGS_PARSE_END) {
280 0 0 if(status)
288 0 0 if(tree->flags & MyHTML_TREE_FLAGS_PARSE_END) {
292 0 0 if(tag_id == 0)
295 0 0 if(ns == 0)
300 0 0 if(myhtml_tokenizer_fragment_init(tree, tag_id, ns) == NULL)
307 0 0 if(status)
315 0 5 if(tree->flags & MyHTML_TREE_FLAGS_PARSE_END) {
324 0 0 if(tree->flags & MyHTML_TREE_FLAGS_PARSE_END) {
328 0 0 if(tag_id == 0)
331 0 0 if(ns == 0)
334 0 0 if(myhtml_tokenizer_fragment_init(tree, tag_id, ns) == NULL)
342 0 0 if((tree->flags & MyHTML_TREE_FLAGS_SINGLE_MODE) == 0)
350 0 0 if((tree->flags & MyHTML_TREE_FLAGS_SINGLE_MODE) == 0)
363 0 147 if(encoding >= MyENCODING_LAST_ENTRY)
381 480 64 while(node) {
382 64 416 if(node->tag_id == tag_id) {
386 0 64 if(collection->length >= collection->size)
390 0 0 if(mystatus != MyHTML_STATUS_OK)
395 48 432 if(node->child)
406 0 16 if(node == NULL)
411 16 0 if(collection == NULL) {
415 0 16 if(mystatus) {
416 0 0 if(status)
422 16 0 if(node->child)
427 0 16 if(status)
436 8 16 if(tag_ctx == NULL) {
444 0 0 if(collection == NULL) {
447 0 0 if(collection == NULL)
453 0 0 while(node)
455 0 0 if(node->tag_id == tag_id)
457 0 0 if(myhtml_collection_check_size(collection, 1, 1024) == MyHTML_STATUS_OK) {
462 0 0 if(status)
469 0 0 if(node->child)
472 0 0 while(node != tree->node_html && node->next == NULL)
0 0 while(node != tree->node_html && node->next == NULL)
475 0 0 if(node == tree->node_html)
482 0 0 if(myhtml_collection_check_size(collection, 1, 1024) == MyHTML_STATUS_OK) {
485 0 0 else if(status) {
496 0 0 if(tag_ctx == NULL)
507 0 0 if(tree->fragment) {
509 0 0 if(tree->document && tree->document->child)
0 0 if(tree->document && tree->document->child)
512 0 0 else if(tree->document) {
577 0 0 if(target == NULL || node == NULL)
0 0 if(target == NULL || node == NULL)
587 0 0 if(target == NULL || node == NULL)
0 0 if(target == NULL || node == NULL)
597 0 0 if(target == NULL || node == NULL)
0 0 if(target == NULL || node == NULL)
607 0 0 if(target == NULL || node == NULL)
0 0 if(target == NULL || node == NULL)
623 0 21 if(node == NULL)
626 0 21 if(encoding >= MyENCODING_LAST_ENTRY)
631 21 0 if(node->token == NULL) {
634 0 21 if(node->token == NULL)
640 21 0 if(node->token->str.data == NULL) {
644 0 0 if(node->token->str.size < length) {
652 0 21 if(encoding != MyENCODING_UTF_8) {
667 0 0 if(node == NULL)
670 0 0 if(encoding >= MyENCODING_LAST_ENTRY)
675 0 0 if(node->token == NULL) {
678 0 0 if(node->token == NULL)
684 0 0 if(node->token->str.data == NULL) {
688 0 0 if(node->token->str.size < length) {
733 167 0 if(length)
736 167 0 if(tree == NULL || tree->tags == NULL)
0 167 if(tree == NULL || tree->tags == NULL)
741 0 167 if(tag_ctx == NULL)
744 167 0 if(length)
752 452 0 if(tree == NULL || tree->tags == NULL)
0 452 if(tree == NULL || tree->tags == NULL)
757 60 392 if(ctx == NULL)
765 2 0 if(node->token)
774 2 36 switch (node->tag_id)
804 2 0 if(node->token)
812 0 0 if(node->token)
820 214 0 if(node->token && node->token->str.length && node->token->str.data)
214 0 if(node->token && node->token->str.length && node->token->str.data)
214 0 if(node->token && node->token->str.length && node->token->str.data)
822 214 0 if(length)
828 0 0 if(length)
836 0 0 if(node && node->token)
0 0 if(node && node->token)
844 0 0 if(node && node->token)
0 0 if(node && node->token)
852 0 0 if(node && node->token)
0 0 if(node && node->token)
875 0 0 while(node)
877 0 0 if(node->token && node->token->attr_first) {
0 0 if(node->token && node->token->attr_first) {
880 0 0 while(attr) {
883 0 0 if(str_key->length == key_len && mycore_strncasecmp(str_key->data, key, key_len) == 0) {
0 0 if(str_key->length == key_len && mycore_strncasecmp(str_key->data, key, key_len) == 0) {
887 0 0 if(collection->length >= collection->size) {
890 0 0 if(status)
899 0 0 if(node->child) {
902 0 0 if(status)
914 0 0 if(collection == NULL) {
917 0 0 if((status && *status) || collection == NULL)
0 0 if((status && *status) || collection == NULL)
0 0 if((status && *status) || collection == NULL)
921 0 0 if(scope_node == NULL)
926 0 0 if(rec_status && status)
0 0 if(rec_status && status)
935 40 24 return str->length == value_len && mycore_strncmp(str->data, value, value_len) == 0;
12 28 return str->length == value_len && mycore_strncmp(str->data, value, value_len) == 0;
940 36 92 if(str->length < value_len)
945 20 72 if(mycore_strncmp(data, value, value_len) == 0) {
946 4 16 if((str->length > value_len && mycore_utils_whithspace(data[value_len], ==, ||)) || str->length == value_len)
0 4 if((str->length > value_len && mycore_utils_whithspace(data[value_len], ==, ||)) || str->length == value_len)
0 0 if((str->length > value_len && mycore_utils_whithspace(data[value_len], ==, ||)) || str->length == value_len)
0 0 if((str->length > value_len && mycore_utils_whithspace(data[value_len], ==, ||)) || str->length == value_len)
0 0 if((str->length > value_len && mycore_utils_whithspace(data[value_len], ==, ||)) || str->length == value_len)
0 0 if((str->length > value_len && mycore_utils_whithspace(data[value_len], ==, ||)) || str->length == value_len)
16 0 if((str->length > value_len && mycore_utils_whithspace(data[value_len], ==, ||)) || str->length == value_len)
950 368 60 for(size_t i = 1; (str->length - i) >= value_len; i++)
952 304 64 if(mycore_utils_whithspace(data[(i - 1)], ==, ||)) {
304 0 if(mycore_utils_whithspace(data[(i - 1)], ==, ||)) {
304 0 if(mycore_utils_whithspace(data[(i - 1)], ==, ||)) {
304 0 if(mycore_utils_whithspace(data[(i - 1)], ==, ||)) {
0 304 if(mycore_utils_whithspace(data[(i - 1)], ==, ||)) {
953 16 48 if(mycore_strncmp(&data[i], value, value_len) == 0) {
954 8 8 if((i > value_len && mycore_utils_whithspace(data[(i + value_len)], ==, ||)) || (str->length - i) == value_len)
4 4 if((i > value_len && mycore_utils_whithspace(data[(i + value_len)], ==, ||)) || (str->length - i) == value_len)
4 0 if((i > value_len && mycore_utils_whithspace(data[(i + value_len)], ==, ||)) || (str->length - i) == value_len)
4 0 if((i > value_len && mycore_utils_whithspace(data[(i + value_len)], ==, ||)) || (str->length - i) == value_len)
4 0 if((i > value_len && mycore_utils_whithspace(data[(i + value_len)], ==, ||)) || (str->length - i) == value_len)
4 0 if((i > value_len && mycore_utils_whithspace(data[(i + value_len)], ==, ||)) || (str->length - i) == value_len)
8 4 if((i > value_len && mycore_utils_whithspace(data[(i + value_len)], ==, ||)) || (str->length - i) == value_len)
965 0 8 if(str->length < value_len)
973 0 8 if(str->length < value_len)
981 0 8 if(str->length < value_len)
986 112 4 for(size_t i = 0; (str->length - i) >= value_len; i++)
988 4 108 if(mycore_strncmp(&data[i], value, value_len) == 0) {
1000 0 16 if(str->length < value_len)
1002 0 16 else if(str->length == value_len && mycore_strncmp(data, value, value_len) == 0) {
0 0 else if(str->length == value_len && mycore_strncmp(data, value, value_len) == 0) {
1005 8 8 else if(mycore_strncmp(data, value, value_len) == 0 && data[value_len] == '-') {
4 4 else if(mycore_strncmp(data, value, value_len) == 0 && data[value_len] == '-') {
1015 8 8 return str->length == value_len && mycore_strncasecmp(str->data, value, value_len) == 0;
4 4 return str->length == value_len && mycore_strncasecmp(str->data, value, value_len) == 0;
1020 0 16 if(str->length < value_len)
1025 0 16 if(mycore_strncasecmp(data, value, value_len) == 0) {
1026 0 0 if((str->length > value_len && mycore_utils_whithspace(data[value_len], ==, ||)) || str->length == value_len)
0 0 if((str->length > value_len && mycore_utils_whithspace(data[value_len], ==, ||)) || str->length == value_len)
0 0 if((str->length > value_len && mycore_utils_whithspace(data[value_len], ==, ||)) || str->length == value_len)
0 0 if((str->length > value_len && mycore_utils_whithspace(data[value_len], ==, ||)) || str->length == value_len)
0 0 if((str->length > value_len && mycore_utils_whithspace(data[value_len], ==, ||)) || str->length == value_len)
0 0 if((str->length > value_len && mycore_utils_whithspace(data[value_len], ==, ||)) || str->length == value_len)
0 0 if((str->length > value_len && mycore_utils_whithspace(data[value_len], ==, ||)) || str->length == value_len)
1030 228 12 for(size_t i = 1; (str->length - i) >= value_len; i++)
1032 180 48 if(mycore_utils_whithspace(data[(i - 1)], ==, ||)) {
180 0 if(mycore_utils_whithspace(data[(i - 1)], ==, ||)) {
180 0 if(mycore_utils_whithspace(data[(i - 1)], ==, ||)) {
180 0 if(mycore_utils_whithspace(data[(i - 1)], ==, ||)) {
0 180 if(mycore_utils_whithspace(data[(i - 1)], ==, ||)) {
1033 8 40 if(mycore_strncasecmp(&data[i], value, value_len) == 0) {
1034 8 0 if((i > value_len && mycore_utils_whithspace(data[(i + value_len)], ==, ||)) || (str->length - i) == value_len)
4 4 if((i > value_len && mycore_utils_whithspace(data[(i + value_len)], ==, ||)) || (str->length - i) == value_len)
4 0 if((i > value_len && mycore_utils_whithspace(data[(i + value_len)], ==, ||)) || (str->length - i) == value_len)
4 0 if((i > value_len && mycore_utils_whithspace(data[(i + value_len)], ==, ||)) || (str->length - i) == value_len)
4 0 if((i > value_len && mycore_utils_whithspace(data[(i + value_len)], ==, ||)) || (str->length - i) == value_len)
4 0 if((i > value_len && mycore_utils_whithspace(data[(i + value_len)], ==, ||)) || (str->length - i) == value_len)
0 4 if((i > value_len && mycore_utils_whithspace(data[(i + value_len)], ==, ||)) || (str->length - i) == value_len)
1045 0 8 if(str->length < value_len)
1053 0 8 if(str->length < value_len)
1061 0 8 if(str->length < value_len)
1066 108 4 for(size_t i = 0; (str->length - i) >= value_len; i++)
1068 4 104 if(mycore_strncasecmp(&data[i], value, value_len) == 0) {
1080 0 16 if(str->length < value_len)
1082 0 16 else if(str->length == value_len && mycore_strncasecmp(data, value, value_len) == 0) {
0 0 else if(str->length == value_len && mycore_strncasecmp(data, value, value_len) == 0) {
1085 8 8 else if(mycore_strncasecmp(data, value, value_len) == 0 && data[value_len] == '-') {
4 4 else if(mycore_strncasecmp(data, value, value_len) == 0 && data[value_len] == '-') {
1097 0 0 while(node)
1099 0 0 if(node->token && node->token->attr_first) {
0 0 if(node->token && node->token->attr_first) {
1102 0 0 while(attr) {
1105 0 0 if(func_eq(str, value, value_len)) {
1109 0 0 if(collection->length >= collection->size) {
1112 0 0 if(status)
1121 0 0 if(node->child) {
1124 0 0 if(status)
1139 4216 680 while(node)
1141 3876 340 if(node->token && node->token->attr_first) {
1836 2040 if(node->token && node->token->attr_first) {
1144 2652 1836 while(attr) {
1148 400 2252 if(str_key->length == key_len && mycore_strncasecmp(str_key->data, key, key_len) == 0)
304 96 if(str_key->length == key_len && mycore_strncasecmp(str_key->data, key, key_len) == 0)
1150 84 220 if(func_eq(str, value, value_len)) {
1154 0 84 if(collection->length >= collection->size) {
1157 0 0 if(status)
1167 544 3672 if(node->child) {
1171 0 544 if(status)
1187 136 0 if(collection == NULL) {
1190 0 136 if((status && *status) || collection == NULL)
0 0 if((status && *status) || collection == NULL)
0 136 if((status && *status) || collection == NULL)
1194 0 136 if(node == NULL)
1199 136 0 if(key && key_len)
136 0 if(key && key_len)
1204 0 136 if(rec_status && status)
0 0 if(rec_status && status)
1216 8 20 if(case_insensitive) {
1233 8 36 if(case_insensitive) {
1250 8 8 if(case_insensitive) {
1267 8 8 if(case_insensitive) {
1284 8 8 if(case_insensitive) {
1301 8 8 if(case_insensitive) {
1337 46 0 if(attr->key.data && attr->key.length)
46 0 if(attr->key.data && attr->key.length)
1339 46 0 if(length)
1345 0 0 if(length)
1353 107 16 if(attr->value.data && attr->value.length)
106 1 if(attr->value.data && attr->value.length)
1355 106 0 if(length)
1361 17 0 if(length)
1369 0 0 if(attr)
1377 0 0 if(attr)
1385 120 0 if(node == NULL || node->token == NULL)
0 120 if(node == NULL || node->token == NULL)
1393 0 63 if(node == NULL)
1398 0 63 if(node->token == NULL) {
1401 0 0 if(node->token == NULL)
1413 0 0 if(node == NULL || node->token == NULL)
0 0 if(node == NULL || node->token == NULL)
1421 20 0 if(node == NULL || node->token == NULL)
0 20 if(node == NULL || node->token == NULL)
1429 33 0 if(node == NULL || node->token == NULL)
0 33 if(node == NULL || node->token == NULL)
1438 12 21 if(attr->key.data)
1440 21 12 if(attr->value.data)
1448 0 0 if(attr)
1456 0 0 if(attr)
1469 0 189 if(collection == NULL) {
1470 0 0 if(status)
1480 0 189 if(collection->list == NULL) {
1483 0 0 if(status)
1489 53 136 if(status)
1497 0 89 if((collection->length + need) >= collection->size)
1502 0 0 if(tmp) {
1515 0 0 if(collection)
1521 0 189 if(collection == NULL)
1524 189 0 if(collection->list)
1539 0 1685 if(tree->parse_flags & MyHTML_TREE_PARSE_FLAGS_SKIP_WHITESPACE_TOKEN) {
1540 0 0 if(token && token->tag_id == MyHTML_TAG__TEXT && token->type & MyHTML_TOKEN_TYPE_WHITESPACE)
0 0 if(token && token->tag_id == MyHTML_TAG__TEXT && token->type & MyHTML_TOKEN_TYPE_WHITESPACE)
0 0 if(token && token->tag_id == MyHTML_TAG__TEXT && token->type & MyHTML_TOKEN_TYPE_WHITESPACE)
1551 1663 22 if(tree->flags & MyHTML_TREE_FLAGS_SINGLE_MODE) {
1552 1663 0 if(qnode && token) {
1663 0 if(qnode && token) {
1562 22 0 if(qnode)
1568 0 22 if(tree->queue_entry->queue->nodes_length == 0) {
1587 0 1685 if(tree->current_qnode == NULL)
1593 1685 0 if(qnode && token)
1685 0 if(qnode && token)
1597 0 1685 if(tree->current_token_node == NULL)
1610 0 0 if(i == size)
1613 0 0 if((const unsigned char)(to_lowercase[i] > 0x40 && to_lowercase[i] < 0x5b ?
0 0 if((const unsigned char)(to_lowercase[i] > 0x40 && to_lowercase[i] < 0x5b ?
1614 0 0 (to_lowercase[i]|0x60) : to_lowercase[i]) != (const unsigned char)ab[i])
1627 0 501 if(node == NULL)
1630 315 186 return node->tag_id == tag_id && node->ns == MyHTML_NAMESPACE_HTML;
315 0 return node->tag_id == tag_id && node->ns == MyHTML_NAMESPACE_HTML;
1647 0 0 if (tag_id >= MyHTML_TAG_LAST_ENTRY) {
1651 0 0 if (tag_to == NULL
1652 0 0 || tag_to->name_length != tag_from->name_length
1653 0 0 || mycore_strncmp(tag_to->name, tag_from->name, tag_from->name_length) != 0)
1666 0 0 if(new_node->token) {
1679 0 0 if(scope_node && scope_node->tree && scope_node->tree->document == scope_node) {
0 0 if(scope_node && scope_node->tree && scope_node->tree->document == scope_node) {
0 0 if(scope_node && scope_node->tree && scope_node->tree->document == scope_node) {
1684 0 0 if (root == NULL) {
1690 0 0 while(src != NULL) {
1692 0 0 if (cloned == NULL) {
1698 0 0 if(src->child) {
1703 0 0 while(src != scope_node && src->next == NULL) {
0 0 while(src != scope_node && src->next == NULL) {
1708 0 0 if(src == scope_node) {