diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-10-21 15:53:34 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-10-22 12:42:07 +0200 |
commit | 4347b5975283ca1a591b6c3d4559ed360e187022 (patch) | |
tree | d607931cc2143988fe344f32b8f311bcf4f3ef51 /svx | |
parent | b55fda6d9eb83460382c0da74eb5cd3a3d03cd7f (diff) |
pvs-studio: V728 An excessive check can be simplified
for...
"The '(A && !B) || (!A && B)' expression is equivalent to the 'bool(A) != bool(B)' expression"
subcases, where the args are already bool
Change-Id: Ica8b5c4974c513f7f7ad8acf17ca931e85ebc8af
Reviewed-on: https://gerrit.libreoffice.org/62146
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShape2d.cxx | 4 | ||||
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShapeEngine.cxx | 4 | ||||
-rw-r--r-- | svx/source/engine3d/float3d.cxx | 24 | ||||
-rw-r--r-- | svx/source/svdraw/svdoashp.cxx | 2 | ||||
-rw-r--r-- | svx/source/table/tablelayouter.cxx | 2 |
5 files changed, 14 insertions, 22 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index 0cb389a9d488..307f5de5a364 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -1175,7 +1175,7 @@ bool EnhancedCustomShape2d::GetHandlePosition( const sal_uInt32 nIndex, Point& r if ( aGeoStat.nShearAngle ) { double nTan = aGeoStat.nTan; - if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV)) + if (bFlipV != bFlipH) nTan = -nTan; ShearPoint( rReturnPosition, Point( aLogicRect.GetWidth() / 2, aLogicRect.GetHeight() / 2 ), nTan ); } @@ -1220,7 +1220,7 @@ bool EnhancedCustomShape2d::SetHandleControllerPosition( const sal_uInt32 nIndex if ( aGeoStat.nShearAngle ) { double nTan = -aGeoStat.nTan; - if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV)) + if (bFlipV != bFlipH) nTan = -nTan; ShearPoint( aP, Point( aLogicRect.GetWidth() / 2, aLogicRect.GetHeight() / 2 ), nTan ); } diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx index aebd702737a1..55b1f7f2fa27 100644 --- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx @@ -328,7 +328,7 @@ Reference< drawing::XShape > SAL_CALL EnhancedCustomShapeEngine::render() { long nShearAngle = rGeoStat.nShearAngle; double nTan = rGeoStat.nTan; - if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV)) + if (bFlipV != bFlipH) { nShearAngle = -nShearAngle; nTan = -nTan; @@ -429,7 +429,7 @@ drawing::PolyPolygonBezierCoords SAL_CALL EnhancedCustomShapeEngine::getLineGeom { long nShearAngle = rGeoStat.nShearAngle; double nTan = rGeoStat.nTan; - if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV)) + if (bFlipV != bFlipH) { nShearAngle = -nShearAngle; nTan = -nTan; diff --git a/svx/source/engine3d/float3d.cxx b/svx/source/engine3d/float3d.cxx index 6df52ce4d8da..85df3f93938e 100644 --- a/svx/source/engine3d/float3d.cxx +++ b/svx/source/engine3d/float3d.cxx @@ -955,8 +955,7 @@ void Svx3DWin::Update( SfxItemSet const & rAttrs ) if( eState != SfxItemState::DONTCARE ) { bool bOn = rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_1).GetValue(); - if( ( bOn && !GetUILightState(*m_pBtnLight1)) || - ( !bOn && GetUILightState(*m_pBtnLight1)) ) + if (bOn != GetUILightState(*m_pBtnLight1)) { SetUILightState(*m_pBtnLight1, bOn); bUpdate = true; @@ -1004,8 +1003,7 @@ void Svx3DWin::Update( SfxItemSet const & rAttrs ) if( eState != SfxItemState::DONTCARE ) { bool bOn = rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_2).GetValue(); - if( ( bOn && !GetUILightState(*m_pBtnLight2)) || - ( !bOn && GetUILightState(*m_pBtnLight2)) ) + if (bOn != GetUILightState(*m_pBtnLight2)) { SetUILightState(*m_pBtnLight2, bOn); bUpdate = true; @@ -1053,8 +1051,7 @@ void Svx3DWin::Update( SfxItemSet const & rAttrs ) if( eState != SfxItemState::DONTCARE ) { bool bOn = rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_3).GetValue(); - if( ( bOn && !GetUILightState(*m_pBtnLight3)) || - ( !bOn && GetUILightState(*m_pBtnLight3)) ) + if (bOn != GetUILightState(*m_pBtnLight3)) { SetUILightState(*m_pBtnLight3, bOn); bUpdate = true; @@ -1102,8 +1099,7 @@ void Svx3DWin::Update( SfxItemSet const & rAttrs ) if( eState != SfxItemState::DONTCARE ) { bool bOn = rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_4).GetValue(); - if( ( bOn && !GetUILightState(*m_pBtnLight4)) || - ( !bOn && GetUILightState(*m_pBtnLight4)) ) + if (bOn != GetUILightState(*m_pBtnLight4)) { SetUILightState(*m_pBtnLight4, bOn); bUpdate = true; @@ -1151,8 +1147,7 @@ void Svx3DWin::Update( SfxItemSet const & rAttrs ) if( eState != SfxItemState::DONTCARE ) { bool bOn = rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_5).GetValue(); - if( ( bOn && !GetUILightState(*m_pBtnLight5)) || - ( !bOn && GetUILightState(*m_pBtnLight5)) ) + if (bOn != GetUILightState(*m_pBtnLight5)) { SetUILightState(*m_pBtnLight5, bOn); bUpdate = true; @@ -1200,8 +1195,7 @@ void Svx3DWin::Update( SfxItemSet const & rAttrs ) if( eState != SfxItemState::DONTCARE ) { bool bOn = rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_6).GetValue(); - if( ( bOn && !GetUILightState(*m_pBtnLight6)) || - ( !bOn && GetUILightState(*m_pBtnLight6)) ) + if (bOn != GetUILightState(*m_pBtnLight6)) { SetUILightState(*m_pBtnLight6, bOn); bUpdate = true; @@ -1249,8 +1243,7 @@ void Svx3DWin::Update( SfxItemSet const & rAttrs ) if( eState != SfxItemState::DONTCARE ) { bool bOn = rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_7).GetValue(); - if( ( bOn && !GetUILightState(*m_pBtnLight7)) || - ( !bOn && GetUILightState(*m_pBtnLight7)) ) + if (bOn != GetUILightState(*m_pBtnLight7)) { SetUILightState(*m_pBtnLight7 , bOn); bUpdate = true; @@ -1298,8 +1291,7 @@ void Svx3DWin::Update( SfxItemSet const & rAttrs ) if( eState != SfxItemState::DONTCARE ) { bool bOn = rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_8).GetValue(); - if( ( bOn && !GetUILightState(*m_pBtnLight8)) || - ( !bOn && GetUILightState(*m_pBtnLight8)) ) + if (bOn != GetUILightState(*m_pBtnLight8)) { SetUILightState(*m_pBtnLight8, bOn); bUpdate = true; diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index f1ac0921dac3..9bacffb665c7 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -1728,7 +1728,7 @@ void SdrObjCustomShape::ImpCheckCustomGluePointsAreAdded() sal_Int32 nXDiff = aBoundRect.Left() - maRect.Left(); sal_Int32 nYDiff = aBoundRect.Top() - maRect.Top(); - if (nShearAngle&&((bMirroredX&&!bMirroredY)||(bMirroredY&&!bMirroredX))) + if (nShearAngle && bMirroredX != bMirroredY) { nShearAngle = -nShearAngle; fTan = -fTan; diff --git a/svx/source/table/tablelayouter.cxx b/svx/source/table/tablelayouter.cxx index 8231eaf9f7c4..076a0f6ed40a 100644 --- a/svx/source/table/tablelayouter.cxx +++ b/svx/source/table/tablelayouter.cxx @@ -735,7 +735,7 @@ void TableLayouter::LayoutTableHeight( tools::Rectangle& rArea, bool bFit ) else { bool bCellHasText = xCell->hasText(); - if ( (!bRowHasText && !bCellHasText) || ( bRowHasText && bCellHasText ) ) + if (bRowHasText == bCellHasText) { nMinHeight = std::max( nMinHeight, xCell->getMinimumHeight() ); } |