Bug 1294260 - Part 2: fix some compile warnings in mailnews about real issues that could change behaviour (hints and help from aleth and jorgk). r=mkmelin, r=jorgk CLOSED TREE

This commit is contained in:
aceman 2016-08-14 20:30:08 +02:00
Родитель 0aa5930e98
Коммит 9d658546b0
19 изменённых файлов: 42 добавлений и 30 удалений

Просмотреть файл

@ -27,10 +27,10 @@
#include "nsLDAPUtils.h"
#include "nsProxyRelease.h"
#include "mozilla/Logging.h"
#include "mozilla/Attributes.h"
using namespace mozilla;
const char kConsoleServiceContractId[] = "@mozilla.org/consoleservice;1";
const char kDNSServiceContractId[] = "@mozilla.org/network/dns-service;1";
// constructor
@ -645,6 +645,7 @@ NS_IMETHODIMP nsLDAPConnectionRunnable::Run()
case LDAP_RES_SEARCH_REFERENCE:
// XXX what should we do with LDAP_RES_SEARCH_EXTENDED
operationFinished = false;
MOZ_FALLTHROUGH;
default:
{
msg = new nsLDAPMessage;

Просмотреть файл

@ -305,8 +305,8 @@ nsAbOSXCard::Update(bool aNotify)
}
}
}
value = GetMultiValue(card, kABAIMInstantProperty);
// This was kABAIMInstantProperty previously, but it was deprecated in OS X 10.7.
value = GetMultiValue(card, kABInstantMessageProperty);
if (value) {
unsigned int count = [value count];
if (count > 0) {

Просмотреть файл

@ -97,7 +97,8 @@ const nsAbOSXPropertyMap nsAbOSXUtils::kPropertyMap[] = {
DEFINE_PROPERTY(JobTitle, kABJobTitleProperty, nil, nil)
DEFINE_PROPERTY(Department, kABDepartmentProperty, nil, nil)
DEFINE_PROPERTY(Company, kABOrganizationProperty, nil, nil)
DONT_MAP(_AimScreenName, kABAIMInstantProperty, nil, nil)
// This was kABAIMInstantProperty previously, but it was deprecated in OS X 10.7.
DONT_MAP(_AimScreenName, kABInstantMessageProperty, nil, nil)
DEFINE_PROPERTY(WebPage1, kABHomePageProperty, nil, nil)
DONT_MAP(WebPage2, kABHomePageProperty, nil, nil)
DONT_MAP(BirthYear, "birthyear", nil, nil)

Просмотреть файл

@ -116,8 +116,8 @@ nsresult nsMsgSearchOnlineMail::Encode (nsCString& pEncoding,
}
}
}
else
asciiOnly = false;
// else
// asciiOnly = false; // TODO: enable this line when the condition is not a plain "true" in the if().
nsAutoString usAsciiCharSet(NS_LITERAL_STRING("us-ascii"));
// Get the optional CHARSET parameter, in case we need it.

Просмотреть файл

@ -396,7 +396,7 @@ nsresult nsMsgSearchOfflineMail::ProcessSearchTerm(nsIMsgDBHdr *msgToMatch,
const char * headers,
uint32_t headerSize,
bool Filtering,
bool *pResult)
bool *pResult)
{
nsresult err = NS_OK;
nsCString recipients;
@ -646,8 +646,10 @@ nsresult nsMsgSearchOfflineMail::ProcessSearchTerm(nsIMsgDBHdr *msgToMatch,
headers, headerSize, Filtering,
&result);
}
else
else {
err = NS_ERROR_INVALID_ARG; // ### was SearchError_InvalidAttribute
result = false;
}
}
*pResult = result;

Просмотреть файл

@ -1494,6 +1494,7 @@ nsresult nsMsgSearchTerm::MatchLabel(nsMsgLabelValue aLabelValue, bool *pResult)
case nsMsgSearchOp::Isnt:
if (m_value.u.label != aLabelValue)
result = true;
break;
default:
rv = NS_ERROR_FAILURE;
NS_ERROR("invalid compare op for label value");

Просмотреть файл

@ -557,7 +557,7 @@ nsMessengerOSXIntegration::BadgeDockIcon()
}
id tile = [[NSApplication sharedApplication] dockTile];
[tile setBadgeLabel:[NSString stringWithFormat:@"%S", badgeString.get()]];
[tile setBadgeLabel:[NSString stringWithFormat:@"%S", (const unichar*)badgeString.get()]];
return NS_OK;
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;

Просмотреть файл

