[Webkit-unassigned] [Bug 98299] String::remove will convert an 8 bit string to a 16 bit string

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Oct 3 17:42:50 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=98299


Benjamin Poulain <benjamin at webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #166981|review?                     |review+
               Flag|                            |




--- Comment #3 from Benjamin Poulain <benjamin at webkit.org>  2012-10-03 17:43:16 PST ---
(From update of attachment 166981)
View in context: https://bugs.webkit.org/attachment.cgi?id=166981&action=review

> Source/WTF/wtf/text/WTFString.cpp:281
>      if (static_cast<unsigned>(lengthToRemove) > length() - position)
>          lengthToRemove = length() - position;

No idea if that case is common.
If it is, shouldn't we just return a substring sharing impl here?

> Source/WTF/wtf/text/WTFString.cpp:289
> +        RefPtr<StringImpl> newImpl = StringImpl::createUninitialized(length() - lengthToRemove, data);
> +        memcpy(data, characters8(), position * sizeof(LChar));
> +        memcpy(data + position, characters8() + position + lengthToRemove,
> +            (length() - lengthToRemove - position) * sizeof(LChar));
> +        m_impl = newImpl.release();

I would do an inline template with that code taking CharacterType as argument.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list