Bug 221826 only create stack objects in Cut if they'll be used

r=dbaron sr=dbaron


git-svn-id: svn://10.0.0.236/trunk@147901 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
timeless%mozdev.org
2003-10-12 23:28:31 +00:00
parent fb4ab3fab4
commit c3b35c37e9

View File

@@ -444,10 +444,12 @@ nsAString::Cut( index_type cutStart, size_type cutLength )
cutLength = NS_MIN(cutLength, myLength-cutStart);
index_type cutEnd = cutStart + cutLength;
const_iterator fromBegin, fromEnd;
iterator toBegin;
if ( cutEnd < myLength )
copy_string(this->BeginReading(fromBegin).advance(PRInt32(cutEnd)), this->EndReading(fromEnd), BeginWriting(toBegin).advance(PRInt32(cutStart)));
{
const_iterator fromBegin, fromEnd;
iterator toBegin;
copy_string(this->BeginReading(fromBegin).advance(PRInt32(cutEnd)), this->EndReading(fromEnd), BeginWriting(toBegin).advance(PRInt32(cutStart)));
}
SetLength(myLength-cutLength);
}
@@ -941,10 +943,12 @@ nsACString::Cut( index_type cutStart, size_type cutLength )
cutLength = NS_MIN(cutLength, myLength-cutStart);
index_type cutEnd = cutStart + cutLength;
const_iterator fromBegin, fromEnd;
iterator toBegin;
if ( cutEnd < myLength )
copy_string(this->BeginReading(fromBegin).advance(PRInt32(cutEnd)), this->EndReading(fromEnd), BeginWriting(toBegin).advance(PRInt32(cutStart)));
{
const_iterator fromBegin, fromEnd;
iterator toBegin;
copy_string(this->BeginReading(fromBegin).advance(PRInt32(cutEnd)), this->EndReading(fromEnd), BeginWriting(toBegin).advance(PRInt32(cutStart)));
}
SetLength(myLength-cutLength);
}