зеркало из https://github.com/mozilla/gecko-dev.git
Bug 870698 - Part 10: Replace Append(NS_LITERAL_STRING("")) with AppendLiteral(u""). r=erahm
The NS_LITERAL_STRING macro creates a temporary nsLiteralString to encapsulate the char16_t string literal and its length, but AssignLiteral() can determine the char16_t string literal's length at compile-time without nsLiteralString. MozReview-Commit-ID: H9I6vNDMdIr --HG-- extra : rebase_source : cf537a1f65af003c6c4f8919b925b0f305c1dd4d extra : source : 13b89ce4e6a66c840f82a335c71f5a12938aba22
This commit is contained in:
Родитель
210c7f9690
Коммит
5698729243
|
@ -686,7 +686,7 @@ logging::Tree(const char* aTitle, const char* aMsgText,
|
|||
printf("%s", NS_ConvertUTF16toUTF8(level).get());
|
||||
logging::AccessibleInfo(prefix, root);
|
||||
if (root->FirstChild() && !root->FirstChild()->IsDoc()) {
|
||||
level.Append(NS_LITERAL_STRING(" "));
|
||||
level.AppendLiteral(u" ");
|
||||
root = root->FirstChild();
|
||||
continue;
|
||||
}
|
||||
|
@ -724,7 +724,7 @@ logging::DOMTree(const char* aTitle, const char* aMsgText,
|
|||
printf("%s", NS_ConvertUTF16toUTF8(level).get());
|
||||
logging::Node("", root);
|
||||
if (root->GetFirstChild()) {
|
||||
level.Append(NS_LITERAL_STRING(" "));
|
||||
level.AppendLiteral(u" ");
|
||||
root = root->GetFirstChild();
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ void GenerateConcatExpression(const nsAString& aStr, nsAString& aResult)
|
|||
nonQuoteBeginPtr = nullptr;
|
||||
}
|
||||
if (!quoteBeginPtr) {
|
||||
result.Append(NS_LITERAL_STRING("\',\""));
|
||||
result.AppendLiteral(u"\',\"");
|
||||
quoteBeginPtr = cur;
|
||||
}
|
||||
} else {
|
||||
|
@ -92,7 +92,7 @@ void GenerateConcatExpression(const nsAString& aStr, nsAString& aResult)
|
|||
}
|
||||
if (quoteBeginPtr) {
|
||||
result.Append(quoteBeginPtr, cur - quoteBeginPtr);
|
||||
result.Append(NS_LITERAL_STRING("\",\'"));
|
||||
result.AppendLiteral(u"\",\'");
|
||||
quoteBeginPtr = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ void GenerateConcatExpression(const nsAString& aStr, nsAString& aResult)
|
|||
|
||||
if (quoteBeginPtr) {
|
||||
result.Append(quoteBeginPtr, cur - quoteBeginPtr);
|
||||
result.Append(NS_LITERAL_STRING("\",\'"));
|
||||
result.AppendLiteral(u"\",\'");
|
||||
} else if (nonQuoteBeginPtr) {
|
||||
result.Append(nonQuoteBeginPtr, cur - nonQuoteBeginPtr);
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ void XPathGenerator::Generate(const nsINode* aNode, nsAString& aResult)
|
|||
if (count != 1) {
|
||||
countPart.AssignLiteral(u"[");
|
||||
countPart.AppendInt(count);
|
||||
countPart.Append(NS_LITERAL_STRING("]"));
|
||||
countPart.AppendLiteral(u"]");
|
||||
}
|
||||
Generate(aNode->GetParentNode(), aResult);
|
||||
aResult.Append(NS_LITERAL_STRING("/") + tag + namePart + countPart);
|
||||
|
|
|
@ -1635,7 +1635,7 @@ nsContentUtils::SandboxFlagsToString(uint32_t aFlags, nsAString& aString)
|
|||
#define SANDBOX_KEYWORD(string, atom, flags) \
|
||||
if (!(aFlags & (flags))) { \
|
||||
if (!aString.IsEmpty()) { \
|
||||
aString.Append(NS_LITERAL_STRING(" ")); \
|
||||
aString.AppendLiteral(u" "); \
|
||||
} \
|
||||
aString.Append(nsDependentAtomString(nsGkAtoms::atom)); \
|
||||
}
|
||||
|
|
|
@ -802,11 +802,11 @@ FlyWebMDNSService::PairWithService(const nsAString& aServiceId,
|
|||
url.Append(aInfo->mService.mHostname);
|
||||
if (!discInfo->mService.mPath.IsEmpty()) {
|
||||
if (discInfo->mService.mPath.Find("/") != 0) {
|
||||
url.Append(NS_LITERAL_STRING("/"));
|
||||
url.AppendLiteral(u"/");
|
||||
}
|
||||
url.Append(discInfo->mService.mPath);
|
||||
} else {
|
||||
url.Append(NS_LITERAL_STRING("/"));
|
||||
url.AppendLiteral(u"/");
|
||||
}
|
||||
nsCOMPtr<nsIURI> uiURL;
|
||||
NS_NewURI(getter_AddRefs(uiURL), url);
|
||||
|
|
|
@ -142,7 +142,7 @@ CSP_LogMessage(const nsAString& aMessage,
|
|||
|
||||
// Prepending CSP to the outgoing console message
|
||||
nsString cspMsg;
|
||||
cspMsg.Append(NS_LITERAL_STRING("Content Security Policy: "));
|
||||
cspMsg.AppendLiteral(u"Content Security Policy: ");
|
||||
cspMsg.Append(aMessage);
|
||||
|
||||
// Currently 'aSourceLine' is not logged to the console, because similar
|
||||
|
@ -152,9 +152,9 @@ CSP_LogMessage(const nsAString& aMessage,
|
|||
// E.g. 'aSourceLine' might be: 'onclick attribute on DIV element'.
|
||||
// In such cases we append 'aSourceLine' directly to the error message.
|
||||
if (!aSourceLine.IsEmpty()) {
|
||||
cspMsg.Append(NS_LITERAL_STRING(" Source: "));
|
||||
cspMsg.AppendLiteral(" Source: ");
|
||||
cspMsg.Append(aSourceLine);
|
||||
cspMsg.Append(NS_LITERAL_STRING("."));
|
||||
cspMsg.AppendLiteral(u".");
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
|
|
|
@ -873,7 +873,7 @@ nsCSSSelector::AppendToStringWithoutCombinatorsOrNegations
|
|||
|
||||
if (list->mValueCaseSensitivity ==
|
||||
nsAttrSelector::ValueCaseSensitivity::CaseInsensitive) {
|
||||
aString.Append(NS_LITERAL_STRING(" i"));
|
||||
aString.AppendLiteral(u" i");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6429,15 +6429,15 @@ nsHttpChannel::BeginConnect()
|
|||
if (consoleService) {
|
||||
nsAutoString message(NS_LITERAL_STRING("Alternate Service Mapping found: "));
|
||||
AppendASCIItoUTF16(scheme.get(), message);
|
||||
message.Append(NS_LITERAL_STRING("://"));
|
||||
message.AppendLiteral(u"://");
|
||||
AppendASCIItoUTF16(host.get(), message);
|
||||
message.Append(NS_LITERAL_STRING(":"));
|
||||
message.AppendLiteral(u":");
|
||||
message.AppendInt(port);
|
||||
message.Append(NS_LITERAL_STRING(" to "));
|
||||
message.AppendLiteral(u" to ");
|
||||
AppendASCIItoUTF16(scheme.get(), message);
|
||||
message.Append(NS_LITERAL_STRING("://"));
|
||||
message.AppendLiteral(u"://");
|
||||
AppendASCIItoUTF16(mapping->AlternateHost().get(), message);
|
||||
message.Append(NS_LITERAL_STRING(":"));
|
||||
message.AppendLiteral(u":");
|
||||
message.AppendInt(mapping->AlternatePort());
|
||||
consoleService->LogStringMessage(message.get());
|
||||
}
|
||||
|
|
|
@ -18,10 +18,10 @@ nsHtml5ViewSourceUtils::NewBodyAttributes()
|
|||
|
||||
nsString klass;
|
||||
if (mozilla::Preferences::GetBool("view_source.wrap_long_lines", true)) {
|
||||
klass.Append(NS_LITERAL_STRING("wrap "));
|
||||
klass.AppendLiteral(u"wrap ");
|
||||
}
|
||||
if (mozilla::Preferences::GetBool("view_source.syntax_highlight", true)) {
|
||||
klass.Append(NS_LITERAL_STRING("highlight"));
|
||||
klass.AppendLiteral(u"highlight");
|
||||
}
|
||||
if (!klass.IsEmpty()) {
|
||||
bodyAttrs->addAttribute(
|
||||
|
|
|
@ -1221,7 +1221,7 @@ CheckDirForUnsignedFiles(nsIFile* aDir,
|
|||
|
||||
// if it's a directory we need to recurse
|
||||
if (isDir) {
|
||||
curName.Append(NS_LITERAL_STRING("/"));
|
||||
curName.AppendLiteral(u"/");
|
||||
rv = CheckDirForUnsignedFiles(file, curName, aItems,
|
||||
sigFilename, sfFilename, mfFilename);
|
||||
} else {
|
||||
|
|
|
@ -805,46 +805,46 @@ internal_LogScalarError(const nsACString& aScalarName, ScalarResult aSr)
|
|||
|
||||
switch (aSr) {
|
||||
case ScalarResult::NotInitialized:
|
||||
errorMessage.Append(NS_LITERAL_STRING(" - Telemetry was not yet initialized."));
|
||||
errorMessage.AppendLiteral(u" - Telemetry was not yet initialized.");
|
||||
break;
|
||||
case ScalarResult::CannotUnpackVariant:
|
||||
errorMessage.Append(NS_LITERAL_STRING(" - Cannot convert the provided JS value to nsIVariant."));
|
||||
errorMessage.AppendLiteral(u" - Cannot convert the provided JS value to nsIVariant.");
|
||||
break;
|
||||
case ScalarResult::CannotRecordInProcess:
|
||||
errorMessage.Append(NS_LITERAL_STRING(" - Cannot record the scalar in the current process."));
|
||||
errorMessage.AppendLiteral(u" - Cannot record the scalar in the current process.");
|
||||
break;
|
||||
case ScalarResult::KeyedTypeMismatch:
|
||||
errorMessage.Append(NS_LITERAL_STRING(" - Attempting to manage a keyed scalar as a scalar (or vice-versa)."));
|
||||
errorMessage.AppendLiteral(u" - Attempting to manage a keyed scalar as a scalar (or vice-versa).");
|
||||
break;
|
||||
case ScalarResult::UnknownScalar:
|
||||
errorMessage.Append(NS_LITERAL_STRING(" - Unknown scalar."));
|
||||
errorMessage.AppendLiteral(u" - Unknown scalar.");
|
||||
break;
|
||||
case ScalarResult::OperationNotSupported:
|
||||
errorMessage.Append(NS_LITERAL_STRING(" - The requested operation is not supported on this scalar."));
|
||||
errorMessage.AppendLiteral(u" - The requested operation is not supported on this scalar.");
|
||||
break;
|
||||
case ScalarResult::InvalidType:
|
||||
errorMessage.Append(NS_LITERAL_STRING(" - Attempted to set the scalar to an invalid data type."));
|
||||
errorMessage.AppendLiteral(u" - Attempted to set the scalar to an invalid data type.");
|
||||
break;
|
||||
case ScalarResult::InvalidValue:
|
||||
errorMessage.Append(NS_LITERAL_STRING(" - Attempted to set the scalar to an incompatible value."));
|
||||
errorMessage.AppendLiteral(u" - Attempted to set the scalar to an incompatible value.");
|
||||
break;
|
||||
case ScalarResult::StringTooLong:
|
||||
errorMessage.Append(NS_LITERAL_STRING(" - Truncating scalar value to 50 characters."));
|
||||
errorMessage.AppendLiteral(u" - Truncating scalar value to 50 characters.");
|
||||
break;
|
||||
case ScalarResult::KeyIsEmpty:
|
||||
errorMessage.Append(NS_LITERAL_STRING(" - The key must not be empty."));
|
||||
errorMessage.AppendLiteral(u" - The key must not be empty.");
|
||||
break;
|
||||
case ScalarResult::KeyTooLong:
|
||||
errorMessage.Append(NS_LITERAL_STRING(" - The key length must be limited to 70 characters."));
|
||||
errorMessage.AppendLiteral(u" - The key length must be limited to 70 characters.");
|
||||
break;
|
||||
case ScalarResult::TooManyKeys:
|
||||
errorMessage.Append(NS_LITERAL_STRING(" - Keyed scalars cannot have more than 100 keys."));
|
||||
errorMessage.AppendLiteral(u" - Keyed scalars cannot have more than 100 keys.");
|
||||
break;
|
||||
case ScalarResult::UnsignedNegativeValue:
|
||||
errorMessage.Append(NS_LITERAL_STRING(" - Trying to set an unsigned scalar to a negative number."));
|
||||
errorMessage.AppendLiteral(u" - Trying to set an unsigned scalar to a negative number.");
|
||||
break;
|
||||
case ScalarResult::UnsignedTruncatedValue:
|
||||
errorMessage.Append(NS_LITERAL_STRING(" - Truncating float/double number."));
|
||||
errorMessage.AppendLiteral(u" - Truncating float/double number.");
|
||||
break;
|
||||
default:
|
||||
// Nothing.
|
||||
|
|
Загрузка…
Ссылка в новой задаче