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

@@ -386,7 +386,7 @@ nsTString_CharT::SetCharAt( char16_t aChar, uint32_t aIndex )
return false;
if (!EnsureMutable())
NS_ABORT_OOM(mLength);
AllocFailed(mLength);
mData[aIndex] = CharT(aChar);
return true;
@@ -401,7 +401,7 @@ void
nsTString_CharT::StripChars( const char* aSet )
{
if (!EnsureMutable())
NS_ABORT_OOM(mLength);
AllocFailed(mLength);
mLength = nsBufferRoutines<CharT>::strip_chars(mData, mLength, aSet);
}
@@ -421,7 +421,7 @@ void
nsTString_CharT::ReplaceChar( char_type aOldChar, char_type aNewChar )
{
if (!EnsureMutable()) // XXX do this lazily?
NS_ABORT_OOM(mLength);
AllocFailed(mLength);
for (uint32_t i=0; i<mLength; ++i)
{
@@ -434,7 +434,7 @@ void
nsTString_CharT::ReplaceChar( const char* aSet, char_type aNewChar )
{
if (!EnsureMutable()) // XXX do this lazily?
NS_ABORT_OOM(mLength);
AllocFailed(mLength);
char_type* data = mData;
uint32_t lenRemaining = mLength;