Bug 869836 - Part 5: Use AssignLiteral instead of Assign where possible. r=ehsan

This commit is contained in:
Birunthan Mohanathas 2014-05-22 06:48:51 +03:00
parent 807e72372f
commit e2a009d822
23 changed files with 51 additions and 51 deletions

View File

@ -408,15 +408,15 @@ nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement,
// Set desktop wallpaper filling style
nsAutoCString options;
if (aPosition == BACKGROUND_TILE)
options.Assign("wallpaper");
options.AssignLiteral("wallpaper");
else if (aPosition == BACKGROUND_STRETCH)
options.Assign("stretched");
options.AssignLiteral("stretched");
else if (aPosition == BACKGROUND_FILL)
options.Assign("zoom");
options.AssignLiteral("zoom");
else if (aPosition == BACKGROUND_FIT)
options.Assign("scaled");
options.AssignLiteral("scaled");
else
options.Assign("centered");
options.AssignLiteral("centered");
// Write the background file to the home directory.
nsAutoCString filePath(PR_GetEnv("HOME"));
@ -581,9 +581,9 @@ nsGNOMEShellService::OpenApplication(int32_t aApplication)
{
nsAutoCString scheme;
if (aApplication == APPLICATION_MAIL)
scheme.Assign("mailto");
scheme.AssignLiteral("mailto");
else if (aApplication == APPLICATION_NEWS)
scheme.Assign("news");
scheme.AssignLiteral("news");
else
return NS_ERROR_NOT_AVAILABLE;

View File

@ -1292,21 +1292,21 @@ DetectByteOrderMark(const unsigned char* aBytes, int32_t aLen, nsCString& oChars
if (aLen >= 3 && 0xBB == aBytes[1] && 0xBF == aBytes[2]) {
// EF BB BF
// Win2K UTF-8 BOM
oCharset.Assign("UTF-8");
oCharset.AssignLiteral("UTF-8");
}
break;
case 0xFE:
if (0xFF == aBytes[1]) {
// FE FF
// UTF-16, big-endian
oCharset.Assign("UTF-16BE");
oCharset.AssignLiteral("UTF-16BE");
}
break;
case 0xFF:
if (0xFE == aBytes[1]) {
// FF FE
// UTF-16, little-endian
oCharset.Assign("UTF-16LE");
oCharset.AssignLiteral("UTF-16LE");
}
break;
}

View File

@ -6733,16 +6733,16 @@ HTMLInputElement::GetValidationMessage(nsAString& aValidationMessage,
switch (mType)
{
case NS_FORM_INPUT_FILE:
key.Assign("FormValidationFileMissing");
key.AssignLiteral("FormValidationFileMissing");
break;
case NS_FORM_INPUT_CHECKBOX:
key.Assign("FormValidationCheckboxMissing");
key.AssignLiteral("FormValidationCheckboxMissing");
break;
case NS_FORM_INPUT_RADIO:
key.Assign("FormValidationRadioMissing");
key.AssignLiteral("FormValidationRadioMissing");
break;
default:
key.Assign("FormValidationValueMissing");
key.AssignLiteral("FormValidationValueMissing");
}
rv = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
key.get(), message);

View File

@ -2986,10 +2986,10 @@ ConvertToMidasInternalCommandInner(const nsAString& inCommandID,
// Hack to support old boolean commands that were backwards (see bug 301490).
bool invertBool = false;
if (convertedCommandID.LowerCaseEqualsLiteral("usecss")) {
convertedCommandID.Assign("styleWithCSS");
convertedCommandID.AssignLiteral("styleWithCSS");
invertBool = true;
} else if (convertedCommandID.LowerCaseEqualsLiteral("readonly")) {
convertedCommandID.Assign("contentReadOnly");
convertedCommandID.AssignLiteral("contentReadOnly");
invertBool = true;
}

View File

@ -603,7 +603,7 @@ NS_ScriptErrorReporter(JSContext *cx,
// Print it to stderr as well, for the benefit of those invoking
// mozilla with -console.
nsAutoCString error;
error.Assign("JavaScript ");
error.AssignLiteral("JavaScript ");
if (JSREPORT_IS_STRICT(report->flags))
error.Append("strict ");
if (JSREPORT_IS_WARNING(report->flags))

View File

@ -54,15 +54,15 @@ ICameraControl::GetCameraName(uint32_t aDeviceNum, nsCString& aDeviceName)
switch (info.facing) {
case CAMERA_FACING_BACK:
aDeviceName.Assign("back");
aDeviceName.AssignLiteral("back");
break;
case CAMERA_FACING_FRONT:
aDeviceName.Assign("front");
aDeviceName.AssignLiteral("front");
break;
default:
aDeviceName.Assign("extra-camera-");
aDeviceName.AssignLiteral("extra-camera-");
aDeviceName.AppendInt(deviceNum);
break;
}

View File

@ -118,7 +118,7 @@ public:
ProfilerString(const Key& aKey)
{
if (aKey.IsUnset()) {
Assign("null");
AssignLiteral("null");
}
else if (aKey.IsFloat()) {
AppendPrintf("%g", aKey.ToFloat());

View File

@ -1415,7 +1415,7 @@ nsPluginHost::RegisterPlayPreviewMimeType(const nsACString& mimeType,
nsAutoCString url(redirectURL);
if (url.Length() == 0) {
// using default play preview iframe URL, if redirectURL is not specified
url.Assign("data:application/x-moz-playpreview;,");
url.AssignLiteral("data:application/x-moz-playpreview;,");
url.Append(mimeType);
}

View File

@ -394,13 +394,13 @@ WebBrowserChrome::SendHistoryStatusMessage(nsIURI * aURI, char * operation, int3
if(!(strcmp(operation, "back")))
{
status.Assign("Going back to url: ");
status.AssignLiteral("Going back to url: ");
status.Append(uriSpec);
}
else if (!(strcmp(operation, "forward")))
{
// Going forward. XXX Get string from a resource file
status.Assign("Going forward to url: ");
status.AssignLiteral("Going forward to url: ");
status.Append(uriSpec);
}
else if (!(strcmp(operation, "reload")))
@ -409,19 +409,19 @@ WebBrowserChrome::SendHistoryStatusMessage(nsIURI * aURI, char * operation, int3
if (aReloadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY &&
aReloadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE)
{
status.Assign("Reloading url, (bypassing proxy and cache): ");
status.AssignLiteral("Reloading url, (bypassing proxy and cache): ");
}
else if (aReloadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY)
{
status.Assign("Reloading url, (bypassing proxy): ");
status.AssignLiteral("Reloading url, (bypassing proxy): ");
}
else if (aReloadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE)
{
status.Assign("Reloading url, (bypassing cache): ");
status.AssignLiteral("Reloading url, (bypassing cache): ");
}
else
{
status.Assign("Reloading url, (normal): ");
status.AssignLiteral("Reloading url, (normal): ");
}
status.Append(uriSpec);
}
@ -432,7 +432,7 @@ WebBrowserChrome::SendHistoryStatusMessage(nsIURI * aURI, char * operation, int3
}
else if (!(strcmp(operation, "goto")))
{
status.Assign("Going to HistoryIndex: ");
status.AssignLiteral("Going to HistoryIndex: ");
AppendIntToCString(info1, status);
@ -446,7 +446,7 @@ WebBrowserChrome::SendHistoryStatusMessage(nsIURI * aURI, char * operation, int3
}
else if (!(strcmp(operation, "replace")))
{
status.Assign("Replacing HistoryIndex: ");
status.AssignLiteral("Replacing HistoryIndex: ");
AppendIntToCString(info1, status);
}

View File

@ -473,7 +473,7 @@ nsGIOInputStream::DoRead(char *aBuf, uint32_t aCount, uint32_t *aCountRead)
continue;
}
mDirBuf.Assign("201: ");
mDirBuf.AssignLiteral("201: ");
// The "filename" field
nsCString escName;
@ -932,7 +932,7 @@ nsGIOProtocolHandler::InitSupportedProtocolsPref(nsIPrefBranch *prefs)
ToLowerCase(mSupportedProtocols);
}
else
mSupportedProtocols.Assign("smb:,sftp:"); // use defaults
mSupportedProtocols.AssignLiteral("smb:,sftp:"); // use defaults
LOG(("gio: supported protocols \"%s\"\n", mSupportedProtocols.get()));
}

View File

@ -522,7 +522,7 @@ nsGnomeVFSInputStream::DoRead(char *aBuf, uint32_t aCount, uint32_t *aCountRead)
continue;
}
mDirBuf.Assign("201: ");
mDirBuf.AssignLiteral("201: ");
// The "filename" field
nsCString escName;
@ -794,7 +794,7 @@ nsGnomeVFSProtocolHandler::InitSupportedProtocolsPref(nsIPrefBranch *prefs)
ToLowerCase(mSupportedProtocols);
}
else
mSupportedProtocols.Assign("smb:,sftp:"); // use defaults
mSupportedProtocols.AssignLiteral("smb:,sftp:"); // use defaults
LOG(("gnomevfs: supported protocols \"%s\"\n", mSupportedProtocols.get()));
}

View File

@ -46,7 +46,7 @@ nsresult nsDateTimeFormatUnix::Initialize(nsILocale* locale)
}
mCharset.AssignLiteral("windows-1252");
mPlatformLocale.Assign("en_US");
mPlatformLocale.AssignLiteral("en_US");
// get locale name string, use app default if no locale specified
if (!locale) {

View File

@ -1911,7 +1911,7 @@ jsdStackFrame::GetFunctionName(nsACString &_rval)
if (str)
return AssignToJSString(mCx, &_rval, str);
_rval.Assign("anonymous");
_rval.AssignLiteral("anonymous");
return NS_OK;
}

View File

@ -507,7 +507,7 @@ EvalInWindow(JSContext *cx, const nsAString &source, HandleObject scope, Mutable
unsigned lineNo;
if (!GetFilenameAndLineNumber(cx, filename, lineNo)) {
// Default values for non-scripted callers.
filename.Assign("Unknown");
filename.AssignLiteral("Unknown");
lineNo = 0;
}

View File

@ -3298,7 +3298,7 @@ CacheFileIOManager::CreateFile(CacheFileHandle *aHandle)
void
CacheFileIOManager::HashToStr(const SHA1Sum::Hash *aHash, nsACString &_retval)
{
_retval.Assign("");
_retval.AssignLiteral("");
const char hexChars[] = {'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
for (uint32_t i=0 ; i<sizeof(SHA1Sum::Hash) ; i++) {

View File

@ -1600,7 +1600,7 @@ void
WebSocketChannel::GeneratePing()
{
nsCString *buf = new nsCString();
buf->Assign("PING");
buf->AssignLiteral("PING");
EnqueueOutgoingMessage(mOutgoingPingMessages,
new OutboundMessage(kMsgTypePing, buf));
}

View File

@ -513,7 +513,7 @@ WyciwygChannelChild::SetContentType(const nsACString & aContentType)
NS_IMETHODIMP
WyciwygChannelChild::GetContentCharset(nsACString & aContentCharset)
{
aContentCharset.Assign("UTF-16");
aContentCharset.AssignLiteral("UTF-16");
return NS_OK;
}
NS_IMETHODIMP

View File

@ -336,7 +336,7 @@ nsWyciwygChannel::SetContentType(const nsACString &aContentType)
NS_IMETHODIMP
nsWyciwygChannel::GetContentCharset(nsACString &aContentCharset)
{
aContentCharset.Assign("UTF-16");
aContentCharset.AssignLiteral("UTF-16");
return NS_OK;
}

View File

@ -32,12 +32,12 @@ nsHtml5MetaScanner::tryCharset(nsString* charset)
}
if (encoding.EqualsLiteral("UTF-16BE") ||
encoding.EqualsLiteral("UTF-16LE")) {
mCharset.Assign("UTF-8");
mCharset.AssignLiteral("UTF-8");
return true;
}
if (encoding.EqualsLiteral("x-user-defined")) {
// WebKit/Blink hack for Indian and Armenian legacy sites
mCharset.Assign("windows-1252");
mCharset.AssignLiteral("windows-1252");
return true;
}
mCharset.Assign(encoding);

View File

@ -70,7 +70,7 @@ nsHtml5Parser::GetContentSink()
NS_IMETHODIMP_(void)
nsHtml5Parser::GetCommand(nsCString& aCommand)
{
aCommand.Assign("view");
aCommand.AssignLiteral("view");
}
NS_IMETHODIMP_(void)

View File

@ -373,9 +373,9 @@ nsHtml5StreamParser::SniffBOMlessUTF16BasicLatin(const uint8_t* aFromSegment,
}
if (byteNonZero[0]) {
mCharset.Assign("UTF-16LE");
mCharset.AssignLiteral("UTF-16LE");
} else {
mCharset.Assign("UTF-16BE");
mCharset.AssignLiteral("UTF-16BE");
}
mCharsetSource = kCharsetFromIrreversibleAutoDetection;
mTreeBuilder->SetDocumentCharset(mCharset, mCharsetSource);
@ -1201,7 +1201,7 @@ nsHtml5StreamParser::PreferredForInternalEncodingDecl(nsACString& aEncoding)
mTreeBuilder->MaybeComplainAboutCharset("EncMetaUtf16",
true,
mTokenizer->getLineNumber());
newEncoding.Assign("UTF-8");
newEncoding.AssignLiteral("UTF-8");
}
if (newEncoding.EqualsLiteral("x-user-defined")) {
@ -1209,7 +1209,7 @@ nsHtml5StreamParser::PreferredForInternalEncodingDecl(nsACString& aEncoding)
mTreeBuilder->MaybeComplainAboutCharset("EncMetaUserDefined",
true,
mTokenizer->getLineNumber());
newEncoding.Assign("windows-1252");
newEncoding.AssignLiteral("windows-1252");
}
if (newEncoding.Equals(mCharset)) {

View File

@ -466,7 +466,7 @@ nsFormFillController::GetSearchCount(uint32_t *aSearchCount)
NS_IMETHODIMP
nsFormFillController::GetSearchAt(uint32_t index, nsACString & _retval)
{
_retval.Assign("form-history");
_retval.AssignLiteral("form-history");
return NS_OK;
}

View File

@ -92,9 +92,9 @@ GetGREVersion(const char *argv0,
nsACString *aVersion)
{
if (aMilestone)
aMilestone->Assign("<Error>");
aMilestone->AssignLiteral("<Error>");
if (aVersion)
aVersion->Assign("<Error>");
aVersion->AssignLiteral("<Error>");
nsCOMPtr<nsIFile> iniFile;
nsresult rv = BinaryPath::GetFile(argv0, getter_AddRefs(iniFile));