Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Commit

Permalink
Bug 556303: Fix unsigned/signed compiler warning in nsTArray.cpp. r=b…
Browse files Browse the repository at this point in the history
…smedberg
  • Loading branch information
dholbert committed Apr 5, 2010
1 parent 7776a80 commit ad4ba21
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion xpcom/glue/nsTArray.cpp
Expand Up @@ -85,7 +85,9 @@ nsTArray_base::EnsureCapacity(size_type capacity, size_type elemSize) {
}

// Use doubling algorithm when forced to increase available capacity.
capacity = PR_MAX(capacity, mHdr->mCapacity << 1);
// (Note that mCapacity is only 31 bits wide, so multiplication promotes its
// type. We use |2u| instead of |2| to make sure it's promoted to unsigned.)
capacity = PR_MAX(capacity, mHdr->mCapacity * 2u);

Header *header;
if (UsesAutoArrayBuffer()) {
Expand Down

0 comments on commit ad4ba21

Please sign in to comment.