Closed
Bug 1008444
Opened 11 years ago
Closed 11 years ago
nsTArray::IndexOf now returns size_t instead of uint32_t
Categories
(MailNews Core :: Backend, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
Thunderbird 32.0
People
(Reporter: jcranmer, Assigned: jcranmer)
Details
Attachments
(1 file, 1 obsolete file)
22.42 KB,
patch
|
neil
:
review+
|
Details | Diff | Splinter Review |
*grumble grumble*
Patch edited by grepping for IndexOf and fixing everyone.
Note that nsCOMArray still returns int32_t. lovely... :-(
Attachment #8420396 -
Flags: review?(neil)
Assignee | ||
Comment 1•11 years ago
|
||
Note: 'twould be helpful if I uploaded the right patch.
Attachment #8420396 -
Attachment is obsolete: true
Attachment #8420396 -
Flags: review?(neil)
Attachment #8420397 -
Flags: review?(neil)
Comment 2•11 years ago
|
||
Comment on attachment 8420397 [details] [diff] [review]
Fix code
>+ size_t sortIndex = m_sortColumns.IndexOf(newSort, 0);
>+ if (sortIndex != m_sortColumns.NoIndex)
>+ m_sortColumns.RemoveElementAt(sortIndex);
[m_sortColumns.RemoveElement(newSort); perhaps?]
>- int32_t index = mListeners.IndexOf(aListener);
>- NS_ASSERTION(index != -1, "removing non-existent listener");
>- if (index != -1)
>+ size_t index = mListeners.IndexOf(aListener);
>+ MOZ_ASSERT(index != size_t(-1), "removing non-existent listener");
>+ if (index != size_t(-1))
Only use MOZ_ASSERT if you really really want to crash because there isn't anything else you can do. In particular, don't MOZ_ASSERT if you're going to do something about it anyway, and try not to MOZ_ASSERT just because some addon screwed up. r=me only if you switch these all back to NS_ASSERTION.
[This should probably be using Contains and RemoveElement too.]
>+ size_t index = mListeners.IndexOf(aListener);
>+ MOZ_ASSERT(index == size_t(-1), "tried to add duplicate listener");
>+ if (index == size_t(-1))
[Contains etc.]
>- int32_t index = mStateListeners.IndexOf(aStateListener);
>- if (index == -1)
>+ size_t index = mStateListeners.IndexOf(aStateListener);
>+ if (index == size_t(-1))
> return NS_ERROR_FAILURE;
>
> return mStateListeners.RemoveElement(aStateListener) ? NS_OK : NS_ERROR_FAILURE;
[Weird; RemoveElement already does a IndexOf check of course.]
Attachment #8420397 -
Flags: review?(neil) → review+
Assignee | ||
Comment 3•11 years ago
|
||
Pushed with the changes requested (the code that tested for NS_ASSERTION I didn't convert to Contains, but I did convert the RemoveElement ones).
https://hg.mozilla.org/comm-central/rev/27968692278f
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 32.0
Assignee | ||
Updated•10 years ago
|
Flags: in-testsuite-
You need to log in
before you can comment on or make changes to this bug.
Description
•