Changeset 70074 in webkit


Ignore:
Timestamp:
Oct 19, 2010 12:23:49 PM (14 years ago)
Author:
Patrick Gansterer
Message:

2010-10-19 Patrick Gansterer <Patrick Gansterer>

Reviewed by David Kilzer.

Use UChar instead of wchar_t in UnicodeWinCE
https://bugs.webkit.org/show_bug.cgi?id=47904

Make UnicodeWinCE more portable, so we can use it for other ports too.

  • wtf/unicode/wince/UnicodeWinCE.cpp: (WTF::Unicode::toLower): (WTF::Unicode::toUpper): (WTF::Unicode::foldCase): (WTF::Unicode::isPrintableChar): (WTF::Unicode::isSpace): (WTF::Unicode::isLetter): (WTF::Unicode::isUpper): (WTF::Unicode::isLower): (WTF::Unicode::isDigit): (WTF::Unicode::isPunct): (WTF::Unicode::isAlphanumeric): (WTF::Unicode::toTitleCase): (WTF::Unicode::mirroredChar): (WTF::Unicode::digitValue):
  • wtf/unicode/wince/UnicodeWinCE.h: (WTF::Unicode::isSeparatorSpace): (WTF::Unicode::isHighSurrogate): (WTF::Unicode::isLowSurrogate): (WTF::Unicode::umemcasecmp): (WTF::Unicode::surrogateToUcs4):
Location:
trunk/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r70041 r70074  
     12010-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
    1322010-10-19  Patrick Gansterer  <paroga@webkit.org>
    233
  • trunk/JavaScriptCore/wtf/unicode/wince/UnicodeWinCE.cpp

    r70041 r70074  
    2828namespace Unicode {
    2929
    30 wchar_t toLower(wchar_t c)
     30UChar toLower(UChar c)
    3131{
    3232    return towlower(c);
    3333}
    3434
    35 wchar_t toUpper(wchar_t c)
     35UChar toUpper(UChar c)
    3636{
    3737    return towupper(c);
    3838}
    3939
    40 wchar_t foldCase(wchar_t c)
     40UChar foldCase(UChar c)
    4141{
    4242    return towlower(c);
    4343}
    4444
    45 bool isPrintableChar(wchar_t c)
     45bool isPrintableChar(UChar c)
    4646{
    4747    return !!iswprint(c);
    4848}
    4949
    50 bool isSpace(wchar_t c)
     50bool isSpace(UChar c)
    5151{
    5252    return !!iswspace(c);
    5353}
    5454
    55 bool isLetter(wchar_t c)
     55bool isLetter(UChar c)
    5656{
    5757    return !!iswalpha(c);
    5858}
    5959
    60 bool isUpper(wchar_t c)
     60bool isUpper(UChar c)
    6161{
    6262    return !!iswupper(c);
    6363}
    6464
    65 bool isLower(wchar_t c)
     65bool isLower(UChar c)
    6666{
    6767    return !!iswlower(c);
    6868}
    6969
    70 bool isDigit(wchar_t c)
     70bool isDigit(UChar c)
    7171{
    7272    return !!iswdigit(c);
    7373}
    7474
    75 bool isPunct(wchar_t c)
     75bool isPunct(UChar c)
    7676{
    7777    return !!iswpunct(c);
    7878}
    7979
    80 bool isAlphanumeric(wchar_t c)
     80bool isAlphanumeric(UChar c)
    8181{
    8282    return !!iswalnum(c);
    8383}
    8484
    85 int toLower(wchar_t* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError)
     85int toLower(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError)
    8686{
    8787    const UChar* sourceIterator = source;
     
    107107}
    108108
    109 int toUpper(wchar_t* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError)
     109int toUpper(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError)
    110110{
    111111    const UChar* sourceIterator = source;
     
    131131}
    132132
    133 int foldCase(wchar_t* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError)
     133int foldCase(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError)
    134134{
    135135    *isError = false;
     
    143143}
    144144
    145 wchar_t toTitleCase(wchar_t c)
     145UChar toTitleCase(UChar c)
    146146{
    147147    return towupper(c);
     
    168168}
    169169
    170 wchar_t mirroredChar(UChar32 c)
     170UChar mirroredChar(UChar32 c)
    171171{
    172172    return UnicodeCE::mirroredChar(c);
    173173}
    174174
    175 int digitValue(wchar_t c)
     175int digitValue(UChar c)
    176176{
    177177    return UnicodeCE::digitValue(c);
  • trunk/JavaScriptCore/wtf/unicode/wince/UnicodeWinCE.h

    r70041 r70074  
    120120CharCategory category(unsigned int);
    121121
    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_t c) { return category(c) == Separator_Space; }
    131 inline bool isHighSurrogate(wchar_t c) { return (c & 0xfc00) == 0xd800; }
    132 inline bool isLowSurrogate(wchar_t c) { return (c & 0xfc00) == 0xdc00; }
     122bool isSpace(UChar);
     123bool isLetter(UChar);
     124bool isPrintableChar(UChar);
     125bool isUpper(UChar);
     126bool isLower(UChar);
     127bool isPunct(UChar);
     128bool isDigit(UChar);
     129bool isAlphanumeric(UChar);
     130inline bool isSeparatorSpace(UChar c) { return category(c) == Separator_Space; }
     131inline bool isHighSurrogate(UChar c) { return (c & 0xfc00) == 0xd800; }
     132inline bool isLowSurrogate(UChar c) { return (c & 0xfc00) == 0xdc00; }
    133133
    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);
     134UChar toLower(UChar);
     135UChar toUpper(UChar);
     136UChar foldCase(UChar);
     137UChar toTitleCase(UChar);
     138int toLower(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError);
     139int toUpper(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError);
     140int foldCase(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError);
    141141
    142 int digitValue(wchar_t);
     142int digitValue(UChar);
    143143
    144 wchar_t mirroredChar(UChar32);
     144UChar mirroredChar(UChar32);
    145145unsigned char combiningClass(UChar32);
    146146DecompositionType decompositionType(UChar32);
     
    156156}
    157157
    158 inline int umemcasecmp(const wchar_t* a, const wchar_t* b, int len)
     158inline int umemcasecmp(const UChar* a, const UChar* b, int len)
    159159{
    160160    for (int i = 0; i < len; ++i) {
    161         wchar_t c1 = foldCase(a[i]);
    162         wchar_t c2 = foldCase(b[i]);
     161        UChar c1 = foldCase(a[i]);
     162        UChar c2 = foldCase(b[i]);
    163163        if (c1 != c2)
    164164            return c1 - c2;
     
    167167}
    168168
    169 inline UChar32 surrogateToUcs4(wchar_t high, wchar_t low)
     169inline UChar32 surrogateToUcs4(UChar high, UChar low)
    170170{
    171171    return (UChar32(high) << 10) + low - 0x35fdc00;
Note: See TracChangeset for help on using the changeset viewer.