coverity#1130421 Improper use of negative value
Change-Id: Iefdd854cb0348b187b95f4a89d52482381c73dfc
This commit is contained in:
parent
391cb2a6c5
commit
01c28e33bf
@ -664,22 +664,23 @@ void CutLines( OUString& rStr, sal_Int32 nStartLine, sal_Int32 nLines, bool bEra
|
|||||||
|
|
||||||
DBG_ASSERTWARNING( nStartPos != -1, "CutLines: Startzeile nicht gefunden!" );
|
DBG_ASSERTWARNING( nStartPos != -1, "CutLines: Startzeile nicht gefunden!" );
|
||||||
|
|
||||||
if ( nStartPos != -1 )
|
if ( nStartPos == -1 )
|
||||||
{
|
return;
|
||||||
sal_Int32 nEndPos = nStartPos;
|
|
||||||
|
|
||||||
for ( sal_Int32 i = 0; i < nLines; i++ )
|
sal_Int32 nEndPos = nStartPos;
|
||||||
nEndPos = searchEOL( rStr, nEndPos+1 );
|
|
||||||
|
|
||||||
if ( nEndPos == -1 ) // might happen at the last line
|
for ( sal_Int32 i = 0; i < nLines; i++ )
|
||||||
nEndPos = rStr.getLength();
|
nEndPos = searchEOL( rStr, nEndPos+1 );
|
||||||
else
|
|
||||||
nEndPos++;
|
if ( nEndPos == -1 ) // might happen at the last line
|
||||||
|
nEndPos = rStr.getLength();
|
||||||
|
else
|
||||||
|
nEndPos++;
|
||||||
|
|
||||||
|
OUString aEndStr = rStr.copy( nEndPos );
|
||||||
|
rStr = rStr.copy( 0, nStartPos );
|
||||||
|
rStr += aEndStr;
|
||||||
|
|
||||||
OUString aEndStr = rStr.copy( nEndPos );
|
|
||||||
rStr = rStr.copy( 0, nStartPos );
|
|
||||||
rStr += aEndStr;
|
|
||||||
}
|
|
||||||
if ( bEraseTrailingEmptyLines )
|
if ( bEraseTrailingEmptyLines )
|
||||||
{
|
{
|
||||||
sal_Int32 n = nStartPos;
|
sal_Int32 n = nStartPos;
|
||||||
@ -692,7 +693,7 @@ void CutLines( OUString& rStr, sal_Int32 nStartLine, sal_Int32 nLines, bool bEra
|
|||||||
|
|
||||||
if ( n > nStartPos )
|
if ( n > nStartPos )
|
||||||
{
|
{
|
||||||
OUString aEndStr = rStr.copy( n );
|
aEndStr = rStr.copy( n );
|
||||||
rStr = rStr.copy( 0, nStartPos );
|
rStr = rStr.copy( 0, nStartPos );
|
||||||
rStr += aEndStr;
|
rStr += aEndStr;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user