Changeset 60481 in vbox for trunk/src/VBox/Runtime/common/string/utf-16-case.cpp
- Timestamp:
- Apr 13, 2016 8:14:41 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/string/utf-16-case.cpp
r57358 r60481 106 106 107 107 108 RTDECL(int) RTUtf16ICmpUtf8(PCRTUTF16 pwsz1, const char *psz2) 109 { 110 /* 111 * NULL and empty strings are all the same. 112 */ 113 if (!pwsz1) 114 return !psz2 || !*psz2 ? 0 : -1; 115 if (!psz2) 116 return !*pwsz1 ? 0 : 1; 117 118 /* 119 * Compare with a UTF-8 string by enumerating them char by char. 120 */ 121 for (;;) 122 { 123 RTUNICP uc1; 124 int rc = RTUtf16GetCpEx(&pwsz1, &uc1); 125 AssertRCReturn(rc, 1); 126 127 RTUNICP uc2; 128 rc = RTStrGetCpEx(&psz2, &uc2); 129 AssertRCReturn(rc, -1); 130 if (uc1 == uc2) 131 { 132 if (uc1) 133 continue; 134 return 0; 135 } 136 137 if (RTUniCpToUpper(uc1) == RTUniCpToUpper(uc2)) 138 continue; 139 if (RTUniCpToLower(uc1) == RTUniCpToLower(uc2)) 140 continue; 141 return uc1 < uc2 ? -1 : 1; 142 } 143 } 144 RT_EXPORT_SYMBOL(RTUtf16CmpIUtf8); 145 146 108 147 RTDECL(PRTUTF16) RTUtf16ToLower(PRTUTF16 pwsz) 109 148 {
Note:
See TracChangeset
for help on using the changeset viewer.