Bug 1008444 - Fix nsTArray usage in mailnews after bug 1004098 landed, r=Neil a=partial bustage fix on a CLOSED TREE.

This commit is contained in:
Joshua Cranmer 2014-05-09 18:39:08 -05:00
Родитель 82cfb31644
Коммит ea7743162f
18 изменённых файлов: 40 добавлений и 56 удалений

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

@ -145,7 +145,7 @@ NS_IMETHODIMP nsAbLDAPCard::GetLDAPMessageInfo(
do_CreateInstance("@mozilla.org/network/ldap-modification;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
uint32_t index = m_attributes.IndexOf(attr);
size_t index = m_attributes.IndexOf(attr);
rv = GetPropertyAsAUTF8String(props[i], propvalue);

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

@ -1038,7 +1038,7 @@ nsresult nsMsgFilterList::MoveFilterAt(uint32_t filterIndex,
nsresult nsMsgFilterList::MoveFilter(nsIMsgFilter *aFilter,
nsMsgFilterMotionValue motion)
{
uint32_t filterIndex = m_filters.IndexOf(aFilter, 0);
size_t filterIndex = m_filters.IndexOf(aFilter, 0);
NS_ENSURE_ARG(filterIndex != m_filters.NoIndex);
return MoveFilterAt(filterIndex, motion);

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

@ -111,8 +111,8 @@ NS_IMETHODIMP nsMsgSearchSession::RegisterListener(nsIMsgSearchNotify *aListener
NS_IMETHODIMP nsMsgSearchSession::UnregisterListener(nsIMsgSearchNotify *aListener)
{
NS_ENSURE_ARG_POINTER(aListener);
int32_t listenerIndex = m_listenerList.IndexOf(aListener);
if (listenerIndex != -1)
size_t listenerIndex = m_listenerList.IndexOf(aListener);
if (listenerIndex != m_listenerList.NoIndex)
{
m_listenerList.RemoveElementAt(listenerIndex);
m_listenerFlagList.RemoveElementAt(listenerIndex);

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

@ -2168,12 +2168,12 @@ NS_IMETHODIMP nsMessenger::OnItemRemoved(nsIMsgFolder *parentItem, nsISupports *
folder->GenerateMessageURI(msgKey, msgUri);
// need to remove the correspnding folder entry, and
// adjust the current history pos.
int32_t uriPos = mLoadedMsgHistory.IndexOf(msgUri);
if (uriPos != kNotFound)
size_t uriPos = mLoadedMsgHistory.IndexOf(msgUri);
if (uriPos != mLoadedMsgHistory.NoIndex)
{
mLoadedMsgHistory.RemoveElementAt(uriPos);
mLoadedMsgHistory.RemoveElementAt(uriPos); // and the folder uri entry
if ((int32_t) mCurHistoryPos >= uriPos)
if (mCurHistoryPos >= (int32_t)uriPos)
mCurHistoryPos -= 2;
}
}

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

@ -232,7 +232,7 @@ nsMessengerUnixIntegration::BuildNotificationBody(nsIMsgDBHdr *aHdr,
bool localOnly;
uint32_t msgURIIndex = mFetchingURIs.IndexOf(msgURI);
size_t msgURIIndex = mFetchingURIs.IndexOf(msgURI);
if (msgURIIndex == mFetchingURIs.NoIndex)
{
localOnly = false;

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

@ -1779,7 +1779,7 @@ bool nsMsgDBView::WasHdrRecentlyDeleted(nsIMsgDBHdr *msgHdr)
NS_IMETHODIMP nsMsgDBView::AddColumnHandler(const nsAString& column, nsIMsgCustomColumnHandler* handler)
{
uint32_t index = m_customColumnHandlerIDs.IndexOf(column);
size_t index = m_customColumnHandlerIDs.IndexOf(column);
nsAutoString strColID(column);
@ -1814,9 +1814,9 @@ NS_IMETHODIMP nsMsgDBView::RemoveColumnHandler(const nsAString& aColID)
// here we should check if the column name matches any of the columns in
// m_sortColumns, and if so, clear m_sortColumns[i].mColHandler
int32_t index = m_customColumnHandlerIDs.IndexOf(aColID);
size_t index = m_customColumnHandlerIDs.IndexOf(aColID);
if (index != -1)
if (index != m_customColumnHandlerIDs.NoIndex)
{
m_customColumnHandlerIDs.RemoveElementAt(index);
m_customColumnHandlers.RemoveObjectAt(index);
@ -1875,8 +1875,9 @@ NS_IMETHODIMP nsMsgDBView::GetCurCustomColumn(nsAString &result)
nsIMsgCustomColumnHandler* nsMsgDBView::GetColumnHandler(const char16_t *colID)
{
int32_t index = m_customColumnHandlerIDs.IndexOf(nsDependentString(colID));
return (index > -1) ? m_customColumnHandlers[index] : nullptr;
size_t index = m_customColumnHandlerIDs.IndexOf(nsDependentString(colID));
return (index != m_customColumnHandlerIDs.NoIndex) ?
m_customColumnHandlers[index] : nullptr;
}
NS_IMETHODIMP nsMsgDBView::GetColumnHandler(const nsAString& aColID, nsIMsgCustomColumnHandler** aHandler)
@ -4055,9 +4056,7 @@ void nsMsgDBView::PushSort(const MsgViewSortColumnInfo &newSort)
if (newSort.mSortType == nsMsgViewSortType::byDate ||
newSort.mSortType == nsMsgViewSortType::byId )
m_sortColumns.Clear();
int32_t sortIndex = m_sortColumns.IndexOf(newSort, 0);
if (sortIndex != kNotFound)
m_sortColumns. RemoveElementAt(sortIndex);
m_sortColumns.RemoveElement(newSort);
m_sortColumns.InsertElementAt(0, newSort);
if (m_sortColumns.Length() > kMaxNumSortColumns)
m_sortColumns.RemoveElementAt(kMaxNumSortColumns);

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

@ -37,6 +37,8 @@
class nsVoidArray;
typedef nsAutoTArray<nsMsgViewIndex, 1> nsMsgViewIndexArray;
static_assert(nsMsgViewIndex(nsMsgViewIndexArray::NoIndex) ==
nsMsgViewIndex_None, "These need to be the same value.");
enum eFieldType {
kCollationKey,

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

@ -48,11 +48,7 @@ NS_IMETHODIMP nsMsgFolderNotificationService::RemoveListener(nsIMsgFolderListene
{
NS_ENSURE_ARG_POINTER(aListener);
int32_t index = mListeners.IndexOf(aListener);
NS_ASSERTION(index != -1, "removing non-existent listener");
if (index != -1)
mListeners.RemoveElementAt(index);
mListeners.RemoveElement(aListener);
return NS_OK;
}

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

@ -828,7 +828,7 @@ nsMsgViewIndex nsMsgXFGroupThread::FindMsgHdr(nsIMsgDBHdr *hdr)
hdr->GetMessageKey(&msgKey);
nsCOMPtr<nsIMsgFolder> folder;
hdr->GetFolder(getter_AddRefs(folder));
uint32_t index = 0;
size_t index = 0;
while (true) {
index = m_keys.IndexOf(msgKey, index);
if (index == m_keys.NoIndex || m_folders[index] == folder)

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

@ -64,9 +64,9 @@ NS_IMETHODIMP nsMsgMailSession::AddFolderListener(nsIFolderListener *aListener,
NS_ENSURE_ARG_POINTER(aListener);
// we don't care about the notification flags for equivalence purposes
int32_t index = mListeners.IndexOf(aListener);
NS_ASSERTION(index == -1, "tried to add duplicate listener");
if (index == -1)
size_t index = mListeners.IndexOf(aListener);
NS_ASSERTION(index == size_t(-1), "tried to add duplicate listener");
if (index == size_t(-1))
{
folderListener newListener(aListener, aNotifyFlags);
mListeners.AppendElement(newListener);
@ -79,11 +79,7 @@ NS_IMETHODIMP nsMsgMailSession::RemoveFolderListener(nsIFolderListener *aListene
{
NS_ENSURE_ARG_POINTER(aListener);
int32_t index = mListeners.IndexOf(aListener);
NS_ASSERTION(index != -1, "removing non-existent listener");
if (index != -1)
mListeners.RemoveElementAt(index);
mListeners.RemoveElement(aListener);
return NS_OK;
}
@ -178,9 +174,9 @@ nsMsgMailSession::AddUserFeedbackListener(nsIMsgUserFeedbackListener *aListener)
{
NS_ENSURE_ARG_POINTER(aListener);
int32_t index = mFeedbackListeners.IndexOf(aListener);
NS_ASSERTION(index == -1, "tried to add duplicate listener");
if (index == -1)
size_t index = mFeedbackListeners.IndexOf(aListener);
NS_ASSERTION(index == size_t(-1), "tried to add duplicate listener");
if (index == size_t(-1))
mFeedbackListeners.AppendElement(aListener);
return NS_OK;
@ -191,11 +187,7 @@ nsMsgMailSession::RemoveUserFeedbackListener(nsIMsgUserFeedbackListener *aListen
{
NS_ENSURE_ARG_POINTER(aListener);
int32_t index = mFeedbackListeners.IndexOf(aListener);
NS_ASSERTION(index != -1, "removing non-existent listener");
if (index != -1)
mFeedbackListeners.RemoveElementAt(index);
mFeedbackListeners.RemoveElement(aListener);
return NS_OK;
}

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

@ -339,9 +339,9 @@ nsMsgQuickSearchDBView::OnSearchDone(nsresult status)
nsresult rv = m_viewFolder->GetDBFolderInfoAndDB(getter_AddRefs(dbFolderInfo), getter_AddRefs(virtDatabase));
NS_ENSURE_SUCCESS(rv, rv);
uint32_t numUnread = 0;
uint32_t numTotal = m_origKeys.Length();
size_t numTotal = m_origKeys.Length();
for (uint32_t i = 0; i < m_origKeys.Length(); i++)
for (size_t i = 0; i < m_origKeys.Length(); i++)
{
bool isRead;
m_db->IsRead(m_origKeys[i], &isRead);
@ -858,8 +858,8 @@ nsMsgQuickSearchDBView::OnHdrDeleted(nsIMsgDBHdr *aHdrDeleted,
NS_ENSURE_ARG_POINTER(aHdrDeleted);
nsMsgKey msgKey;
aHdrDeleted->GetMessageKey(&msgKey);
int32_t keyIndex = m_origKeys.BinaryIndexOf(msgKey);
if (keyIndex != -1)
size_t keyIndex = m_origKeys.BinaryIndexOf(msgKey);
if (keyIndex != m_origKeys.NoIndex)
m_origKeys.RemoveElementAt(keyIndex);
return nsMsgThreadedDBView::OnHdrDeleted(aHdrDeleted, aParentKey, aFlags,
aInstigator);

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

@ -112,13 +112,11 @@ nsresult nsMsgMailNewsUrl::UnRegisterListener(nsIUrlListener *aUrlListener)
{
NS_ENSURE_ARG_POINTER(aUrlListener);
int32_t index = mUrlListeners.IndexOf(aUrlListener);
// Due to the way mailnews is structured, some listeners attempt to remove
// themselves twice. This may in fact be an error in the coding, however
// if they didn't do it as they do currently, then they could fail to remove
// their listeners.
if (index != -1)
mUrlListeners.RemoveElementAt(index);
mUrlListeners.RemoveElement(aUrlListener);
return NS_OK;
}

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

@ -1019,10 +1019,6 @@ nsMsgCompose::UnregisterStateListener(nsIMsgComposeStateListener *aStateListener
{
NS_ENSURE_ARG_POINTER(aStateListener);
int32_t index = mStateListeners.IndexOf(aStateListener);
if (index == -1)
return NS_ERROR_FAILURE;
return mStateListeners.RemoveElement(aStateListener) ? NS_OK : NS_ERROR_FAILURE;
}
@ -4701,7 +4697,7 @@ nsMsgCompose::LookupAddressBook(RecipientsArray &recipientsList)
if (!recipient.mDirectory)
{
// First check if it's a mailing list
uint32_t index = mailListArray.IndexOf(recipient, 0,
size_t index = mailListArray.IndexOf(recipient, 0,
nsMsgMailListComparator());
if (index != mailListArray.NoIndex &&
mailListArray[index].mDirectory)

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

@ -1385,7 +1385,7 @@ nsresult nsMsgComposeService::AddGlobalHtmlDomains()
// Get the current plaintext domain list into new list var
ParseString(currentPlaintextDomainList, DOMAIN_DELIMITER, domainArray);
uint32_t i = domainArray.Length();
size_t i = domainArray.Length();
if (i > 0) {
// Append each domain in the preconfigured html domain list
globalHtmlDomainList.StripWhitespace();

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

@ -2719,7 +2719,7 @@ void CorpusStore::remove(const char* word, uint32_t aTraitId, uint32_t aCount)
uint32_t CorpusStore::getMessageCount(uint32_t aTraitId)
{
uint32_t index = mMessageCountsId.IndexOf(aTraitId);
size_t index = mMessageCountsId.IndexOf(aTraitId);
if (index == mMessageCountsId.NoIndex)
return 0;
return mMessageCounts.ElementAt(index);
@ -2727,7 +2727,7 @@ uint32_t CorpusStore::getMessageCount(uint32_t aTraitId)
void CorpusStore::setMessageCount(uint32_t aTraitId, uint32_t aCount)
{
uint32_t index = mMessageCountsId.IndexOf(aTraitId);
size_t index = mMessageCountsId.IndexOf(aTraitId);
if (index == mMessageCountsId.NoIndex)
{
mMessageCounts.AppendElement(aCount);

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

@ -31,6 +31,6 @@ NS_IMETHODIMP nsEncryptedSMIMEURIsService::ForgetEncrypted(const nsACString & ur
NS_IMETHODIMP nsEncryptedSMIMEURIsService::IsEncrypted(const nsACString & uri, bool *_retval)
{
*_retval = (mEncryptedURIs.IndexOf(uri) != -1);
*_retval = mEncryptedURIs.Contains(uri);
return NS_OK;
}

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

@ -1045,7 +1045,7 @@ nsresult nsParseMailMessageState::ParseHeaders ()
#endif
ToLowerCase(headerStr);
uint32_t customHeaderIndex = m_customDBHeaders.IndexOf(headerStr);
size_t customHeaderIndex = m_customDBHeaders.IndexOf(headerStr);
if (customHeaderIndex != m_customDBHeaders.NoIndex)
header = & m_customDBHeaderValues[customHeaderIndex];
}

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

@ -95,7 +95,8 @@ nsNNTPArticleList::FinishAddingArticleKeys()
#ifdef DEBUG
// make sure none of the deleted turned up on the idsOnServer list
for (uint32_t i = 0; i < m_idsDeleted.Length(); i++) {
NS_ASSERTION(m_idsOnServer.IndexOf((nsMsgKey)(m_idsDeleted[i]), 0) == nsMsgViewIndex_None, "a deleted turned up on the idsOnServer list");
NS_ASSERTION(!m_idsOnServer.Contains((nsMsgKey)m_idsDeleted[i]),
"a deleted turned up on the idsOnServer list");
}
#endif
return NS_OK;