| 328 skipped lines |
|
| 330 | U | 330 | U | // End SString functions |
|
|
| | | 332 | A | bool PropSet::caseSensitiveFilenames = false; |
| | | 333 | A | |
| 332 | U | 334 | U | PropSet::PropSet() { |
|
|
| 334 | U | 336 | U | for (int root = 0; root < hashRoots; root++) |
|
| 124 skipped lines |
| 459 | U | 461 | U | VarChain(const char*var_=NULL, const VarChain *link_=NULL): var(var_), link(link_) {} |
|
|
| 461 | U | 463 | U | bool contains(const char *testVar) const { |
|
| 462 | C | return (var && (0 == strcmp(var, testVar))) | | 464 | C | return (var && (0 == strcmp(var, testVar))) |
| 463 | U | 465 | U | || (link && link->contains(testVar)); |
|
|
|
| 70 skipped lines |
|
|
|
| 539 | C | static bool IsSuffixCaseInsensitive(const char *target, const char *suffix) { | | 541 | C | static bool IsSuffix(const char *target, const char *suffix, bool caseSensitive) { |
| 540 | U | 542 | U | size_t lentarget = strlen(target); |
|
| 541 | U | 543 | U | size_t lensuffix = strlen(suffix); |
|
| 542 | U | 544 | U | if (lensuffix > lentarget) |
|
|
| | | 546 | A | if (caseSensitive) { |
| | | 547 | A | for (int i = static_cast<int>(lensuffix) - 1; i >= 0; i--) { |
| | | 548 | A | if (target[i + lentarget - lensuffix] != suffix[i]) |
| | | 549 | A | return false; |
| | | 550 | A | } |
| | | 551 | A | } else { |
| 544 | U | 552 | U | for (int i = static_cast<int>(lensuffix) - 1; i >= 0; i--) { |
|
| 545 | U | 553 | U | if (MakeUpperCase(target[i + lentarget - lensuffix]) != |
|
| 546 | U | 554 | U | MakeUpperCase(suffix[i])) |
|
|
|
| | | 557 | A | } |
|
|
|
| 25 skipped lines |
| 577 | U | 586 | U | char delchr = *del; |
|
|
| 579 | U | 588 | U | if (*keyfile == '*') { |
|
| 580 | C | if (IsSuffixCaseInsensitive(filename, keyfile + 1)) { | | 589 | C | if (IsSuffix(filename, keyfile + 1, caseSensitiveFilenames)) { |
|
| 582 | U | 591 | U | delete []keyptr; |
|
|
| 206 skipped lines |
|
|
|
| | | 802 | A | sortedNoCase = false; |
|
|
| 795 | U | 805 | U | void WordList::Set(const char *s) { |
|
| 796 | U | 806 | U | list = StringDup(s); |
|
|
| | | 808 | A | sortedNoCase = false; |
| 798 | U | 809 | U | words = ArrayFromWordList(list, &len, onlyLineEnds); |
|
| 799 | U | 810 | U | wordsNoCase = new char * [len + 1]; |
|
| 800 | U | 811 | U | memcpy(wordsNoCase, words, (len + 1) * sizeof (*words)); |
|
| 7 skipped lines |
|
| 809 | U | 820 | U | void WordList::SetFromAllocated() { |
|
|
| | | 822 | A | sortedNoCase = false; |
| 811 | U | 823 | U | words = ArrayFromWordList(list, &len, onlyLineEnds); |
|
| 812 | U | 824 | U | wordsNoCase = new char * [len + 1]; |
|
| 813 | U | 825 | U | memcpy(wordsNoCase, words, (len + 1) * sizeof (*words)); |
|
| 9 skipped lines |
| 823 | U | 835 | U | return CompareCaseInsensitive(*(char**)(a1), *(char**)(a2)); |
|
|
|
| 826 | C | static void SortWordList(char **words, char **wordsNoCase, unsigned int len) { | | 838 | C | static void SortWordList(char **words, unsigned int len) { |
| 827 | U | 839 | U | qsort(reinterpret_cast<void*>(words), len, sizeof(*words), |
|
|
| | | 841 | A | } |
| | | 842 | A | |
| | | 843 | A | static void SortWordListNoCase(char **wordsNoCase, unsigned int len) { |
| 829 | U | 844 | U | qsort(reinterpret_cast<void*>(wordsNoCase), len, sizeof(*wordsNoCase), |
|
| 830 | U | 845 | U | cmpStringNoCase); |
|
|
| 3 skipped lines |
|
|
|
| 838 | C | SortWordList(words, wordsNoCase, len); | | 853 | C | SortWordList(words, len); |
| 839 | U | 854 | U | for (unsigned int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++) |
|
|
| 841 | U | 856 | U | for (int l = len - 1; l >= 0; l--) { |
|
| 35 skipped lines |
|
|
|
| | | 895 | A | /** similar to InList, but word s can be a substring of keyword. |
| | | 896 | A | * eg. the keyword define is defined as def~ine. This means the word must start |
| | | 897 | A | * with def to be a keyword, but also defi, defin and define are valid. |
| | | 898 | A | * The marker is ~ in this case. |
| | | 899 | A | */ |
| 52 skipped lines |
| | | 952 | A | } |
| | | 953 | A | } |
| | | 954 | A | return false; |
| | | 955 | A | } |
| | | 956 | A | |
|
| 881 | U | 958 | U | * Returns an element (complete) of the wordlist array which has |
|
| 882 | U | 959 | U | * the same beginning as the passed string. |
|
| 9 skipped lines |
|
|
|
| 895 | R | if (!sorted) { | | |
| 896 | R | sorted = true; | | |
| 897 | R | SortWordList(words, wordsNoCase, len); | | |
| 898 | R | } | | |
| 899 | U | 972 | U | if (ignoreCase) { |
|
| | | 973 | A | if (!sortedNoCase) { |
| | | 974 | A | sortedNoCase = true; |
| | | 975 | A | SortWordListNoCase(wordsNoCase, len); |
| | | 976 | A | } |
| 900 | U | 977 | U | while (start <= end) { // binary searching loop |
|
| 901 | U | 978 | U | pivot = (start + end) >> 1; |
|
| 902 | U | 979 | U | word = wordsNoCase[pivot]; |
|
| 9 skipped lines |
| 912 | U | 989 | U | while (end < len-1 && !CompareNCaseInsensitive(wordStart, wordsNoCase[end+1], searchLen)) { |
|
|
|
| 915 | C | | | 992 | C | |
| 916 | U | 993 | U | // Finds first word in a series of equal words |
|
| 917 | U | 994 | U | for (pivot = start; pivot <= end; pivot++) { |
|
| 918 | U | 995 | U | word = wordsNoCase[pivot]; |
|
| 11 skipped lines |
| 930 | U | 1007 | U | end = pivot - 1; |
|
|
| 932 | U | 1009 | U | } else { // preserve the letter case |
|
| | | 1010 | A | if (!sorted) { |
| | | 1011 | A | sorted = true; |
| | | 1012 | A | SortWordList(words, len); |
| | | 1013 | A | } |
| 933 | U | 1014 | U | while (start <= end) { // binary searching loop |
|
| 934 | U | 1015 | U | pivot = (start + end) >> 1; |
|
| 935 | U | 1016 | U | word = words[pivot]; |
|
| 9 skipped lines |
| 945 | U | 1026 | U | while (end < len-1 && !strncmp(wordStart, words[end+1], searchLen)) { |
|
|
|
| 948 | C | | | 1029 | C | |
| 949 | U | 1030 | U | // Finds first word in a series of equal words |
|
|
| 951 | U | 1032 | U | while (pivot <= end) { |
|
| 68 skipped lines |
|
| 1021 | U | 1102 | U | if (0 == words) |
|
|
| 1023 | R | if (!sorted) { | | |
| 1024 | R | sorted = true; | | |
| 1025 | R | SortWordList(words, wordsNoCase, len); | | |
| 1026 | R | } | | |
| 1027 | U | 1104 | U | if (ignoreCase) { |
|
| | | 1105 | A | if (!sortedNoCase) { |
| | | 1106 | A | sortedNoCase = true; |
| | | 1107 | A | SortWordListNoCase(wordsNoCase, len); |
| | | 1108 | A | } |
| 1028 | U | 1109 | U | while (start <= end) { // Binary searching loop |
|
| 1029 | U | 1110 | U | pivot = (start + end) / 2; |
|
| 1030 | U | 1111 | U | cond = CompareNCaseInsensitive(wordStart, wordsNoCase[pivot], searchLen); |
|
| 22 skipped lines |
|
|
| 1055 | U | 1136 | U | } else {// Preserve the letter case |
|
| | | 1137 | A | if (!sorted) { |
| | | 1138 | A | sorted = true; |
| | | 1139 | A | SortWordList(words, len); |
| | | 1140 | A | } |
| 1056 | U | 1141 | U | while (start <= end) { // Binary searching loop |
|
| 1057 | U | 1142 | U | pivot = (start + end) / 2; |
|
| 1058 | U | 1143 | U | cond = strncmp(wordStart, words[pivot], searchLen); |
|
| 28 skipped lines |