Closed Bug 85310 Opened 23 years ago Closed 9 years ago

ToNewCString, AssignWithConversion, NS_ConvertASCIItoUCS2 in libnet

Categories

(Core :: Networking, defect)

defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME
Future

People

(Reporter: nhottanscp, Unassigned)

Details

Attachments

(2 files)

Separated from bug 51355. Under mozilla/netwerk, there are 59 of ToNewCstring, 43 of AssignWithConversion, 11 of NS_ConvertASCIItoUCS2 Some of them might not be appropriate (i.e. data might not be ASCII only). Changing them to ToNewUTF8String, NS_ConvertUTF8toUCS2 would not break ASCII (UTF-8 is a superset of ASCII), though I am not sure about performance difference if changing all of them unconditionally.
.
Target Milestone: --- → mozilla1.0
what is milestone "mozilla1.0" anyway? Moving to future.
Target Milestone: mozilla1.0 → Future
to gagan. Given time, we should review these call sites.
Assignee: dougt → gagan
Attachment #151727 - Flags: superreview?(darin)
Attachment #151727 - Flags: review?(darin)
Comment on attachment 151727 [details] [diff] [review] remove all AssignWithConversion in necko (checked in) >Index: streamconv/test/TestStreamConv.cpp > nsresult SendData(const char * aData, nsIStreamListener* aListener, nsIRequest* request) { >- nsString data; >- data.AssignWithConversion(aData); > nsCOMPtr<nsIInputStream> dataStream; >- nsresult rv = NS_NewStringInputStream(getter_AddRefs(dataStream), data); >+ nsresult rv = NS_NewCharInputStream(getter_AddRefs(dataStream), aData); > if (NS_FAILED(rv)) return rv; > > return aListener->OnDataAvailable(request, nsnull, dataStream, 0, -1); > } note: you're eliminating a string copy here. |dataStream| will hold a pointer to aData, so we're really counting on the fact that OnDataAvailable is supposed to consume all of |dataStream| before returning. hmm... we should be passing strlen(aData) for the ODA's count param. but, whatever... this is just test code. r+sr=darin
Attachment #151727 - Flags: superreview?(darin)
Attachment #151727 - Flags: superreview+
Attachment #151727 - Flags: review?(darin)
Attachment #151727 - Flags: review+
Comment on attachment 151727 [details] [diff] [review] remove all AssignWithConversion in necko (checked in) thanks, patch checked in.
Attachment #151727 - Attachment description: remove all AssignWithConversion in necko → remove all AssignWithConversion in necko (checked in)
this kills *WithConversion (which only matches AppendWithConversion)
Attachment #153719 - Flags: superreview?(darin)
Attachment #153719 - Flags: review?(darin)
Attachment #153719 - Flags: superreview?(darin)
Attachment #153719 - Flags: superreview+
Attachment #153719 - Flags: review?(darin)
Attachment #153719 - Flags: review+
Comment on attachment 153719 [details] [diff] [review] remove all *WithConversion from necko (checked in) checked in
Attachment #153719 - Attachment description: remove all *WithConversion from necko → remove all *WithConversion from necko (checked in)
Assignee: gagan → nobody
QA Contact: benc → networking
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: