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:
@@ -499,13 +499,11 @@ nsFilePicker::ShowFilePicker(const nsString& aInitialDir)
|
||||
dialog->SetFileName(mDefaultFilename.get());
|
||||
}
|
||||
|
||||
NS_NAMED_LITERAL_STRING(htmExt, "html");
|
||||
|
||||
// default extension to append to new files
|
||||
if (!mDefaultExtension.IsEmpty()) {
|
||||
dialog->SetDefaultExtension(mDefaultExtension.get());
|
||||
} else if (IsDefaultPathHtml()) {
|
||||
dialog->SetDefaultExtension(htmExt.get());
|
||||
dialog->SetDefaultExtension(L"html");
|
||||
}
|
||||
|
||||
// initial location
|
||||
|
||||
Reference in New Issue
Block a user