Bug 1393219 - Code clean-up: Style nits, typos and trailing spaces

Tag #1273
This commit is contained in:
Matt A. Tobin 2019-11-10 19:32:24 -05:00 • committed by Roy Tam
commit c021f0c983
4 changed files with 107 additions and 109 deletions

View file

@ -2506,15 +2506,15 @@ nsAutoCString MsgExtractQueryPart(nsAutoCString spec, const char* queryToExtract
if (queryIndex == kNotFound) if (queryIndex == kNotFound)
return queryPart; return queryPart;
int32_t queryEnd = Substring(spec, queryIndex + 1).FindChar('&'); int32_t queryEnd = spec.FindChar('&', queryIndex + 1);
if (queryEnd == kNotFound) if (queryEnd == kNotFound)
queryEnd = Substring(spec, queryIndex + 1).FindChar('?'); queryEnd = spec.FindChar('?', queryIndex + 1);
if (queryEnd == kNotFound) { if (queryEnd == kNotFound) {
// Nothing follows, so return from where the query qualifier started. // Nothing follows, so return from where the query qualifier started.
queryPart.Assign(Substring(spec, queryIndex)); queryPart.Assign(Substring(spec, queryIndex));
} else { } else {
// Return the substring that represents the query qualifier. // Return the substring that represents the query qualifier.
queryPart.Assign(Substring(spec, queryIndex, queryEnd + 1)); queryPart.Assign(Substring(spec, queryIndex, queryEnd - queryIndex));
} }
return queryPart; return queryPart;
} }

View file

@ -95,7 +95,7 @@ nsresult nsMailtoUrl::ParseMailtoUrl(char * searchPart)
nsCString decodedName; nsCString decodedName;
MsgUnescapeString(nsDependentCString(token), 0, decodedName); MsgUnescapeString(nsDependentCString(token), 0, decodedName);
if (decodedName.Length() == 0) if (decodedName.IsEmpty())
break; break;
switch (NS_ToUpper(decodedName.First())) switch (NS_ToUpper(decodedName.First()))

View file

@ -751,10 +751,8 @@ nsMsgBrkMBoxStore::GetMsgInputStream(nsIMsgFolder *aMsgFolder,
else else
*aOffset = ParseUint64Str(PromiseFlatCString(aMsgToken).get()); *aOffset = ParseUint64Str(PromiseFlatCString(aMsgToken).get());
*aReusable = true; *aReusable = true;
nsCString URI;
nsCOMPtr<nsIFile> mboxFile; nsCOMPtr<nsIFile> mboxFile;
aMsgFolder->GetURI(URI);
aMsgFolder->GetFilePath(getter_AddRefs(mboxFile)); aMsgFolder->GetFilePath(getter_AddRefs(mboxFile));
return NS_NewLocalFileInputStream(aResult, mboxFile); return NS_NewLocalFileInputStream(aResult, mboxFile);
} }

View file

@ -97,7 +97,7 @@ mime_draft_data::mime_draft_data() : url_name(nullptr), format_out(0),
nsresult nsresult
nsMsgCreateTempFile(const char *tFileName, nsIFile **tFile) nsMsgCreateTempFile(const char *tFileName, nsIFile **tFile)
{ {
if ((!tFileName) || (!*tFileName)) if (!tFileName || !*tFileName)
tFileName = SAFE_TMP_FILENAME; tFileName = SAFE_TMP_FILENAME;
nsresult rv = GetSpecialDirectoryWithFileName(NS_OS_TEMP_DIR, nsresult rv = GetSpecialDirectoryWithFileName(NS_OS_TEMP_DIR,
@ -137,7 +137,7 @@ mime_dump_attachments ( nsMsgAttachmentData *attachData )
int32_t i = 0; int32_t i = 0;
class nsMsgAttachmentData *tmp = attachData; class nsMsgAttachmentData *tmp = attachData;
while ( (tmp) && (tmp->m_url) ) while (tmp && tmp->m_url)
{ {
printf("Real Name : %s\n", tmp->m_realName.get()); printf("Real Name : %s\n", tmp->m_realName.get());
@ -1736,7 +1736,7 @@ mime_decompose_file_init_fn ( void *stream_closure, MimeHeaders *headers )
if (!contLoc && !newAttachment->m_realName.IsEmpty()) if (!contLoc && !newAttachment->m_realName.IsEmpty())
workURLSpec = ToNewCString(newAttachment->m_realName); workURLSpec = ToNewCString(newAttachment->m_realName);
if ( (contLoc) && (!workURLSpec) ) if (contLoc && !workURLSpec)
workURLSpec = strdup(contLoc); workURLSpec = strdup(contLoc);
PR_FREEIF(contLoc); PR_FREEIF(contLoc);