Commit abdfaa55 authored by paroga@webkit.org's avatar paroga@webkit.org
Browse files

2010-10-19 Patrick Gansterer <paroga@webkit.org>

        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):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70074 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 5ef4c464
2010-10-19 Patrick Gansterer <paroga@webkit.org>
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):
2010-10-19 Patrick Gansterer <paroga@webkit.org>
Reviewed by Andreas Kling.
......
......@@ -27,62 +27,62 @@
namespace WTF {
namespace Unicode {
wchar_t toLower(wchar_t c)
UChar toLower(UChar c)
{
return towlower(c);
}
wchar_t toUpper(wchar_t c)
UChar toUpper(UChar c)
{
return towupper(c);
}
wchar_t foldCase(wchar_t c)
UChar foldCase(UChar c)
{
return towlower(c);
}
bool isPrintableChar(wchar_t c)
bool isPrintableChar(UChar c)
{
return !!iswprint(c);
}
bool isSpace(wchar_t c)
bool isSpace(UChar c)
{
return !!iswspace(c);
}
bool isLetter(wchar_t c)
bool isLetter(UChar c)
{
return !!iswalpha(c);
}
bool isUpper(wchar_t c)
bool isUpper(UChar c)
{
return !!iswupper(c);
}
bool isLower(wchar_t c)
bool isLower(UChar c)
{
return !!iswlower(c);
}
bool isDigit(wchar_t c)
bool isDigit(UChar c)
{
return !!iswdigit(c);
}
bool isPunct(wchar_t c)
bool isPunct(UChar c)
{
return !!iswpunct(c);
}
bool isAlphanumeric(wchar_t c)
bool isAlphanumeric(UChar c)
{
return !!iswalnum(c);
}
int toLower(wchar_t* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError)
int toLower(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError)
{
const UChar* sourceIterator = source;
const UChar* sourceEnd = source + sourceLength;
......@@ -106,7 +106,7 @@ int toLower(wchar_t* result, int resultLength, const wchar_t* source, int source
return (resultIterator - result) + remainingCharacters;
}
int toUpper(wchar_t* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError)
int toUpper(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError)
{
const UChar* sourceIterator = source;
const UChar* sourceEnd = source + sourceLength;
......@@ -130,7 +130,7 @@ int toUpper(wchar_t* result, int resultLength, const wchar_t* source, int source
return (resultIterator - result) + remainingCharacters;
}
int foldCase(wchar_t* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError)
int foldCase(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError)
{
*isError = false;
if (resultLength < sourceLength) {
......@@ -142,7 +142,7 @@ int foldCase(wchar_t* result, int resultLength, const wchar_t* source, int sourc
return sourceLength;
}
wchar_t toTitleCase(wchar_t c)
UChar toTitleCase(UChar c)
{
return towupper(c);
}
......@@ -167,12 +167,12 @@ unsigned char combiningClass(UChar32 c)
return UnicodeCE::combiningClass(c);
}
wchar_t mirroredChar(UChar32 c)
UChar mirroredChar(UChar32 c)
{
return UnicodeCE::mirroredChar(c);
}
int digitValue(wchar_t c)
int digitValue(UChar c)
{
return UnicodeCE::digitValue(c);
}
......
......@@ -119,29 +119,29 @@ enum CharCategory {
CharCategory category(unsigned int);
bool isSpace(wchar_t);
bool isLetter(wchar_t);
bool isPrintableChar(wchar_t);
bool isUpper(wchar_t);
bool isLower(wchar_t);
bool isPunct(wchar_t);
bool isDigit(wchar_t);
bool isAlphanumeric(wchar_t);
inline bool isSeparatorSpace(wchar_t c) { return category(c) == Separator_Space; }
inline bool isHighSurrogate(wchar_t c) { return (c & 0xfc00) == 0xd800; }
inline bool isLowSurrogate(wchar_t c) { return (c & 0xfc00) == 0xdc00; }
wchar_t toLower(wchar_t);
wchar_t toUpper(wchar_t);
wchar_t foldCase(wchar_t);
wchar_t toTitleCase(wchar_t);
int toLower(wchar_t* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError);
int toUpper(wchar_t* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError);
int foldCase(UChar* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError);
int digitValue(wchar_t);
wchar_t mirroredChar(UChar32);
bool isSpace(UChar);
bool isLetter(UChar);
bool isPrintableChar(UChar);
bool isUpper(UChar);
bool isLower(UChar);
bool isPunct(UChar);
bool isDigit(UChar);
bool isAlphanumeric(UChar);
inline bool isSeparatorSpace(UChar c) { return category(c) == Separator_Space; }
inline bool isHighSurrogate(UChar c) { return (c & 0xfc00) == 0xd800; }
inline bool isLowSurrogate(UChar c) { return (c & 0xfc00) == 0xdc00; }
UChar toLower(UChar);
UChar toUpper(UChar);
UChar foldCase(UChar);
UChar toTitleCase(UChar);
int toLower(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError);
int toUpper(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError);
int foldCase(UChar* result, int resultLength, const UChar* source, int sourceLength, bool* isError);
int digitValue(UChar);
UChar mirroredChar(UChar32);
unsigned char combiningClass(UChar32);
DecompositionType decompositionType(UChar32);
Direction direction(UChar32);
......@@ -155,18 +155,18 @@ inline bool hasLineBreakingPropertyComplexContext(UChar32)
return false; // FIXME: implement!
}
inline int umemcasecmp(const wchar_t* a, const wchar_t* b, int len)
inline int umemcasecmp(const UChar* a, const UChar* b, int len)
{
for (int i = 0; i < len; ++i) {
wchar_t c1 = foldCase(a[i]);
wchar_t c2 = foldCase(b[i]);
UChar c1 = foldCase(a[i]);
UChar c2 = foldCase(b[i]);
if (c1 != c2)
return c1 - c2;
}
return 0;
}
inline UChar32 surrogateToUcs4(wchar_t high, wchar_t low)
inline UChar32 surrogateToUcs4(UChar high, UChar low)
{
return (UChar32(high) << 10) + low - 0x35fdc00;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment