| 80 | |
| 81 | |
| 82 | int strnicomp(const char *s1,const char *s2,size_t n) |
| 83 | { |
| 84 | #ifdef _WIN_ALL |
| 85 | // If we specify 'n' exceeding the actual string length, CompareString goes |
| 86 | // beyond the trailing zero and compares garbage. So we need to limit 'n' |
| 87 | // to real string length. |
| 88 | // It is important to use strnlen (or memchr(...,0)) instead of strlen, |
| 89 | // because data can be not zero terminated. |
| 90 | size_t l1=Min(strnlen(s1,n),n); |
| 91 | size_t l2=Min(strnlen(s2,n),n); |
| 92 | return CompareStringA(LOCALE_USER_DEFAULT,NORM_IGNORECASE|SORT_STRINGSORT,s1,(int)l1,s2,(int)l2)-2; |
| 93 | #else |
| 94 | if (n==0) |
| 95 | return 0; |
| 96 | while (toupper(*s1)==toupper(*s2)) |
| 97 | { |
| 98 | if (*s1==0 || --n==0) |
| 99 | return 0; |
| 100 | s1++; |
| 101 | s2++; |
| 102 | } |
| 103 | return s1 < s2 ? -1 : 1; |
| 104 | #endif |
| 105 | } |
| 106 | |
| 107 | |
| 108 | wchar* RemoveEOL(wchar *Str) |
nothing calls this directly
no outgoing calls
no test coverage detected