Closed Bug 248810 Opened 20 years ago Closed 20 years ago

nsIStreamConverter[Service] uses wide strings for mime types

Categories

(Core :: Networking, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.8alpha2

People

(Reporter: Biesinger, Assigned: Biesinger)

Details

Attachments

(1 file)

nsIStreamConverter and nsIStreamConverterService use wide strings for mime types. that's completely unnecessary, and a waste of codesize due to conversions PRUnichar<->char
Attachment #151809 - Flags: superreview?(darin)
Attachment #151809 - Flags: review?(darin)
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.8alpha2
Would this... Index: netwerk/streamconv/src/nsStreamConverterService.cpp nsCAutoString contractID(NS_ISTREAMCONVERTER_KEY); contractID.Append("?from="); contractID.Append(aFromType); contractID.Append("&to="); contractID.Append(aToType); (x 2) be more efficient as a single assign? nsCAutoString contractID( NS_LITERAL_CSTRING(NS_ISTREAMCONVERTER_KEY) + NS_LITERAL_CSTRING("?from=") + nsDependentCString(aFromType) + NS_LITERAL_CSTRING("&to=") + nsDependentString(aToType) ); Or at least using AppendLiteral for the 2 literals.
Comment on attachment 151809 [details] [diff] [review] patch need to rev UUID on interfaces, and please move NS_STREAMCONVERTERSERVICE_CID into nsNetCID.h ... no CID or ContractID should be declared in an interface (general rule of thumb). probably makes sense to keep NS_ISTREAMCONVERTER_KEY in the IDL file though. i agree with brodie.. maybe do a dependent concat. r+sr=darin with those changes.
Attachment #151809 - Flags: superreview?(darin)
Attachment #151809 - Flags: superreview+
Attachment #151809 - Flags: review?(darin)
Attachment #151809 - Flags: review+
hm... ok... I'll make a concat, but I wonder if the cost of the three constructors & destructors (of the literal strings) is worth it, performance- and codesize-wise.
(add two ctors/dtors to the list - nsDependentCString)
checked in
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
(In reply to comment #4) > hm... ok... I'll make a concat, but I wonder if the cost of the three > constructors & destructors (of the literal strings) is worth it, performance- > and codesize-wise. good point... though ctors are inlined
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: