Closed Bug 186729 Opened 22 years ago Closed 16 years ago

mailbox service NewURI should use callqueryinterface

Categories

(MailNews Core :: Networking, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.9

People

(Reporter: timeless, Assigned: Bienvenu)

References

()

Details

Attachments

(1 file, 4 obsolete files)

from reading the netwerk impls, it looks like this could use CallQueryInterface.
Attached patch callqueryinterface (obsolete) — Splinter Review
Attachment #110933 - Attachment is obsolete: true
Comment on attachment 111143 [details] [diff] [review]
fix tabs, early returns, correct PR_...free calls, 

requesting review on behalf of timeless
Attachment #111143 - Flags: review?(dmose)
Comment on attachment 111143 [details] [diff] [review]
fix tabs, early returns, correct PR_...free calls, 

whatever conflicts may exist are resolved in my tree at home. i'm traveling
until mid january, please review based on the changes in the patch, i'll
address any concerns before i commit.
Attachment #111143 - Flags: review?(dmose) → review?(bienvenu)
Product: MailNews → Core
From my reading of the code, we need to check both the source and dest of CallQueryInterface parameters, because it only does null checks in debug mode
Assignee: timeless → bienvenu
Attachment #111143 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #321265 - Flags: superreview?(neil)
Attachment #111143 - Flags: review?(bienvenu)
Comment on attachment 321265 [details] [diff] [review]
salvage unbitrotted parts of patch

>-  if (NS_SUCCEEDED(rv) && mailboxurl)
>+  if (NS_SUCCEEDED(rv) && aURL)
I think you still want to null-check mailboxurl rather than aURL - aURL is contracted not to be null (although I think QueryInterface checks anyway).

>-    rv = mailboxurl->QueryInterface(NS_GET_IID(nsIURI), (void **) aURL);
>+    CallQueryInterface(mailboxurl, aURL);
Isn't this supposed to have rv = ?
Attached patch patch addressing comments (obsolete) — Splinter Review
you're right about rv, and needing to check mailboxurl. But I think QueryInterface doesn't check the output parameter (it asserts, but I think in release mode it would crash), so I added an NS_ENSURE_ARG_POINTER
Attachment #321265 - Attachment is obsolete: true
Attachment #321516 - Flags: superreview?(neil)
Attachment #321265 - Flags: superreview?(neil)
Comment on attachment 321516 [details] [diff] [review]
patch addressing comments

>+    nsCAutoString temp = NS_LITERAL_CSTRING("mailbox://") + buf;
I don't think this is external API safe... might want to do this separately?

>+  if (mailboxurl && aURL)
>   if (aURL && mailboxurl)
>+  if (aURL && mailboxurl)
Some consistency would look nice ;-)
Attachment #321516 - Flags: superreview?(neil) → superreview+
I went ahead and tweaked the string stuff so that it should work with external linkage, and made the if aURL and mailboxurl checks consistent. Carrying forward the review flags...
Attachment #321516 - Attachment is obsolete: true
Attachment #322149 - Flags: superreview+
Attachment #322149 - Flags: review+
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
OS: Windows 2000 → All
QA Contact: grylchan → mailnews.networking
Hardware: PC → All
Target Milestone: --- → mozilla1.9
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: