Bug 71208 - StringImpl::empty() should have a 8-bit version
Summary: StringImpl::empty() should have a 8-bit version
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-31 00:47 PDT by Xianzhu Wang
Modified: 2012-02-10 11:15 PST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xianzhu Wang 2011-10-31 00:47:23 PDT
For now, some 8-bit version of static member function of StringImpl returns empty() which for now has only a 16-bit version. This will cause problems in the following scenario:

RefPtr<StringImpl> s(StringImpl::create8(""));
s.characters8(); // Assertion fails

I thought of two solutions:
1. Add StringImpl::empty8() which is the 8-bit version of StringImpl::empty();
2. Add StringImpl::is16Bit(). For empty strings, both is8Bit() and is16Bit() returns true. Change all ASSERT(!is8Bit()) to ASSERT(is16Bit()).

I prefer the second way because all existing callers of empty() could remain unchanged.
Comment 1 Xianzhu Wang 2011-10-31 01:59:34 PDT
I'd like to hold on this bug until we actually enable 8-bit buffers (i.e. when we remove the ASSERT_NOT_REACHED() in StringImpl::characters8().
Comment 2 Xianzhu Wang 2012-02-10 11:15:49 PST
The current StringImpl::empty() returns a 8-bit string.