Closed Bug 454103 Opened 16 years ago Closed 16 years ago

Make nsIMsgCompFields's attachments an nsISimpleEnumerator

Categories

(MailNews Core :: Composition, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 3.0a3

People

(Reporter: jminta, Assigned: jminta)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch patch v1 (obsolete) (deleted) — Splinter Review
This is me trying to force myself to pick up a bit more c++. This switches nsIMsgCompField's attachmentsArray property to be an nsISimpleEnumerator, instead of an nsISupportsArray. It also switches the internal m_attachments to be a nsCOMArray.
Attachment #337329 - Flags: superreview?(neil)
Attachment #337329 - Flags: review?(neil)
Comment on attachment 337329 [details] [diff] [review]
patch v1

>+      var attachments = msgCompFields.attachments;
>+      var hasAttachments = false;
You could write var hasAttachments = attachments.hasMoreElements();
Or you could write
if (attachments.hasMoreElements()){ChangeAttachmentBucketVisibility(false);}

>-  return m_attachments->InsertElementAt(attachment, attachmentCount);
>+  return m_attachments.AppendObject(attachment);
InsertElementAt returns an nsresult. AppendObject returns a PRBool.

>+  for (PRInt32 i = 0; i < attachmentCount; i ++)
>+    m_attachments.RemoveObjectAt(0);
Strangely nobody bothered to use the Clear() method. Now's your big chance!

>-  nsCOMPtr<nsISupportsArray>  m_attachments;
>+  nsCOMArray<nsIMsgAttachment>  m_attachments;
Nit: don't need two spaces here.

>+    attachmentCount++;
We don't actually care.
Attachment #337329 - Flags: superreview?(neil)
Attachment #337329 - Flags: review?(neil)
Attachment #337329 - Flags: review-
Attached patch patch v2 (deleted) — Splinter Review
Updated to review comments.
Assignee: nobody → jminta
Attachment #337329 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #337341 - Flags: superreview?(neil)
Attachment #337341 - Flags: review?(neil)
Comment on attachment 337341 [details] [diff] [review]
patch v2

>+      if(attachments.hasMoreElements())
Nit.
Attachment #337341 - Flags: superreview?(neil)
Attachment #337341 - Flags: superreview+
Attachment #337341 - Flags: review?(neil)
Attachment #337341 - Flags: review+
Nit picked, and "patch v2" push as 362:8240c87b0dab
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 3.0b1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: