chart2/source/tools/AxisHelper.cxx | 2 - cui/source/tabpages/autocdlg.cxx | 4 +-- dbaccess/source/ui/app/AppController.cxx | 2 - editeng/source/accessibility/AccessibleEditableTextPara.cxx | 14 +++--------- sc/source/core/data/attarray.cxx | 2 - sc/source/core/tool/address.cxx | 13 ++++++----- slideshow/source/engine/animatedsprite.cxx | 2 - svtools/source/brwbox/brwbox2.cxx | 2 - svx/source/accessibility/AccessibleShape.cxx | 2 - svx/source/xoutdev/_xoutbmp.cxx | 2 - sw/source/core/access/accmap.cxx | 2 - sw/source/core/access/accpara.cxx | 6 ++--- sw/source/core/edit/autofmt.cxx | 4 +-- vcl/source/bitmap/bitmap.cxx | 6 ++--- 14 files changed, 29 insertions(+), 34 deletions(-)
New commits: commit 6b67f867cca1cb62ca045b60635f6da0a347c4f2 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Sun Nov 11 18:04:43 2018 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Sun Nov 11 19:38:25 2018 +0100 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.kagan...@collabora.com> diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index 733d716bd945..0a1091a579c1 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -720,7 +720,7 @@ Reference< beans::XPropertySet > AxisHelper::getGridProperties( 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 03aa790d0f9d..c491d265253c 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -95,8 +95,8 @@ OfaAutoCorrDlg::OfaAutoCorrDlg(vcl::Window* pParent, const SfxItemSet* _pSet ) { // 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 0958cda048e8..0915c666c0fa 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -571,7 +571,7 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const 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 8023887dcfb0..b42e895f67e0 100644 --- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx +++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx @@ -926,14 +926,10 @@ namespace accessibility 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 @@ namespace accessibility 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 24e782bb8d39..ed59c0c5a451 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -520,7 +520,7 @@ void ScAttrArray::SetPatternArea(SCROW nStartRow, SCROW nEndRow, const ScPattern 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 730e7de022a9..abb057647be3 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -793,14 +793,14 @@ static ScRefFlags lcl_ScRange_Parse_XL_R1C1( ScRange& r, 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 @@ static ScRefFlags lcl_ScRange_Parse_XL_R1C1( ScRange& r, { // 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 @@ static ScRefFlags lcl_ScRange_Parse_XL_R1C1( ScRange& r, 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 @@ static ScRefFlags lcl_ScRange_Parse_XL_R1C1( ScRange& r, 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 2c1870119bcd..46379897168a 100644 --- a/slideshow/source/engine/animatedsprite.cxx +++ b/slideshow/source/engine/animatedsprite.cxx @@ -136,7 +136,7 @@ namespace slideshow "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 3ffcc8e227d6..54e1afd405bd 100644 --- a/svx/source/accessibility/AccessibleShape.cxx +++ b/svx/source/accessibility/AccessibleShape.cxx @@ -164,7 +164,7 @@ void AccessibleShape::Init() 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 640d7bb356f0..116ad8f8e614 100644 --- a/svx/source/xoutdev/_xoutbmp.cxx +++ b/svx/source/xoutdev/_xoutbmp.cxx @@ -330,7 +330,7 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName, 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 a2df42b565a2..6c690e631a31 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -3144,7 +3144,7 @@ bool SwAccessibleMap::ReplaceChild ( 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 8015d832d3f5..d3f49f370487 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -1408,7 +1408,7 @@ OUString SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex) 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 @@ OUString SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex) 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 2328bf1fe205..37865d7c9a98 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -2417,7 +2417,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFormatFlags const & BuildTextIndent(); eStat = READ_NEXT_PARA; } - else if( nLevel && pNxtNd && !m_bEnd && + else if( nLevel && pNxtNd && !bNxtEmpty && !bNxtAlpha && !nNxtLevel && !IsEnumericChar( *pNxtNd ) ) { @@ -2443,7 +2443,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFormatFlags const & 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 6e6d27ce7506..7a9b025e906d 100644 --- a/vcl/source/bitmap/bitmap.cxx +++ b/vcl/source/bitmap/bitmap.cxx @@ -459,14 +459,14 @@ bool Bitmap::CopyPixel( const tools::Rectangle& rRectDst, { 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; commit b7f022234589c84ddb8566ddf7d91701eba55d3d Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Sun Nov 11 18:09:21 2018 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Sun Nov 11 19:38:11 2018 +0100 tdf#120703 PVS: V560 A part of conditional expression is always true This changes the condition to only select row if it's not selected yet; previously, because of the always-true condition or'ed, SelectRow was always executed. Change-Id: Id12b640518f3d72810e997735216db336d79f7f6 Reviewed-on: https://gerrit.libreoffice.org/63267 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx index c9ba487b91e0..4280c0818332 100644 --- a/svtools/source/brwbox/brwbox2.cxx +++ b/svtools/source/brwbox/brwbox2.cxx @@ -453,7 +453,7 @@ void BrowseBox::ExpandRowSelection( const BrowserMouseEvent& rEvt ) } } else - if ( !bMultiSelection || !IsRowSelected( rEvt.GetRow() ) ) + if (!IsRowSelected(rEvt.GetRow())) SelectRow( rEvt.GetRow() ); GoToRow( rEvt.GetRow(), false ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits