From 45171d7daff19064e38ecfc8a189aa0c4d9e4d1b Mon Sep 17 00:00:00 2001 From: "bratell%lysator.liu.se" Date: Thu, 28 Sep 2000 05:32:52 +0000 Subject: [PATCH] Fix for bug 54016 - crash when indentation wider then wrap width. The fix was to check for that condition. r=akkana@netscape.com, a=vidur@netscape.com --- htmlparser/src/nsHTMLToTXTSinkStream.cpp | 4 ++-- parser/htmlparser/src/nsHTMLToTXTSinkStream.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htmlparser/src/nsHTMLToTXTSinkStream.cpp b/htmlparser/src/nsHTMLToTXTSinkStream.cpp index 05b43ce56f0..3ad9072040e 100644 --- a/htmlparser/src/nsHTMLToTXTSinkStream.cpp +++ b/htmlparser/src/nsHTMLToTXTSinkStream.cpp @@ -1233,7 +1233,7 @@ nsHTMLToTXTSinkStream::AddToLine(const PRUnichar * aLineFragment, PRInt32 aLineF } // fallback if the line breaker is unavailable or failed if (nsnull == mLineBreaker || NS_FAILED(result)) { - goodSpace = mWrapColumn-prefixwidth; + goodSpace=(prefixwidth>mWrapColumn)?1:mWrapColumn-prefixwidth; while (goodSpace >= 0 && !nsCRT::IsAsciiSpace(mCurrentLine.CharAt(goodSpace))) { goodSpace--; @@ -1244,7 +1244,7 @@ nsHTMLToTXTSinkStream::AddToLine(const PRUnichar * aLineFragment, PRInt32 aLineF if(goodSpace<0) { // If we don't found a good place to break, accept long line and // try to find another place to break - goodSpace=mWrapColumn-prefixwidth+1; + goodSpace=(prefixwidth>mWrapColumn+1)?1:mWrapColumn-prefixwidth+1; result = NS_OK; if (nsnull != mLineBreaker) { result = mLineBreaker->Next(mCurrentLine.GetUnicode(), mCurrentLine.Length(), goodSpace, diff --git a/parser/htmlparser/src/nsHTMLToTXTSinkStream.cpp b/parser/htmlparser/src/nsHTMLToTXTSinkStream.cpp index 05b43ce56f0..3ad9072040e 100644 --- a/parser/htmlparser/src/nsHTMLToTXTSinkStream.cpp +++ b/parser/htmlparser/src/nsHTMLToTXTSinkStream.cpp @@ -1233,7 +1233,7 @@ nsHTMLToTXTSinkStream::AddToLine(const PRUnichar * aLineFragment, PRInt32 aLineF } // fallback if the line breaker is unavailable or failed if (nsnull == mLineBreaker || NS_FAILED(result)) { - goodSpace = mWrapColumn-prefixwidth; + goodSpace=(prefixwidth>mWrapColumn)?1:mWrapColumn-prefixwidth; while (goodSpace >= 0 && !nsCRT::IsAsciiSpace(mCurrentLine.CharAt(goodSpace))) { goodSpace--; @@ -1244,7 +1244,7 @@ nsHTMLToTXTSinkStream::AddToLine(const PRUnichar * aLineFragment, PRInt32 aLineF if(goodSpace<0) { // If we don't found a good place to break, accept long line and // try to find another place to break - goodSpace=mWrapColumn-prefixwidth+1; + goodSpace=(prefixwidth>mWrapColumn+1)?1:mWrapColumn-prefixwidth+1; result = NS_OK; if (nsnull != mLineBreaker) { result = mLineBreaker->Next(mCurrentLine.GetUnicode(), mCurrentLine.Length(), goodSpace,