Ignore:
Timestamp:
Mar 10, 2008, 3:06:44 PM (17 years ago)
Author:
[email protected]
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:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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)
Note: See TracChangeset for help on using the changeset viewer.