Closed
Bug 114140
Opened 23 years ago
Closed 15 years ago
need clearer API for writing to strings
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
INCOMPLETE
People
(Reporter: dbaron, Assigned: jag+mozilla)
References
Details
This is partly a spin-off of some of the early discussion in bug 104663. |SetLength| and |SetCapacity| are rather ugly members of the string API, and they do multiple things that aren't clear from their names. It's also not clear what the rules for using writing iterators are. We need to address these issues. A possible public API to replace these functions would be: * |Truncate| - already exists, and could replace most (?) calls to |SetLength|. * |EnsureCapacity| - if one wants to use writing iterators to write a length longer than the current one or ensure capacity for an append. (Alternately, this could be required for *all* writes to a string and we wouldn't override GetWritableFragment on sharable strings -- which we need to do -- to ensure a unique buffer.) * |ReleaseStorage| - do we even need this? See http://bugzilla.mozilla.org/show_bug.cgi?id=104663#c0 * |DidWrite(nsWritingIterator& aIter)| - tell a string that one has written a specific amount (perhaps smaller than the capacity ensured by |EnsureCapacity|), and allow it to null-terminate itself if it is flat. See http://lxr.mozilla.org/seamonkey/source/string/src/nsSharableString.cpp#40 for some additional comments.
Reporter | ||
Comment 1•23 years ago
|
||
Note that if |EnsureCapacity| were required for all writes, it would need to be called something else, like |WillWrite|.
Comment 2•22 years ago
|
||
giving up ancient string bugs to the new string owner. jag, you'll want to sort through these and see which ones still apply and go with or against the direction in which you intend strings evolve
Assignee: scc → jaggernaut
Updated•15 years ago
|
QA Contact: jag → string
Updated•15 years ago
|
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → INCOMPLETE
Updated•4 years ago
|
Component: String → XPCOM
You need to log in
before you can comment on or make changes to this bug.
Description
•