Bug 757960 - GCC 4.6.3 build warnings in nsNavHistoryResult.cpp for unsigned >= 0 (or < 0) always returning the same value [-Wtype-limits] r=mak

This commit is contained in:
David Zbarsky 2012-07-11 00:14:49 -07:00
parent 68ea4f962a
commit 89f14406ab

View File

@ -692,7 +692,9 @@ nsNavHistoryContainerResultNode::ReverseUpdateStats(PRInt32 aAccessCountChange)
if ((sortingByVisitCount && aAccessCountChange != 0) ||
(sortingByTime && timeChanged)) {
PRUint32 ourIndex = mParent->FindChild(this);
EnsureItemPosition(ourIndex);
NS_ASSERTION(ourIndex >= 0, "Could not find self in parent");
if (ourIndex >= 0)
EnsureItemPosition(ourIndex);
}
nsresult rv = mParent->ReverseUpdateStats(aAccessCountChange);
@ -1457,8 +1459,8 @@ nsNavHistoryContainerResultNode::InsertSortedChild(
*/
bool
nsNavHistoryContainerResultNode::EnsureItemPosition(PRUint32 aIndex) {
NS_ASSERTION(aIndex >= 0 && aIndex < (PRUint32)mChildren.Count(), "Invalid index");
if (aIndex < 0 || aIndex >= (PRUint32)mChildren.Count())
NS_ASSERTION(aIndex < (PRUint32)mChildren.Count(), "Invalid index");
if (aIndex >= (PRUint32)mChildren.Count())
return false;
SortComparator comparator = GetSortingComparator(GetSortType());
@ -3887,7 +3889,9 @@ nsNavHistoryResultNode::OnItemChanged(PRInt64 aItemId,
// The sorting methods fall back to each other so we need to re-sort the
// result even if it's not set to sort by the given property.
PRInt32 ourIndex = mParent->FindChild(this);
mParent->EnsureItemPosition(ourIndex);
NS_ASSERTION(ourIndex >= 0, "Could not find self in parent");
if (ourIndex >= 0)
mParent->EnsureItemPosition(ourIndex);
return NS_OK;
}
@ -4025,7 +4029,8 @@ nsNavHistoryFolderResultNode::OnItemMoved(PRInt64 aItemId,
node->mBookmarkIndex = aNewIndex;
// adjust position
EnsureItemPosition(index);
if (index >= 0)
EnsureItemPosition(index);
return NS_OK;
} else {
// moving between two different folders, just do a remove and an add