Bug 1097283: Fix count/byte mismatches in NS_ABORT_OOM calls. r=froydnj

This commit is contained in:
David Major
2014-11-12 21:13:44 +13:00
parent b3f8716d59
commit d85f8b5439
7 changed files with 40 additions and 26 deletions

View File

@@ -263,7 +263,7 @@ void
nsTSubstring_CharT::Assign(char_type aChar)
{
if (!ReplacePrep(0, mLength, 1)) {
NS_ABORT_OOM(mLength);
AllocFailed(mLength);
}
*mData = aChar;
@@ -284,7 +284,7 @@ void
nsTSubstring_CharT::Assign(const char_type* aData)
{
if (!Assign(aData, size_type(-1), fallible_t())) {
NS_ABORT_OOM(char_traits::length(aData));
AllocFailed(char_traits::length(aData));
}
}
@@ -292,8 +292,8 @@ void
nsTSubstring_CharT::Assign(const char_type* aData, size_type aLength)
{
if (!Assign(aData, aLength, fallible_t())) {
NS_ABORT_OOM(aLength == size_type(-1) ? char_traits::length(aData)
: aLength);
AllocFailed(aLength == size_type(-1) ? char_traits::length(aData)
: aLength);
}
}
@@ -326,7 +326,7 @@ void
nsTSubstring_CharT::AssignASCII(const char* aData, size_type aLength)
{
if (!AssignASCII(aData, aLength, fallible_t())) {
NS_ABORT_OOM(aLength);
AllocFailed(aLength);
}
}
@@ -363,7 +363,7 @@ void
nsTSubstring_CharT::Assign(const self_type& aStr)
{
if (!Assign(aStr, fallible_t())) {
NS_ABORT_OOM(aStr.Length());
AllocFailed(aStr.Length());
}
}
@@ -413,7 +413,7 @@ void
nsTSubstring_CharT::Assign(const substring_tuple_type& aTuple)
{
if (!Assign(aTuple, fallible_t())) {
NS_ABORT_OOM(aTuple.Length());
AllocFailed(aTuple.Length());
}
}
@@ -505,7 +505,7 @@ nsTSubstring_CharT::Replace(index_type aCutStart, size_type aCutLength,
{
if (!Replace(aCutStart, aCutLength, aData, aLength,
mozilla::fallible_t())) {
NS_ABORT_OOM(Length() - aCutLength + 1);
AllocFailed(Length() - aCutLength + 1);
}
}
@@ -603,7 +603,7 @@ void
nsTSubstring_CharT::SetCapacity(size_type aCapacity)
{
if (!SetCapacity(aCapacity, fallible_t())) {
NS_ABORT_OOM(aCapacity);
AllocFailed(aCapacity);
}
}
@@ -784,7 +784,7 @@ nsTSubstring_CharT::StripChar(char_type aChar, int32_t aOffset)
}
if (!EnsureMutable()) { // XXX do this lazily?
NS_ABORT_OOM(mLength);
AllocFailed(mLength);
}
// XXX(darin): this code should defer writing until necessary.
@@ -811,7 +811,7 @@ nsTSubstring_CharT::StripChars(const char_type* aChars, uint32_t aOffset)
}
if (!EnsureMutable()) { // XXX do this lazily?
NS_ABORT_OOM(mLength);
AllocFailed(mLength);
}
// XXX(darin): this code should defer writing until necessary.