tdf#120703 PVS: V560 A part of conditional expression is always true/false
Change-Id: I1027242192dfd2be4918094d59f2a8f8c8fec041
Reviewed-on: https://gerrit.libreoffice.org/63266
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx
index 733d716..0a1091a 100644
--- a/chart2/source/tools/AxisHelper.cxx
+++ b/chart2/source/tools/AxisHelper.cxx
@@ -720,7 +720,7 @@
else
{
Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() );
if( nSubGridIndex >= 0 && nSubGridIndex < aSubGrids.getLength() )
if (nSubGridIndex < aSubGrids.getLength())
xRet.set( aSubGrids[nSubGridIndex] );
}
}
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index 03aa790..c491d26 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -95,8 +95,8 @@
{
// remove smart tag tab page if no extensions are installed
SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
SvxSwAutoFormatFlags *pOpt = &pAutoCorrect->GetSwFlags();
if ( !pOpt || !pOpt->pSmartTagMgr || 0 == pOpt->pSmartTagMgr->NumberOfRecognizers() )
SvxSwAutoFormatFlags& rOpt = pAutoCorrect->GetSwFlags();
if (!rOpt.pSmartTagMgr || 0 == rOpt.pSmartTagMgr->NumberOfRecognizers())
RemoveTabPage("smarttags");
RemoveTabPage("options");
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index 0958cda..0915c666c 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -571,7 +571,7 @@
break;
case ID_BROWSER_CUT:
aReturn.bEnabled = !isDataSourceReadOnly() && getContainer()->getSelectionCount() >= 1;
aReturn.bEnabled = aReturn.bEnabled && ( !(ID_BROWSER_CUT == _nId && getContainer()->getElementType() == E_TABLE) || getContainer()->isCutAllowed() );
aReturn.bEnabled = aReturn.bEnabled && (getContainer()->getElementType() != E_TABLE || getContainer()->isCutAllowed());
break;
case ID_BROWSER_PASTE:
switch( getContainer()->getElementType() )
diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
index 8023887..b42e895 100644
--- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx
+++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
@@ -926,14 +926,10 @@
sal_Int32 reeBegin = ree.aPosition.nIndex + nAllFieldLen;
sal_Int32 reeEnd = reeBegin + ree.aCurrentText.getLength();
nAllFieldLen += (ree.aCurrentText.getLength() - 1);
if (reeBegin > nIndex)
{
if (nIndex < reeBegin)
break;
}
if (nIndex >= reeBegin && nIndex < reeEnd)
{
if (nIndex < reeEnd)
return GetFieldTypeNameFromField(ree);
}
}
return OUString();
}
@@ -1584,13 +1580,11 @@
reeBegin = ree.aPosition.nIndex + nAllFieldLen;
reeEnd = reeBegin + ree.aCurrentText.getLength();
nAllFieldLen += (ree.aCurrentText.getLength() - 1);
if( reeBegin > nIndex )
{
if (nIndex < reeBegin)
break;
}
if (!ree.pFieldItem)
continue;
if (nIndex >= reeBegin && nIndex < reeEnd)
if (nIndex < reeEnd)
{
if (ree.pFieldItem->GetField()->GetClassId() != text::textfield::Type::URL)
{
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 24e782b..ed59c0c 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -520,7 +520,7 @@
ni++;
nInsert = ni;
}
else if ( ni > 0 && mvData[ni-1].nEndRow == nStartRow - 1 )
else if (mvData[ni - 1].nEndRow == nStartRow - 1)
nInsert = ni;
}
if ( ni > 0 && mvData[ni-1].pPattern == pPattern )
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index 730e7de..abb0576 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -793,14 +793,14 @@
applyStartToEndFlags(nFlags);
r.aEnd.SetRow( r.aStart.Row() );
}
else
else // pTmp != nullptr
{
// Full row range successfully parsed.
applyStartToEndFlags(nFlags, nFlags2);
p = pTmp;
}
if (p && p[0] != 0)
if (p[0] != 0)
{
// any trailing invalid character must invalidate the whole address.
nFlags &= ~ScRefFlags(ScRefFlags::VALID | ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID |
@@ -829,7 +829,7 @@
{
// single cell reference
if (p && p[0] != 0)
if (p[0] != 0)
{
// any trailing invalid character must invalidate the whole address.
nFlags &= ~ScRefFlags(ScRefFlags::VALID | ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID);
@@ -838,11 +838,12 @@
return bOnlyAcceptSingle ? nFlags : ScRefFlags::ZERO;
}
assert(pTmp);
p = pTmp;
// double reference
if (p && p[0] != 0)
if (p[0] != 0)
{
// any trailing invalid character must invalidate the whole range.
nFlags &= ~ScRefFlags(ScRefFlags::VALID | ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID |
@@ -864,13 +865,13 @@
applyStartToEndFlags(nFlags);
r.aEnd.SetCol( r.aStart.Col() );
}
else
else // pTmp != nullptr
{
applyStartToEndFlags(nFlags, nFlags2);
p = pTmp;
}
if (p && p[0] != 0)
if (p[0] != 0)
{
// any trailing invalid character must invalidate the whole address.
nFlags &= ~ScRefFlags(ScRefFlags::VALID | ScRefFlags::COL_VALID | ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID |
diff --git a/slideshow/source/engine/animatedsprite.cxx b/slideshow/source/engine/animatedsprite.cxx
index 2c18701..4637989 100644
--- a/slideshow/source/engine/animatedsprite.cxx
+++ b/slideshow/source/engine/animatedsprite.cxx
@@ -136,7 +136,7 @@
"AnimatedSprite::resize(): Could not create new sprite" );
// set attributes similar to previous sprite
if( mpSprite && mbSpriteVisible )
if (mbSpriteVisible)
{
mpSprite->show();
mpSprite->setAlpha( mnAlpha );
diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx
index 3ffcc8e..54e1afd 100644
--- a/svx/source/accessibility/AccessibleShape.cxx
+++ b/svx/source/accessibility/AccessibleShape.cxx
@@ -164,7 +164,7 @@
bool bOwnParaObj = pOutlinerParaObject != nullptr;
if( !pOutlinerParaObject && pSdrObject )
if (!pOutlinerParaObject)
pOutlinerParaObject = pSdrObject->GetOutlinerParaObject();
// create AccessibleTextHelper to handle this shape's text
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index 640d7bb3..116ad8f 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -330,7 +330,7 @@
aGraphic = MirrorGraphic( aGraphic, nBmpMirrorFlags );
}
if( ( GRFILTER_FORMAT_NOTFOUND != nFilter ) && ( aGraphic.GetType() != GraphicType::NONE ) )
if (aGraphic.GetType() != GraphicType::NONE)
{
if( !(nFlags & XOutFlags::DontAddExtension) )
aURL.setExtension( aExt );
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index a2df42b..6c690e6 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -3144,7 +3144,7 @@
if(pAccShape && ::accessibility::ShapeTypeHandler::Instance().GetTypeId (pAccShape->GetXShape()) == ::accessibility::DRAWING_CONTROL)
{
::accessibility::AccessibleControlShape *pCtlAccShape = static_cast < ::accessibility::AccessibleControlShape* >(pAccShape);
if (pCtlAccShape && pCtlAccShape->GetControlModel() == pSet)
if (pCtlAccShape->GetControlModel() == pSet)
return pCtlAccShape;
}
++aIter;
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 8015d83..d3f49f3 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -1408,7 +1408,7 @@
strTypeName = SwFieldType::GetTypeStr(pField->GetTypeId());
const SwFieldIds nWhich = pField->GetTyp()->Which();
OUString sEntry;
sal_Int32 subType = 0;
sal_uInt32 subType = 0;
switch (nWhich)
{
case SwFieldIds::DocStat:
@@ -1511,11 +1511,11 @@
break;
default: break;
}
if (subType > 0 || (subType == 0 && (nWhich == SwFieldIds::DocInfo || nWhich == SwFieldIds::ExtUser || nWhich == SwFieldIds::DocStat)))
if (subType > 0 || nWhich == SwFieldIds::DocInfo || nWhich == SwFieldIds::ExtUser || nWhich == SwFieldIds::DocStat)
{
std::vector<OUString> aLst;
aMgr.GetSubTypes(pField->GetTypeId(), aLst);
if (static_cast<size_t>(subType) < aLst.size())
if (subType < aLst.size())
sEntry = aLst[subType];
if (sEntry.getLength() > 0)
{
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 2328bf1..37865d7 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -2417,7 +2417,7 @@
BuildTextIndent();
eStat = READ_NEXT_PARA;
}
else if( nLevel && pNxtNd && !m_bEnd &&
else if( nLevel && pNxtNd &&
!bNxtEmpty && !bNxtAlpha && !nNxtLevel &&
!IsEnumericChar( *pNxtNd ) )
{
@@ -2443,7 +2443,7 @@
BuildText();
eStat = READ_NEXT_PARA;
}
else if( !nLevel && pNxtNd && !m_bEnd &&
else if( !nLevel && pNxtNd &&
!bNxtEmpty && !bNxtAlpha && nNxtLevel &&
!IsEnumericChar( *pNxtNd ) )
{
diff --git a/vcl/source/bitmap/bitmap.cxx b/vcl/source/bitmap/bitmap.cxx
index 6e6d27c..7a9b025 100644
--- a/vcl/source/bitmap/bitmap.cxx
+++ b/vcl/source/bitmap/bitmap.cxx
@@ -459,14 +459,14 @@
{
int nNextIndex = 0;
if( ( nSrcBitCount == 24 ) && ( nDstBitCount < 24 ) )
if (nSrcBitCount == 24)
Convert( BmpConversion::N24Bit );
else if( ( nSrcBitCount == 8 ) && ( nDstBitCount < 8 ) )
else if (nSrcBitCount == 8)
{
Convert( BmpConversion::N8BitColors );
nNextIndex = 16;
}
else if( ( nSrcBitCount == 4 ) && ( nDstBitCount < 4 ) )
else if (nSrcBitCount == 4)
{
Convert( BmpConversion::N4BitColors );
nNextIndex = 2;