diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-12-02 20:46:02 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-12-03 01:20:21 +0100 |
commit | eddee22b0eed069c3ee2929c9b36a9b4fb05f130 (patch) | |
tree | 6ace29c24dfc58407049cef21d6af314f7624e14 | |
parent | 6ed52ecfed5781659cd27ff9aea5d0a04be77cd1 (diff) |
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>
-rw-r--r-- | cui/source/dialogs/SpellDialog.cxx | 2 | ||||
-rw-r--r-- | editeng/source/misc/splwrap.cxx | 4 | ||||
-rw-r--r-- | framework/source/services/substitutepathvars.cxx | 2 | ||||
-rw-r--r-- | sd/source/core/stlfamily.cxx | 2 | ||||
-rw-r--r-- | svx/source/dialog/svxbmpnumvalueset.cxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdedtv.cxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/svdedxv.cxx | 8 | ||||
-rw-r--r-- | svx/source/svdraw/svdmrkv.cxx | 1 | ||||
-rw-r--r-- | svx/source/svdraw/svdograf.cxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/svdomeas.cxx | 2 | ||||
-rw-r--r-- | svx/source/table/svdotable.cxx | 20 | ||||
-rw-r--r-- | sw/source/core/docnode/swbaslnk.cxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/dochdl/swdtflvr.cxx | 2 | ||||
-rw-r--r-- | tools/source/stream/stream.cxx | 3 |
14 files changed, 26 insertions, 35 deletions
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index 42c6721b3ec8..f1bc5f8ae708 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -1838,7 +1838,7 @@ svx::SpellPortions SentenceEditWindow_Impl::CreateSpellPortions() const ++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 1a4e8568351b..33328dda8d37 100644 --- a/editeng/source/misc/splwrap.cxx +++ b/editeng/source/misc/splwrap.cxx @@ -159,8 +159,8 @@ SvxSpellWrapper::SvxSpellWrapper( vcl::Window* pWn, 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 afa83643b87a..13dc84760517 100644 --- a/framework/source/services/substitutepathvars.cxx +++ b/framework/source/services/substitutepathvars.cxx @@ -345,7 +345,7 @@ OUString SubstitutePathVariables::impl_substituteVariable( const OUString& rText // 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 54680db5d510..62eab7b25e43 100644 --- a/sd/source/core/stlfamily.cxx +++ b/sd/source/core/stlfamily.cxx @@ -148,7 +148,7 @@ SdStyleSheet* SdStyleFamily::GetSheetByName( const OUString& rName ) { // 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 5b6df74f9c68..017bc1dfb853 100644 --- a/svx/source/dialog/svxbmpnumvalueset.cxx +++ b/svx/source/dialog/svxbmpnumvalueset.cxx @@ -259,7 +259,7 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt ) 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 @@ void NumValueSet::UserDraw( const UserDrawEvent& rUDEvt ) 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 a3b20b853068..71c1aabaecfe 100644 --- a/svx/source/svdraw/svdedtv.cxx +++ b/svx/source/svdraw/svdedtv.cxx @@ -384,7 +384,7 @@ bool SdrEditView::IsMirrorAllowed(bool b45Deg, bool b90Deg) const 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 66a409c8cfae..0e7ca533bd5c 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -1476,7 +1476,8 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally) 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 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally) // 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 @@ bool SdrObjEditView::IsTextEditFrameHit(const Point& rHit) const 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 8a55f973873d..46c93e985716 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -650,7 +650,6 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell) 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 c0cebde414b5..bcc4f1098a51 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -370,7 +370,7 @@ GraphicAttr SdrGrafObj::GetGraphicAttr( SdrGrafObjTransformsAttrs nTransformFlag { 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 cc44db30d0bd..cf14585cea5f 100644 --- a/svx/source/svdraw/svdomeas.cxx +++ b/svx/source/svdraw/svdomeas.cxx @@ -244,7 +244,7 @@ void SdrMeasureObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const 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 b800c7a06181..5a69a8bf83c9 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -584,7 +584,7 @@ void SdrTableObjImpl::DragEdge( bool mbHorizontal, int nEdge, sal_Int32 nOffset 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 @@ void SdrTableObjImpl::DragEdge( bool mbHorizontal, int nEdge, sal_Int32 nOffset 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 @@ void SdrTableObjImpl::DragEdge( bool mbHorizontal, int nEdge, sal_Int32 nOffset /* 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 @@ void SdrTableObj::NbcReformatText() 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 c3ded6711d25..bce6076aa523 100644 --- a/sw/source/core/docnode/swbaslnk.cxx +++ b/sw/source/core/docnode/swbaslnk.cxx @@ -173,7 +173,7 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem ) if ( !bUpdate || bFrameInPaint ) return SUCCESS; - if (bUpdate && pSwGrfNode) + if (pSwGrfNode) { if (!SetGrfFlySize(aGrfSz, pSwGrfNode, aOldSz)) { @@ -236,11 +236,8 @@ static bool SetGrfFlySize( const Size& rGrfSz, SwGrfNode* pGrfNd, const Size& rO // 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 c612bf38e3bc..9c370a51ff8d 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -3327,7 +3327,7 @@ bool SwTransferable::PrivatePaste( SwWrtShell& rShell ) 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 b00c0d024c86..4fd9890a865b 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -1872,9 +1872,6 @@ void* SvMemoryStream::SwitchBuffer() nResize = 64; nPos = 0; - if( nResize != 0 && nResize < 16 ) - nResize = 16; - ResetError(); std::size_t nInitSize = 512; |