Changeset 70074 in webkit
- Timestamp:
- Oct 19, 2010 12:23:49 PM (14 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r70041 r70074 1 2010-10-19 Patrick Gansterer <paroga@webkit.org> 2 3 Reviewed by David Kilzer. 4 5 Use UChar instead of wchar_t in UnicodeWinCE 6 https://bugs.webkit.org/show_bug.cgi?id=47904 7 8 Make UnicodeWinCE more portable, so we can use it for other ports too. 9 10 * wtf/unicode/wince/UnicodeWinCE.cpp: 11 (WTF::Unicode::toLower): 12 (WTF::Unicode::toUpper): 13 (WTF::Unicode::foldCase): 14 (WTF::Unicode::isPrintableChar): 15 (WTF::Unicode::isSpace): 16 (WTF::Unicode::isLetter): 17 (WTF::Unicode::isUpper): 18 (WTF::Unicode::isLower): 19 (WTF::Unicode::isDigit): 20 (WTF::Unicode::isPunct): 21 (WTF::Unicode::isAlphanumeric): 22 (WTF::Unicode::toTitleCase): 23 (WTF::Unicode::mirroredChar): 24 (WTF::Unicode::digitValue): 25 * wtf/unicode/wince/UnicodeWinCE.h: 26 (WTF::Unicode::isSeparatorSpace): 27 (WTF::Unicode::isHighSurrogate): 28 (WTF::Unicode::isLowSurrogate): 29 (WTF::Unicode::umemcasecmp): 30 (WTF::Unicode::surrogateToUcs4): 31 1 32 2010-10-19 Patrick Gansterer <paroga@webkit.org> 2 33 -
trunk/JavaScriptCore/wtf/unicode/wince/UnicodeWinCE.cpp
r70041 r70074 28 28 namespace Unicode { 29 29 30 wchar_t toLower(wchar_tc)30 UChar toLower(UChar c) 31 31 { 32 32 return towlower(c); 33 33 } 34 34 35 wchar_t toUpper(wchar_tc)35 UChar toUpper(UChar c) 36 36 { 37 37 return towupper(c); 38 38 } 39 39 40 wchar_t foldCase(wchar_tc)40 UChar foldCase(UChar c) 41 41 { 42 42 return towlower(c); 43 43 } 44 44 45 bool isPrintableChar( wchar_tc)45 bool isPrintableChar(UChar c) 46 46 { 47 47 return !!iswprint(c); 48 48 } 49 49 50 bool isSpace( wchar_tc)50 bool isSpace(UChar c) 51 51 { 52 52 return !!iswspace(c); 53 53 } 54 54 55 bool isLetter( wchar_tc)55 bool isLetter(UChar c) 56 56 { 57 57 return !!iswalpha(c); 58 58 } 59 59 60 bool isUpper( wchar_tc)60 bool isUpper(UChar c) 61 61 { 62 62 return !!iswupper(c); 63 63 } 64 64 65 bool isLower( wchar_tc)65 bool isLower(UChar c) 66 66 { 67 67 return !!iswlower(c); 68 68 } 69 69 70 bool isDigit( wchar_tc)70 bool isDigit(UChar c) 71 71 { 72 72 return !!iswdigit(c); 73 73 } 74 74 75 bool isPunct( wchar_tc)75 bool isPunct(UChar c) 76 76 { 77 77 return !!iswpunct(c); 78 78 } 79 79 80 bool isAlphanumeric( wchar_tc)80 bool isAlphanumeric(UChar c) 81 81 { 82 82 return !!iswalnum(c); 83 83 } 84 84 85 int toLower( wchar_t* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError)85 int toLower(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError) 86 86 { 87 87 const UChar* sourceIterator = source; … … 107 107 } 108 108 109 int toUpper( wchar_t* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError)109 int toUpper(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError) 110 110 { 111 111 const UChar* sourceIterator = source; … … 131 131 } 132 132 133 int foldCase( wchar_t* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError)133 int foldCase(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError) 134 134 { 135 135 *isError = false; … … 143 143 } 144 144 145 wchar_t toTitleCase(wchar_tc)145 UChar toTitleCase(UChar c) 146 146 { 147 147 return towupper(c); … … 168 168 } 169 169 170 wchar_tmirroredChar(UChar32 c)170 UChar mirroredChar(UChar32 c) 171 171 { 172 172 return UnicodeCE::mirroredChar(c); 173 173 } 174 174 175 int digitValue( wchar_tc)175 int digitValue(UChar c) 176 176 { 177 177 return UnicodeCE::digitValue(c); -
trunk/JavaScriptCore/wtf/unicode/wince/UnicodeWinCE.h
r70041 r70074 120 120 CharCategory category(unsigned int); 121 121 122 bool isSpace( wchar_t);123 bool isLetter( wchar_t);124 bool isPrintableChar( wchar_t);125 bool isUpper( wchar_t);126 bool isLower( wchar_t);127 bool isPunct( wchar_t);128 bool isDigit( wchar_t);129 bool isAlphanumeric( wchar_t);130 inline bool isSeparatorSpace( wchar_tc) { return category(c) == Separator_Space; }131 inline bool isHighSurrogate( wchar_tc) { return (c & 0xfc00) == 0xd800; }132 inline bool isLowSurrogate( wchar_tc) { return (c & 0xfc00) == 0xdc00; }122 bool isSpace(UChar); 123 bool isLetter(UChar); 124 bool isPrintableChar(UChar); 125 bool isUpper(UChar); 126 bool isLower(UChar); 127 bool isPunct(UChar); 128 bool isDigit(UChar); 129 bool isAlphanumeric(UChar); 130 inline bool isSeparatorSpace(UChar c) { return category(c) == Separator_Space; } 131 inline bool isHighSurrogate(UChar c) { return (c & 0xfc00) == 0xd800; } 132 inline bool isLowSurrogate(UChar c) { return (c & 0xfc00) == 0xdc00; } 133 133 134 wchar_t toLower(wchar_t);135 wchar_t toUpper(wchar_t);136 wchar_t foldCase(wchar_t);137 wchar_t toTitleCase(wchar_t);138 int toLower( wchar_t* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError);139 int toUpper( wchar_t* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError);140 int foldCase(UChar* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError);134 UChar toLower(UChar); 135 UChar toUpper(UChar); 136 UChar foldCase(UChar); 137 UChar toTitleCase(UChar); 138 int toLower(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError); 139 int toUpper(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError); 140 int foldCase(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError); 141 141 142 int digitValue( wchar_t);142 int digitValue(UChar); 143 143 144 wchar_tmirroredChar(UChar32);144 UChar mirroredChar(UChar32); 145 145 unsigned char combiningClass(UChar32); 146 146 DecompositionType decompositionType(UChar32); … … 156 156 } 157 157 158 inline int umemcasecmp(const wchar_t* a, const wchar_t* b, int len)158 inline int umemcasecmp(const UChar* a, const UChar* b, int len) 159 159 { 160 160 for (int i = 0; i < len; ++i) { 161 wchar_tc1 = foldCase(a[i]);162 wchar_tc2 = foldCase(b[i]);161 UChar c1 = foldCase(a[i]); 162 UChar c2 = foldCase(b[i]); 163 163 if (c1 != c2) 164 164 return c1 - c2; … … 167 167 } 168 168 169 inline UChar32 surrogateToUcs4( wchar_t high, wchar_tlow)169 inline UChar32 surrogateToUcs4(UChar high, UChar low) 170 170 { 171 171 return (UChar32(high) << 10) + low - 0x35fdc00;
Note: See TracChangeset
for help on using the changeset viewer.