Replace SetAt with operator[] b=413413 r+sr=bienvenu
git-svn-id: svn://10.0.0.236/trunk@247740 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
250d86c9da
commit
e8a201a125
@ -770,7 +770,7 @@ nsresult nsMsgDBView::SaveAndClearSelection(nsMsgKey *aCurrentMsgKey, nsMsgKeyAr
|
||||
nsMsgKey msgKey;
|
||||
for (PRInt32 index = 0; index < numIndices; index++)
|
||||
{
|
||||
msgKey = m_keys.GetAt(selection[index]);
|
||||
msgKey = m_keys[selection[index]];
|
||||
aMsgKeyArray[index] = msgKey;
|
||||
}
|
||||
|
||||
@ -2549,7 +2549,7 @@ nsMsgDBView::ApplyCommandToIndices(nsMsgViewCommandTypeValue command, nsMsgViewI
|
||||
for (int32 i = 0; i < numIndices; i++)
|
||||
{
|
||||
if (thisIsImapFolder && command != nsMsgViewCommandType::markThreadRead)
|
||||
imapUids.SetAt(i, GetAt(indices[i]));
|
||||
imapUids[i] = GetAt(indices[i]);
|
||||
|
||||
switch (command)
|
||||
{
|
||||
@ -3170,7 +3170,7 @@ nsresult nsMsgDBView::ReverseThreads()
|
||||
PRInt32 saveEndThread = endThread;
|
||||
while (endThread >= sourceIndex)
|
||||
{
|
||||
newKeyArray.SetAt(destIndex, m_keys[endThread]);
|
||||
newKeyArray[destIndex] = m_keys[endThread];
|
||||
newFlagArray[destIndex] = m_flags[endThread];
|
||||
newLevelArray[destIndex] = m_levels[endThread];
|
||||
endThread--;
|
||||
@ -3206,8 +3206,8 @@ nsresult nsMsgDBView::ReverseSort()
|
||||
|
||||
// swap keys
|
||||
nsMsgKey tempKey = m_keys[i];
|
||||
m_keys.SetAt(i, m_keys[end]);
|
||||
m_keys.SetAt(end, tempKey);
|
||||
m_keys[i] = m_keys[end];
|
||||
m_keys[end] = tempKey;
|
||||
|
||||
if (folders)
|
||||
{
|
||||
@ -4017,7 +4017,7 @@ NS_IMETHODIMP nsMsgDBView::Sort(nsMsgViewSortTypeValue sortType, nsMsgViewSortOr
|
||||
// now put the IDs into the array in proper order
|
||||
for (PRUint32 i = 0; i < numSoFar; i++)
|
||||
{
|
||||
m_keys.SetAt(i, pPtrBase[i]->id);
|
||||
m_keys[i] = pPtrBase[i]->id;
|
||||
m_flags[i] = pPtrBase[i]->bits;
|
||||
|
||||
if (folders)
|
||||
@ -4817,7 +4817,7 @@ nsresult nsMsgDBView::ListIdsInThreadOrder(nsIMsgThread *threadHdr, nsMsgKey par
|
||||
msgHdr->GetMessageKey(&msgKey);
|
||||
msgHdr->GetFlags(&msgFlags);
|
||||
AdjustReadFlag(msgHdr, &msgFlags);
|
||||
m_keys.SetAt(*viewIndex, msgKey);
|
||||
m_keys[*viewIndex] = msgKey;
|
||||
// ### TODO - how about hasChildren flag?
|
||||
m_flags[*viewIndex] = msgFlags & ~MSG_VIEW_FLAGS;
|
||||
// ### TODO this is going to be tricky - might use enumerators
|
||||
@ -4868,7 +4868,7 @@ nsresult nsMsgDBView::ListIdsInThread(nsIMsgThread *threadHdr, nsMsgViewIndex st
|
||||
msgHdr->GetMessageKey(&msgKey);
|
||||
msgHdr->GetFlags(&msgFlags);
|
||||
AdjustReadFlag(msgHdr, &msgFlags);
|
||||
m_keys.SetAt(viewIndex, msgKey);
|
||||
m_keys[viewIndex] = msgKey;
|
||||
m_flags[viewIndex] = msgFlags & ~MSG_VIEW_FLAGS;
|
||||
// here, we're either flat, or we're grouped - in either case, level is 1
|
||||
// turn off thread or elided bit if they got turned on (maybe from new only view?)
|
||||
|
||||
@ -330,7 +330,7 @@ NS_IMETHODIMP nsMsgGroupThread::RemoveChildHdr(nsIMsgDBHdr *child, nsIDBChangeAn
|
||||
// if we're deleting the root of a dummy thread, need to update the threadKey
|
||||
// and the dummy header at position 0
|
||||
if (m_dummy && keyWasFirstKey && m_keys.GetSize() > 1)
|
||||
m_keys.SetAt(0, m_keys[1]);
|
||||
m_keys[0] = m_keys[1];
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -344,9 +344,9 @@ nsMsgGroupThread *nsMsgGroupView::AddHdrToThread(nsIMsgDBHdr *msgHdr, PRBool *pN
|
||||
if (!newThread && foundThread->m_keys[0] == msgKey)
|
||||
{
|
||||
if (viewIndexOfThread != nsMsgKey_None)
|
||||
m_keys.SetAt(viewIndexOfThread, msgKey);
|
||||
m_keys[viewIndexOfThread] = msgKey;
|
||||
if (GroupViewUsesDummyRow())
|
||||
foundThread->m_keys.SetAt(1, msgKey); // replace the old duplicate dummy header.
|
||||
foundThread->m_keys[1] = msgKey; // replace the old duplicate dummy header.
|
||||
}
|
||||
|
||||
return foundThread;
|
||||
@ -592,7 +592,7 @@ NS_IMETHODIMP nsMsgGroupView::OnHdrDeleted(nsIMsgDBHdr *aHdrDeleted, nsMsgKey aP
|
||||
}
|
||||
else if (rootDeleted && viewIndexOfThread > 0)
|
||||
{
|
||||
m_keys.SetAt(viewIndexOfThread - 1, m_keys[viewIndexOfThread]);
|
||||
m_keys[viewIndexOfThread - 1] = m_keys[viewIndexOfThread];
|
||||
OrExtraFlag(viewIndexOfThread - 1, MSG_VIEW_FLAG_DUMMY | MSG_VIEW_FLAG_ISTHREAD);
|
||||
}
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ nsresult nsMsgThreadedDBView::SortThreads(nsMsgViewSortTypeValue sortType, nsMsg
|
||||
{
|
||||
if (numThreads < i)
|
||||
{
|
||||
m_keys.SetAt(numThreads, m_keys[i]);
|
||||
m_keys[numThreads] = m_keys[i];
|
||||
m_flags[numThreads] = m_flags[i];
|
||||
}
|
||||
m_levels[numThreads] = 0;
|
||||
@ -646,7 +646,7 @@ nsresult nsMsgThreadedDBView::OnNewHeader(nsIMsgDBHdr *newHdr, nsMsgKey aParentK
|
||||
{
|
||||
// if we have a collapsed thread which just got a new
|
||||
// top of thread, change the keys array.
|
||||
m_keys.SetAt(threadIndex, newKey);
|
||||
m_keys[threadIndex] = newKey;
|
||||
}
|
||||
// note change, to update the parent thread's unread and total counts
|
||||
NoteChange(threadIndex, 1, nsMsgViewNotificationCode::changed);
|
||||
@ -806,9 +806,7 @@ nsresult nsMsgThreadedDBView::RemoveByIndex(nsMsgViewIndex index)
|
||||
rv = threadHdr->GetChildHdrAt(0, getter_AddRefs(msgHdr));
|
||||
if (msgHdr != nsnull)
|
||||
{
|
||||
nsMsgKey msgKey;
|
||||
msgHdr->GetMessageKey(&msgKey);
|
||||
m_keys.SetAt(index, msgKey);
|
||||
msgHdr->GetMessageKey(&m_keys[index]);
|
||||
|
||||
PRUint32 flag = 0;
|
||||
msgHdr->GetFlags(&flag);
|
||||
|
||||
@ -63,15 +63,6 @@ public:
|
||||
nsMsgKey GetKeyFromIndex(PRUint32 nIndex) {
|
||||
return(operator[](nIndex));
|
||||
}
|
||||
nsMsgKey GetAt(PRUint32 nIndex) const {
|
||||
return(operator[](nIndex));
|
||||
}
|
||||
void SetAt(PRUint32 nIndex, nsMsgKey key) {
|
||||
nsUInt32Array::SetAt(nIndex, (PRUint32)key);
|
||||
}
|
||||
void SetAtGrow(PRUint32 nIndex, nsMsgKey key) {
|
||||
nsUInt32Array::SetAtGrow(nIndex, (uint32)key);
|
||||
}
|
||||
void InsertAt(PRUint32 nIndex, nsMsgKey key, int nCount = 1) {
|
||||
nsUInt32Array::InsertAt(nIndex, (PRUint32)key, nCount);
|
||||
}
|
||||
|
||||
@ -163,12 +163,6 @@ PRUint32 *nsUInt32Array::GetData()
|
||||
return m_pData;
|
||||
}
|
||||
|
||||
void nsUInt32Array::SetAt(PRUint32 nIndex, PRUint32 newElement)
|
||||
{
|
||||
NS_ASSERTION(nIndex < m_nSize, "array index out of bounds");
|
||||
m_pData[nIndex] = newElement;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PRUint32 nsUInt32Array::Add(PRUint32 newElement)
|
||||
|
||||
@ -69,9 +69,7 @@ public:
|
||||
|
||||
// Accessor member functions
|
||||
PRUint32 &ElementAt(PRUint32 nIndex);
|
||||
PRUint32 GetAt(PRUint32 nIndex) const;
|
||||
PRUint32 *GetData();
|
||||
void SetAt(PRUint32 nIndex, PRUint32 newElement);
|
||||
PRUint32 IndexOf(PRUint32 element);
|
||||
PRUint32 IndexOfSorted(PRUint32 element);
|
||||
|
||||
@ -82,7 +80,6 @@ public:
|
||||
void InsertAt(PRUint32 nStartIndex, const nsUInt32Array *pNewArray);
|
||||
void RemoveAll();
|
||||
void RemoveAt(PRUint32 nIndex, PRUint32 nCount = 1);
|
||||
void SetAtGrow(PRUint32 nIndex, PRUint32 newElement);
|
||||
PRBool RemoveElement(PRUint32 element);
|
||||
// Sorting member functions
|
||||
void QuickSort(int (* PR_CALLBACK compare) (const void *elem1, const void *elem2, void *) = NULL);
|
||||
@ -97,6 +94,8 @@ public:
|
||||
void CopyArray(nsUInt32Array &oldA);
|
||||
|
||||
protected:
|
||||
PRUint32 GetAt(PRUint32 nIndex) const;
|
||||
void SetAtGrow(PRUint32 nIndex, PRUint32 newElement);
|
||||
// Member data
|
||||
PRUint32 m_nSize;
|
||||
PRUint32 m_nMaxSize;
|
||||
|
||||
@ -200,7 +200,7 @@ NS_IMETHODIMP nsImapFlagAndUidState::ExpungeByIndex(PRUint32 msgIndex)
|
||||
fNumberDeleted--;
|
||||
for (counter = msgIndex; counter < (PRUint32) fNumberOfMessagesAdded; counter++)
|
||||
{
|
||||
fUids.SetAt(counter, fUids[counter + 1]);
|
||||
fUids[counter] = fUids[counter + 1];
|
||||
fFlags[counter] = fFlags[counter + 1];
|
||||
}
|
||||
|
||||
@ -230,7 +230,7 @@ NS_IMETHODIMP nsImapFlagAndUidState::AddUidFlagPair(PRUint32 uid, imapMessageFla
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
fUids.SetAt(zeroBasedIndex, uid);
|
||||
fUids[zeroBasedIndex] = uid;
|
||||
fFlags[zeroBasedIndex] = flags;
|
||||
if (flags & kImapMsgDeletedFlag)
|
||||
fNumberDeleted++;
|
||||
|
||||
@ -98,7 +98,7 @@ nsImapMoveCopyMsgTxn::Init(nsIMsgFolder* srcFolder, nsMsgKeyArray* srcKeyArray,
|
||||
{
|
||||
srcDB->GetNextPseudoMsgKey(&pseudoKey);
|
||||
pseudoKey--;
|
||||
m_dupKeyArray.SetAt(i,pseudoKey);
|
||||
m_dupKeyArray[i] = pseudoKey;
|
||||
rv = srcDB->CopyHdrFromExistingHdr(pseudoKey,
|
||||
srcHdr, PR_FALSE,
|
||||
getter_AddRefs(copySrcHdr));
|
||||
@ -466,7 +466,7 @@ nsImapOfflineTxn::nsImapOfflineTxn(nsIMsgFolder* srcFolder, nsMsgKeyArray* srcKe
|
||||
|
||||
srcDB->GetNextPseudoMsgKey(&pseudoKey);
|
||||
pseudoKey--;
|
||||
m_dupKeyArray.SetAt(0, pseudoKey);
|
||||
m_dupKeyArray[0] = pseudoKey;
|
||||
rv = srcDB->CopyHdrFromExistingHdr(pseudoKey, srcHdr, PR_FALSE, getter_AddRefs(copySrcHdr));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user