Maybe expose direct buffer manipulation in frozen string API

RESOLVED DUPLICATE of bug 288786

Status

()

Core
String
--
enhancement
RESOLVED DUPLICATE of bug 288786
14 years ago
13 years ago

People

(Reporter: Darin Fisher, Assigned: Darin Fisher)

Tracking

({arch})

Trunk
Future
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Assignee)

Description

14 years ago
Maybe expose direct buffer manipulation in frozen string API.

To facilitate implementing functions like ToLowerCase using only the string API,
it might be good to expose a version of NS_StringGetData that returns a mutable
|PRUnichar*| buffer.  The new function would have a parameter that allows the
caller to specify the desired string length, e.g.:

NS_STRINGAPI(nsresult)
NS_StringGetDataMutable(nsAString &aStr, PRUint32 aDataLen, PRUnichar **aData);

I'm not sure I like this signature or name, but putting that issue aside for a
moment, this function would be implemented like this:

NS_StringGetDataMutable(nsAString &aStr, PRUint32 aDataLen, PRUnichar **aData)
{
  aStr->SetLength(aDataLen);

  nsAString::iterator iter;
  aStr->BeginWriting(iter);
  *aData = iter.get();

  return NS_OK;
}
(Assignee)

Updated

14 years ago
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.8alpha
(Assignee)

Updated

14 years ago
Keywords: arch
Target Milestone: mozilla1.8alpha1 → Future
(Assignee)

Comment 1

13 years ago

*** This bug has been marked as a duplicate of 288786 ***
Status: ASSIGNED → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.