Misc improvements to CString 1- Make it possible to initialize a CString from a CStringBuffer 2- Make it possible to get a CStringBuffer from a CString 3- Change CStringBuffer::data() to return a const pointer to ward off mutation 4- Remove unused releaseBuffer() methods. 5- Make CStringBuffer::create() private to force consumers to get a CStringBuffer from a CString.
Created attachment 27816 [details] v1 patch
There is no consumer yet for CString::buffer() and the corresponding constructor, but I am brewing such a consumer that will live in the chromium WebKit layer.
Comment on attachment 27816 [details] v1 patch This looks fine. It's kinda sad how we're growing a parallel string class here, but that happened long ago, and was inevitable based on how many APIs outside of WebKit depend on char* strings. (And doesn't really relate to this patch.) releaseBuffer() was not used anywhere? I'm surprised. Looks fine.
I see releaseBuffer was added: 2008-03-25 Brady Eidson <beidson@apple.com> Reviewed by Anders Add the ability to transform a CString into a SharedBuffer to avoid copying data This is valuable to avoid copying a block of data for an upcoming patch * platform/SharedBuffer.cpp: (WebCore::SharedBuffer::adoptVector): * platform/SharedBuffer.h: * platform/text/CString.cpp: (WebCore::CString::releaseBuffer): * platform/text/CString.h: (WebCore::CStringBuffer::releaseBuffer): But I don't see the upcomming patch. :)
Brady, please let me know if you want releaseBuffer added back. Landed as http://trac.webkit.org/changeset/41105