Changeset 30942 in webkit


Ignore:
Timestamp:
Mar 10, 2008 3:06:44 PM (16 years ago)
Author:
eric@webkit.org
Message:

Reviewed by Darin.

Remove KJS::UChar, use ::UChar instead
http://bugs.webkit.org/show_bug.cgi?id=17017

To functional changes, thus no tests.

  • bindings/js/JSCSSStyleDeclarationCustom.cpp: (WebCore::hasCSSPropertyNamePrefix): (WebCore::cssPropertyName):
  • bindings/js/JSDOMWindowBase.cpp: (WebCore::windowProtoFuncAToB): (WebCore::windowProtoFuncBToA):
  • bindings/js/JSSVGPODTypeWrapper.h:
  • bindings/js/kjs_proxy.cpp: (WebCore::KJSProxy::evaluate):
  • bridge/objc/objc_utility.mm: (KJS::Bindings::throwError):
  • dom/Document.cpp: (WebCore::Document::parseQualifiedName):
  • platform/text/AtomicString.cpp: (WebCore::AtomicString::add):
  • platform/text/String.cpp: (WebCore::String::String): (WebCore::String::operator Identifier): (WebCore::String::operator UString):
  • platform/text/TextCodecICU.cpp: (WebCore::TextCodecICU::decode):
  • svg/SVGAnimatedTemplate.h:
