Bug 869836 - Part 7: Use AppendLiteral instead of Append where possible. r=ehsan

This commit is contained in:
Birunthan Mohanathas 2014-05-22 06:48:51 +03:00
parent 58641805f1
commit aea8617b92
47 changed files with 156 additions and 152 deletions

View File

@ -79,9 +79,9 @@ LoadGtkModule(GnomeAccessibilityModule& aModule)
char *curLibPath = PR_GetLibraryPath();
nsAutoCString libPath(curLibPath);
#if defined(LINUX) && defined(__x86_64__)
libPath.Append(":/usr/lib64:/usr/lib");
libPath.AppendLiteral(":/usr/lib64:/usr/lib");
#else
libPath.Append(":/usr/lib");
libPath.AppendLiteral(":/usr/lib");
#endif
PR_FreeLibraryName(curLibPath);
@ -94,7 +94,7 @@ LoadGtkModule(GnomeAccessibilityModule& aModule)
else
subLen = loc2 - loc1;
nsAutoCString sub(Substring(libPath, loc1, subLen));
sub.Append("/gtk-2.0/modules/");
sub.AppendLiteral("/gtk-2.0/modules/");
sub.Append(aModule.libName);
aModule.lib = PR_LoadLibrary(sub.get());
if (aModule.lib)

View File

@ -439,7 +439,7 @@ nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement,
// build the file name
filePath.Append('/');
filePath.Append(NS_ConvertUTF16toUTF8(brandName));
filePath.Append("_wallpaper.png");
filePath.AppendLiteral("_wallpaper.png");
// write the image to a file in the home dir
rv = WriteImage(filePath, container);

View File

@ -1379,7 +1379,7 @@ nsXMLHttpRequest::GetResponseHeader(const nsACString& header,
nsCString value;
if (NS_SUCCEEDED(mChannel->GetContentCharset(value)) &&
!value.IsEmpty()) {
_retval.Append(";charset=");
_retval.AppendLiteral(";charset=");
_retval.Append(value);
}
}
@ -3877,9 +3877,9 @@ nsHeaderVisitor::VisitHeader(const nsACString &header, const nsACString &value)
{
if (mXHR->IsSafeHeader(header, mHttpChannel)) {
mHeaders.Append(header);
mHeaders.Append(": ");
mHeaders.AppendLiteral(": ");
mHeaders.Append(value);
mHeaders.Append("\r\n");
mHeaders.AppendLiteral("\r\n");
}
return NS_OK;
}

View File

