Closed Bug 315786 Opened 19 years ago Closed 19 years ago

Make the functions defined in nsEscape.h more useful

Categories

(Core :: XPCOM, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: darin.moz, Assigned: darin.moz)

References

Details

(Keywords: fixed1.8.1)

Attachments

(1 file, 1 obsolete file)

Make the functions defined in nsEscape.h more useful

For example, it is a pain to escape/unescape UTF-16 strings.  NS_EscapeURL and NS_UnescapeURL all have versions that return nsACString references that helps avoid copying when unnecessary.  However, many consumers would be happier with a nsCSubstring reference or a nsCString reference.  We can easily support other inline variants on those methods that makes the APIs easier to use.
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.9alpha
Attached patch v1 patch (obsolete) — Splinter Review
This patch cleans up the string types (dropping the deprecated string class names) and adds versions of NS_EscapeURL that operate on nsCSubstring.
Attachment #202610 - Flags: review?(cbiesinger)
Comment on attachment 202610 [details] [diff] [review]
v1 patch

could use BeginReading() these days, and avoid the temp variable

I wonder if making these templates would be a good idea? It'd avoid having all these copies of the function in this file.

Oh, and couldn't you make the first argument an nsACString&, now that it has a BeginReading() method?
Attachment #202610 - Flags: review?(cbiesinger) → review+
(one that returns a const char*, that is)
Attached patch v1.1 patchSplinter Review
Here's the version that I ended up checking in.  I realized that my first patch would not work if compiled without MOZ_V1_STRING_ABI.
Attachment #202610 - Attachment is obsolete: true
fixed-on-trunk
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Blocks: 324274
Keywords: fixed1.8.1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: