Bug 969864 - Make nsTArray::SetLength return void; r=froydnj

This commit is contained in:
Ehsan Akhgari 2014-02-19 08:27:15 -05:00
parent 6ff96ec5c2
commit ad09f563e0
2 changed files with 5 additions and 4 deletions

View File

@ -262,7 +262,8 @@ nsCOMArray_base::SetCount(int32_t aNewCount)
int32_t count = mArray.Length();
if (count > aNewCount)
RemoveObjectsAt(aNewCount, mArray.Length() - aNewCount);
return mArray.SetLength(aNewCount);
mArray.SetLength(aNewCount);
return true;
}
size_t

View File

@ -1388,14 +1388,14 @@ public:
// @return True if the operation succeeded; false otherwise.
// See also TruncateLength if the new length is guaranteed to be
// smaller than the old.
bool SetLength(size_type newLen) {
typename Alloc::ResultType SetLength(size_type newLen) {
size_type oldLen = Length();
if (newLen > oldLen) {
return InsertElementsAt(oldLen, newLen - oldLen) != nullptr;
return Alloc::ConvertBoolToResultType(InsertElementsAt(oldLen, newLen - oldLen) != nullptr);
}
TruncateLength(newLen);
return true;
return Alloc::ConvertBoolToResultType(true);
}
// This method modifies the length of the array, but may only be