tdf#120703 PVS: V547 Expression 'bRet' is always true
Change-Id: I637ba12d0c1b7baa8f7f4be456e6101594eb934a
Reviewed-on: https://gerrit.libreoffice.org/63227
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index 1dda19b..584b74c 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -172,7 +172,6 @@
bool SwPageFrame::GetCursorOfst( SwPosition *pPos, Point &rPoint,
SwCursorMoveState* pCMS, bool bTestBackground ) const
{
bool bRet = false;
Point aPoint( rPoint );
// check, if we have to adjust the point
@@ -184,9 +183,7 @@
aPoint.setY( std::min( aPoint.Y(), getFrameArea().Bottom() ) );
}
bool bTextRet = false;
bool bBackRet = false;
bool bRet = false;
//Could it be a free flying one?
//If his content should be protected, we can't set the Cursor in it, thus
//all changes should be impossible.
@@ -203,11 +200,7 @@
//We fix the StartPoint if no Content below the page 'answers' and then
//start all over again one page before the current one.
//However we can't use Flys in such a case.
if ( SwLayoutFrame::GetCursorOfst( &aTextPos, aPoint, pCMS ) )
{
bTextRet = true;
}
else
if (!SwLayoutFrame::GetCursorOfst(&aTextPos, aPoint, pCMS))
{
if ( pCMS && (pCMS->m_bStop || pCMS->m_bExactOnly) )
{
@@ -220,6 +213,8 @@
if ( pCMS && pCMS->m_bStop )
return false;
bool bTextRet = false;
OSL_ENSURE( pCnt, "Cursor is gone to a Black hole" );
if( pCMS && pCMS->m_pFill && pCnt->IsTextFrame() )
bTextRet = pCnt->GetCursorOfst( &aTextPos, rPoint, pCMS );
@@ -239,7 +234,6 @@
assert(pCnt->IsNoTextFrame());
aTextPos = SwPosition( *static_cast<SwNoTextFrame const*>(pCnt)->GetNode() );
}
bTextRet = true;
}
}
@@ -258,23 +252,22 @@
}
}
bool bBackRet = false;
// Check objects in the background if nothing else matched
if ( GetSortedObjs() )
{
bBackRet = lcl_GetCursorOfst_Objects( this, true, &aBackPos, rPoint, pCMS );
}
if ( ( bConsiderBackground && bTestBackground && bBackRet ) || !bTextRet )
if (bConsiderBackground && bTestBackground && bBackRet)
{
bRet = bBackRet;
(*pPos) = aBackPos;
}
else if (bTextRet && !bBackRet)
else if (!bBackRet)
{
bRet = bTextRet;
(*pPos) = aTextPos;
}
else
else // bBackRet && !(bConsiderBackground && bTestBackground)
{
/* In order to provide a selection as accurate as possible when we have both
* text and background object, then we compute the distance between both
@@ -349,21 +342,17 @@
if ( bValidTextDistance && bValidBackDistance && basegfx::fTools::more( nTextDistance, nBackDistance ) )
{
bRet = bBackRet;
(*pPos) = aBackPos;
}
else
{
bRet = bTextRet;
(*pPos) = aTextPos;
}
}
}
if ( bRet )
rPoint = aPoint;
return bRet;
rPoint = aPoint;
return true;
}
bool SwLayoutFrame::FillSelection( SwSelectionList& rList, const SwRect& rRect ) const