Closed Bug 298820 Opened 20 years ago Closed 20 years ago

nsIScriptableUConv should use ACString

Categories

(Core :: Internationalization, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.8beta3

People

(Reporter: Biesinger, Assigned: Biesinger)

Details

Attachments

(1 file)

it would be nice if nsIScriptableUnicodeConverter would use ACString in its signatures, so that if someone actually can get hold of a string with null bytes, they can convert it successfully. This does not affect JS compatibility.
Attached patch patchSplinter Review
Attachment #187344 - Flags: review?(jshin1987)
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.8beta3
Comment on attachment 187344 [details] [diff] [review] patch r=jshin thanks ! ConvertFromByteArray(NS_REINTERPRET_CAST(const PRUint8*, aSrc), >- strlen(aSrc), >+ nsACString::const_iterator i; >+ aSrc.BeginReading(i); >+ return ConvertFromByteArray(NS_REINTERPRET_CAST(const PRUint8*, i.get()), >+ aSrc.Length(), > _retval); How about using darin's idiom? :-) const PRUint8* i = NS_REINTERPRET_CAST(const PRUint8*, aSrc.BeginReading()); ConvertFromByteArray(i, aSrc.Length(), _retval);
Attachment #187344 - Flags: review?(jshin1987) → review+
Comment on attachment 187344 [details] [diff] [review] patch NS_REINTERPRET_CAST(const PRUint8*, aSrc.BeginReading()); I'd love to, but that requires an nsCString, not an nsACString.
Attachment #187344 - Flags: superreview?(darin)
Comment on attachment 187344 [details] [diff] [review] patch You could optimize this code to avoid the buffer copies by using SetLength + BeginWriting on nsACString, but I'm not sure it's worth it. sr=darin
Attachment #187344 - Flags: superreview?(darin) → superreview+
Comment on attachment 187344 [details] [diff] [review] patch yeah, not sure either. maybe as a followup patch. Low risk patch to change the type accepted by a function to allow passing all kinds of binary data.
Attachment #187344 - Flags: approval1.8b3?
Attachment #187344 - Flags: approval1.8b3? → approval1.8b3+
Checking in intl/uconv/idl/nsIScriptableUConv.idl; /cvsroot/mozilla/intl/uconv/idl/nsIScriptableUConv.idl,v <-- nsIScriptableUConv.idl new revision: 1.10; previous revision: 1.9 done Checking in intl/uconv/src/nsScriptableUConv.cpp; /cvsroot/mozilla/intl/uconv/src/nsScriptableUConv.cpp,v <-- nsScriptableUConv.cpp new revision: 1.17; previous revision: 1.16 done
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: