78727,86998: Fix a hang with rewrap introduced by the string API conversion. r=sspitzer, sr=sfraser

This commit is contained in:
akkana%netscape.com 2001-07-10 00:40:11 +00:00
parent 1bc78bfc1a
commit a05d3e3c8e
2 changed files with 4 additions and 10 deletions

View File

@ -78,7 +78,6 @@ nsInternetCiter::QueryInterface(REFNSIID aIID, void** aInstancePtr)
NS_IMETHODIMP
nsInternetCiter::GetCiteString(const nsAReadableString& aInString, nsAWritableString& aOutString)
{
PRInt32 i = 0;
aOutString.SetLength(0);
PRUnichar uch = nl;
@ -131,8 +130,6 @@ nsInternetCiter::StripCitesAndLinebreaks(const nsAReadableString& aInString,
nsReadingIterator <PRUnichar> beginIter,endIter;
aInString.BeginReading(beginIter);
aInString.EndReading(endIter);
PRInt32 length = aInString.Length();
PRInt32 i = 0;
while (beginIter!= endIter) // loop over lines
{
// Clear out cites first, at the beginning of the line:
@ -233,12 +230,12 @@ nsInternetCiter::Rewrap(const nsAReadableString& aInString,
// Special case: if this is a blank line, maintain a blank line
// (retain the original paragraph breaks)
if (tString[posInString] == nl)
if (tString[posInString] == nl && aOutString.Length() > 0)
{
nsReadingIterator <PRUnichar> outPeekIter;
aOutString.EndReading(outPeekIter);
outPeekIter.advance(-1);
if (aOutString.Length() > 0 && (*outPeekIter) != nl)
if ((*outPeekIter) != nl)
aOutString.Append(nl);
AddCite(aOutString, newCiteLevel);
aOutString.Append(nl);

View File

@ -78,7 +78,6 @@ nsInternetCiter::QueryInterface(REFNSIID aIID, void** aInstancePtr)
NS_IMETHODIMP
nsInternetCiter::GetCiteString(const nsAReadableString& aInString, nsAWritableString& aOutString)
{
PRInt32 i = 0;
aOutString.SetLength(0);
PRUnichar uch = nl;
@ -131,8 +130,6 @@ nsInternetCiter::StripCitesAndLinebreaks(const nsAReadableString& aInString,
nsReadingIterator <PRUnichar> beginIter,endIter;
aInString.BeginReading(beginIter);
aInString.EndReading(endIter);
PRInt32 length = aInString.Length();
PRInt32 i = 0;
while (beginIter!= endIter) // loop over lines
{
// Clear out cites first, at the beginning of the line:
@ -233,12 +230,12 @@ nsInternetCiter::Rewrap(const nsAReadableString& aInString,
// Special case: if this is a blank line, maintain a blank line
// (retain the original paragraph breaks)
if (tString[posInString] == nl)
if (tString[posInString] == nl && aOutString.Length() > 0)
{
nsReadingIterator <PRUnichar> outPeekIter;
aOutString.EndReading(outPeekIter);
outPeekIter.advance(-1);
if (aOutString.Length() > 0 && (*outPeekIter) != nl)
if ((*outPeekIter) != nl)
aOutString.Append(nl);
AddCite(aOutString, newCiteLevel);
aOutString.Append(nl);