Closed
Bug 838805
Opened 12 years ago
Closed 12 years ago
remove some small occurrences of nsISupportsArray in mailnews
Categories
(MailNews Core :: Backend, defect)
MailNews Core
Backend
Tracking
(Not tracked)
RESOLVED
FIXED
Thunderbird 23.0
People
(Reporter: aceman, Assigned: aceman)
References
Details
Attachments
(1 file, 6 obsolete files)
(deleted),
patch
|
aceman
:
review+
|
Details | Diff | Splinter Review |
Convert these to nsCOMArray (or something else):
mailnews/local/src/nsLocalMailFolder.cpp::mDownloadMessages
mailnews/base/src/nsMsgSearchDBView.cpp::m_hdrsForEachFolder
Remove now unneeded 'interface nsISupportsArray;' from nsIMsgFolder.idl.
Some files inherited the definitions without including nsISupportsArray.h so I add them where needed now.
Status: NEW → ASSIGNED
Summary: remove some occurrences of nsISupportsArray in mailnews → remove some small occurrences of nsISupportsArray in mailnews
I am not sure what the nsISupportsArray.clone() usages were supposed to do and if the conversion to AppendElements is enough for them.
Attachment #710940 -
Flags: feedback?(neil)
Comment 2•12 years ago
|
||
Comment on attachment 710940 [details] [diff] [review]
WIP patch
> newMsgDBView->m_folders.InsertObjectsAt(m_folders, 0);
m_folders is an nsCOMArray so you see how it works (although feel free to use AppendObjects/AppendElements instead).
>+ // ACE: is this still needed? There is no other use of m_copyListenerList...
I agree, it looks unused.
Attachment #710940 -
Flags: feedback?(neil) → feedback+
Attachment #710940 -
Attachment is obsolete: true
Attachment #711570 -
Flags: review?(neil)
Comment 4•12 years ago
|
||
Comment on attachment 711570 [details] [diff] [review]
patch v2
> // now copy all of our private member data
> newMsgDBView->mDestFolder = mDestFolder;
> newMsgDBView->mCommand = mCommand;
> newMsgDBView->mTotalIndices = mTotalIndices;
> newMsgDBView->mCurIndex = mCurIndex;
> newMsgDBView->m_folders.InsertObjectsAt(m_folders, 0);
> newMsgDBView->m_curCustomColumn = m_curCustomColumn;
>
Nit: don't need this blank line any more.
>+ m_hdrsForEachFolder.InsertObjectsAt(newMsgDBView->m_hdrsForEachFolder, 0);
Still the wrong way around, compare m_folders above and m_uniqueFoldersSelected below!
>
> newMsgDBView->m_uniqueFoldersSelected.InsertObjectsAt(m_uniqueFoldersSelected, 0);
[The blank line here can probably go too.]
> nsMsgSearchDBView::GetFoldersAndHdrsForSelection(nsMsgViewIndex *indices, int32_t numIndices)
[Wow, this method is lame. It loops through all of the selected messages and establishes an array of unique folders. It then loops through the array again once for each folder, extracting those messages that are from that folder... After this lands, I might submit a rewrite.]
Attachment #711570 -
Attachment is obsolete: true
Attachment #711570 -
Flags: review?(neil)
Attachment #729285 -
Flags: review?(neil)
Comment 6•12 years ago
|
||
Comment on attachment 729285 [details] [diff] [review]
patch v3
>- nsCOMPtr<nsISupports> child;
>+ nsCOMPtr<nsIMsgFolder> child;
> rv = enumerator->GetNext(getter_AddRefs(child));
I consider it a bug that this actually compiles :-( You need to GetNext into an nsISupports, then do_QueryInterface into the nsIMsgFolder.
Attachment #729285 -
Flags: review?(neil) → review-
Attachment #729285 -
Attachment is obsolete: true
Attachment #729826 -
Flags: review?(neil)
Comment 8•12 years ago
|
||
Comment on attachment 729826 [details] [diff] [review]
patch v4
>- nsCOMPtr<nsISupports> child;
>- rv = enumerator->GetNext(getter_AddRefs(child));
>+ nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(item, &rv));
>+ rv = enumerator->GetNext(getter_AddRefs(folder));
Didn't I say GetNext comes first, then do_QueryInterface? (And you can keep the existing child variable.)
Sorry, what a thinko :)
Why should I keep 'child'? I tried to reuse the existing variable 'item'.
Assignee | ||
Comment 10•12 years ago
|
||
Attachment #729826 -
Attachment is obsolete: true
Attachment #729826 -
Flags: review?(neil)
Attachment #730287 -
Flags: review?(neil)
Comment 11•12 years ago
|
||
(In reply to aceman from comment #9)
> Why should I keep 'child'? I tried to reuse the existing variable 'item'.
Depends on your point of view; 'child' looks like it's the existing variable compared to the code before the patch, but 'item' is "existing" compared to the code after the original patch.
Assignee | ||
Comment 12•12 years ago
|
||
OK, I merged child and item and moved the new declaration above them so it can be shared. So what to do now?
Assignee | ||
Comment 13•12 years ago
|
||
Attachment #730287 -
Attachment is obsolete: true
Attachment #730287 -
Flags: review?(neil)
Attachment #731369 -
Flags: review?(neil)
Comment 15•12 years ago
|
||
Comment on attachment 731369 [details] [diff] [review]
patch v6
[Sorry for the delay; bugmail backlog.]
I'm not entirely convinced about merging those two variables, as one is child folders while the other is messages and it might confuse someone later on.
The hasNext merger isn't so bad, but IMHO you should have kept the short name.
Attachment #731369 -
Flags: review?(neil) → review+
Flags: needinfo?(neil)
Assignee | ||
Comment 16•12 years ago
|
||
(In reply to neil@parkwaycc.co.uk from comment #15)
> I'm not entirely convinced about merging those two variables, as one is
> child folders while the other is messages and it might confuse someone later
> on.
I merged it based on the variable type. Semantically, in this case of nsISupports, it is not a folder or a message (but a generic enumerator item) until you queryInterface it to one of those. And that object then has a separate variable with proper name.
Assignee | ||
Comment 17•12 years ago
|
||
Fixed the hasMore variable name.
Attachment #731369 -
Attachment is obsolete: true
Attachment #732898 -
Flags: review+
Keywords: checkin-needed
Comment 18•12 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 23.0
You need to log in
before you can comment on or make changes to this bug.
Description
•