Closed Bug 628716 Opened 10 years ago Closed 10 years ago

Remove m_numReferences from nsMsgHdr


(MailNews Core :: Database, defect)

Not set


(Not tracked)

Thunderbird 3.3a3


(Reporter: standard8, Assigned: neil)


(Keywords: memory-footprint)


(1 file)

Per bug 628094 we believe that m_numReferences is no longer required as a separate variable, m_references.Length() should just be able to be used instead.

Assigning to Neil as he said he'd do a patch for this if we're interested, which we are ;-)
Severity: normal → minor
Depends on: 628094
Version: unspecified → Trunk
No longer depends on: 628094
Attached patch Proposed patchSplinter Review
Comparing a PRInt32 and a PRUint16 does a signed comparison (a PRInt32 can contain the range of a PRUint16 so there's no ambiguity). Now the old nsCStringArray bounds-checked its index, which meant that calling GetStringReference(-1) returned an empty string (by comparison calling GetStringReference(32767) throws). The TArray version doesn't, which means that the code currently in the tree will crash if you try to get the -1th reference. Simply changing the comparison to .Length(), which is now a PRUint32, generates a signed/unsigned comparison warning, for good reason! The cast is designed so that passing in -1 results in 4294967295 and thus fails the comparison.

Alternatively I could change the API to use PRUint32 throughout but we have PRInt32 descending loop indices which are a pain to convert to PRUint32.
Attachment #507086 - Flags: review?(bienvenu)
Comment on attachment 507086 [details] [diff] [review]
Proposed patch

looks good, thx.
Attachment #507086 - Flags: review?(bienvenu) → review+
Pushed changeset c33788adf0ab to comm-central.
Closed: 10 years ago
Resolution: --- → FIXED
Flags: in-testsuite-
Target Milestone: --- → Thunderbird 3.3a3
You need to log in before you can comment on or make changes to this bug.