Bug 1453134 - part 1 - add a string input stream constructor that accepts move references; r=baku
This method is more efficient when we know we're not going to need the string afterwards, and should cut down on intermediate allocations.
This commit is contained in:
@@ -782,8 +782,9 @@ FSTextPlain::GetEncodedSubmission(nsIURI* aURI,
|
||||
ConvertLineBreaks(cbody.get(),
|
||||
nsLinebreakConverter::eLinebreakAny,
|
||||
nsLinebreakConverter::eLinebreakNet));
|
||||
uint32_t bodyLength = cbody.Length();
|
||||
nsCOMPtr<nsIInputStream> bodyStream;
|
||||
rv = NS_NewCStringInputStream(getter_AddRefs(bodyStream), cbody);
|
||||
rv = NS_NewCStringInputStream(getter_AddRefs(bodyStream), Move(cbody));
|
||||
if (!bodyStream) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@@ -797,7 +798,7 @@ FSTextPlain::GetEncodedSubmission(nsIURI* aURI,
|
||||
mimeStream->SetData(bodyStream);
|
||||
CallQueryInterface(mimeStream, aPostDataStream);
|
||||
|
||||
*aPostDataStreamLength = cbody.Length();
|
||||
*aPostDataStreamLength = bodyLength;
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
||||
Reference in New Issue
Block a user