tdf#120703 PVS: V560 A part of conditional expression is always true/false
Change-Id: Id7af9a6eaefc8b49a790eb299620c4fa97067a11
Reviewed-on: https://gerrit.libreoffice.org/64429
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index 42c6721..f1bc5f8 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -1838,7 +1838,7 @@
++aCursor.GetIndex();
}
if(nTextLen && aBreakPositions.empty())
if (aBreakPositions.empty())
{
//if all content has been overwritten the attributes may have been removed, too
svx::SpellPortion aPortion1;
diff --git a/editeng/source/misc/splwrap.cxx b/editeng/source/misc/splwrap.cxx
index 1a4e856..33328dd 100644
--- a/editeng/source/misc/splwrap.cxx
+++ b/editeng/source/misc/splwrap.cxx
@@ -159,8 +159,8 @@
bOtherCntnt ( bOther ),
bHyphen ( false ),
bReverse ( false ),
bStartDone ( bOther || ( !bReverse && bStart ) ),
bEndDone ( bReverse && bStart && !bOther ),
bStartDone ( bOther || bStart ),
bEndDone ( false ),
bStartChk ( bOther ),
bRevAllowed ( false ),
bAllRight ( true )
diff --git a/framework/source/services/substitutepathvars.cxx b/framework/source/services/substitutepathvars.cxx
index afa8364..13dc847 100644
--- a/framework/source/services/substitutepathvars.cxx
+++ b/framework/source/services/substitutepathvars.cxx
@@ -345,7 +345,7 @@
// Is there something to replace ?
bool bWorkRetrieved = false;
bool bWorkDirURLRetrieved = false;
while ( !bSubstitutionCompleted && nDepth < nMaxRecursiveDepth )
while (nDepth < nMaxRecursiveDepth)
{
while ( ( nPosition != -1 ) && ( nLength > 3 ) ) // "$(" ")"
{
diff --git a/sd/source/core/stlfamily.cxx b/sd/source/core/stlfamily.cxx
index 54680db..62eab7b 100644
--- a/sd/source/core/stlfamily.cxx
+++ b/sd/source/core/stlfamily.cxx
@@ -148,7 +148,7 @@
{
// we assume that we have only SdStyleSheets
SdStyleSheet* pSdStyle = static_cast< SdStyleSheet* >( pStyle );
if( pSdStyle && pSdStyle->GetApiName() == rName)
if (pSdStyle->GetApiName() == rName)
{
pRet = pSdStyle;
break;
diff --git a/svx/source/dialog/svxbmpnumvalueset.cxx b/svx/source/dialog/svxbmpnumvalueset.cxx
index 5b6df74..017bc1d 100644
--- a/svx/source/dialog/svxbmpnumvalueset.cxx
+++ b/svx/source/dialog/svxbmpnumvalueset.cxx
@@ -259,7 +259,7 @@
sal_Int32 nLevelCount = xLevel->getCount();
if(nLevelCount > 5)
nLevelCount = 5;
for( sal_Int32 i = 0; i < nLevelCount && i < 5; i++)
for( sal_Int32 i = 0; i < nLevelCount; i++)
{
long nTop = nStartY + nRectHeight * (aLinesArr[2 * i + 11])/100 ;
Point aLeft(nStartX + nRectWidth * (aLinesArr[2 * i + 10])/ 100, nTop );
@@ -634,7 +634,7 @@
sal_Int32 nLevelCount = xLevel->getCount();
if(nLevelCount > 5)
nLevelCount = 5;
for( sal_Int32 i = 0; i < nLevelCount && i < 5; i++)
for( sal_Int32 i = 0; i < nLevelCount; i++)
{
long nTop = nStartY + nRectHeight * (aLinesArr[2 * i + 11])/100 ;
Point aLeft(nStartX + nRectWidth * (aLinesArr[2 * i + 10])/ 100, nTop );
diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx
index a3b20b8..71c1aab 100644
--- a/svx/source/svdraw/svdedtv.cxx
+++ b/svx/source/svdraw/svdedtv.cxx
@@ -384,7 +384,7 @@
if (m_bMoveProtect) return false;
if (b90Deg) return m_bMirror90Allowed;
if (b45Deg) return m_bMirror45Allowed;
return m_bMirrorFreeAllowed && !m_bMoveProtect;
return m_bMirrorFreeAllowed;
}
bool SdrEditView::IsTransparenceAllowed() const
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 66a409c..0e7ca53 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -1476,7 +1476,8 @@
pTEObj->EndTextEdit(*pTEOutliner);
if( (pTEObj->GetRotateAngle() != 0) || (pTEObj && dynamic_cast<const SdrTextObj*>( pTEObj) != nullptr && pTEObj->IsFontwork()) )
if ((pTEObj->GetRotateAngle() != 0)
|| (dynamic_cast<const SdrTextObj*>(pTEObj) != nullptr && pTEObj->IsFontwork()))
{
pTEObj->ActionChanged();
}
@@ -1492,7 +1493,7 @@
// check deletion of entire TextObj
std::unique_ptr<SdrUndoAction> pDelUndo;
bool bDelObj=false;
if (pTEObj!=nullptr && bTextEditNewObj)
if (bTextEditNewObj)
{
bDelObj=pTEObj->IsTextFrame() &&
!pTEObj->HasText() &&
@@ -1702,7 +1703,8 @@
if( pOLV )
{
vcl::Window* pWin=pOLV->GetWindow();
if (pText!=nullptr && pText->IsTextFrame() && pOLV!=nullptr && pWin!=nullptr) {
if (pText != nullptr && pText->IsTextFrame() && pWin != nullptr)
{
sal_uInt16 nPixSiz=pOLV->GetInvalidateMore();
tools::Rectangle aEditArea(aMinTextEditArea);
aEditArea.Union(pOLV->GetOutputArea());
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 8a55f973..46c93e9 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -650,7 +650,6 @@
if(nullptr != mpMarkedObj)
{
bSingleTextObjMark =
mpMarkedObj &&
dynamic_cast<const SdrTextObj*>( mpMarkedObj) != nullptr &&
static_cast<SdrTextObj*>(mpMarkedObj)->IsTextFrame();
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index c0cebde..bcc4f10 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -370,7 +370,7 @@
{
const bool bMirror = bool( nTransformFlags & SdrGrafObjTransformsAttrs::MIRROR );
const bool bRotate = bool( nTransformFlags & SdrGrafObjTransformsAttrs::ROTATE ) &&
( aGeo.nRotationAngle && aGeo.nRotationAngle != 18000 ) && ( GraphicType::NONE != eType );
(aGeo.nRotationAngle && aGeo.nRotationAngle != 18000);
// Need cropping info earlier
const_cast<SdrGrafObj*>(this)->ImpSetAttrToGrafInfo();
diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx
index cc44db3..cf14585 100644
--- a/svx/source/svdraw/svdomeas.cxx
+++ b/svx/source/svdraw/svdomeas.cxx
@@ -244,7 +244,7 @@
rInfo.bCanConvToPoly =true;
rInfo.bCanConvToPathLineToArea=false;
rInfo.bCanConvToPolyLineToArea=false;
rInfo.bCanConvToContour = (rInfo.bCanConvToPoly || LineGeometryUsageIsNecessary());
rInfo.bCanConvToContour = LineGeometryUsageIsNecessary();
}
sal_uInt16 SdrMeasureObj::GetObjIdentifier() const
diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx
index b800c7a..5a69a8b 100644
--- a/svx/source/table/svdotable.cxx
+++ b/svx/source/table/svdotable.cxx
@@ -584,7 +584,7 @@
const OUString sSize( "Size" );
if( mbHorizontal )
{
if( (nEdge >= 0) && (nEdge <= getRowCount()) )
if (nEdge <= getRowCount())
{
sal_Int32 nHeight = mpLayouter->getRowHeight( (!nEdge)?nEdge:(nEdge-1) );
if(nEdge==0)
@@ -606,7 +606,7 @@
In LTR table dragging of edge 0(for RTL table edge N) does nothing.
*/
//Todo: Implement Dragging functionality for leftmost edge of table.
if( (nEdge >= 0) && (nEdge <= getColumnCount()) )
if (nEdge <= getColumnCount())
{
const bool bRTL = mpTableObj != nullptr && (mpTableObj->GetWritingMode() == WritingMode_RL_TB);
sal_Int32 nWidth;
@@ -633,18 +633,14 @@
/* To prevent the table resizing on edge dragging */
if( nEdge > 0 && nEdge < mxTable->getColumnCount() )
{
if( bRTL )
nEdge--;
if( (bRTL && (nEdge >= 0)) || (!bRTL && (nEdge < mxTable->getColumnCount())) )
{
nWidth = mpLayouter->getColumnWidth( nEdge );
nWidth = std::max( static_cast<sal_Int32>(nWidth - nOffset), sal_Int32(0) );
nWidth = mpLayouter->getColumnWidth(nEdge);
nWidth = std::max(static_cast<sal_Int32>(nWidth - nOffset), sal_Int32(0));
Reference< XPropertySet > xColSet( xCols->getByIndex( nEdge ), UNO_QUERY_THROW );
xColSet->setPropertyValue( sSize, Any( nWidth ) );
}
Reference<XPropertySet> xColSet(xCols->getByIndex(nEdge), UNO_QUERY_THROW);
xColSet->setPropertyValue(sSize, Any(nWidth));
}
}
}
@@ -1999,8 +1995,8 @@
bool SdrTableObj::IsVerticalWriting() const
{
const SvxWritingModeItem* pModeItem = &GetObjectItem( SDRATTR_TEXTDIRECTION );
return pModeItem && pModeItem->GetValue() == css::text::WritingMode_TB_RL;
const SvxWritingModeItem& rModeItem = GetObjectItem( SDRATTR_TEXTDIRECTION );
return rModeItem.GetValue() == css::text::WritingMode_TB_RL;
}
diff --git a/sw/source/core/docnode/swbaslnk.cxx b/sw/source/core/docnode/swbaslnk.cxx
index c3ded67..bce6076 100644
--- a/sw/source/core/docnode/swbaslnk.cxx
+++ b/sw/source/core/docnode/swbaslnk.cxx
@@ -173,7 +173,7 @@
if ( !bUpdate || bFrameInPaint )
return SUCCESS;
if (bUpdate && pSwGrfNode)
if (pSwGrfNode)
{
if (!SetGrfFlySize(aGrfSz, pSwGrfNode, aOldSz))
{
@@ -236,11 +236,8 @@
// the table rows
const SwDoc *pDoc = pGrfNd->GetDoc();
const SwPosition* pAPos = pFormat->GetAnchor().GetContentAnchor();
SwNode *pANd;
SwTableNode *pTableNd;
if( pAPos &&
nullptr != (pANd = & pAPos->nNode.GetNode()) &&
nullptr != (pTableNd = pANd->FindTableNode()) )
if (pAPos && nullptr != (pTableNd = pAPos->nNode.GetNode().FindTableNode()))
{
const bool bLastGrf = !pTableNd->GetTable().DecGrfsThatResize();
SwHTMLTableLayout *pLayout =
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index c612bf3..9c370a5 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -3327,7 +3327,7 @@
if( bSmart )
{
bSttWrd = rShell.IsStartWord();
if( bSmart && !bSttWrd && (bInWrd || bEndWrd) )
if (!bSttWrd && (bInWrd || bEndWrd))
rShell.SwEditShell::Insert(' ');
}
}
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index b00c0d0..4fd9890 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -1872,9 +1872,6 @@
nResize = 64;
nPos = 0;
if( nResize != 0 && nResize < 16 )
nResize = 16;
ResetError();
std::size_t nInitSize = 512;