зеркало из https://github.com/mozilla/gecko-dev.git
Bug 870698 - Part 6: Replace Append(NS_LITERAL_CSTRING("")) with AppendLiteral(""). r=erahm
The NS_LITERAL_CSTRING macro creates a temporary nsLiteralCString to encapsulate the string literal and its length, but AssignLiteral() can determine the string literal's length at compile-time without nsLiteralCString. MozReview-Commit-ID: F750v6NN81s --HG-- extra : rebase_source : 714dd78df0f4c33e23e5b117615bd8fd561674c5 extra : source : 742bda9e6b1ddaf34d09894204ad18ce798b79b7
This commit is contained in:
Родитель
47e9fa9ec2
Коммит
a6a56ed916
|
@ -141,7 +141,7 @@ public:
|
|||
if (GetFragment().IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
aURL.Append(NS_LITERAL_CSTRING("#"));
|
||||
aURL.AppendLiteral("#");
|
||||
aURL.Append(GetFragment());
|
||||
}
|
||||
|
||||
|
|
|
@ -924,7 +924,7 @@ HttpServer::Connection::QueueResponse(InternalResponse* aResponse)
|
|||
NS_LITERAL_CSTRING("\r\n"));
|
||||
}
|
||||
|
||||
head.Append(NS_LITERAL_CSTRING("\r\n"));
|
||||
head.AppendLiteral("\r\n");
|
||||
|
||||
mOutputBuffers.AppendElement()->mString = head;
|
||||
if (body) {
|
||||
|
|
|
@ -498,7 +498,7 @@ public:
|
|||
// Try again with d3d9, but record the failure reason
|
||||
// into a new var to avoid overwriting the d3d11 failure.
|
||||
failureReason = &secondFailureReason;
|
||||
mFailureReason.Append(NS_LITERAL_CSTRING("; "));
|
||||
mFailureReason.AppendLiteral("; ");
|
||||
}
|
||||
|
||||
const nsCString& blacklistedDLL = FindD3D9BlacklistedDLL();
|
||||
|
@ -636,9 +636,9 @@ WMFVideoMFTManager::Init()
|
|||
// If we had some failures but eventually made it work,
|
||||
// make sure we preserve the messages.
|
||||
if (mDXVA2Manager->IsD3D11()) {
|
||||
mDXVAFailureReason.Append(NS_LITERAL_CSTRING("Using D3D11 API"));
|
||||
mDXVAFailureReason.AppendLiteral("Using D3D11 API");
|
||||
} else {
|
||||
mDXVAFailureReason.Append(NS_LITERAL_CSTRING("Using D3D9 API"));
|
||||
mDXVAFailureReason.AppendLiteral("Using D3D9 API");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8237,7 +8237,7 @@ OriginParser::Parse(nsACString& aSpec, OriginAttributes* aAttrs) -> ResultType
|
|||
}
|
||||
|
||||
if (!mHandledTokens.IsEmpty()) {
|
||||
mHandledTokens.Append(NS_LITERAL_CSTRING(", "));
|
||||
mHandledTokens.AppendLiteral(", ");
|
||||
}
|
||||
mHandledTokens.Append('\'');
|
||||
mHandledTokens.Append(token);
|
||||
|
|
|
@ -83,7 +83,7 @@ CreateCacheKey_Internal(nsIURI* aContentLocation,
|
|||
outCacheKey.Truncate();
|
||||
if (aContentType != nsIContentPolicy::TYPE_SCRIPT && isDataScheme) {
|
||||
// For non-script data: URI, use ("data:", aContentType) as the cache key.
|
||||
outCacheKey.Append(NS_LITERAL_CSTRING("data:"));
|
||||
outCacheKey.AppendLiteral("data:");
|
||||
outCacheKey.AppendInt(aContentType);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ CreateCacheKey_Internal(nsIURI* aContentLocation,
|
|||
// Don't cache for a URI longer than the cutoff size.
|
||||
if (spec.Length() <= CSP_CACHE_URI_CUTOFF_SIZE) {
|
||||
outCacheKey.Append(spec);
|
||||
outCacheKey.Append(NS_LITERAL_CSTRING("!"));
|
||||
outCacheKey.AppendLiteral("!");
|
||||
outCacheKey.AppendInt(aContentType);
|
||||
}
|
||||
|
||||
|
|
|
@ -92,8 +92,9 @@ Scheme0Scope(LocalStorageCacheBridge* aCache)
|
|||
if (result.IsEmpty()) {
|
||||
// Must contain the old prefix, otherwise we won't search for the whole
|
||||
// origin attributes suffix.
|
||||
result.Append(NS_LITERAL_CSTRING("0:f:"));
|
||||
result.AppendLiteral("0:f:");
|
||||
}
|
||||
|
||||
// Append the whole origin attributes suffix despite we have already stored
|
||||
// appid and inbrowser. We are only looking for it when the scope string
|
||||
// starts with "$appid:$inbrowser:" (with whatever valid values).
|
||||
|
|
|
@ -500,9 +500,9 @@ nsAboutCache::Channel::OnCacheEntryInfo(nsIURI *aURI, const nsACString & aIdEnha
|
|||
// Pinning
|
||||
mBuffer.AppendLiteral(" <td>");
|
||||
if (aPinned) {
|
||||
mBuffer.Append(NS_LITERAL_CSTRING("Pinned"));
|
||||
mBuffer.AppendLiteral("Pinned");
|
||||
} else {
|
||||
mBuffer.Append(NS_LITERAL_CSTRING(" "));
|
||||
mBuffer.AppendLiteral(" ");
|
||||
}
|
||||
mBuffer.AppendLiteral("</td>\n");
|
||||
|
||||
|
|
|
@ -920,7 +920,7 @@ AltSvcCache::UpdateAltServiceMapping(AltSvcMapping *map, nsProxyInfo *pi,
|
|||
|
||||
nsCOMPtr<nsIURI> wellKnown;
|
||||
nsAutoCString uri(origin);
|
||||
uri.Append(NS_LITERAL_CSTRING("/.well-known/http-opportunistic"));
|
||||
uri.AppendLiteral("/.well-known/http-opportunistic");
|
||||
NS_NewURI(getter_AddRefs(wellKnown), uri);
|
||||
|
||||
auto *checker = new WellKnownChecker(wellKnown, origin, caps, ci, map);
|
||||
|
|
|
@ -329,10 +329,10 @@ nsHttpRequestHead::SetOrigin(const nsACString &scheme, const nsACString &host,
|
|||
{
|
||||
RecursiveMutexAutoLock mon(mRecursiveMutex);
|
||||
mOrigin.Assign(scheme);
|
||||
mOrigin.Append(NS_LITERAL_CSTRING("://"));
|
||||
mOrigin.AppendLiteral("://");
|
||||
mOrigin.Append(host);
|
||||
if (port >= 0) {
|
||||
mOrigin.Append(NS_LITERAL_CSTRING(":"));
|
||||
mOrigin.AppendLiteral(":");
|
||||
mOrigin.AppendInt(port);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1761,14 +1761,12 @@ PlacesSQLQueryBuilder::SelectAsDay()
|
|||
sqlFragmentContainerBeginTime = NS_LITERAL_CSTRING(
|
||||
"(strftime('%s','now','localtime','start of month','-");
|
||||
sqlFragmentContainerBeginTime.AppendInt(MonthIndex);
|
||||
sqlFragmentContainerBeginTime.Append(NS_LITERAL_CSTRING(
|
||||
" months','utc')*1000000)"));
|
||||
sqlFragmentContainerBeginTime.AppendLiteral(" months','utc')*1000000)");
|
||||
// To start of MonthIndex months ago
|
||||
sqlFragmentContainerEndTime = NS_LITERAL_CSTRING(
|
||||
"(strftime('%s','now','localtime','start of month','-");
|
||||
sqlFragmentContainerEndTime.AppendInt(MonthIndex - 1);
|
||||
sqlFragmentContainerEndTime.Append(NS_LITERAL_CSTRING(
|
||||
" months','utc')*1000000)"));
|
||||
sqlFragmentContainerEndTime.AppendLiteral(" months','utc')*1000000)");
|
||||
// Search for the same timeframe.
|
||||
sqlFragmentSearchBeginTime = sqlFragmentContainerBeginTime;
|
||||
sqlFragmentSearchEndTime = sqlFragmentContainerEndTime;
|
||||
|
|
Загрузка…
Ссылка в новой задаче