summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-10-21 15:53:34 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-10-22 12:42:07 +0200
commit4347b5975283ca1a591b6c3d4559ed360e187022 (patch)
treed607931cc2143988fe344f32b8f311bcf4f3ef51 /sw
parentb55fda6d9eb83460382c0da74eb5cd3a3d03cd7f (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 'sw')
-rw-r--r--sw/qa/extras/globalfilter/globalfilter.cxx3
-rw-r--r--sw/source/core/bastyp/calc.cxx2
-rw-r--r--sw/source/core/frmedt/feshview.cxx3
-rw-r--r--sw/source/core/layout/trvlfrm.cxx3
-rw-r--r--sw/source/core/text/txtfrm.cxx4
-rw-r--r--sw/source/filter/ww8/writerwordglue.cxx6
-rw-r--r--sw/source/uibase/app/appopt.cxx4
7 files changed, 9 insertions, 16 deletions
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx
index 5c935a97ac56..f9a6a60df823 100644
--- a/sw/qa/extras/globalfilter/globalfilter.cxx
+++ b/sw/qa/extras/globalfilter/globalfilter.cxx
@@ -287,8 +287,7 @@ static uno::Reference<drawing::XShape> lcl_getShape(const uno::Reference<lang::X
{
Graphic aGraphic(xGraphic);
- if ((bEmbedded && aGraphic.getOriginURL().isEmpty()) ||
- (!bEmbedded && !aGraphic.getOriginURL().isEmpty()))
+ if (bEmbedded == aGraphic.getOriginURL().isEmpty())
{
xShape.set(xShapeProperties, uno::UNO_QUERY);
return xShape;
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index 050bf145d995..06e22ce090de 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -859,7 +859,7 @@ SwSbxValue SwCalc::Term()
GetToken();
bool bR = Prim().GetBool();
bool bL = left.GetBool();
- left.PutBool( (bL && !bR) || (!bL && bR) );
+ left.PutBool(bL != bR);
}
break;
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 8d2888ee166e..1a85c3aec296 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -1393,8 +1393,7 @@ bool SwFEShell::ShouldObjectBeSelected(const Point& rPt)
{
const SwPosition& rPos = pContact->GetContentAnchor();
bool bInHdrFtr = GetDoc()->IsInHeaderFooter( rPos.nNode );
- if ( ( IsHeaderFooterEdit() && !bInHdrFtr ) ||
- ( !IsHeaderFooterEdit() && bInHdrFtr ) )
+ if (IsHeaderFooterEdit() != bInHdrFtr)
{
bRet = false;
}
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index 8ca24da7f0ae..5a5da9abc580 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -67,8 +67,7 @@ namespace {
const SvxOpaqueItem& rOpaque = pAnchoredObj->GetFrameFormat().GetOpaque();
bool bInBackground = ( rSurround.GetSurround() == css::text::WrapTextMode_THROUGH ) && !rOpaque.GetValue();
- bool bBackgroundMatches = ( bInBackground && bSearchBackground ) ||
- ( !bInBackground && !bSearchBackground );
+ bool bBackgroundMatches = bInBackground == bSearchBackground;
const SwFlyFrame* pFly = pObj ? pObj->GetFlyFrame() : nullptr;
if ( pFly && bBackgroundMatches &&
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index fb3504d86da8..b6b51c9c713b 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -501,9 +501,7 @@ long SwTextFrame::SwitchVerticalToHorizontal( long nLimit ) const
SwFrameSwapper::SwFrameSwapper( const SwTextFrame* pTextFrame, bool bSwapIfNotSwapped )
: pFrame( pTextFrame ), bUndo( false )
{
- if ( pFrame->IsVertical() &&
- ( ( bSwapIfNotSwapped && ! pFrame->IsSwapped() ) ||
- ( ! bSwapIfNotSwapped && pFrame->IsSwapped() ) ) )
+ if (pFrame->IsVertical() && bSwapIfNotSwapped != pFrame->IsSwapped())
{
bUndo = true;
const_cast<SwTextFrame*>(pFrame)->SwapWidthAndHeight();
diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx
index c34e9f6e3e06..b803a43a1329 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -433,8 +433,7 @@ namespace sw
{
// Check top only if both object have a header or if
// both object don't have a header
- if ( ( HasHeader() && rOther.HasHeader() ) ||
- ( !HasHeader() && !rOther.HasHeader() ) )
+ if (HasHeader() == rOther.HasHeader())
{
if (dyaTop != rOther.dyaTop)
return false;
@@ -442,8 +441,7 @@ namespace sw
// Check bottom only if both object have a footer or if
// both object don't have a footer
- if ( ( HasFooter() && rOther.HasFooter() ) ||
- ( !HasFooter() && !rOther.HasFooter() ) )
+ if (HasFooter() == rOther.HasFooter())
{
if (dyaBottom != rOther.dyaBottom)
return false;
diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx
index 17bf33292a4c..2da5febfa372 100644
--- a/sw/source/uibase/app/appopt.cxx
+++ b/sw/source/uibase/app/appopt.cxx
@@ -86,9 +86,9 @@ std::unique_ptr<SfxItemSet> SwModule::CreateItemSet( sal_uInt16 nId )
pAppView = nullptr;
if(pAppView)
{
- // if Text then no WebView and vice versa
bool bWebView = dynamic_cast<SwWebView*>( pAppView ) != nullptr;
- if( (bWebView && !bTextDialog) ||(!bWebView && bTextDialog))
+ // if Text then no WebView and vice versa
+ if (bWebView != bTextDialog)
{
aViewOpt = *pAppView->GetWrtShell().GetViewOptions();
}