[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
Thu Oct 4 09:44:08 PDT 2012


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





--- Comment #4 from Michael Saboff <msaboff at apple.com>  2012-10-04 09:44:35 PST ---
(In reply to comment #3)
> (From update of attachment 166981 [details])
> 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?

>From what I've seen, the use of remove is within length range and this wouldn't help.

> > 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.

Done.

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