Bug 1344629 - Part 6: Rewrite unnecessary uses of nsLiteralString. r=dbaron
There's an antipattern where nsLiteralString is used as an unnecessary intermediary in converting from CharT* to CharT*,
e.g. CallAFunctionThatTakesACharPointer(NS_LITERAL_CSTRING("foo").get());
or
NS_NAMED_LITERAL_STRING(foo, "abc");
CallAFunctionThatTakesACharPointer(foo.get());
This patch rewrites the callsites that can be trivially changed to use char*/char16_t*.
I'd somewhat like to remove nsTLiteralString::get() altogether, but in code that's less straightforward than these examples, get() is useful enough to keep.
MozReview-Commit-ID: Kh1rUziVllo
This commit is contained in:
@@ -585,8 +585,7 @@ ImageDocument::OnLoadComplete(imgIRequest* aRequest, nsresult aStatus)
|
||||
NS_ConvertUTF8toUTF16 srcString(src);
|
||||
const char16_t* formatString[] = { srcString.get() };
|
||||
nsXPIDLString errorMsg;
|
||||
NS_NAMED_LITERAL_STRING(str, "InvalidImage");
|
||||
mStringBundle->FormatStringFromName(str.get(), formatString, 1,
|
||||
mStringBundle->FormatStringFromName(u"InvalidImage", formatString, 1,
|
||||
getter_Copies(errorMsg));
|
||||
|
||||
mImageContent->SetAttr(kNameSpaceID_None, nsGkAtoms::alt, errorMsg, false);
|
||||
|
||||
Reference in New Issue
Block a user