Branch Coverage

third_party/modest/source/myencoding/detect.c
Criterion Covered Total %
branch 226 428 52.8


line true false branch
31 2495 19 for (size_t i = 0; i < (length - 3); i++) {
32 1888 607 if(u_text[i] > 127)
34 1172076 1120 for (size_t j = 0; j < list_length; j++)
36 768 1171308 if(memcmp(list[j].trigram, &u_text[i], 3) == 0) {
40 4 764 if(res.value >= max_sum_for_break)
54 15 4 if(res->value >= min_value || res->count >= min_count)
0 15 if(res->value >= min_value || res->count >= min_count)
62 122 13 if(res->count_good == 0) {
63 4 118 if(res->count_bad)
68 13 0 else if(res->count_bad == 0)
72 0 0 if(percent_bad < max_bad_percent)
83 13807 134 while(i < length)
85 12922 885 if((u_text[i] & 0x80) == 0x00) {
89 84 801 else if((u_text[i] & 0xE0) == 0xC0) {
92 0 84 if(i >= length)
95 84 0 if(((u_text[i - 1] & 0x80) && (u_text[i - 1] & 0x40) == 0))
80 4 if(((u_text[i - 1] & 0x80) && (u_text[i - 1] & 0x40) == 0))
100 500 301 else if((u_text[i] & 0xF0) == 0xE0) {
103 1 499 if(i >= length)
106 499 0 if(((u_text[i - 1] & 0x80) && (u_text[i - 1] & 0x40) == 0) &&
0 499 if(((u_text[i - 1] & 0x80) && (u_text[i - 1] & 0x40) == 0) &&
0 0 if(((u_text[i - 1] & 0x80) && (u_text[i - 1] & 0x40) == 0) &&
107 0 0 ((u_text[i - 2] & 0x80) && (u_text[i - 2] & 0x40) == 0)) {
113 301 0 else if((u_text[i] & 0xF8) == 0xF0) {
116 0 301 if(i >= length)
119 1 300 if(((u_text[i - 1] & 0x80) && (u_text[i - 1] & 0x40) == 0) &&
0 1 if(((u_text[i - 1] & 0x80) && (u_text[i - 1] & 0x40) == 0) &&
0 0 if(((u_text[i - 1] & 0x80) && (u_text[i - 1] & 0x40) == 0) &&
120 0 0 ((u_text[i - 2] & 0x80) && (u_text[i - 2] & 0x40) == 0) &&
0 0 ((u_text[i - 2] & 0x80) && (u_text[i - 2] & 0x40) == 0) &&
121 0 0 ((u_text[i - 3] & 0x80) && (u_text[i - 3] & 0x40) == 0)) {
141 16046 138 while(i < length)
143 30 16016 if(u_text[i] == 0x00) {
144 0 30 if((i % 2) == 0) {
147 0 0 if(u_text[i] > 0x1F && u_text[i] < 0x7F)
0 0 if(u_text[i] > 0x1F && u_text[i] < 0x7F)
151 30 0 if(u_text[(i - 1)] > 0x1F && u_text[(i - 1)] < 0x7F)
30 0 if(u_text[(i - 1)] > 0x1F && u_text[(i - 1)] < 0x7F)
168 136 0 if(length > 2) {
169 1 135 if(u_text[0] == 0xEF &&
1 0 if(u_text[0] == 0xEF &&
170 1 0 u_text[1] == 0xBB &&
178 135 0 if(length > 1) {
179 0 135 if(u_text[0] == 0xFE && u_text[1] == 0xFF) {
0 0 if(u_text[0] == 0xFE && u_text[1] == 0xFF) {
184 0 135 if(u_text[0] == 0xFF && u_text[1] == 0xFE) {
0 0 if(u_text[0] == 0xFF && u_text[1] == 0xFE) {
216 1 135 if(myencoding_detect_bom(text, length, encoding))
218 1 0 if(*encoding == MyENCODING_UTF_8) {
240 138 0 if(res.count_bad == 0 && res.count_good >= 3) {
3 135 if(res.count_bad == 0 && res.count_good >= 3) {
244 0 135 else if(res.count_bad >= 3 && res.count_good == 0) {
0 0 else if(res.count_bad >= 3 && res.count_good == 0) {
250 131 4 if(myencoding_detect_unicode_has_end(&res, 10)) {
270 4 3 if(myencoding_detect_russian_has_end(&res, min_count, min_value)) {
276 1 2 if(max_value) {
281 0 3 if(myencoding_detect_russian_has_end(&res, min_count, min_value)) {
286 2 1 if(max_value < res.value) {
292 0 3 if(myencoding_detect_russian_has_end(&res, min_count, min_value)) {
297 0 3 if(max_value < res.value) {
303 0 3 if(myencoding_detect_russian_has_end(&res, min_count, min_value)) {
308 0 3 if(max_value < res.value) {
314 0 3 if(myencoding_detect_russian_has_end(&res, min_count, min_value)) {
319 0 3 if(max_value < res.value) {
330 133 4 if(myencoding_detect_unicode(text, length, encoding))
333 1 3 if(myencoding_detect_russian(text, length, encoding))
346 22 0 while (myencoding_detect_name_entry_static_list_index[idx].label)
348 21 1 if(myencoding_detect_name_entry_static_list_index[idx].label_length == length) {
349 18 3 if(mycore_strncasecmp(myencoding_detect_name_entry_static_list_index[idx].label, name, length) == 0)
352 3 0 if(myencoding_detect_name_entry_static_list_index[idx].next)
357 1 0 else if(myencoding_detect_name_entry_static_list_index[idx].label_length > length) {
372 18 1 if(entry) {
373 18 0 if(encoding)
384 1 2 if(encoding >= MyENCODING_LAST_ENTRY) {
385 1 0 if(length) {
394 2 0 if(length) {
418 0 2 if(found)
420 0 2 if(found_length)
431 24 0 while((length + charset_length) < data_size) {
432 2 22 if(mycore_ustrcasecmp_without_checks_by_secondary((const unsigned char*)"charset", &udata[length]))
437 2 0 while(length < data_size) {
438 2 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
2 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
2 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
2 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
439 2 0 udata[length] != 0x0D && udata[length] != 0x20)
448 2 0 if(udata[length] == 0x3D) { /* EQUALS SIGN (=) */
459 2 0 if(is_get_pos == false || length >= data_size)
0 2 if(is_get_pos == false || length >= data_size)
463 2 0 while(length < data_size) {
464 2 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
2 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
2 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
2 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
465 2 0 udata[length] != 0x0D && udata[length] != 0x20)
473 0 2 if(length >= data_size)
478 0 2 if(udata[length] == 0x22)
483 0 0 while(length < data_size) {
484 0 0 if(udata[length] == 0x22)
486 0 0 if(found)
488 0 0 if(found_length)
501 0 2 if(udata[length] == 0x27)
506 0 0 while(length < data_size) {
507 0 0 if(udata[length] == 0x27)
509 0 0 if(found)
511 0 0 if(found_length)
524 2 0 while(length < data_size) {
525 2 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
2 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
2 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
2 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
526 2 0 udata[length] != 0x0D && udata[length] != 0x20)
530 24 2 while(length < data_size) {
532 0 24 if(udata[length] == 0x3B)
534 0 0 if(found)
536 0 0 if(found_length)
545 0 2 if(found)
547 0 2 if(found_length)
567 120 0 while(length < data_size) {
568 120 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
120 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
120 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
120 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
569 120 0 udata[length] != 0x0D && udata[length] != 0x20 && udata[length] != 0x2F)
120 0 udata[length] != 0x0D && udata[length] != 0x20 && udata[length] != 0x2F)
577 0 120 if(length >= data_size) {
583 120 0 if(udata[length] != 0x3D) {
596 2 0 while(length < data_size) {
597 2 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
2 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
2 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
2 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
598 2 0 udata[length] != 0x0D && udata[length] != 0x20)
606 0 2 if(length >= data_size) {
617 45 0 while(length < data_size) {
618 2 43 if(udata[length] == 0x22)
633 0 0 while(length < data_size) {
634 0 0 if(udata[length] == 0x27)
652 0 0 while(length < data_size) {
653 0 0 if(udata[length] == 0x09 || udata[length] == 0x0A || udata[length] == 0x0C ||
0 0 if(udata[length] == 0x09 || udata[length] == 0x0A || udata[length] == 0x0C ||
0 0 if(udata[length] == 0x09 || udata[length] == 0x0A || udata[length] == 0x0C ||
0 0 if(udata[length] == 0x09 || udata[length] == 0x0A || udata[length] == 0x0C ||
654 0 0 udata[length] == 0x0D || udata[length] == 0x20 || udata[length] == 0x3E)
0 0 udata[length] == 0x0D || udata[length] == 0x20 || udata[length] == 0x3E)
679 740 0 while(length < data_size) {
680 740 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
740 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
740 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
740 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
681 739 1 udata[length] != 0x0D && udata[length] != 0x20 && udata[length] != 0x2F)
738 1 udata[length] != 0x0D && udata[length] != 0x20 && udata[length] != 0x2F)
689 0 738 if(length >= data_size) {
695 2 736 if(udata[length] == 0x3E) { /* (ASCII >) */
703 2408 0 while(length < data_size) {
706 2 0 if(attr->key_begin != (length - 1)) {
722 120 0 if(myencoding_prescan_stream_to_determine_encoding_get_attr_spaces(udata, &length, data_size, attr) == false) {
743 0 0 if(myencoding_prescan_stream_to_determine_encoding_get_attr_spaces(udata, &length, data_size, attr) == false) {
768 4 0 while(*length < data_size) {
775 1 0 if((is_exists & 1) == 0) {
788 1 0 if((is_exists & 2) == 0) {
791 1 0 if(myencoding_extracting_character_encoding_from_charset_with_found((const char*)(&udata[ attr.value_begin ]), attr.value_length, encoding, found, found_length)) {
799 0 0 if((is_exists & 4) == 0) {
802 0 0 if(found)
804 0 0 if(found_length)
812 2 2 if(it_last)
817 1 1 if(need_pragma == 0 || (need_pragma == 2 && got_pragma == false)) {
1 0 if(need_pragma == 0 || (need_pragma == 2 && got_pragma == false)) {
0 1 if(need_pragma == 0 || (need_pragma == 2 && got_pragma == false)) {
823 1 0 if(*encoding == MyENCODING_UTF_16BE || *encoding == MyENCODING_UTF_16LE) {
0 1 if(*encoding == MyENCODING_UTF_16BE || *encoding == MyENCODING_UTF_16LE) {
828 0 1 if(*encoding == MyENCODING_X_USER_DEFINED) {
838 746 0 while(length < data_size) {
839 746 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
740 6 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
740 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
740 0 if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C &&
840 734 6 udata[length] != 0x0D && udata[length] != 0x20)
848 0 734 if(length >= data_size)
851 0 734 if(udata[length] == 0x3E) {
858 734 0 while(length < data_size) {
861 734 0 if(it_last) {
871 361 467 if(udata[length] == 0x2F) { /* / */
874 0 361 if(length >= data_size)
877 361 0 if(mycore_tokenizer_chars_map[ udata[length] ] == MyCORE_STRING_MAP_CHAR_A_Z_a_z) {
881 0 0 while(length < data_size) {
882 0 0 if(udata[length] != 0x3E) {
891 94 373 else if(udata[length] == 0x21) { /* ! */
894 94 0 if((length + 2) < data_size && udata[length] == 0x2D && udata[(length+1)] == 0x2D) {
58 36 if((length + 2) < data_size && udata[length] == 0x2D && udata[(length+1)] == 0x2D) {
58 0 if((length + 2) < data_size && udata[length] == 0x2D && udata[(length+1)] == 0x2D) {
895 174 0 while(length < data_size) {
896 174 0 if(udata[length] != 0x3E) {
897 116 58 if(udata[(length - 1)] == 0x2D && udata[(length - 2)] == 0x2D)
58 58 if(udata[(length - 1)] == 0x2D && udata[(length - 2)] == 0x2D)
907 36 0 while(length < data_size) {
908 36 0 if(udata[length] != 0x3E) {
917 0 373 else if(udata[length] == 0x3F) { /* ? */
920 0 0 while(length < data_size) {
921 0 0 if(udata[length] != 0x3E) {
945 0 136 if(found)
947 0 136 if(found_length)
951 9615 126 while(i < data_size) {
953 840 8775 if(data[i] == 0x3C)
955 9 831 if((i + 5) >= data_size)
960 3 828 switch (data[i]) {
969 3 0 if(mycore_ustrcasecmp_without_checks_by_secondary((const unsigned char*)"meta", &udata[i])) {
972 3 0 if(udata[i] == 0x09 || udata[i] == 0x0A || udata[i] == 0x0C ||
3 0 if(udata[i] == 0x09 || udata[i] == 0x0A || udata[i] == 0x0C ||
3 0 if(udata[i] == 0x09 || udata[i] == 0x0A || udata[i] == 0x0C ||
3 0 if(udata[i] == 0x09 || udata[i] == 0x0A || udata[i] == 0x0C ||
973 1 2 udata[i] == 0x0D || udata[i] == 0x20 || udata[i] == 0x2F)
0 1 udata[i] == 0x0D || udata[i] == 0x20 || udata[i] == 0x2F)
977 1 1 if(myencoding_prescan_stream_to_determine_encoding_check_meta(udata, &i, data_size, &encoding, found, found_length))