Ignore:
Timestamp:
Aug 18, 2010, 1:56:49 AM (15 years ago)
Author:
[email protected]
Message:

Rename UString::substr to substringSharingImpl, add to WTF::String.
Now WTF::String can do everything that JSC::UString can do!

Rubber stamped by Sam Weinig.

(JSC::escapeQuotes):

  • bytecompiler/NodesCodegen.cpp:

(JSC::substitute):

  • parser/SourceProvider.h:

(JSC::UStringSourceProvider::getRange):

  • runtime/FunctionPrototype.cpp:

(JSC::insertSemicolonIfNeeded):

  • runtime/JSGlobalObjectFunctions.cpp:

(JSC::parseInt):

  • runtime/JSONObject.cpp:

(JSC::gap):
(JSC::Stringifier::indent):
(JSC::Stringifier::unindent):

  • runtime/JSString.cpp:

(JSC::JSString::replaceCharacter):

  • runtime/NumberPrototype.cpp:

(JSC::numberProtoFuncToFixed):
(JSC::numberProtoFuncToPrecision):

  • runtime/StringPrototype.cpp:

(JSC::stringProtoFuncReplace):
(JSC::trimString):

  • runtime/UString.cpp:

(JSC::UString::substringSharingImpl):

  • runtime/UString.h:
  • wtf/text/WTFString.cpp:

(WTF::String::substringSharingImpl):

  • wtf/text/WTFString.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/UString.cpp

    r65588 r65593  
    205205}
    206206
    207 UString UString::substr(unsigned pos, unsigned len) const
     207UString UString::substringSharingImpl(unsigned offset, unsigned length) const
    208208{
    209209    // FIXME: We used to check against a limit of Heap::minExtraCost / sizeof(UChar).
    210210
    211     unsigned s = length();
    212 
    213     if (pos >= s)
    214         pos = s;
    215     unsigned limit = s - pos;
    216     if (len > limit)
    217         len = limit;
    218 
    219     if (pos == 0 && len == s)
     211    unsigned stringLength = this->length();
     212    offset = min(offset, stringLength);
     213    length = min(length, stringLength - offset);
     214
     215    if (!offset && length == stringLength)
    220216        return *this;
    221 
    222     return UString(StringImpl::create(m_impl, pos, len));
     217    return UString(StringImpl::create(m_impl, offset, length));
    223218}
    224219
Note: See TracChangeset for help on using the changeset viewer.