@ -252,7 +252,7 @@ nsXULTemplateQueryProcessorRDF::GetDatasource(nsIArray* aDataSources,
// security, a bad URL, etc.
#ifdef DEBUG
nsAutoCString msg;
msg.Append("unable to load datasource '");
msg.AppendLiteral("unable to load datasource '");
msg.Append(uristrC);
msg.Append('\'');
NS_WARNING(msg.get());

View File

@ -605,15 +605,15 @@ NS_ScriptErrorReporter(JSContext *cx,
nsAutoCString error;
error.AssignLiteral("JavaScript ");
if (JSREPORT_IS_STRICT(report->flags))
error.Append("strict ");
error.AppendLiteral("strict ");
if (JSREPORT_IS_WARNING(report->flags))
error.Append("warning: ");
error.AppendLiteral("warning: ");
else
error.Append("error: ");
error.AppendLiteral("error: ");
error.Append(report->filename);
error.Append(", line ");
error.AppendLiteral(", line ");
error.AppendInt(report->lineno, 10);
error.Append(": ");
error.AppendLiteral(": ");
if (report->ucmessage) {
AppendUTF16toUTF8(reinterpret_cast<const char16_t*>(report->ucmessage),
error);

View File

@ -822,7 +822,7 @@ nsNPAPIPluginStreamListener::NewResponseHeader(const char* headerName,
const char* headerValue)
{
mResponseHeaders.Append(headerName);
mResponseHeaders.Append(": ");
mResponseHeaders.AppendLiteral(": ");
mResponseHeaders.Append(headerValue);
mResponseHeaders.Append('\n');
return NS_OK;

View File

@ -2281,7 +2281,7 @@ nsPluginHost::WritePluginInfo()
return rv;
nsAutoCString filename(kPluginRegistryFilename);
filename.Append(".tmp");
filename.AppendLiteral(".tmp");
rv = pluginReg->AppendNative(filename);
if (NS_FAILED(rv))
return rv;

View File

@ -474,11 +474,11 @@ PluginModuleParent::TerminateChildProcess(MessageLoop* aMsgLoop)
if (CreateFlashMinidump(mFlashProcess1, 0, pluginDumpFile,
NS_LITERAL_CSTRING("flash1"))) {
additionalDumps.Append(",flash1");
additionalDumps.AppendLiteral(",flash1");
}
if (CreateFlashMinidump(mFlashProcess2, 0, pluginDumpFile,
NS_LITERAL_CSTRING("flash2"))) {
additionalDumps.Append(",flash2");
additionalDumps.AppendLiteral(",flash2");
}
}
#endif

View File

@ -149,7 +149,7 @@ nsXBLSpecialDocInfo::GetAllHandlers(const char* aType,
{
if (mUserHTMLBindings) {
nsAutoCString type(aType);
type.Append("User");
type.AppendLiteral("User");
GetHandlers(mUserHTMLBindings, type, aUserHandler);
}
if (mHTMLBindings) {

View File

@ -428,7 +428,7 @@ WebBrowserChrome::SendHistoryStatusMessage(nsIURI * aURI, char * operation, int3
else if (!(strcmp(operation, "add")))
{
status.Assign(uriSpec);
status.Append(" added to session History");
status.AppendLiteral(" added to session History");
}
else if (!(strcmp(operation, "goto")))
{
@ -436,13 +436,13 @@ WebBrowserChrome::SendHistoryStatusMessage(nsIURI * aURI, char * operation, int3
AppendIntToCString(info1, status);
status.Append(" Url: ");
status.AppendLiteral(" Url: ");
status.Append(uriSpec);
}
else if (!(strcmp(operation, "purge")))
{
AppendIntToCString(info1, status);
status.Append(" purged from Session History");
status.AppendLiteral(" purged from Session History");
}
else if (!(strcmp(operation, "replace")))
{

View File

@ -285,18 +285,18 @@ nsGIOInputStream::DoOpenDirectory()
mDirListPtr = mDirList;
// Write base URL (make sure it ends with a '/')
mDirBuf.Append("300: ");
mDirBuf.AppendLiteral("300: ");
mDirBuf.Append(mSpec);
if (mSpec.get()[mSpec.Length() - 1] != '/')
mDirBuf.Append('/');
mDirBuf.Append('\n');
// Write column names
mDirBuf.Append("200: filename content-length last-modified file-type\n");
mDirBuf.AppendLiteral("200: filename content-length last-modified file-type\n");
// Write charset (assume UTF-8)
// XXX is this correct?
mDirBuf.Append("301: UTF-8\n");
mDirBuf.AppendLiteral("301: UTF-8\n");
SetContentTypeOfChannel(APPLICATION_HTTP_INDEX_FORMAT);
return NS_OK;
}
@ -512,13 +512,13 @@ nsGIOInputStream::DoRead(char *aBuf, uint32_t aCount, uint32_t *aCountRead)
switch (g_file_info_get_file_type(info))
{
case G_FILE_TYPE_REGULAR:
mDirBuf.Append("FILE ");
mDirBuf.AppendLiteral("FILE ");
break;
case G_FILE_TYPE_DIRECTORY:
mDirBuf.Append("DIRECTORY ");
mDirBuf.AppendLiteral("DIRECTORY ");
break;
case G_FILE_TYPE_SYMBOLIC_LINK:
mDirBuf.Append("SYMBOLIC-LINK ");
mDirBuf.AppendLiteral("SYMBOLIC-LINK ");
break;
default:
break;

View File

@ -450,18 +450,18 @@ nsGnomeVFSInputStream::DoOpen()
mDirListPtr = mDirList;
// Write base URL (make sure it ends with a '/')
mDirBuf.Append("300: ");
mDirBuf.AppendLiteral("300: ");
mDirBuf.Append(mSpec);
if (mSpec.get()[mSpec.Length() - 1] != '/')
mDirBuf.Append('/');
mDirBuf.Append('\n');
// Write column names
mDirBuf.Append("200: filename content-length last-modified file-type\n");
mDirBuf.AppendLiteral("200: filename content-length last-modified file-type\n");
// Write charset (assume UTF-8)
// XXX is this correct?
mDirBuf.Append("301: UTF-8\n");
mDirBuf.AppendLiteral("301: UTF-8\n");
SetContentTypeOfChannel(APPLICATION_HTTP_INDEX_FORMAT);
}
@ -558,13 +558,13 @@ nsGnomeVFSInputStream::DoRead(char *aBuf, uint32_t aCount, uint32_t *aCountRead)
switch (info->type)
{
case GNOME_VFS_FILE_TYPE_REGULAR:
mDirBuf.Append("FILE ");
mDirBuf.AppendLiteral("FILE ");
break;
case GNOME_VFS_FILE_TYPE_DIRECTORY:
mDirBuf.Append("DIRECTORY ");
mDirBuf.AppendLiteral("DIRECTORY ");
break;
case GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK:
mDirBuf.Append("SYMBOLIC-LINK ");
mDirBuf.AppendLiteral("SYMBOLIC-LINK ");
break;
default:
break;

View File

@ -189,7 +189,7 @@ GLBlitTextureImageHelper::SetBlitFramebufferForDestTexture(GLuint aTexture)
GLenum result = mGL->fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER);
if (aTexture && (result != LOCAL_GL_FRAMEBUFFER_COMPLETE)) {
nsAutoCString msg;
msg.Append("Framebuffer not complete -- error 0x");
msg.AppendLiteral("Framebuffer not complete -- error 0x");
msg.AppendInt(result, 16);
// Note: if you are hitting this, it is likely that
// your texture is not texture complete -- that is, you

View File

@ -223,7 +223,9 @@ private:
return false;
}
if (!(version.EqualsLiteral("7") || version.EqualsLiteral("8") || version.EqualsLiteral("13"))) {
if (!(version.EqualsLiteral("7") ||
version.EqualsLiteral("8") ||
version.EqualsLiteral("13"))) {
return false;
}
@ -243,10 +245,10 @@ private:
Base64Encode(newString, res);
nsCString response("HTTP/1.1 101 Switching Protocols\r\n");
response.Append("Upgrade: websocket\r\n");
response.Append("Connection: Upgrade\r\n");
response.AppendLiteral("Upgrade: websocket\r\n");
response.AppendLiteral("Connection: Upgrade\r\n");
response.Append(nsCString("Sec-WebSocket-Accept: ") + res + nsCString("\r\n"));
response.Append("Sec-WebSocket-Protocol: binary\r\n\r\n");
response.AppendLiteral("Sec-WebSocket-Protocol: binary\r\n\r\n");
uint32_t written = 0;
uint32_t size = response.Length();
while (written < size) {

View File

@ -1242,7 +1242,7 @@ gfxFT2FontList::FindFonts()
} else {
root = NS_LITERAL_CSTRING("/system");
}
root.Append("/fonts");
root.AppendLiteral("/fonts");
FindFontsInDir(root, &fnc);

View File

@ -128,7 +128,7 @@ public:
#define REPORT_VECTOR(_path, _uri, _amount, _desc) \
do { \
nsAutoCString path(NS_LITERAL_CSTRING(_path)); \
path.Append("/("); \
path.AppendLiteral("/("); \
path.Append(_uri); \
path.Append(")"); \
nsresult rv; \

View File

@ -85,7 +85,7 @@ nsEntityConverter::LoadEntityBundle(uint32_t version)
// all property file names are ASCII, like "html40Latin1" so this is safe
LossyAppendUTF16toASCII(versionName, url);
url.Append(".properties");
url.AppendLiteral(".properties");
nsCOMPtr<nsIStringBundle> bundle;
rv = bundleService->CreateBundle(url.get(), getter_AddRefs(bundle));

View File

@ -419,7 +419,7 @@ WindowIsDeferredWindow(HWND hWnd)
if (appInfo) {
nsAutoCString appName;
if (NS_SUCCEEDED(appInfo->GetName(appName))) {
appName.Append("MessageWindow");
appName.AppendLiteral("MessageWindow");
nsDependentString windowName(gAppMessageWindowName);
CopyUTF8toUTF16(appName, windowName);
gAppMessageWindowNameLength = windowName.Length();

View File

@ -2823,7 +2823,7 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram
if (gfxUtils::sDumpPaintingToFile) {
nsCString string("dump-");
string.AppendInt(gPaintCount);
string.Append(".html");
string.AppendLiteral(".html");
gfxUtils::sDumpPaintFile = fopen(string.BeginReading(), "w");
} else {
gfxUtils::sDumpPaintFile = stderr;

View File

@ -804,21 +804,21 @@ nsUserFontSet::LogMessage(gfxMixedFontFamily* aFamily,
aProxy->mSrcIndex);
if (NS_FAILED(aStatus)) {
message.Append(": ");
message.AppendLiteral(": ");
switch (aStatus) {
case NS_ERROR_DOM_BAD_URI:
message.Append("bad URI or cross-site access not allowed");
message.AppendLiteral("bad URI or cross-site access not allowed");
break;
case NS_ERROR_CONTENT_BLOCKED:
message.Append("content blocked");
message.AppendLiteral("content blocked");
break;
default:
message.Append("status=");
message.AppendLiteral("status=");
message.AppendInt(static_cast<uint32_t>(aStatus));
break;
}
}
message.Append("\nsource: ");
message.AppendLiteral("\nsource: ");
message.Append(fontURI);
#ifdef PR_LOGGING

View File

@ -217,19 +217,19 @@ static void str_escape(const char * original, nsAFlatCString& aResult)
switch (*p)
{
case '\n':
aResult.Append("\\n");
aResult.AppendLiteral("\\n");
break;
case '\r':
aResult.Append("\\r");
aResult.AppendLiteral("\\r");
break;
case '\\':
aResult.Append("\\\\");
aResult.AppendLiteral("\\\\");
break;
case '\"':
aResult.Append("\\\"");
aResult.AppendLiteral("\\\"");
break;
default:

View File

@ -1019,7 +1019,7 @@ Http2Compressor::EncodeHeaderBlock(const nsCString &nvInput,
nextCookie = semiSpaceIndex + 2;
}
} else {
ProcessHeader(nvPair(name, value), name.EqualsLiteral("authorization") ? true : false);
ProcessHeader(nvPair(name, value), name.EqualsLiteral("authorization"));
}
}

View File

@ -1009,7 +1009,7 @@ static int32_t kShift = 6;
// service. Now that it's a member we can be more cleverer.
s.Truncate();
s.Append("rdf:#$");
s.AppendLiteral("rdf:#$");
uint32_t id = ++gCounter;
while (id) {

View File

@ -67,7 +67,7 @@ rdf_FormatDate(PRTime aTime, nsACString &aResult)
aResult.Append(buf);
// usecs
aResult.Append(" +");
aResult.AppendLiteral(" +");
int32_t usec = t.tm_usec;
for (int32_t digit = 100000; digit > 1; digit /= 10) {
aResult.Append(char('0' + (usec / digit)));

View File

@ -155,7 +155,7 @@ nsRDFResource::GetDelegate(const char* aKey, REFNSIID aIID, void** aResult)
// Construct a ContractID of the form "@mozilla.org/rdf/delegate/[key]/[scheme];1
nsAutoCString contractID(NS_RDF_DELEGATEFACTORY_CONTRACTID_PREFIX);
contractID.Append(aKey);
contractID.Append("&scheme=");
contractID.AppendLiteral("&scheme=");
int32_t i = mURI.FindChar(':');
contractID += StringHead(mURI, i);

View File

@ -814,17 +814,17 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress,
if (testFlags & nsIChannel::LOAD_DOCUMENT_URI)
{
testFlags -= nsIChannel::LOAD_DOCUMENT_URI;
info2.Append("LOAD_DOCUMENT_URI ");
info2.AppendLiteral("LOAD_DOCUMENT_URI ");
}
if (testFlags & nsIChannel::LOAD_RETARGETED_DOCUMENT_URI)
{
testFlags -= nsIChannel::LOAD_RETARGETED_DOCUMENT_URI;
info2.Append("LOAD_RETARGETED_DOCUMENT_URI ");
info2.AppendLiteral("LOAD_RETARGETED_DOCUMENT_URI ");
}
if (testFlags & nsIChannel::LOAD_REPLACE)
{
testFlags -= nsIChannel::LOAD_REPLACE;
info2.Append("LOAD_REPLACE ");
info2.AppendLiteral("LOAD_REPLACE ");
}
const char *_status = NS_SUCCEEDED(aStatus) ? "1" : "0";
@ -834,77 +834,77 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress,
if (f & nsIWebProgressListener::STATE_START)
{
f -= nsIWebProgressListener::STATE_START;
info.Append("START ");
info.AppendLiteral("START ");
}
if (f & nsIWebProgressListener::STATE_REDIRECTING)
{
f -= nsIWebProgressListener::STATE_REDIRECTING;
info.Append("REDIRECTING ");
info.AppendLiteral("REDIRECTING ");
}
if (f & nsIWebProgressListener::STATE_TRANSFERRING)
{
f -= nsIWebProgressListener::STATE_TRANSFERRING;
info.Append("TRANSFERRING ");
info.AppendLiteral("TRANSFERRING ");
}
if (f & nsIWebProgressListener::STATE_NEGOTIATING)
{
f -= nsIWebProgressListener::STATE_NEGOTIATING;
info.Append("NEGOTIATING ");
info.AppendLiteral("NEGOTIATING ");
}
if (f & nsIWebProgressListener::STATE_STOP)
{
f -= nsIWebProgressListener::STATE_STOP;
info.Append("STOP ");
info.AppendLiteral("STOP ");
}
if (f & nsIWebProgressListener::STATE_IS_REQUEST)
{
f -= nsIWebProgressListener::STATE_IS_REQUEST;
info.Append("IS_REQUEST ");
info.AppendLiteral("IS_REQUEST ");
}
if (f & nsIWebProgressListener::STATE_IS_DOCUMENT)
{
f -= nsIWebProgressListener::STATE_IS_DOCUMENT;
info.Append("IS_DOCUMENT ");
info.AppendLiteral("IS_DOCUMENT ");
}
if (f & nsIWebProgressListener::STATE_IS_NETWORK)
{
f -= nsIWebProgressListener::STATE_IS_NETWORK;
info.Append("IS_NETWORK ");
info.AppendLiteral("IS_NETWORK ");
}
if (f & nsIWebProgressListener::STATE_IS_WINDOW)
{
f -= nsIWebProgressListener::STATE_IS_WINDOW;
info.Append("IS_WINDOW ");
info.AppendLiteral("IS_WINDOW ");
}
if (f & nsIWebProgressListener::STATE_IS_INSECURE)
{
f -= nsIWebProgressListener::STATE_IS_INSECURE;
info.Append("IS_INSECURE ");
info.AppendLiteral("IS_INSECURE ");
}
if (f & nsIWebProgressListener::STATE_IS_BROKEN)
{
f -= nsIWebProgressListener::STATE_IS_BROKEN;
info.Append("IS_BROKEN ");
info.AppendLiteral("IS_BROKEN ");
}
if (f & nsIWebProgressListener::STATE_IS_SECURE)
{
f -= nsIWebProgressListener::STATE_IS_SECURE;
info.Append("IS_SECURE ");
info.AppendLiteral("IS_SECURE ");
}
if (f & nsIWebProgressListener::STATE_SECURE_HIGH)
{
f -= nsIWebProgressListener::STATE_SECURE_HIGH;
info.Append("SECURE_HIGH ");
info.AppendLiteral("SECURE_HIGH ");
}
if (f & nsIWebProgressListener::STATE_RESTORING)
{
f -= nsIWebProgressListener::STATE_RESTORING;
info.Append("STATE_RESTORING ");
info.AppendLiteral("STATE_RESTORING ");
}
if (f > 0)
{
info.Append("f contains unknown flag!");
info.AppendLiteral("f contains unknown flag!");
}
PR_LOG(gSecureDocLog, PR_LOG_DEBUG,

View File

@ -2339,10 +2339,10 @@ nsSSLIOLayerSetOptions(PRFileDesc* fd, bool forSTARTTLS,
uint32_t flags = infoObject->GetProviderFlags();
nsAutoCString peerId;
if (flags & nsISocketProvider::ANONYMOUS_CONNECT) { // See bug 466080
peerId.Append("anon:");
peerId.AppendLiteral("anon:");
}
if (flags & nsISocketProvider::NO_PERMANENT_STORAGE) {
peerId.Append("private:");
peerId.AppendLiteral("private:");
}
peerId.Append(host);
peerId.Append(':');

View File

@ -135,7 +135,7 @@ canonicalizeBase(nsAutoCString &spec,
if (underGre && underApp && greBase.Length() < appBase.Length())
underGre = false;
out.Append("/resource/");
out.AppendLiteral("/resource/");
out.Append(baseName[underGre ? mozilla::Omnijar::GRE : mozilla::Omnijar::APP]);
out.Append(Substring(spec, underGre ? greBase.Length() : appBase.Length()));
return true;

View File

@ -733,17 +733,17 @@ Connection::databaseElementExists(enum DatabaseElementType aElementType,
element.Assign(Substring(aElementName, ind + 1, aElementName.Length()));
query.Append(db);
}
query.Append("sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type = '");
query.AppendLiteral("sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type = '");
switch (aElementType) {
case INDEX:
query.Append("index");
query.AppendLiteral("index");
break;
case TABLE:
query.Append("table");
query.AppendLiteral("table");
break;
}
query.Append("' AND name ='");
query.AppendLiteral("' AND name ='");
query.Append(element);
query.Append("'");

View File

@ -98,12 +98,12 @@ checkAndLogStatementPerformance(sqlite3_stmt *aStatement)
nsAutoCString message;
message.AppendInt(count);
if (count == 1)
message.Append(" sort operation has ");
message.AppendLiteral(" sort operation has ");
else
message.Append(" sort operations have ");
message.Append("occurred for the SQL statement '");
message.AppendLiteral(" sort operations have ");
message.AppendLiteral("occurred for the SQL statement '");
#ifdef MOZ_STORAGE_SORTWARNING_SQL_DUMP
message.Append("SQL command: ");
message.AppendLiteral("SQL command: ");
message.Append(sql);
#else
nsPrintfCString address("0x%p", aStatement);

View File

@ -158,7 +158,7 @@ AsyncStatementSpinner::HandleError(mozIStorageError *aError)
NS_ENSURE_SUCCESS(rv, rv);
nsAutoCString warnMsg;
warnMsg.Append("An error occurred while executing an async statement: ");
warnMsg.AppendLiteral("An error occurred while executing an async statement: ");
warnMsg.AppendInt(result);
warnMsg.Append(" ");
warnMsg.Append(message);

View File

@ -415,11 +415,11 @@ PendingLookup::EscapeCertificateAttribute(const nsACString& aAttribute)
escaped.SetCapacity(aAttribute.Length());
for (unsigned int i = 0; i < aAttribute.Length(); ++i) {
if (aAttribute.Data()[i] == '%') {
escaped.Append("%25");
escaped.AppendLiteral("%25");
} else if (aAttribute.Data()[i] == '/') {
escaped.Append("%2F");
escaped.AppendLiteral("%2F");
} else if (aAttribute.Data()[i] == ' ') {
escaped.Append("%20");
escaped.AppendLiteral("%20");
} else {
escaped.Append(aAttribute.Data()[i]);
}
@ -465,7 +465,7 @@ PendingLookup::GenerateWhitelistStringsForPair(
rv = certificate->GetCommonName(commonName);
NS_ENSURE_SUCCESS(rv, rv);
if (!commonName.IsEmpty()) {
whitelistString.Append("/CN=");
whitelistString.AppendLiteral("/CN=");
whitelistString.Append(
EscapeCertificateAttribute(NS_ConvertUTF16toUTF8(commonName)));
}
@ -474,7 +474,7 @@ PendingLookup::GenerateWhitelistStringsForPair(
rv = certificate->GetOrganization(organization);
NS_ENSURE_SUCCESS(rv, rv);
if (!organization.IsEmpty()) {
whitelistString.Append("/O=");
whitelistString.AppendLiteral("/O=");
whitelistString.Append(
EscapeCertificateAttribute(NS_ConvertUTF16toUTF8(organization)));
}
@ -483,7 +483,7 @@ PendingLookup::GenerateWhitelistStringsForPair(
rv = certificate->GetOrganizationalUnit(organizationalUnit);
NS_ENSURE_SUCCESS(rv, rv);
if (!organizationalUnit.IsEmpty()) {
whitelistString.Append("/OU=");
whitelistString.AppendLiteral("/OU=");
whitelistString.Append(
EscapeCertificateAttribute(NS_ConvertUTF16toUTF8(organizationalUnit)));
}

View File

@ -50,7 +50,7 @@ AsyncStatementCallback::HandleError(mozIStorageError *aError)
NS_ENSURE_SUCCESS(rv, rv);
nsAutoCString warnMsg;
warnMsg.Append("An error occurred while executing an async statement: ");
warnMsg.AppendLiteral("An error occurred while executing an async statement: ");
warnMsg.AppendInt(result);
warnMsg.Append(" ");
warnMsg.Append(message);

View File

@ -1898,7 +1898,7 @@ PlacesSQLQueryBuilder::Where()
nsAutoCString tmp = additionalVisitsConditions;
additionalVisitsConditions = "AND EXISTS (SELECT 1 FROM moz_historyvisits WHERE place_id = h.id ";
additionalVisitsConditions.Append(tmp);
additionalVisitsConditions.Append("LIMIT 1)");
additionalVisitsConditions.AppendLiteral("LIMIT 1)");
}
mQueryString.ReplaceSubstring("{QUERY_OPTIONS_VISITS}",

View File

@ -197,7 +197,7 @@ Classifier::TableRequest(nsACString& aResult)
ChunkSet &subs = store->SubChunks();
if (adds.Length() > 0) {
aResult.Append("a:");
aResult.AppendLiteral("a:");
nsAutoCString addList;
adds.Serialize(addList);
aResult.Append(addList);
@ -206,7 +206,7 @@ Classifier::TableRequest(nsACString& aResult)
if (subs.Length() > 0) {
if (adds.Length() > 0)
aResult.Append(':');
aResult.Append("s:");
aResult.AppendLiteral("s:");
nsAutoCString subList;
subs.Serialize(subList);
aResult.Append(subList);

View File

@ -237,7 +237,7 @@ nsGConfService::GetAppForProtocol(const nsACString &aScheme, bool *aEnabled,
{
nsAutoCString key("/desktop/gnome/url-handlers/");
key.Append(aScheme);
key.Append("/command");
key.AppendLiteral("/command");
GError *err = nullptr;
gchar *command = gconf_client_get_string(mClient, key.get(), &err);
@ -265,7 +265,7 @@ nsGConfService::HandlerRequiresTerminal(const nsACString &aScheme,
{
nsAutoCString key("/desktop/gnome/url-handlers/");
key.Append(aScheme);
key.Append("/requires_terminal");
key.AppendLiteral("/requires_terminal");
GError *err = nullptr;
*aResult = gconf_client_get_bool(mClient, key.get(), &err);
@ -283,7 +283,7 @@ nsGConfService::SetAppForProtocol(const nsACString &aScheme,
{
nsAutoCString key("/desktop/gnome/url-handlers/");
key.Append(aScheme);
key.Append("/command");
key.AppendLiteral("/command");
bool res = gconf_client_set_string(mClient, key.get(),
PromiseFlatCString(aCommand).get(),

View File

@ -83,13 +83,13 @@ X11Error(Display *display, XErrorEvent *event) {
if (buffer[0]) {
notes.Append(buffer);
} else {
notes.Append("Request ");
notes.AppendLiteral("Request ");
notes.AppendInt(event->request_code);
notes.Append('.');
notes.AppendInt(event->minor_code);
}
notes.Append(": ");
notes.AppendLiteral(": ");
// Get a string to describe the error.
XGetErrorText(display, event->error_code, buffer, sizeof(buffer));
@ -109,11 +109,11 @@ X11Error(Display *display, XErrorEvent *event) {
// XSynchronize call returns the same function after an enable call then
// synchronization must have already been enabled.
if (XSynchronize(display, True) == XSynchronize(display, False)) {
notes.Append("; sync");
notes.AppendLiteral("; sync");
} else {
notes.Append("; ");
notes.AppendLiteral("; ");
notes.AppendInt(uint32_t(age));
notes.Append(" requests ago");
notes.AppendLiteral(" requests ago");
}
}
@ -132,14 +132,14 @@ X11Error(Display *display, XErrorEvent *event) {
#ifdef DEBUG
// The resource id is unlikely to be useful in a crash report without
// context of other ids, but add it to the debug console output.
notes.Append("; id=0x");
notes.AppendLiteral("; id=0x");
notes.AppendInt(uint32_t(event->resourceid), 16);
#ifdef MOZ_X11
// Actually, for requests where Xlib gets the reply synchronously,
// MOZ_X_SYNC=1 will not be necessary, but we don't have a table to tell us
// which requests get a synchronous reply.
if (!PR_GetEnv("MOZ_X_SYNC")) {
notes.Append("\nRe-running with MOZ_X_SYNC=1 in the environment may give a more helpful backtrace.");
notes.AppendLiteral("\nRe-running with MOZ_X_SYNC=1 in the environment may give a more helpful backtrace.");
}
#endif
#endif

View File

@ -2597,7 +2597,7 @@ NS_IMETHODIMP nsExternalHelperAppService::GetFromTypeAndExtension(const nsACStri
if (NS_FAILED(rv) && !aFileExt.IsEmpty()) {
// XXXzpao This should probably be localized
nsAutoCString desc(aFileExt);
desc.Append(" File");
desc.AppendLiteral(" File");
(*_retval)->SetDescription(NS_ConvertASCIItoUTF16(desc));
LOG(("Falling back to 'File' file description\n"));
}

View File

@ -47,7 +47,7 @@ nsCUPSShim::Init()
if (! *(symAddr[i])) {
#ifdef DEBUG
nsAutoCString msg(gSymName[i]);
msg.Append(" not found in CUPS library");
msg.AppendLiteral(" not found in CUPS library");
NS_WARNING(msg.get());
#endif
PR_UnloadLibrary(mCupsLib);

View File

@ -2903,7 +2903,7 @@ TestApp::TestScrollMessages(void)
#define DO_CHECK(aFailureCondition, aDescription) \
if (aFailureCondition) { \
nsAutoCString str(aDescription); \
str.Append(": "); \
str.AppendLiteral(": "); \
str.Append(#aFailureCondition); \
fail(str.get()); \
mTextArea->SetAttribute(NS_LITERAL_STRING("style"), EmptyString()); \

View File

@ -738,19 +738,19 @@ GfxInfo::AddCrashReportAnnotations()
* can go away after we store the above in the socorro db */
nsAutoCString note;
/* AppendPrintf only supports 32 character strings, mrghh. */
note.Append("AdapterVendorID: ");
note.AppendLiteral("AdapterVendorID: ");
note.Append(narrowVendorID);
note.Append(", AdapterDeviceID: ");
note.AppendLiteral(", AdapterDeviceID: ");
note.Append(narrowDeviceID);
note.AppendPrintf(", AdapterSubsysID: %08x, ", mAdapterSubsysID);
note.Append("AdapterDriverVersion: ");
note.AppendLiteral("AdapterDriverVersion: ");
note.Append(NS_LossyConvertUTF16toASCII(adapterDriverVersionString));
if (vendorID == GfxDriverInfo::GetDeviceVendor(VendorAll)) {
/* if we didn't find a valid vendorID lets append the mDeviceID string to try to find out why */
note.Append(", ");
note.AppendLiteral(", ");
LossyAppendUTF16toASCII(mDeviceID, note);
note.Append(", ");
note.AppendLiteral(", ");
LossyAppendUTF16toASCII(mDeviceKeyDebug, note);
LossyAppendUTF16toASCII(mDeviceKeyDebug, note);
}
@ -767,9 +767,9 @@ GfxInfo::AddCrashReportAnnotations()
GetAdapterVendorID2(vendorID2);
CopyUTF16toUTF8(vendorID2, narrowVendorID2);
GetAdapterDriverVersion2(adapterDriverVersionString2);
note.Append("AdapterVendorID2: ");
note.AppendLiteral("AdapterVendorID2: ");
note.Append(narrowVendorID2);
note.Append(", AdapterDeviceID2: ");
note.AppendLiteral(", AdapterDeviceID2: ");
note.Append(narrowDeviceID2);
note.AppendPrintf(", AdapterSubsysID2: %08x, ", mAdapterSubsysID2);
note.AppendPrintf("AdapterDriverVersion2: ");

View File

@ -1125,7 +1125,7 @@ nsresult FaviconHelper::GetOutputIconPath(nsCOMPtr<nsIURI> aFaviconPageURI,
NS_ENSURE_SUCCESS(rv, rv);
// Append the icon extension
inputURIHash.Append(".ico");
inputURIHash.AppendLiteral(".ico");
rv = aICOFile->AppendNative(inputURIHash);
return rv;

View File

@ -1240,7 +1240,7 @@ HRESULT nsDataObj::GetText(const nsACString & aDataFlavor, FORMATETC& aFE, STGME
// if someone asks for text/plain, look up text/unicode instead in the transferable.
const char* flavorStr;
const nsPromiseFlatCString& flat = PromiseFlatCString(aDataFlavor);
if ( aDataFlavor.EqualsLiteral("text/plain") )
if (aDataFlavor.EqualsLiteral("text/plain"))
flavorStr = kUnicodeMime;
else
flavorStr = flat.get();

View File

@ -244,7 +244,7 @@ nsImageFromClipboard ::GetEncodedImageStream (unsigned char * aClipboardData, co
// Map image/jpg to image/jpeg (which is how the encoder is registered).
if (strcmp(aMIMEFormat, kJPGImageMime) == 0)
encoderCID.Append("image/jpeg");
encoderCID.AppendLiteral("image/jpeg");
else
encoderCID.Append(aMIMEFormat);
nsCOMPtr<imgIEncoder> encoder = do_CreateInstance(encoderCID.get(), &rv);

View File

@ -187,13 +187,13 @@ GfxInfo::GetData()
mAdapterDescription.Append(mRenderer);
nsAutoCString note;
note.Append("OpenGL: ");
note.AppendLiteral("OpenGL: ");
note.Append(mAdapterDescription);
note.Append(" -- ");
note.AppendLiteral(" -- ");
note.Append(mVersion);
if (mHasTextureFromPixmap)
note.Append(" -- texture_from_pixmap");
note.Append("\n");
note.AppendLiteral(" -- texture_from_pixmap");
note.AppendLiteral("\n");
#ifdef MOZ_CRASHREPORTER
CrashReporter::AppendAppNotesToCrashReport(note);
#endif

View File

@ -255,11 +255,11 @@ private:
// as path separators. Consumers of this reporter (such as
// about:memory) have to undo this change.
processName.ReplaceChar('/', '\\');
processName.Append(", ");
processName.AppendLiteral(", ");
}
fclose(f);
}
processName.Append("pid=");
processName.AppendLiteral("pid=");
processName.Append(pidStr);
processName.Append(")");
@ -299,7 +299,7 @@ private:
nsAutoCString desc("This is the sum of all processes' '");
desc.Append(kindPathSuffixes[i]);
desc.Append("' numbers.");
desc.AppendLiteral("' numbers.");
REPORT(path, processSizes.mSizes[i], desc);
}
@ -397,27 +397,28 @@ private:
GetBasename(absPath, basename);
if (basename.EqualsLiteral("[heap]")) {
aName.Append("anonymous/brk-heap");
aDesc.Append("Memory in anonymous mappings within the boundaries "
"defined by brk() / sbrk(). This is likely to be just "
"a portion of the application's heap; the remainder "
"lives in other anonymous mappings. This corresponds to "
"'[heap]' in /proc/<pid>/smaps.");
aName.AppendLiteral("anonymous/brk-heap");
aDesc.AppendLiteral(
"Memory in anonymous mappings within the boundaries defined by "
"brk() / sbrk(). This is likely to be just a portion of the "
"application's heap; the remainder lives in other anonymous mappings. "
"This corresponds to '[heap]' in /proc/<pid>/smaps.");
*aProcessSizeKind = AnonymousBrkHeap;
} else if (basename.EqualsLiteral("[stack]")) {
aName.Append("main-thread-stack");
aDesc.Append("The stack size of the process's main thread. This "
"corresponds to '[stack]' in /proc/<pid>/smaps.");
aName.AppendLiteral("main-thread-stack");
aDesc.AppendLiteral(
"The stack size of the process's main thread. This corresponds to "
"'[stack]' in /proc/<pid>/smaps.");
*aProcessSizeKind = MainThreadStack;
} else if (basename.EqualsLiteral("[vdso]")) {
aName.Append("vdso");
aDesc.Append("The virtual dynamically-linked shared object, also known "
"as the 'vsyscall page'. This is a memory region mapped by "
"the operating system for the purpose of allowing processes "
"to perform some privileged actions without the overhead of "
"a syscall.");
aName.AppendLiteral("vdso");
aDesc.AppendLiteral(
"The virtual dynamically-linked shared object, also known as the "
"'vsyscall page'. This is a memory region mapped by the operating "
"system for the purpose of allowing processes to perform some "
"privileged actions without the overhead of a syscall.");
*aProcessSizeKind = Vdso;
} else if (!IsAnonymous(basename)) {
@ -428,7 +429,7 @@ private:
// its dirname contains "/lib", or if the basename ends with ".so".
if (EndsWithLiteral(basename, ".so") ||
(basename.Find(".so") != -1 && dirname.Find("/lib") != -1)) {
aName.Append("shared-libraries/");
aName.AppendLiteral("shared-libraries/");
if (strncmp(aPerms, "r-x", 3) == 0) {
*aProcessSizeKind = SharedLibrariesRX;
@ -441,11 +442,11 @@ private:
}
} else {
aName.Append("other-files/");
aName.AppendLiteral("other-files/");
if (EndsWithLiteral(basename, ".xpi")) {
aName.Append("extensions/");
aName.AppendLiteral("extensions/");
} else if (dirname.Find("/fontconfig") != -1) {
aName.Append("fontconfig/");
aName.AppendLiteral("fontconfig/");
}
*aProcessSizeKind = OtherFiles;
}
@ -454,20 +455,21 @@ private:
aDesc.Append(absPath);
} else {
aName.Append("anonymous/outside-brk");
aDesc.Append("Memory in anonymous mappings outside the boundaries "
"defined by brk() / sbrk().");
aName.AppendLiteral("anonymous/outside-brk");
aDesc.AppendLiteral(
"Memory in anonymous mappings outside the boundaries defined by "
"brk() / sbrk().");
*aProcessSizeKind = AnonymousOutsideBrk;
}
aName.Append("/[");
aName.AppendLiteral("/[");
aName.Append(aPerms);
aName.Append("]");
// Append the permissions. This is useful for non-verbose mode in
// about:memory when the filename is long and goes of the right side of the
// window.
aDesc.Append(" [");
aDesc.AppendLiteral(" [");
aDesc.Append(aPerms);
aDesc.Append("]");
}

View File

@ -116,11 +116,11 @@ BlockingResourceBase::CheckAcquire(const CallStack& aCallContext)
if (maybeImminent) {
fputs("\n###!!! Deadlock may happen NOW!\n\n", stderr);
out.Append("\n###!!! Deadlock may happen NOW!\n\n");
out.AppendLiteral("\n###!!! Deadlock may happen NOW!\n\n");
} else {
fputs("\nDeadlock may happen for some other execution\n\n",
stderr);
out.Append("\nDeadlock may happen for some other execution\n\n");
out.AppendLiteral("\nDeadlock may happen for some other execution\n\n");
}
// XXX can customize behavior on whether we /think/ deadlock is