Closed Bug 1340845 Opened 7 years ago Closed 7 years ago

convert nsIArray.QueryElementAt() to do_QueryElementAt() in mailnews

Categories

(MailNews Core :: Backend, defect)

defect
Not set
trivial

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: aceman, Assigned: aceman)

References

Details

Attachments

(1 file)

Convert some nsIArray.QueryElementAt() occurrences to do_QueryElementAt() in mailnews C++ code. The new helper is shorter and retrieves the interface class automatically.

The pattern:
-  nsCOMPtr<nsIMsgSearchTerm> term;
-  nsresult rv = m_termList->QueryElementAt(termIndex, NS_GET_IID(nsIMsgSearchTerm),
-                                           (void **)getter_AddRefs(term));
+  nsresult rv;
+  nsCOMPtr<nsIMsgSearchTerm> term = do_QueryElementAt(m_termList, termIndex, &rv);
Comment on attachment 8838903 [details] [diff] [review]
patch

Review of attachment 8838903 [details] [diff] [review]:
-----------------------------------------------------------------

LGTM
Attachment #8838903 - Flags: review?(rkent) → review+
Thanks.
Keywords: checkin-needed
Whiteboard: [apply on top of bug 1340835]
https://hg.mozilla.org/comm-central/rev/56f686a5c3c0da25c08d6542149bbe66eafca5c3
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Whiteboard: [apply on top of bug 1340835]
Just for the record:
https://hg.mozilla.org/comm-central/rev/56f686a5c3c0da25c08d6542149bbe66eafca5c3#l17.12

-  nsCOMPtr<nsINntpIncomingServer> nntpServer;
-  rv = server->QueryInterface(NS_GET_IID(nsINntpIncomingServer),
-                              getter_AddRefs(nntpServer));
+  nsCOMPtr<nsINntpIncomingServer> nntpServer = do_QueryInterface(server, &rv);

There are heaps more just like this one:
http://searchfox.org/comm-central/search?q=-%3EQueryInterface&case=false&regexp=false&path=
for example
http://searchfox.org/comm-central/source/mailnews/compose/src/nsMsgComposeService.cpp#958

Care to do another clean-up run?
Blocks: 1342003
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: