Skip to content

Commit

Permalink
Bug 869836 - Part 7: Use AppendLiteral instead of Append where possib…
Browse files Browse the repository at this point in the history
…le. r=ehsan
  • Loading branch information
poiru committed May 22, 2014
1 parent 5864180 commit aea8617
Show file tree
Hide file tree
Showing 47 changed files with 156 additions and 152 deletions.
6 changes: 3 additions & 3 deletions accessible/src/atk/Platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion browser/components/shell/src/nsGNOMEShellService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions content/base/src/nsXMLHttpRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
10 changes: 5 additions & 5 deletions dom/base/nsJSEnvironment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion dom/plugins/base/nsNPAPIPluginStreamListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion dom/plugins/base/nsPluginHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions dom/plugins/ipc/PluginModuleParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion dom/xbl/nsXBLWindowKeyHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions embedding/tests/winEmbed/WebBrowserChrome.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,21 +428,21 @@ 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")))
{
status.AssignLiteral("Going to HistoryIndex: ");

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")))
{
Expand Down
12 changes: 6 additions & 6 deletions extensions/gio/nsGIOProtocolHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion gfx/gl/GLBlitTextureImageHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions gfx/layers/LayerScope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ class LayerScopeWebSocketHandler : public nsIInputStreamCallback {
return false;
}

if (!(version.EqualsLiteral("7") || version.EqualsLiteral("8") || version.EqualsLiteral("13"))) {
if (!(version.EqualsLiteral("7") ||
version.EqualsLiteral("8") ||
version.EqualsLiteral("13"))) {
return false;
}

Expand All @@ -243,10 +245,10 @@ class LayerScopeWebSocketHandler : public nsIInputStreamCallback {
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) {
Expand Down
2 changes: 1 addition & 1 deletion gfx/thebes/gfxFT2FontList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1242,7 +1242,7 @@ gfxFT2FontList::FindFonts()
} else {
root = NS_LITERAL_CSTRING("/system");
}
root.Append("/fonts");
root.AppendLiteral("/fonts");

FindFontsInDir(root, &fnc);

Expand Down
2 changes: 1 addition & 1 deletion image/src/imgLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class imgMemoryReporter MOZ_FINAL : public nsIMemoryReporter
#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; \
Expand Down
2 changes: 1 addition & 1 deletion intl/unicharutil/src/nsEntityConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion ipc/glue/WindowsMessageLoop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion layout/base/nsLayoutUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions layout/style/nsFontFaceLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions modules/libpref/src/prefapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion netwerk/protocol/http/Http2Compression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
}

Expand Down
2 changes: 1 addition & 1 deletion rdf/base/src/nsRDFService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion rdf/base/src/rdfutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down
2 changes: 1 addition & 1 deletion rdf/util/src/nsRDFResource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading

0 comments on commit aea8617

Please sign in to comment.