Changeset 66361 in vbox for trunk/src/VBox/Runtime/common/string
- Timestamp:
- Mar 30, 2017 1:44:39 PM (8 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
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.