Changeset 66361 in vbox
- Timestamp:
- Mar 30, 2017 1:44:39 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 114302
- Location:
- trunk
- Files:
-
- 3 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/mangling.h
r65579 r66361 1838 1838 # define RTStrHash1N RT_MANGLER(RTStrHash1N) 1839 1839 # define RTStrICmp RT_MANGLER(RTStrICmp) 1840 # define RTStrICmpAscii RT_MANGLER(RTStrICmpAscii) 1840 1841 # define RTStrIStartsWith RT_MANGLER(RTStrIStartsWith) 1841 1842 # define RTStrIStr RT_MANGLER(RTStrIStr) -
trunk/include/iprt/string.h
r66284 r66361 2212 2212 2213 2213 /** 2214 * Performs a case insensitive string compare between a UTF-8 string and a 7-bit 2215 * ASCII string. 2216 * 2217 * This is potentially faster than RTStrICmp and drags in less dependencies. It 2218 * is really handy for hardcoded inputs. 2219 * 2220 * If the string encoding is invalid the function will assert (strict builds) 2221 * and use RTStrCmp for the remainder of the string. 2222 * 2223 * @returns < 0 if the first string less than the second string. 2224 * @returns 0 if the first string identical to the second string. 2225 * @returns > 0 if the first string greater than the second string. 2226 * @param psz1 First UTF-8 string. Null is allowed. 2227 * @param psz2 Second string, 7-bit ASCII. Null is allowed. 2228 * @sa RTUtf16ICmpAscii 2229 */ 2230 RTDECL(int) RTStrICmpAscii(const char *psz1, const char *psz2); 2231 2232 /** 2214 2233 * Checks whether @a pszString starts with @a pszStart. 2215 2234 * -
trunk/src/VBox/Runtime/Makefile.kmk
r66072 r66361 538 538 common/string/RTStrStartsWith.cpp \ 539 539 common/string/RTStrIStartsWith.cpp \ 540 common/string/RTStrICmpAscii.cpp \ 540 541 common/string/RTStrStr.cpp \ 541 542 common/string/RTUtf16Copy.cpp \ … … 1883 1884 common/string/RTStrCopyP.cpp \ 1884 1885 common/string/RTStrCopyPEx.cpp \ 1886 common/string/RTStrCmp.cpp \ 1887 common/string/RTStrICmpAscii.cpp \ 1885 1888 common/string/RTStrNLen.cpp \ 1886 1889 common/string/RTStrNLenEx.cpp \ … … 2063 2066 common/string/RTStrCopyP.cpp \ 2064 2067 common/string/RTStrCopyPEx.cpp \ 2068 common/string/RTStrICmpAscii.cpp \ 2065 2069 common/string/RTStrNCmp.cpp \ 2066 2070 common/string/RTStrNLen.cpp \ … … 2594 2598 common/string/strprintf.cpp \ 2595 2599 common/string/strprintf2.cpp \ 2600 common/string/RTStrCmp.cpp \ 2596 2601 common/string/RTStrCopy.cpp \ 2597 2602 common/string/RTStrCopyEx.cpp \ 2603 common/string/RTStrICmpAscii.cpp \ 2598 2604 common/table/avllu32.cpp \ 2599 2605 common/table/avlou32.cpp \ -
trunk/src/VBox/Runtime/common/string/RTStrICmpAscii.cpp
r66348 r66361 36 36 37 37 38 RTDECL(int) RT Utf16ICmpAscii(PCRTUTF16 pwsz1, const char *psz2)38 RTDECL(int) RTStrICmpAscii(const char *psz1, const char *psz2) 39 39 { 40 if (psz1 == psz2) 41 return 0; 42 if (!psz1) 43 return -1; 44 if (!psz2) 45 return 1; 46 40 47 for (;;) 41 48 { 42 RTU TF16 wc1 = *pwsz1++;43 unsigned char uch2 = *psz2++; Assert(uch2 < 0x80);44 if ( wc1 != uch2)49 RTUNICP uc1; 50 int rc = RTStrGetCpEx(&psz1, &uc1); 51 if (RT_SUCCESS(rc)) 45 52 { 46 if (wc1 >= 0x80) 47 return 1; 48 if (RT_C_TO_LOWER(wc1) != RT_C_TO_LOWER(uch2)) 49 return wc1 < uch2 ? -1 : 1; 53 unsigned char uch2 = *psz2++; Assert(uch2 < 0x80); 54 55 /* compare */ 56 int iDiff = uc1 - uch2; 57 if (iDiff) 58 { 59 if (uc1 >= 0x80) 60 return 1; 61 62 iDiff = RT_C_TO_LOWER(uc1) - RT_C_TO_LOWER(uch2); /* Return lower cased diff! */ 63 if (iDiff) 64 return iDiff; 65 } 66 67 if (uch2) 68 { /* likely */ } 69 else 70 return 0; 50 71 } 51 if (!uch2) 52 return 0; 72 /* Hit some bad encoding, continue in case sensitive mode. */ 73 else 74 return RTStrCmp(psz1 - 1, psz2); 53 75 } 54 76 } 55 RT_EXPORT_SYMBOL(RT Utf16ICmpAscii);77 RT_EXPORT_SYMBOL(RTStrICmpAscii); 56 78
Note:
See TracChangeset
for help on using the changeset viewer.