Location:
trunk
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/JSStringRef.cpp

    r29663 r30942  
    4545{
    4646    JSLock lock;
    47     return toRef(UString(reinterpret_cast<const KJS::UChar*>(chars), static_cast<int>(numChars)).rep()->ref());
     47    return toRef(UString(chars, static_cast<int>(numChars)).rep()->ref());
    4848}
    4949
     
    5353
    5454    size_t length = strlen(string);
    55     Vector< ::UChar, 1024> buffer(length);
    56     ::UChar* p = buffer.data();
     55    Vector<UChar, 1024> buffer(length);
     56    UChar* p = buffer.data();
    5757    if (conversionOK != convertUTF8ToUTF16(&string, string + length, &p, p + length))
    5858        return 0;
    5959
    60     return toRef(UString(reinterpret_cast<KJS::UChar*>(buffer.data()), p - buffer.data()).rep()->ref());
     60    return toRef(UString(buffer.data(), p - buffer.data()).rep()->ref());
    6161}
    6262
  • trunk/JavaScriptCore/API/JSStringRefCF.cpp

    r29663 r30942  
    4646        UniChar* buffer = static_cast<UniChar*>(fastMalloc(sizeof(UniChar) * length));
    4747        CFStringGetCharacters(string, CFRangeMake(0, length), buffer);
    48         rep = UString(reinterpret_cast<UChar*>(buffer), length, false).rep()->ref();
     48        rep = UString(buffer, length, false).rep()->ref();
    4949    }
    5050    return toRef(rep);
  • trunk/JavaScriptCore/ChangeLog

    r30920 r30942  
     12008-03-10  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Darin.
     4
     5        Remove KJS::UChar, use ::UChar instead
     6        http://bugs.webkit.org/show_bug.cgi?id=17017
     7
     8        * API/JSStringRef.cpp:
     9        (JSStringCreateWithCharacters):
     10        (JSStringCreateWithUTF8CString):
     11        * API/JSStringRefCF.cpp:
     12        (JSStringCreateWithCFString):
     13        * JavaScriptCore.exp:
     14        * kjs/Parser.h:
     15        * kjs/function.cpp:
     16        (KJS::decode):
     17        (KJS::parseInt):
     18        (KJS::parseFloat):
     19        (KJS::globalFuncEscape):
     20        (KJS::globalFuncUnescape):
     21        * kjs/function_object.cpp:
     22        (KJS::FunctionObjectImp::construct):
     23        * kjs/identifier.cpp:
     24        (KJS::Identifier::equal):
     25        (KJS::CStringTranslator::translate):
     26        * kjs/interpreter.h:
     27        * kjs/lexer.cpp:
     28        (KJS::Lexer::setCode):
     29        (KJS::Lexer::shift):
     30        (KJS::Lexer::lex):
     31        (KJS::Lexer::convertUnicode):
     32        (KJS::Lexer::makeIdentifier):
     33        * kjs/lookup.cpp:
     34        (KJS::keysMatch):
     35        * kjs/nodes2string.cpp:
     36        (KJS::escapeStringForPrettyPrinting):
     37        (KJS::SourceStream::operator<<):
     38        * kjs/regexp.cpp:
     39        (KJS::RegExp::RegExp):
     40        (KJS::RegExp::match):
     41        * kjs/string_object.cpp:
     42        (KJS::substituteBackreferences):
     43        (KJS::stringProtoFuncCharCodeAt):
     44        (KJS::stringProtoFuncToLowerCase):
     45        (KJS::stringProtoFuncToUpperCase):
     46        (KJS::stringProtoFuncToLocaleLowerCase):
     47        (KJS::stringProtoFuncToLocaleUpperCase):
     48        * kjs/ustring.cpp:
     49        (KJS::UString::Rep::computeHash):
     50        (KJS::UString::UString):
     51        (KJS::UString::append):
     52        (KJS::UString::ascii):
     53        (KJS::UString::operator=):
     54        (KJS::UString::is8Bit):
     55        (KJS::UString::toStrictUInt32):
     56        (KJS::UString::find):
     57        (KJS::operator==):
     58        (KJS::operator<):
     59        (KJS::compare):
     60        (KJS::UString::UTF8String):
     61        * kjs/ustring.h:
     62        * pcre/pcre.h:
     63
    1642008-03-09  Steve Falkenburg  <sfalken@apple.com>
    265
  • trunk/JavaScriptCore/JavaScriptCore.exp

    r30849 r30942  
    7878__Z15jsRegExpExecutePK8JSRegExpPKtiiPii
    7979__ZN3KJS10Identifier11addSlowCaseEPNS_7UString3RepE
    80 __ZN3KJS10Identifier3addEPKNS_5UCharEi
     80__ZN3KJS10Identifier3addEPKti
    8181__ZN3KJS10Identifier3addEPKc
    8282__ZN3KJS10Identifier5equalEPKNS_7UString3RepEPKc
     
    8484__ZN3KJS10throwErrorEPNS_9ExecStateENS_9ErrorTypeEPKc
    8585__ZN3KJS10throwErrorEPNS_9ExecStateENS_9ErrorTypeERKNS_7UStringE
    86 __ZN3KJS11Interpreter11checkSyntaxEPNS_9ExecStateERKNS_7UStringEiPKNS_5UCharEi
     86__ZN3KJS11Interpreter11checkSyntaxEPNS_9ExecStateERKNS_7UStringEiPKti
    8787__ZN3KJS11Interpreter21shouldPrintExceptionsEv
    8888__ZN3KJS11Interpreter24setShouldPrintExceptionsEb
    89 __ZN3KJS11Interpreter8evaluateEPNS_9ExecStateERKNS_7UStringEiPKNS_5UCharEiPNS_7JSValueE
     89__ZN3KJS11Interpreter8evaluateEPNS_9ExecStateERKNS_7UStringEiPKtiPNS_7JSValueE
    9090__ZN3KJS11Interpreter8evaluateEPNS_9ExecStateERKNS_7UStringEiS5_PNS_7JSValueE
    9191__ZN3KJS11JSImmediate4typeEPKNS_7JSValueE
     
    149149__ZN3KJS6JSLock9lockCountEv
    150150__ZN3KJS6Lookup9findEntryEPKNS_9HashTableERKNS_10IdentifierE
    151 __ZN3KJS6Parser5parseEiPKNS_5UCharEjPiS4_PNS_7UStringE
     151__ZN3KJS6Parser5parseEiPKtjPiS3_PNS_7UStringE
    152152__ZN3KJS6parserEv
    153153__ZN3KJS7CStringD1Ev
     
    158158__ZN3KJS7UString6appendEPKc
    159159__ZN3KJS7UString6appendERKS0_
    160 __ZN3KJS7UStringC1EPKNS_5UCharEi
     160__ZN3KJS7UStringC1EPKti
    161161__ZN3KJS7UStringC1EPKc
    162162__ZN3KJS7UStringC1ERKS0_S2_
  • trunk/JavaScriptCore/kjs/Parser.h

    r29059 r30942  
    3737    class ProgramNode;
    3838    class UString;
    39 
    40     struct UChar;
    4139
    4240    template <typename T> struct ParserRefCountedData : ParserRefCounted {
  • trunk/JavaScriptCore/kjs/function.cpp

    r30871 r30942  
    516516    if (c == '%') {
    517517      int charLen = 0;
    518       if (k <= len - 3 && isASCIIHexDigit(p[1].uc) && isASCIIHexDigit(p[2].uc)) {
    519         const char b0 = Lexer::convertHex(p[1].uc, p[2].uc);
     518      if (k <= len - 3 && isASCIIHexDigit(p[1]) && isASCIIHexDigit(p[2])) {
     519        const char b0 = Lexer::convertHex(p[1], p[2]);
    520520        const int sequenceLen = UTF8SequenceLength(b0);
    521521        if (sequenceLen != 0 && k <= len - sequenceLen * 3) {
     
    525525          for (int i = 1; i < sequenceLen; ++i) {
    526526            const UChar* q = p + i * 3;
    527             if (q[0] == '%' && isASCIIHexDigit(q[1].uc) && isASCIIHexDigit(q[2].uc))
    528               sequence[i] = Lexer::convertHex(q[1].uc, q[2].uc);
     527            if (q[0] == '%' && isASCIIHexDigit(q[1]) && isASCIIHexDigit(q[2]))
     528              sequence[i] = Lexer::convertHex(q[1], q[2]);
    529529            else {
    530530              charLen = 0;
     
    553553        // For that, it's good to support the wonky "%u" syntax for compatibility with WinIE.
    554554        if (k <= len - 6 && p[1] == 'u'
    555             && isASCIIHexDigit(p[2].uc) && isASCIIHexDigit(p[3].uc)
    556             && isASCIIHexDigit(p[4].uc) && isASCIIHexDigit(p[5].uc)) {
     555            && isASCIIHexDigit(p[2]) && isASCIIHexDigit(p[3])
     556            && isASCIIHexDigit(p[4]) && isASCIIHexDigit(p[5])) {
    557557          charLen = 6;
    558           u = Lexer::convertUnicode(p[2].uc, p[3].uc, p[4].uc, p[5].uc);
     558          u = Lexer::convertUnicode(p[2], p[3], p[4], p[5]);
    559559        }
    560560      }
    561       if (charLen && (u.uc == 0 || u.uc >= 128 || !strchr(do_not_unescape, u.low()))) {
     561      if (charLen && (u == 0 || u >= 128 || !strchr(do_not_unescape, u))) {
    562562        c = u;
    563563        k += charLen - 1;
     
    632632    int p = 0;
    633633
    634     while (p < length && isStrWhiteSpace(s[p].uc)) {
     634    while (p < length && isStrWhiteSpace(s[p])) {
    635635        ++p;
    636636    }
     
    663663    double number = 0;
    664664    while (p < length) {
    665         int digit = parseDigit(s[p].uc, radix);
     665        int digit = parseDigit(s[p], radix);
    666666        if (digit == -1)
    667667            break;
     
    691691    int length = s.size();
    692692    int p = 0;
    693     while (p < length && isStrWhiteSpace(s[p].uc)) {
     693    while (p < length && isStrWhiteSpace(s[p])) {
    694694        ++p;
    695695    }
     
    817817    const UChar* c = str.data();
    818818    for (int k = 0; k < str.size(); k++, c++) {
    819         int u = c->uc;
     819        int u = c[0];
    820820        if (u > 255) {
    821821            char tmp[7];
     
    842842        const UChar* c = str.data() + k;
    843843        UChar u;
    844         if (*c == UChar('%') && k <= len - 6 && *(c + 1) == UChar('u')) {
    845             if (Lexer::isHexDigit((c + 2)->uc) && Lexer::isHexDigit((c + 3)->uc) && Lexer::isHexDigit((c + 4)->uc) && Lexer::isHexDigit((c + 5)->uc)) {
    846                 u = Lexer::convertUnicode((c + 2)->uc, (c + 3)->uc, (c + 4)->uc, (c + 5)->uc);
     844        if (c[0] == '%' && k <= len - 6 && c[1] == 'u') {
     845            if (Lexer::isHexDigit(c[2]) && Lexer::isHexDigit(c[3]) && Lexer::isHexDigit(c[4]) && Lexer::isHexDigit(c[5])) {
     846                u = Lexer::convertUnicode(c[2], c[3], c[4], c[5]);
    847847                c = &u;
    848848                k += 5;
    849849            }
    850         } else if (*c == UChar('%') && k <= len - 3 && Lexer::isHexDigit((c + 1)->uc) && Lexer::isHexDigit((c + 2)->uc)) {
    851             u = UChar(Lexer::convertHex((c+1)->uc, (c+2)->uc));
     850        } else if (c[0] == '%' && k <= len - 3 && Lexer::isHexDigit(c[1]) && Lexer::isHexDigit(c[2])) {
     851            u = UChar(Lexer::convertHex(c[1], c[2]));
    852852            c = &u;
    853853            k += 2;
  • trunk/JavaScriptCore/kjs/function_object.cpp

    r30679 r30942  
    193193        while (*c == ' ' && i < len)
    194194            c++, i++;
    195         if (Lexer::isIdentStart(c->uc)) {  // else error
     195        if (Lexer::isIdentStart(c[0])) {  // else error
    196196            param = UString(c, 1);
    197197            c++, i++;
    198             while (i < len && (Lexer::isIdentPart(c->uc))) {
     198            while (i < len && (Lexer::isIdentPart(c[0]))) {
    199199                param += UString(c, 1);
    200200                c++, i++;
  • trunk/JavaScriptCore/kjs/identifier.cpp

    r27176 r30942  
    6868    const UChar *d = r->data();
    6969    for (int i = 0; i != length; ++i)
    70         if (d[i].uc != (unsigned char)s[i])
     70        if (d[i] != (unsigned char)s[i])
    7171            return false;
    7272    return s[length] == 0;
     
    7979    const UChar *d = r->data();
    8080    for (int i = 0; i != length; ++i)
    81         if (d[i].uc != s[i].uc)
     81        if (d[i] != s[i])
    8282            return false;
    8383    return true;
     
    9292    const UChar *s = b->data();
    9393    for (int i = 0; i != length; ++i)
    94         if (d[i].uc != s[i].uc)
     94        if (d[i] != s[i])
    9595            return false;
    9696    return true;
     
    114114        UChar *d = static_cast<UChar *>(fastMalloc(sizeof(UChar) * length));
    115115        for (size_t i = 0; i != length; i++)
    116             d[i] = c[i];
     116            d[i] = static_cast<unsigned char>(c[i]); // use unsigned char to zero-extend instead of sign-extend
    117117       
    118118        UString::Rep *r = UString::Rep::create(d, static_cast<int>(length)).releaseRef();
  • trunk/JavaScriptCore/kjs/interpreter.h

    r28468 r30942  
    2424#define KJS_Interpreter_h
    2525
     26#include <wtf/unicode/Unicode.h>
     27
    2628namespace KJS {
    2729
     
    3032  class JSValue;
    3133  class UString;
    32 
    33   struct UChar;
    3434 
    3535  class Interpreter {
  • trunk/JavaScriptCore/kjs/lexer.cpp

    r29538 r30942  
    9595}
    9696
    97 void Lexer::setCode(int startingLineNumber, const KJS::UChar *c, unsigned int len)
     97void Lexer::setCode(int startingLineNumber, const UChar* c, unsigned int len)
    9898{
    9999  yylineno = 1 + startingLineNumber;
     
    112112
    113113  // read first characters
    114   current = (length > 0) ? code[0].uc : -1;
    115   next1 = (length > 1) ? code[1].uc : -1;
    116   next2 = (length > 2) ? code[2].uc : -1;
    117   next3 = (length > 3) ? code[3].uc : -1;
     114  current = (length > 0) ? code[0] : -1;
     115  next1 = (length > 1) ? code[1] : -1;
     116  next2 = (length > 2) ? code[2] : -1;
     117  next3 = (length > 3) ? code[3] : -1;
    118118}
    119119
     
    127127    next1 = next2;
    128128    next2 = next3;
    129     next3 = (pos + 3 < length) ? code[pos + 3].uc : -1;
     129    next3 = (pos + 3 < length) ? code[pos + 3] : -1;
    130130  }
    131131}
     
    428428        break;
    429429      }
    430       token = convertUnicode(current, next1, next2, next3).uc;
     430      token = convertUnicode(current, next1, next2, next3);
    431431      shift(3);
    432432      if (!isIdentStart(token)) {
     
    442442        break;
    443443      }
    444       token = convertUnicode(current, next1, next2, next3).uc;
     444      token = convertUnicode(current, next1, next2, next3);
    445445      shift(3);
    446446      if (!isIdentPart(token)) {
     
    793793}
    794794
    795 KJS::UChar Lexer::convertUnicode(int c1, int c2, int c3, int c4)
    796 {
    797   return KJS::UChar((convertHex(c1) << 4) + convertHex(c2),
    798                (convertHex(c3) << 4) + convertHex(c4));
     795UChar Lexer::convertUnicode(int c1, int c2, int c3, int c4)
     796{
     797    unsigned char highByte = (convertHex(c1) << 4) + convertHex(c2);
     798    unsigned char lowByte = (convertHex(c3) << 4) + convertHex(c4);
     799    return (highByte << 8 | lowByte);
    799800}
    800801
     
    813814}
    814815
    815 void Lexer::record16(KJS::UChar c)
     816void Lexer::record16(UChar c)
    816817{
    817818    m_buffer16.append(c);
     
    881882}
    882883
    883 Identifier* Lexer::makeIdentifier(const Vector<KJS::UChar>& buffer)
     884Identifier* Lexer::makeIdentifier(const Vector<UChar>& buffer)
    884885{
    885886    KJS::Identifier* identifier = new KJS::Identifier(buffer.data(), buffer.size());
     
    888889}
    889890 
    890 UString* Lexer::makeUString(const Vector<KJS::UChar>& buffer)
     891UString* Lexer::makeUString(const Vector<UChar>& buffer)
    891892{
    892893    UString* string = new UString(buffer);
  • trunk/JavaScriptCore/kjs/lookup.cpp

    r27608 r30942  
    3232  const char* end = s + len;
    3333  for (; s != end; c++, s++)
    34     if (c->uc != *s)
     34    if (*c != *s)
    3535      return false;
    3636  return *s == 0;
  • trunk/JavaScriptCore/kjs/nodes2string.cpp

    r30871 r30942  
    7979
    8080    for (int i = 0; i < s.size(); i++) {
    81         unsigned short c = s.data()[i].unicode();
     81        unsigned short c = s.data()[i];
    8282        switch (c) {
    8383            case '\"':
     
    160160    m_numberNeedsParens = false;
    161161    m_atStartOfStatement = false;
    162     UChar ch(c);
     162    // use unsigned char to zero-extend instead of sign-extend
     163    UChar ch(static_cast<unsigned char>(c));
    163164    m_string.append(ch);
    164165    return *this;
  • trunk/JavaScriptCore/kjs/regexp.cpp

    r30408 r30942  
    3939  , m_numSubpatterns(0)
    4040{
    41     m_regExp = jsRegExpCompile(reinterpret_cast<const ::UChar*>(pattern.data()), pattern.size(),
     41    m_regExp = jsRegExpCompile(reinterpret_cast<const UChar*>(pattern.data()), pattern.size(),
    4242        JSRegExpDoNotIgnoreCase, JSRegExpSingleLine, &m_numSubpatterns, &m_constructionError);
    4343}
     
    7373    }
    7474   
    75     m_regExp = jsRegExpCompile(reinterpret_cast<const ::UChar*>(pattern.data()), pattern.size(),
     75    m_regExp = jsRegExpCompile(reinterpret_cast<const UChar*>(pattern.data()), pattern.size(),
    7676        ignoreCaseOption, multilineOption, &m_numSubpatterns, &m_constructionError);
    7777}
     
    114114  }
    115115
    116   int numMatches = jsRegExpExecute(m_regExp, reinterpret_cast<const ::UChar*>(s.data()), s.size(), i, offsetVector, offsetVectorSize);
     116  int numMatches = jsRegExpExecute(m_regExp, reinterpret_cast<const UChar*>(s.data()), s.size(), i, offsetVector, offsetVectorSize);
    117117
    118118  if (numMatches < 0) {
  • trunk/JavaScriptCore/kjs/string_object.cpp

    r30842 r30942  
    246246        break;
    247247
    248     unsigned short ref = substitutedReplacement[i+1].unicode();
     248    unsigned short ref = substitutedReplacement[i+1];
    249249    int backrefStart = 0;
    250250    int backrefLength = 0;
     
    269269            continue;
    270270        if (substitutedReplacement.size() > i + 2) {
    271             ref = substitutedReplacement[i+2].unicode();
     271            ref = substitutedReplacement[i+2];
    272272            if (ref >= '0' && ref <= '9') {
    273273                backrefIndex = 10 * backrefIndex + ref - '0';
     
    451451    double dpos = a0->toInteger(exec);
    452452    if (dpos >= 0 && dpos < len)
    453       result = jsNumber(s[static_cast<int>(dpos)].unicode());
     453      result = jsNumber(s[static_cast<int>(dpos)]);
    454454    else
    455455      result = jsNaN();
     
    764764    if (!ssize)
    765765        return sVal;
    766     Vector< ::UChar> buffer(ssize);
     766    Vector<UChar> buffer(ssize);
    767767    bool error;
    768     int length = Unicode::toLower(buffer.data(), ssize, reinterpret_cast<const ::UChar*>(s.data()), ssize, &error);
     768    int length = Unicode::toLower(buffer.data(), ssize, reinterpret_cast<const UChar*>(s.data()), ssize, &error);
    769769    if (error) {
    770770        buffer.resize(length);
    771         length = Unicode::toLower(buffer.data(), length, reinterpret_cast<const ::UChar*>(s.data()), ssize, &error);
     771        length = Unicode::toLower(buffer.data(), length, reinterpret_cast<const UChar*>(s.data()), ssize, &error);
    772772        if (error)
    773773            return sVal;
     
    775775    if (length == ssize && memcmp(buffer.data(), s.data(), length * sizeof(UChar)) == 0)
    776776        return sVal;
    777     return jsString(UString(reinterpret_cast<UChar*>(buffer.releaseBuffer()), length, false));
     777    return jsString(UString(buffer.releaseBuffer(), length, false));
    778778}
    779779
     
    789789    if (!ssize)
    790790        return sVal;
    791     Vector< ::UChar> buffer(ssize);
     791    Vector<UChar> buffer(ssize);
    792792    bool error;
    793     int length = Unicode::toUpper(buffer.data(), ssize, reinterpret_cast<const ::UChar*>(s.data()), ssize, &error);
     793    int length = Unicode::toUpper(buffer.data(), ssize, reinterpret_cast<const UChar*>(s.data()), ssize, &error);
    794794    if (error) {
    795795        buffer.resize(length);
    796         length = Unicode::toUpper(buffer.data(), length, reinterpret_cast<const ::UChar*>(s.data()), ssize, &error);
     796        length = Unicode::toUpper(buffer.data(), length, reinterpret_cast<const UChar*>(s.data()), ssize, &error);
    797797        if (error)
    798798            return sVal;
     
    800800    if (length == ssize && memcmp(buffer.data(), s.data(), length * sizeof(UChar)) == 0)
    801801        return sVal;
    802     return jsString(UString(reinterpret_cast<UChar*>(buffer.releaseBuffer()), length, false));
     802    return jsString(UString(buffer.releaseBuffer(), length, false));
    803803}
    804804
     
    815815    if (!ssize)
    816816        return sVal;
    817     Vector< ::UChar> buffer(ssize);
     817    Vector<UChar> buffer(ssize);
    818818    bool error;
    819     int length = Unicode::toLower(buffer.data(), ssize, reinterpret_cast<const ::UChar*>(s.data()), ssize, &error);
     819    int length = Unicode::toLower(buffer.data(), ssize, reinterpret_cast<const UChar*>(s.data()), ssize, &error);
    820820    if (error) {
    821821        buffer.resize(length);
    822         length = Unicode::toLower(buffer.data(), length, reinterpret_cast<const ::UChar*>(s.data()), ssize, &error);
     822        length = Unicode::toLower(buffer.data(), length, reinterpret_cast<const UChar*>(s.data()), ssize, &error);
    823823        if (error)
    824824            return sVal;
     
    826826    if (length == ssize && memcmp(buffer.data(), s.data(), length * sizeof(UChar)) == 0)
    827827        return sVal;
    828     return jsString(UString(reinterpret_cast<UChar*>(buffer.releaseBuffer()), length, false));
     828    return jsString(UString(buffer.releaseBuffer(), length, false));
    829829}
    830830
     
    840840    if (!ssize)
    841841        return sVal;
    842     Vector< ::UChar> buffer(ssize);
     842    Vector<UChar> buffer(ssize);
    843843    bool error;
    844     int length = Unicode::toUpper(buffer.data(), ssize, reinterpret_cast<const ::UChar*>(s.data()), ssize, &error);
     844    int length = Unicode::toUpper(buffer.data(), ssize, reinterpret_cast<const UChar*>(s.data()), ssize, &error);
    845845    if (error) {
    846846        buffer.resize(length);
    847         length = Unicode::toUpper(buffer.data(), length, reinterpret_cast<const ::UChar*>(s.data()), ssize, &error);
     847        length = Unicode::toUpper(buffer.data(), length, reinterpret_cast<const UChar*>(s.data()), ssize, &error);
    848848        if (error)
    849849            return sVal;
     
    851851    if (length == ssize && memcmp(buffer.data(), s.data(), length * sizeof(UChar)) == 0)
    852852        return sVal;
    853     return jsString(UString(reinterpret_cast<UChar*>(buffer.releaseBuffer()), length, false));
     853    return jsString(UString(buffer.releaseBuffer(), length, false));
    854854}
    855855
  • trunk/JavaScriptCore/kjs/ustring.cpp

    r29653 r30942  
    164164
    165165// Hack here to avoid a global with a constructor; point to an unsigned short instead of a UChar.
    166 static unsigned short almostUChar;
     166static UChar sharedEmptyChar;
    167167UString::Rep UString::Rep::null = { 0, 0, 1, 0, 0, &UString::Rep::null, 0, 0, 0, 0, 0, 0 };
    168 UString::Rep UString::Rep::empty = { 0, 0, 1, 0, 0, &UString::Rep::empty, 0, reinterpret_cast<UChar*>(&almostUChar), 0, 0, 0, 0 };
     168UString::Rep UString::Rep::empty = { 0, 0, 1, 0, 0, &UString::Rep::empty, 0, &sharedEmptyChar, 0, 0, 0, 0 };
    169169const int normalStatBufferSize = 4096;
    170170static char *statBuffer = 0; // FIXME: This buffer is never deallocated.
     
    265265  // Main loop
    266266  for (; l > 0; l--) {
    267     hash += s[0].uc;
    268     tmp = (s[1].uc << 11) ^ hash;
     267    hash += s[0];
     268    tmp = (s[1] << 11) ^ hash;
    269269    hash = (hash << 16) ^ tmp;
    270270    s += 2;
     
    274274  // Handle end case
    275275  if (rem) {
    276     hash += s[0].uc;
     276    hash += s[0];
    277277    hash ^= hash << 11;
    278278    hash += hash >> 17;
     
    430430  else {
    431431      for (size_t i = 0; i < length; i++)
    432           d[i].uc = c[i];
     432          d[i] = static_cast<unsigned char>(c[i]); // use unsigned char to zero-extend instead of sign-extend
    433433      m_rep = Rep::create(d, static_cast<int>(length));
    434434  }
     
    710710}
    711711
    712 UString &UString::append(const UString &t)
     712UString& UString::append(const UString &t)
    713713{
    714714  int thisSize = size();
     
    755755}
    756756
    757 UString &UString::append(const char *t)
     757UString& UString::append(const char *t)
    758758{
    759759  int thisSize = size();
     
    774774    if (d) {
    775775        for (int i = 0; i < tSize; ++i)
    776             d[thisSize + i] = t[i];
     776            d[thisSize + i] = static_cast<unsigned char>(t[i]); // use unsigned char to zero-extend instead of sign-extend
    777777        m_rep->len = length;
    778778        m_rep->_hash = 0;
     
    784784    if (d) {
    785785        for (int i = 0; i < tSize; ++i)
    786             d[thisSize + i] = t[i];
     786            d[thisSize + i] = static_cast<unsigned char>(t[i]); // use unsigned char to zero-extend instead of sign-extend
    787787        m_rep = Rep::create(m_rep, 0, length);
    788788    }
     
    796796        memcpy(d, data(), thisSize * sizeof(UChar));
    797797        for (int i = 0; i < tSize; ++i)
    798             d[thisSize + i] = t[i];
     798            d[thisSize + i] = static_cast<unsigned char>(t[i]); // use unsigned char to zero-extend instead of sign-extend
    799799        m_rep = Rep::create(d, length);
    800800        m_rep->capacity = newCapacity;
     
    805805}
    806806
    807 UString &UString::append(unsigned short c)
     807UString& UString::append(UChar c)
    808808{
    809809  int thisOffset = m_rep->offset;
     
    880880  const UChar *limit = p + length;
    881881  while (p != limit) {
    882     *q = static_cast<char>(p->uc);
     882    *q = static_cast<char>(p[0]);
    883883    ++p;
    884884    ++q;
     
    889889}
    890890
    891 UString &UString::operator=(const char *c)
     891UString& UString::operator=(const char *c)
    892892{
    893893    if (!c) {
     
    916916  }
    917917  for (int i = 0; i < l; i++)
    918     d[i].uc = c[i];
     918    d[i] = static_cast<unsigned char>(c[i]); // use unsigned char to zero-extend instead of sign-extend
    919919
    920920  return *this;
     
    926926  const UChar *limit = u + size();
    927927  while (u < limit) {
    928     if (u->uc > 0xFF)
     928    if (u[0] > 0xFF)
    929929      return false;
    930930    ++u;
     
    10691069    return 0;
    10701070  const UChar *p = m_rep->data();
    1071   unsigned short c = p->unicode();
     1071  unsigned short c = p[0];
    10721072
    10731073  // If the first digit is 0, only 0 itself is OK.
     
    11051105   
    11061106    // Get next character.
    1107     c = (++p)->unicode();
     1107    c = *(++p);
    11081108  }
    11091109}
     
    11221122  int fsizeminusone = (fsz - 1) * sizeof(UChar);
    11231123  const UChar *fdata = f.data();
    1124   unsigned short fchar = fdata->uc;
     1124  unsigned short fchar = fdata[0];
    11251125  ++fdata;
    11261126  for (const UChar *c = data() + pos; c <= end; c++)
    1127     if (c->uc == fchar && !memcmp(c + 1, fdata, fsizeminusone))
     1127    if (c[0] == fchar && !memcmp(c + 1, fdata, fsizeminusone))
    11281128      return static_cast<int>(c - data());
    11291129
     
    12161216  const UChar *uend = u + s1.size();
    12171217  while (u != uend && *s2) {
    1218     if (u->uc != (unsigned char)*s2)
     1218    if (u[0] != (unsigned char)*s2)
    12191219      return false;
    12201220    s2++;
     
    12391239  }
    12401240  if (l < lmin)
    1241     return (c1->uc < c2->uc);
     1241    return (c1[0] < c2[0]);
    12421242
    12431243  return (l1 < l2);
     
    12591259
    12601260  if (l < lmin)
    1261     return (c1->uc > c2->uc) ? 1 : -1;
     1261    return (c1[0] > c2[0]) ? 1 : -1;
    12621262
    12631263  if (l1 == l2)
     
    12751275  // Convert to runs of 8-bit characters.
    12761276  char* p = buffer.data();
    1277   const ::UChar* d = reinterpret_cast<const ::UChar*>(&data()->uc);
     1277  const UChar* d = reinterpret_cast<const UChar*>(&data()[0]);
    12781278  ConversionResult result = convertUTF16ToUTF8(&d, d + length, &p, p + buffer.size(), strict);
    12791279  if (result != conversionOK)
  • trunk/JavaScriptCore/kjs/ustring.h

    r29660 r30942  
    3131#include <wtf/PassRefPtr.h>
    3232#include <wtf/RefPtr.h>
     33#include <wtf/unicode/Unicode.h>
    3334#include <wtf/Vector.h>
    34 
    35 /* On some ARM platforms GCC won't pack structures by default so sizeof(UChar)
    36    will end up being != 2 which causes crashes since the code depends on that. */
    37 #if COMPILER(GCC) && PLATFORM(FORCE_PACK)
    38 #define PACK_STRUCT __attribute__((packed))
    39 #else
    40 #define PACK_STRUCT
    41 #endif
    4235
    4336/**
     
    5649
    5750  class UString;
    58 
    59   /**
    60    * @short Unicode character.
    61    *
    62    * UChar represents a 16 bit Unicode character. It's internal data
    63    * representation is compatible to XChar2b and QChar. It's therefore
    64    * possible to exchange data with X and Qt with shallow copies.
    65    */
    66   struct UChar {
    67     /**
    68      * Construct a character with uninitialized value.   
    69      */
    70     UChar();
    71     /**
    72      * Construct a character with the value denoted by the arguments.
    73      * @param h higher byte
    74      * @param l lower byte
    75      */
    76     UChar(unsigned char h , unsigned char l);
    77     /**
    78      * Construct a character with the given value.
    79      * @param u 16 bit Unicode value
    80      */
    81     UChar(char u);
    82     UChar(unsigned char u);
    83     UChar(unsigned short u);
    84     /**
    85      * @return The higher byte of the character.
    86      */
    87     unsigned char high() const { return static_cast<unsigned char>(uc >> 8); }
    88     /**
    89      * @return The lower byte of the character.
    90      */
    91     unsigned char low() const { return static_cast<unsigned char>(uc); }
    92     /**
    93      * @return the 16 bit Unicode value of the character
    94      */
    95     unsigned short unicode() const { return uc; }
    96 
    97     unsigned short uc;
    98   } PACK_STRUCT;
    99 
    100   inline UChar::UChar() { }
    101   inline UChar::UChar(unsigned char h , unsigned char l) : uc(h << 8 | l) { }
    102   inline UChar::UChar(char u) : uc((unsigned char)u) { }
    103   inline UChar::UChar(unsigned char u) : uc(u) { }
    104   inline UChar::UChar(unsigned short u) : uc(u) { }
    105 
     51 
    10652  /**
    10753   * @short 8 bit char based string class
     
    258204    };
    259205
    260     UString spliceSubstringsWithSeparators(const Range *substringRanges, int rangeCount, const UString *separators, int separatorCount) const;
     206    UString spliceSubstringsWithSeparators(const Range* substringRanges, int rangeCount, const UString* separators, int separatorCount) const;
    261207
    262208    /**
    263209     * Append another string.
    264210     */
    265     UString &append(const UString &);
    266     UString &append(const char *);
    267     UString &append(unsigned short);
    268     UString &append(char c) { return append(static_cast<unsigned short>(static_cast<unsigned char>(c))); }
    269     UString &append(UChar c) { return append(c.uc); }
     211    UString& append(const UString&);
     212    UString& append(const char*);
     213    UString& append(UChar);
     214    UString& append(char c) { return append(static_cast<unsigned short>(static_cast<unsigned char>(c))); }
    270215
    271216    /**
     
    282227     * instances.
    283228     */
    284     char *ascii() const;
     229    char* ascii() const;
    285230
    286231    /**
     
    404349  };
    405350
    406   inline bool operator==(const UChar &c1, const UChar &c2) {
    407     return (c1.uc == c2.uc);
    408   }
    409351  bool operator==(const UString& s1, const UString& s2);
    410352  inline bool operator!=(const UString& s1, const UString& s2) {
  • trunk/JavaScriptCore/pcre/pcre.h

    r28833 r30942  
    5656const int JSRegExpErrorInternal = -4;
    5757
    58 JSRegExp* jsRegExpCompile(const ::UChar* pattern, int patternLength,
     58JSRegExp* jsRegExpCompile(const UChar* pattern, int patternLength,
    5959    JSRegExpIgnoreCaseOption, JSRegExpMultilineOption,
    6060    unsigned* numSubpatterns, const char** errorMessage);
    6161
    6262int jsRegExpExecute(const JSRegExp*,
    63     const ::UChar* subject, int subjectLength, int startOffset,
     63    const UChar* subject, int subjectLength, int startOffset,
    6464    int* offsetsVector, int offsetsVectorLength);
    6565
  • trunk/WebCore/ChangeLog

    r30939 r30942  
     12008-03-10  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Darin.
     4
     5        Remove KJS::UChar, use ::UChar instead
     6        http://bugs.webkit.org/show_bug.cgi?id=17017
     7
     8        To functional changes, thus no tests.
     9
     10        * bindings/js/JSCSSStyleDeclarationCustom.cpp:
     11        (WebCore::hasCSSPropertyNamePrefix):
     12        (WebCore::cssPropertyName):
     13        * bindings/js/JSDOMWindowBase.cpp:
     14        (WebCore::windowProtoFuncAToB):
     15        (WebCore::windowProtoFuncBToA):
     16        * bindings/js/JSSVGPODTypeWrapper.h:
     17        * bindings/js/kjs_proxy.cpp:
     18        (WebCore::KJSProxy::evaluate):
     19        * bridge/objc/objc_utility.mm:
     20        (KJS::Bindings::throwError):
     21        * dom/Document.cpp:
     22        (WebCore::Document::parseQualifiedName):
     23        * platform/text/AtomicString.cpp:
     24        (WebCore::AtomicString::add):
     25        * platform/text/String.cpp:
     26        (WebCore::String::String):
     27        (WebCore::String::operator Identifier):
     28        (WebCore::String::operator UString):
     29        * platform/text/TextCodecICU.cpp:
     30        (WebCore::TextCodecICU::decode):
     31        * svg/SVGAnimatedTemplate.h:
     32
    1332008-03-10  Darin Adler  <darin@apple.com>
    234
  • trunk/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp

    r30534 r30942  
    5656    ASSERT(length);
    5757
    58     if (toASCIILower(propertyName.data()[0].unicode()) != prefix[0])
     58    if (toASCIILower(propertyName.data()[0]) != prefix[0])
    5959        return false;
    6060
    6161    for (unsigned i = 1; i < length; ++i) {
    6262        if (!prefix[i])
    63             return isASCIIUpper(propertyName.data()[i].unicode());
    64         if (propertyName.data()[0].unicode() != prefix[0])
     63            return isASCIIUpper(propertyName.data()[i]);
     64        if (propertyName.data()[0] != prefix[0])
    6565            return false;
    6666    }
     
    7777        return String();
    7878
    79     Vector< ::UChar> name;
     79    Vector<UChar> name;
    8080    name.reserveCapacity(length);
    8181
     
    9797        name.append('-');
    9898
    99     name.append(toASCIILower(propertyName.data()[i++].unicode()));
     99    name.append(toASCIILower(propertyName.data()[i++]));
    100100
    101101    for (; i < length; ++i) {
    102         ::UChar c = propertyName.data()[i].unicode();
     102        UChar c = propertyName.data()[i];
    103103        if (!isASCIIUpper(c))
    104104            name.append(c);
  • trunk/WebCore/bindings/js/JSDOMWindowBase.cpp

    r30923 r30942  
    10491049    Vector<char> in(s.size());
    10501050    for (int i = 0; i < s.size(); ++i)
    1051         in[i] = static_cast<char>(s.data()[i].unicode());
     1051        in[i] = static_cast<char>(s.data()[i]);
    10521052    Vector<char> out;
    10531053
     
    10801080    Vector<char> in(s.size());
    10811081    for (int i = 0; i < s.size(); ++i)
    1082         in[i] = static_cast<char>(s.data()[i].unicode());
     1082        in[i] = static_cast<char>(s.data()[i]);
    10831083    Vector<char> out;
    10841084
  • trunk/WebCore/bindings/js/JSSVGPODTypeWrapper.h

    r30122 r30942  
    204204    static unsigned hash(const PODTypeReadWriteHashInfo<PODType, PODTypeCreator>& info)
    205205    {
    206         return StringImpl::computeHash((::UChar*) &info, sizeof(PODTypeReadWriteHashInfo<PODType, PODTypeCreator>) / sizeof(::UChar));
     206        return StringImpl::computeHash(reinterpret_cast<const UChar*>(&info), sizeof(PODTypeReadWriteHashInfo<PODType, PODTypeCreator>) / sizeof(UChar));
    207207    }
    208208
  • trunk/WebCore/bindings/js/kjs_proxy.cpp

    r30787 r30942  
    8686
    8787    m_globalObject->startTimeoutCheck();
    88     Completion comp = Interpreter::evaluate(exec, filename, baseLine, reinterpret_cast<const KJS::UChar*>(str.characters()), str.length(), thisNode);
     88    Completion comp = Interpreter::evaluate(exec, filename, baseLine, str.characters(), str.length(), thisNode);
    8989    m_globalObject->stopTimeoutCheck();
    9090 
  • trunk/WebCore/bridge/objc/objc_utility.mm

    r30782 r30942  
    364364    unichar *buffer = new unichar[length];
    365365    [message getCharacters:buffer];
    366     JSObject *error = throwError(exec, type, UString(reinterpret_cast<UChar *>(buffer), length));
     366    JSObject *error = throwError(exec, type, UString(buffer, length));
    367367    delete [] buffer;
    368368    return error;
  • trunk/WebCore/dom/Document.cpp

    r30840 r30942  
    26742674bool Document::isValidName(const String &name)
    26752675{
    2676     const UChar* s = reinterpret_cast<const UChar*>(name.characters());
     2676    const UChar* s = name.characters();
    26772677    unsigned length = name.length();
    26782678
     
    27072707    int colonPos = 0;
    27082708
    2709     const UChar* s = reinterpret_cast<const UChar*>(qualifiedName.characters());
     2709    const UChar* s = qualifiedName.characters();
    27102710    for (unsigned i = 0; i < length;) {
    27112711        UChar32 c;
  • trunk/WebCore/platform/text/AtomicString.cpp

    r30501 r30942  
    193193PassRefPtr<StringImpl> AtomicString::add(const KJS::Identifier& str)
    194194{
    195     return add(reinterpret_cast<const UChar*>(str.data()), str.size());
     195    return add(str.data(), str.size());
    196196}
    197197
    198198PassRefPtr<StringImpl> AtomicString::add(const KJS::UString& str)
    199199{
    200     return add(reinterpret_cast<const UChar*>(str.data()), str.size());
     200    return add(str.data(), str.size());
    201201}
    202202
  • trunk/WebCore/platform/text/String.cpp

    r30501 r30942  
    593593    if (str.isNull())
    594594        return;
    595     m_impl = StringImpl::create(reinterpret_cast<const UChar*>(str.data()), str.size());
     595    m_impl = StringImpl::create(str.data(), str.size());
    596596}
    597597
     
    600600    if (str.isNull())
    601601        return;
    602     m_impl = StringImpl::create(reinterpret_cast<const UChar*>(str.data()), str.size());
     602    m_impl = StringImpl::create(str.data(), str.size());
    603603}
    604604
     
    607607    if (!m_impl)
    608608        return Identifier();
    609     return Identifier(reinterpret_cast<const KJS::UChar*>(m_impl->characters()), m_impl->length());
     609    return Identifier(m_impl->characters(), m_impl->length());
    610610}
    611611
     
    614614    if (!m_impl)
    615615        return UString();
    616     return UString(reinterpret_cast<const KJS::UChar*>(m_impl->characters()), m_impl->length());
     616    return UString(m_impl->characters(), m_impl->length());
    617617}
    618618
  • trunk/WebCore/platform/text/TextCodecICU.cpp

    r30894 r30942  
    242242        ucnv_toUnicode(m_converterICU, &target, targetLimit, &source, sourceLimit, offsets, flush, &err);
    243243        int count = target - buffer;
    244         appendOmittingBOM(result, reinterpret_cast<const UChar*>(buffer), count);
     244        appendOmittingBOM(result, buffer, count);
    245245    } while (err == U_BUFFER_OVERFLOW_ERROR);
    246246
  • trunk/WebCore/svg/SVGAnimatedTemplate.h

    r30122 r30942  
    7575        static unsigned hash(const SVGAnimatedTypeWrapperKey& key)
    7676        {
    77             return StringImpl::computeHash((::UChar*) &key, sizeof(SVGAnimatedTypeWrapperKey) / sizeof(::UChar));
     77            return StringImpl::computeHash(reinterpret_cast<const UChar*>(&key), sizeof(SVGAnimatedTypeWrapperKey) / sizeof(UChar));
    7878        }
    7979           
Note: See TracChangeset for help on using the changeset viewer.