@ -6380,6 +6380,7 @@ NS_IMETHODIMP nsMsgDBView::NoteChange(nsMsgViewIndex firstLineChanged,
// RowCountChanged() will call our GetRowCount()
mTree->RowCountChanged(firstLineChanged, numChanged);
mRemovingRow = false;
MOZ_FALLTHROUGH;
case nsMsgViewNotificationCode::all:
ClearHdrCache();
break;

Просмотреть файл

@ -4581,7 +4581,7 @@ NS_IMETHODIMP nsMsgDBFolder::GetBiffState(uint32_t *aBiffState)
NS_IMETHODIMP nsMsgDBFolder::SetBiffState(uint32_t aBiffState)
{
uint32_t oldBiffState;
uint32_t oldBiffState = nsMsgBiffState_Unknown;
nsCOMPtr<nsIMsgIncomingServer> server;
nsresult rv = GetServer(getter_AddRefs(server));
if (NS_SUCCEEDED(rv) && server)

Просмотреть файл

@ -34,7 +34,7 @@
/* End of a Part. */
#define errFileOpen static_cast<uint32_t>(NS_MSG_UNABLE_TO_OPEN_TMP_FILE)
#define errFileOpen NS_ERROR_GET_CODE(NS_MSG_UNABLE_TO_OPEN_TMP_FILE)
#define errFileWrite -202 /*Error writing temporary file.*/
#define errUsrCancel -2 /*MK_INTERRUPTED */
#define errDecoding -1

Просмотреть файл

@ -80,7 +80,7 @@ MacGetFileType(nsIFile *fs,
}
}
#pragma cplusplus reset
//#pragma cplusplus reset
/*
* ap_encode_init

Просмотреть файл

@ -4749,7 +4749,7 @@ nsresult nsMsgCompose::GetABDirectories(const nsACString& aDirUri,
nsresult nsMsgCompose::BuildMailListArray(nsIAbDirectory* parentDir,
nsTArray<nsMsgMailList>& array)
{
nsresult rv;
nsresult rv = NS_OK;
nsCOMPtr<nsIAbDirectory> directory;
nsCOMPtr<nsISimpleEnumerator> subDirectories;

Просмотреть файл

@ -255,8 +255,8 @@ NS_IMETHODIMP nsMsgThread::AddChild(nsIMsgDBHdr *child, nsIMsgDBHdr *inReplyTo,
child->SetThreadParent(parentKey);
parentKeyNeedsSetting = false;
}
// check if this header is a parent of one of the messages in this thread
// check if this header is a parent of one of the messages in this thread
bool hdrMoved = false;
nsCOMPtr <nsIMsgDBHdr> curHdr;
uint32_t moveIndex = 0;
@ -278,7 +278,7 @@ NS_IMETHODIMP nsMsgThread::AddChild(nsIMsgDBHdr *child, nsIMsgDBHdr *inReplyTo,
{
for (childIndex = 0; childIndex < numChildren; childIndex++)
{
nsMsgKey msgKey;
nsMsgKey msgKey = nsMsgKey_None;
rv = GetChildHdrAt(childIndex, getter_AddRefs(curHdr));
if (NS_SUCCEEDED(rv) && curHdr)
@ -314,6 +314,7 @@ NS_IMETHODIMP nsMsgThread::AddChild(nsIMsgDBHdr *child, nsIMsgDBHdr *inReplyTo,
}
}
curHdr->SetThreadParent(newHdrKey);
// TODO: what should be msgKey if hdrMoved was true above?
if (msgKey == newHdrKey)
parentKeyNeedsSetting = false;

Просмотреть файл

@ -2496,7 +2496,7 @@ void CorpusStore::readTrainingData()
// FIXME: should make sure that the tokenizers are empty.
char cookie[4];
uint32_t goodMessageCount, junkMessageCount;
uint32_t goodMessageCount = 0, junkMessageCount = 0;
if (!((fread(cookie, sizeof(cookie), 1, stream) == 1) &&
(memcmp(cookie, kMagicCookie, sizeof(cookie)) == 0) &&
(readUInt32(stream, &goodMessageCount) == 1) &&

Просмотреть файл

@ -98,7 +98,7 @@ nsresult nsAutoSyncState::ManageStorageSpace()
nsresult nsAutoSyncState::PlaceIntoDownloadQ(const nsTArray<nsMsgKey> &aMsgKeyList)
{
nsresult rv;
nsresult rv = NS_OK;
if (!aMsgKeyList.IsEmpty())
{
nsCOMPtr <nsIMsgFolder> folder = do_QueryReferent(mOwnerFolder, &rv);

Просмотреть файл

@ -3945,8 +3945,8 @@ NS_IMETHODIMP nsImapMailFolder::StoreImapFlags(int32_t flags, bool addFlags,
}
else
{
GetDatabase();
if (mDatabase)
rv = GetDatabase();
if (NS_SUCCEEDED(rv) && mDatabase)
{
uint32_t total = numKeys;
for (uint32_t keyIndex = 0; keyIndex < total; keyIndex++)
@ -4043,10 +4043,7 @@ void nsImapMailFolder::SetNamespaceForFolder(nsIMAPNamespace *ns)
NS_IMETHODIMP nsImapMailFolder::FolderPrivileges(nsIMsgWindow *window)
{
NS_ENSURE_ARG_POINTER(window);
nsresult rv ; // if no window...
#ifdef DEBUG_bienvenu
m_adminUrl.Assign("http://www.netscape.com");
#endif
nsresult rv = NS_OK; // if no window...
if (!m_adminUrl.IsEmpty())
{
nsCOMPtr<nsIExternalProtocolService> extProtService = do_GetService(NS_EXTERNALPROTOCOLSERVICE_CONTRACTID);
@ -4191,7 +4188,8 @@ nsresult nsImapMailFolder::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
rv = NS_OK;
}
}
}
} else
rv = NS_ERROR_UNEXPECTED;
// we have to return an error because we do not actually move the message
// it is done async and that can fail

Просмотреть файл

@ -1747,7 +1747,7 @@ bool nsImapProtocol::ProcessCurrentURL()
if (m_runningUrl)
FindMailboxesIfNecessary();
nsImapState imapState;
nsImapState imapState = nsIImapUrl::ImapStatusNone;
if (m_runningUrl)
m_runningUrl->GetRequiredImapState(&imapState);
@ -2163,6 +2163,8 @@ NS_IMETHODIMP nsImapProtocol::LoadImapUrl(nsIURI * aURL, nsISupports * aConsumer
NS_ASSERTION(false, "missing channel or running url");
} // if we received a url!
else
rv = NS_ERROR_UNEXPECTED;
return rv;
}

Просмотреть файл

@ -1710,20 +1710,23 @@ nsMsgLocalMailFolder::CopyFolderAcrossServer(nsIMsgFolder* srcFolder, nsIMsgWind
nsCOMPtr<nsISimpleEnumerator> messages;
rv = srcFolder->GetMessages(getter_AddRefs(messages));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIMutableArray> msgArray(do_CreateInstance(NS_ARRAY_CONTRACTID));
bool hasMoreElements;
bool hasMoreElements = false;
nsCOMPtr<nsISupports> aSupport;
if (messages)
messages->HasMoreElements(&hasMoreElements);
rv = messages->HasMoreElements(&hasMoreElements);
while (hasMoreElements && NS_SUCCEEDED(rv))
while (NS_SUCCEEDED(rv) && hasMoreElements)
{
rv = messages->GetNext(getter_AddRefs(aSupport));
NS_ENSURE_SUCCESS(rv, rv);
rv = msgArray->AppendElement(aSupport, false);
messages->HasMoreElements(&hasMoreElements);
NS_ENSURE_SUCCESS(rv, rv);
rv = messages->HasMoreElements(&hasMoreElements);
}
uint32_t numMsgs=0;
@ -2197,7 +2200,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::CopyData(nsIInputStream *aIStream, int32_t a
if (mCopyState->m_wholeMsgInStream)
{
end = start + mCopyState->m_leftOver;
memcpy (end, MSG_LINEBREAK + '\0', MSG_LINEBREAK_LEN + 1);
memcpy(end, MSG_LINEBREAK "\0", MSG_LINEBREAK_LEN + 1);
}
else
{

Просмотреть файл

@ -1644,6 +1644,7 @@ nsresult nsNNTPProtocol::GetPropertiesResponse(nsIInputStream * inputStream, uin
nsresult nsNNTPProtocol::SendListSubscriptions()
{
nsresult rv = NS_OK;
/* TODO: is this needed for anything?
#if 0
bool searchable=false;
rv = m_nntpServer->QueryExtension("LISTSUBSCR",&listsubscr);
@ -1658,6 +1659,7 @@ nsresult nsNNTPProtocol::SendListSubscriptions()
SetFlag(NNTP_PAUSE_FOR_READ);
}
else
*/
{
/* since LIST SUBSCRIPTIONS isn't supported, move on to real work */
m_nextState = SEND_FIRST_NNTP_COMMAND;