Closed Bug 838805 Opened 9 years ago Closed 9 years ago
remove some small occurrences of ns
ISupports Array in mailnews
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 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+
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.]
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-
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'.
(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.
OK, I merged child and item and moved the new declaration above them so it can be shared. So what to do now?
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+
(In reply to email@example.com 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.
Fixed the hasMore variable name.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 23.0
You need to log in before you can comment on or make changes to this bug.