Kaydet (Commit) 5294e631 authored tarafından Matteo Casalin's avatar Matteo Casalin

Use std::min + rename Ende to End

Change-Id: I835d661a5bd30c235fdf61a94ad73f85b57bf9ed
üst 485331b1
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
#include <fldbas.hxx> #include <fldbas.hxx>
#include <ftninfo.hxx> #include <ftninfo.hxx>
#include <algorithm>
/* /*
* This file contains all output functions of the ASCII-Writer; * This file contains all output functions of the ASCII-Writer;
* For all nodes, attributes, formats and chars. * For all nodes, attributes, formats and chars.
...@@ -175,11 +177,11 @@ static Writer& OutASC_SwTxtNode( Writer& rWrt, SwCntntNode& rNode ) ...@@ -175,11 +177,11 @@ static Writer& OutASC_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
const SwTxtNode& rNd = (SwTxtNode&)rNode; const SwTxtNode& rNd = (SwTxtNode&)rNode;
sal_Int32 nStrPos = rWrt.pCurPam->GetPoint()->nContent.GetIndex(); sal_Int32 nStrPos = rWrt.pCurPam->GetPoint()->nContent.GetIndex();
const sal_Int32 nNodeEnde = rNd.Len(); const sal_Int32 nNodeEnd = rNd.Len();
sal_Int32 nEnde = nNodeEnde; sal_Int32 nEnd = nNodeEnd;
bool bLastNd = rWrt.pCurPam->GetPoint()->nNode == rWrt.pCurPam->GetMark()->nNode; bool bLastNd = rWrt.pCurPam->GetPoint()->nNode == rWrt.pCurPam->GetMark()->nNode;
if( bLastNd ) if( bLastNd )
nEnde = rWrt.pCurPam->GetMark()->nContent.GetIndex(); nEnd = rWrt.pCurPam->GetMark()->nContent.GetIndex();
SwASC_AttrIter aAttrIter( (SwASCWriter&)rWrt, rNd, nStrPos ); SwASC_AttrIter aAttrIter( (SwASCWriter&)rWrt, rNd, nStrPos );
...@@ -201,10 +203,7 @@ static Writer& OutASC_SwTxtNode( Writer& rWrt, SwCntntNode& rNode ) ...@@ -201,10 +203,7 @@ static Writer& OutASC_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
RTL_TEXTENCODING_UTF8 == rWrt.GetAsciiOptions().GetCharSet(); RTL_TEXTENCODING_UTF8 == rWrt.GetAsciiOptions().GetCharSet();
do { do {
sal_Int32 nNextAttr = aAttrIter.WhereNext(); const sal_Int32 nNextAttr = std::min(aAttrIter.WhereNext(), nEnd);
if( nNextAttr > nEnde )
nNextAttr = nEnde;
if( !aAttrIter.OutAttr( nStrPos )) if( !aAttrIter.OutAttr( nStrPos ))
{ {
...@@ -216,11 +215,11 @@ static Writer& OutASC_SwTxtNode( Writer& rWrt, SwCntntNode& rNode ) ...@@ -216,11 +215,11 @@ static Writer& OutASC_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
} }
nStrPos = nNextAttr; nStrPos = nNextAttr;
aAttrIter.NextPos(); aAttrIter.NextPos();
} while( nStrPos < nEnde ); } while( nStrPos < nEnd );
if( !bLastNd || if( !bLastNd ||
( ( !rWrt.bWriteClipboardDoc && !rWrt.bASCII_NoLastLineEnd ) ( ( !rWrt.bWriteClipboardDoc && !rWrt.bASCII_NoLastLineEnd )
&& !nStrPos && nEnde == nNodeEnde ) ) && !nStrPos && nEnd == nNodeEnd ) )
rWrt.Strm().WriteUnicodeOrByteText( ((SwASCWriter&)rWrt).GetLineEnd()); rWrt.Strm().WriteUnicodeOrByteText( ((SwASCWriter&)rWrt).GetLineEnd());
return rWrt; return rWrt;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment