mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 14:58:37 +09:00
Avoid unnecessary string creation.
This commit is contained in:
parent
ea1e157289
commit
9a0997d28b
3 changed files with 19 additions and 5 deletions
|
|
@ -4128,9 +4128,15 @@ nsContentUtils::GetSubdocumentWithOuterWindowId(nsIDocument *aDocument,
|
|||
/* static */
|
||||
nsresult
|
||||
nsContentUtils::ConvertStringFromEncoding(const nsACString& aEncoding,
|
||||
const nsACString& aInput,
|
||||
const char* aInput,
|
||||
uint32_t aInputLen,
|
||||
nsAString& aOutput)
|
||||
{
|
||||
CheckedInt32 len = aInputLen;
|
||||
if (!len.isValid()) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsAutoCString encoding;
|
||||
if (aEncoding.IsEmpty()) {
|
||||
encoding.AssignLiteral("UTF-8");
|
||||
|
|
@ -4142,7 +4148,7 @@ nsContentUtils::ConvertStringFromEncoding(const nsACString& aEncoding,
|
|||
nsAutoPtr<TextDecoder> decoder(new TextDecoder());
|
||||
decoder->InitWithEncoding(encoding, false);
|
||||
|
||||
decoder->Decode(aInput.BeginReading(), aInput.Length(), false,
|
||||
decoder->Decode(aInput, len.value(), false,,
|
||||
aOutput, rv);
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue