[Libreoffice-commits] core.git: basctl/source comphelper/source compilerplugins/clang connectivity/source cui/source extensions/source filter/source framework/source hwpfilter/source io/source jvmfwk/plugins oox/source pyuno/source registry/source sal/osl sal/rtl sax/source sc/source sd/source sfx2/source solenv/CompilerTest_compilerplugins_clang.mk starmath/source store/source svl/source svtools/source svx/source sw/source toolkit/source tools/source vcl/source vcl/unx writerfilter/source xmloff/source

Noel Grandin noel.grandin at collabora.co.uk
Thu Nov 23 05:59:59 UTC 2017


 basctl/source/basicide/brkdlg.cxx                      |    2 
 comphelper/source/misc/types.cxx                       |    2 
 compilerplugins/clang/simplifybool.cxx                 |   52 +++++++++++------
 compilerplugins/clang/test/simplifybool.cxx            |   18 +++++
 connectivity/source/drivers/odbc/OResultSet.cxx        |    2 
 cui/source/tabpages/swpossizetabpage.cxx               |    2 
 extensions/source/update/feed/updatefeed.cxx           |    2 
 filter/source/graphicfilter/icgm/class4.cxx            |    4 -
 framework/source/fwe/helper/propertysetcontainer.cxx   |    4 -
 framework/source/fwi/uielement/itemcontainer.cxx       |    2 
 framework/source/fwi/uielement/rootitemcontainer.cxx   |    2 
 framework/source/layoutmanager/uielement.cxx           |    4 -
 hwpfilter/source/hwpread.cxx                           |   28 ++++-----
 io/source/stm/odata.cxx                                |    6 -
 jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx       |    2 
 oox/source/ole/vbainputstream.cxx                      |    2 
 pyuno/source/module/pyuno_runtime.cxx                  |    2 
 registry/source/regimpl.cxx                            |    2 
 sal/osl/unx/pipe.cxx                                   |    2 
 sal/rtl/digest.cxx                                     |   18 ++---
 sal/rtl/math.cxx                                       |    2 
 sax/source/expatwrap/saxwriter.cxx                     |    2 
 sc/source/core/data/document.cxx                       |    4 -
 sc/source/core/opencl/op_database.cxx                  |    4 -
 sc/source/core/tool/charthelper.cxx                    |    2 
 sc/source/filter/excel/xiescher.cxx                    |    2 
 sc/source/filter/html/htmlpars.cxx                     |    2 
 sc/source/filter/orcus/filterdetect.cxx                |    2 
 sc/source/filter/xml/XMLStylesExportHelper.cxx         |    6 -
 sc/source/ui/view/tabview.cxx                          |    2 
 sc/source/ui/view/viewdata.cxx                         |   12 +--
 sd/source/ui/dlg/sdtreelb.cxx                          |    2 
 sd/source/ui/presenter/PresenterTextView.cxx           |    2 
 sfx2/source/dialog/templdlg.cxx                        |    2 
 sfx2/source/doc/DocumentMetadataAccess.cxx             |    2 
 solenv/CompilerTest_compilerplugins_clang.mk           |    1 
 starmath/source/accessibility.cxx                      |   14 ++--
 store/source/lockbyte.cxx                              |    8 +-
 store/source/stordata.cxx                              |    6 -
 store/source/storpage.cxx                              |    6 -
 store/source/stortree.cxx                              |   10 +--
 store/source/stortree.hxx                              |    2 
 svl/source/misc/inethist.cxx                           |    2 
 svl/source/numbers/zforlist.cxx                        |    4 -
 svl/source/numbers/zformat.cxx                         |    2 
 svtools/source/control/valueacc.cxx                    |    2 
 svx/source/accessibility/GraphCtlAccessibleContext.cxx |    2 
 svx/source/dialog/docrecovery.cxx                      |    4 -
 svx/source/form/formcontrolfactory.cxx                 |    2 
 sw/source/core/doc/DocumentRedlineManager.cxx          |    2 
 sw/source/core/doc/docfld.cxx                          |    2 
 sw/source/core/docnode/nodes.cxx                       |    2 
 sw/source/core/layout/flycnt.cxx                       |    4 -
 sw/source/core/layout/sectfrm.cxx                      |    2 
 sw/source/core/layout/trvlfrm.cxx                      |    2 
 sw/source/core/text/EnhancedPDFExportHelper.cxx        |    2 
 sw/source/core/text/porlay.cxx                         |    2 
 sw/source/core/txtnode/ndtxt.cxx                       |    4 -
 sw/source/core/unocore/unofield.cxx                    |    2 
 sw/source/filter/ww8/ww8atr.cxx                        |    2 
 sw/source/filter/ww8/ww8par3.cxx                       |    2 
 sw/source/ui/frmdlg/frmpage.cxx                        |    2 
 sw/source/uibase/app/swmodul1.cxx                      |    2 
 sw/source/uibase/frmdlg/frmmgr.cxx                     |    4 -
 sw/source/uibase/shells/textfld.cxx                    |    2 
 sw/source/uibase/uno/unomod.cxx                        |    2 
 sw/source/uibase/utlui/content.cxx                     |    2 
 toolkit/source/helper/formpdfexport.cxx                |    2 
 tools/source/generic/b3dtrans.cxx                      |    4 -
 vcl/source/font/font.cxx                               |    2 
 vcl/source/gdi/pdfwriter_impl.cxx                      |    2 
 vcl/source/opengl/OpenGLHelper.cxx                     |    2 
 vcl/source/window/decoview.cxx                         |    2 
 vcl/source/window/winproc.cxx                          |    4 -
 vcl/unx/generic/print/common_gfx.cxx                   |    4 -
 writerfilter/source/dmapper/ConversionHelper.cxx       |    2 
 xmloff/source/style/xmlnumfi.cxx                       |    2 
 77 files changed, 188 insertions(+), 151 deletions(-)

New commits:
commit 7a1c21e53fc4733a4bb52282ce0098fcc085ab0e
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Nov 22 09:33:32 2017 +0200

    loplugin:simplifybool for negation of comparison operator
    
    Change-Id: Ie56daf560185274754afbc7a09c432b5c2793791
    Reviewed-on: https://gerrit.libreoffice.org/45068
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/basctl/source/basicide/brkdlg.cxx b/basctl/source/basicide/brkdlg.cxx
index 27fc322e5805..bab9694795f1 100644
--- a/basctl/source/basicide/brkdlg.cxx
+++ b/basctl/source/basicide/brkdlg.cxx
@@ -222,7 +222,7 @@ IMPL_LINK( BreakPointDialog, ButtonHdl, Button *, pButton, void )
         {
             delete m_aModifiedBreakPointList.remove( pBrk );
             m_pComboBox->RemoveEntryAt(nEntry);
-            if ( nEntry && !( nEntry < m_pComboBox->GetEntryCount() ) )
+            if ( nEntry && nEntry >= m_pComboBox->GetEntryCount() )
                 nEntry--;
             m_pComboBox->SetText( m_pComboBox->GetEntry( nEntry ) );
             if (SfxDispatcher* pDispatcher = GetDispatcher())
diff --git a/comphelper/source/misc/types.cxx b/comphelper/source/misc/types.cxx
index 4f92aa15c319..f5a57410495f 100644
--- a/comphelper/source/misc/types.cxx
+++ b/comphelper/source/misc/types.cxx
@@ -137,7 +137,7 @@ Type getSequenceElementType(const Type& _rSequenceType)
     OSL_ENSURE(_rSequenceType.getTypeClass() == TypeClass_SEQUENCE,
                 "getSequenceElementType: must be called with a  sequence type!");
 
-    if (!(_rSequenceType.getTypeClass() == TypeClass_SEQUENCE))
+    if (_rSequenceType.getTypeClass() != TypeClass_SEQUENCE)
         return Type();
 
     TypeDescription aTD(_rSequenceType);
diff --git a/compilerplugins/clang/simplifybool.cxx b/compilerplugins/clang/simplifybool.cxx
index cf5570b60008..091591f30988 100644
--- a/compilerplugins/clang/simplifybool.cxx
+++ b/compilerplugins/clang/simplifybool.cxx
@@ -87,25 +87,43 @@ bool SimplifyBool::VisitUnaryLNot(UnaryOperator const * expr) {
         return true;
     }
     auto e = getSubExprOfLogicalNegation(expr->getSubExpr());
-    if (e == nullptr) {
+    if (e) {
+        // Ignore macros, otherwise
+        //    OSL_ENSURE(!b, ...);
+        // triggers.
+        if (e->getLocStart().isMacroID())
+            return true;
+        // double logical not of an int is an idiom to convert to bool
+        if (!e->IgnoreImpCasts()->getType()->isBooleanType())
+            return true;
+        report(
+            DiagnosticsEngine::Warning,
+            ("double logical negation expression of the form '!!A' (with A of type"
+             " %0) can %select{logically|literally}1 be simplified as 'A'"),
+            expr->getLocStart())
+            << e->IgnoreImpCasts()->getType()
+            << e->IgnoreImpCasts()->getType()->isBooleanType()
+            << expr->getSourceRange();
         return true;
     }
-    // Ignore macros, otherwise
-    //    OSL_ENSURE(!b, ...);
-    // triggers.
-    if (e->getLocStart().isMacroID())
-        return true;
-    // double logical not of an int is an idiom to convert to bool
-    if (!e->IgnoreImpCasts()->getType()->isBooleanType())
-        return true;
-    report(
-        DiagnosticsEngine::Warning,
-        ("double logical negation expression of the form '!!A' (with A of type"
-         " %0) can %select{logically|literally}1 be simplified as 'A'"),
-        expr->getLocStart())
-        << e->IgnoreImpCasts()->getType()
-        << e->IgnoreImpCasts()->getType()->isBooleanType()
-        << expr->getSourceRange();
+    if (auto binaryOp = dyn_cast<BinaryOperator>(expr->getSubExpr()->IgnoreParenImpCasts())) {
+        // Ignore macros, otherwise
+        //    OSL_ENSURE(!b, ...);
+        // triggers.
+        if (binaryOp->getLocStart().isMacroID())
+            return true;
+        auto t = binaryOp->getLHS()->IgnoreImpCasts()->getType()->getUnqualifiedDesugaredType();
+        // RecordType would require more smarts - we'd need to verify that an inverted operator actually existed
+        if (t->isTemplateTypeParmType() || t->isRecordType() || t->isDependentType())
+            return true;
+        if (!binaryOp->isComparisonOp())
+            return true;
+        report(
+            DiagnosticsEngine::Warning,
+            ("logical negation of comparison operator, can be simplified by inverting operator"),
+            expr->getLocStart())
+            << expr->getSourceRange();
+    }
     return true;
 }
 
diff --git a/compilerplugins/clang/test/simplifybool.cxx b/compilerplugins/clang/test/simplifybool.cxx
new file mode 100644
index 000000000000..383e513b25e2
--- /dev/null
+++ b/compilerplugins/clang/test/simplifybool.cxx
@@ -0,0 +1,18 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+void f1(int a, int b)
+{
+    if (!(a < b))
+    { // expected-error at -1 {{logical negation of comparison operator, can be simplified by inverting operator [loplugin:simplifybool]}}
+        a = b;
+    }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/odbc/OResultSet.cxx b/connectivity/source/drivers/odbc/OResultSet.cxx
index e3a9d0aa0e4e..8c8ccc7e28fb 100644
--- a/connectivity/source/drivers/odbc/OResultSet.cxx
+++ b/connectivity/source/drivers/odbc/OResultSet.cxx
@@ -136,7 +136,7 @@ OResultSet::OResultSet(SQLHANDLE _pStatementHandle ,OStatement_Base* pStmt) :
         // In other words, isolate them from ODBC restrictions.
         // TODO: we assume SQL_GD_BLOCK, unless fetchSize is 1
         OTools::GetInfo(m_pStatement->getOwnConnection(),m_aConnectionHandle,SQL_GETDATA_EXTENSIONS,nValueLen,nullptr);
-        m_bFetchDataInOrder = !((SQL_GD_ANY_ORDER & nValueLen) == SQL_GD_ANY_ORDER);
+        m_bFetchDataInOrder = ((SQL_GD_ANY_ORDER & nValueLen) != SQL_GD_ANY_ORDER);
     }
     catch(const Exception&)
     {
diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx
index 44e7ca613259..c220ca3d41cc 100644
--- a/cui/source/tabpages/swpossizetabpage.cxx
+++ b/cui/source/tabpages/swpossizetabpage.cxx
@@ -1831,7 +1831,7 @@ sal_uInt16 SvxSwPosSizeTabPage::FillPosLB(FrmMap const *_pMap,
         // #i22341# - add condition to handle map <aVCharMap>
         // that is ambiguous in the alignment.
         if ( _pMap[i].nAlign == _nAlign &&
-             ( !(_pMap == aVCharMap) || _pMap[i].nLBRelations & nLBRelations ) )
+             ( _pMap != aVCharMap || _pMap[i].nLBRelations & nLBRelations ) )
         {
             sSelEntry = sEntry;
         }
diff --git a/extensions/source/update/feed/updatefeed.cxx b/extensions/source/update/feed/updatefeed.cxx
index a7daf0ef708e..b660eff706b1 100644
--- a/extensions/source/update/feed/updatefeed.cxx
+++ b/extensions/source/update/feed/updatefeed.cxx
@@ -227,7 +227,7 @@ public:
         OSL_ASSERT( m_xNodeList.is() );
         OSL_ASSERT( m_xUpdateInformationProvider.is() );
 
-        if( !(m_nCount < m_nNodes ) )
+        if( m_nCount >= m_nNodes )
             throw container::NoSuchElementException(OUString::number(m_nCount), *this);
 
         try
diff --git a/filter/source/graphicfilter/icgm/class4.cxx b/filter/source/graphicfilter/icgm/class4.cxx
index 0185f699014c..46f15e650c01 100644
--- a/filter/source/graphicfilter/icgm/class4.cxx
+++ b/filter/source/graphicfilter/icgm/class4.cxx
@@ -395,7 +395,7 @@ void CGM::ImplDoClass4()
                         fStartAngle = fEndAngle;
                         fEndAngle = fG;
                     }
-                    if ( ! ( fInterAngle > fStartAngle )  && ( fInterAngle < fEndAngle ) )
+                    if ( ( fInterAngle <= fStartAngle )  && ( fInterAngle < fEndAngle ) )
                     {
                         nSwitch ^=1;
                         aIntermediatePoint = aEndingPoint;
@@ -465,7 +465,7 @@ void CGM::ImplDoClass4()
                         fStartAngle = fEndAngle;
                         fEndAngle = fG;
                     }
-                    if ( ! ( fInterAngle > fStartAngle )  && ( fInterAngle < fEndAngle ) )
+                    if ( ( fInterAngle <= fStartAngle )  && ( fInterAngle < fEndAngle ) )
                     {
                         aIntermediatePoint = aEndingPoint;
                         aEndingPoint = aStartingPoint;
diff --git a/framework/source/fwe/helper/propertysetcontainer.cxx b/framework/source/fwe/helper/propertysetcontainer.cxx
index 5051d776f470..788a5e589801 100644
--- a/framework/source/fwe/helper/propertysetcontainer.cxx
+++ b/framework/source/fwe/helper/propertysetcontainer.cxx
@@ -105,7 +105,7 @@ void SAL_CALL PropertySetContainer::removeByIndex( sal_Int32 nIndex )
 {
     SolarMutexGuard g;
 
-    if ( !((sal_Int32)m_aPropertySetVector.size() > nIndex) )
+    if ( (sal_Int32)m_aPropertySetVector.size() <= nIndex )
         throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
 
     m_aPropertySetVector.erase(m_aPropertySetVector.begin() +  nIndex);
@@ -114,7 +114,7 @@ void SAL_CALL PropertySetContainer::removeByIndex( sal_Int32 nIndex )
 // XIndexReplace
 void SAL_CALL PropertySetContainer::replaceByIndex( sal_Int32 Index, const css::uno::Any& Element )
 {
-    if ( !((sal_Int32)m_aPropertySetVector.size() > Index) )
+    if ( (sal_Int32)m_aPropertySetVector.size() <= Index )
         throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
 
     Reference< XPropertySet > aPropertySetElement;
diff --git a/framework/source/fwi/uielement/itemcontainer.cxx b/framework/source/fwi/uielement/itemcontainer.cxx
index ec57f33b07a4..ba9e78128619 100644
--- a/framework/source/fwi/uielement/itemcontainer.cxx
+++ b/framework/source/fwi/uielement/itemcontainer.cxx
@@ -210,7 +210,7 @@ void SAL_CALL ItemContainer::replaceByIndex( sal_Int32 Index, const Any& aItem )
                                         static_cast<OWeakObject *>(this), 2 );
 
     ShareGuard aLock( m_aShareMutex );
-    if ( !(sal_Int32( m_aItemVector.size()) > Index) )
+    if ( sal_Int32( m_aItemVector.size()) <= Index )
         throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
 
     m_aItemVector[Index] = aSeq;
diff --git a/framework/source/fwi/uielement/rootitemcontainer.cxx b/framework/source/fwi/uielement/rootitemcontainer.cxx
index 72f41e761a1e..ee6e078ed3d9 100644
--- a/framework/source/fwi/uielement/rootitemcontainer.cxx
+++ b/framework/source/fwi/uielement/rootitemcontainer.cxx
@@ -224,7 +224,7 @@ void SAL_CALL RootItemContainer::replaceByIndex( sal_Int32 Index, const Any& aIt
         throw IllegalArgumentException( WRONG_TYPE_EXCEPTION, static_cast<OWeakObject *>(this), 2 );
 
     ShareGuard aLock( m_aShareMutex );
-    if ( !(sal_Int32( m_aItemVector.size()) > Index) )
+    if ( sal_Int32( m_aItemVector.size()) <= Index )
         throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
 
     m_aItemVector[Index] = aSeq;
diff --git a/framework/source/layoutmanager/uielement.cxx b/framework/source/layoutmanager/uielement.cxx
index be210277c6c0..097911b16441 100644
--- a/framework/source/layoutmanager/uielement.cxx
+++ b/framework/source/layoutmanager/uielement.cxx
@@ -61,7 +61,7 @@ namespace framework
                 if ( m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_TOP ||
                      m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_BOTTOM )
                 {
-                    if ( !( m_aDockedData.m_aPos.Y == aUIElement.m_aDockedData.m_aPos.Y ) )
+                    if (  m_aDockedData.m_aPos.Y != aUIElement.m_aDockedData.m_aPos.Y )
                         return  ( m_aDockedData.m_aPos.Y < aUIElement.m_aDockedData.m_aPos.Y );
                     else
                     {
@@ -76,7 +76,7 @@ namespace framework
                 }
                 else
                 {
-                    if ( !( m_aDockedData.m_aPos.X == aUIElement.m_aDockedData.m_aPos.X ) )
+                    if ( m_aDockedData.m_aPos.X != aUIElement.m_aDockedData.m_aPos.X )
                         return ( m_aDockedData.m_aPos.X < aUIElement.m_aDockedData.m_aPos.X );
                     else
                     {
diff --git a/hwpfilter/source/hwpread.cxx b/hwpfilter/source/hwpread.cxx
index 149c4f239301..cd29aae17e25 100644
--- a/hwpfilter/source/hwpread.cxx
+++ b/hwpfilter/source/hwpread.cxx
@@ -123,7 +123,7 @@ bool Bookmark::Read(HWPFile & hwpf)
     if (!hwpf.Read2b(dummy))
         return false;
 
-    if (!(len == 34))// 2 * (BMK_COMMENT_LEN + 1) + 2
+    if (len != 34)// 2 * (BMK_COMMENT_LEN + 1) + 2
      {
         return hwpf.SetState(HWP_InvalidFileFormat);
      }
@@ -282,7 +282,7 @@ bool TxtBox::Read(HWPFile & hwpf)
     UpdateBBox(this);
 
     ncell = nCell;
-    if (!(ncell > 0)){
+    if (ncell <= 0){
         return hwpf.SetState(HWP_InvalidFileFormat);
      }
 
@@ -656,7 +656,7 @@ bool AutoNum::Read(HWPFile & hwpf)
     hwpf.Read2b(&number, 1);
     hwpf.Read2b(&dummy, 1);
 
-    if (!(hh == dummy)){
+    if (hh != dummy){
         return hwpf.SetState(HWP_InvalidFileFormat);
      }
     return !hwpf.State();
@@ -679,7 +679,7 @@ bool NewNum::Read(HWPFile & hwpf)
     hwpf.Read2b(&number, 1);
     hwpf.Read2b(&dummy, 1);
 
-    if (!(hh == dummy)){
+    if (hh != dummy){
         return hwpf.SetState(HWP_InvalidFileFormat);
      }
     return !hwpf.State();
@@ -701,7 +701,7 @@ bool ShowPageNum::Read(HWPFile & hwpf)
     hwpf.Read2b(&shape, 1);
     hwpf.Read2b(&dummy, 1);
 
-    if (!(hh == dummy)){
+    if (hh != dummy){
         return hwpf.SetState(HWP_InvalidFileFormat);
      }
      m_nPageNumber = hwpf.getCurrentPage();
@@ -725,7 +725,7 @@ bool PageNumCtrl::Read(HWPFile & hwpf)
     hwpf.Read2b(&what, 1);
     hwpf.Read2b(&dummy, 1);
 
-    if (!(hh == dummy)){
+    if (hh != dummy){
         return hwpf.SetState(HWP_InvalidFileFormat);
      }
     return !hwpf.State();
@@ -744,7 +744,7 @@ bool MailMerge::Read(HWPFile & hwpf)
     hwpf.Read1b(field_name, 20);
     hwpf.Read2b(&dummy, 1);
 
-    if (!(hh == dummy)){
+    if (hh != dummy){
         return hwpf.SetState(HWP_InvalidFileFormat);
      }
     return !hwpf.State();
@@ -762,7 +762,7 @@ bool Compose::Read(HWPFile & hwpf)
     hwpf.Read2b(compose, 3);
     hwpf.Read2b(&dummy, 1);
 
-    if (!(hh == dummy)){
+    if (hh != dummy){
         return hwpf.SetState(HWP_InvalidFileFormat);
      }
     return !hwpf.State();
@@ -781,7 +781,7 @@ bool Hyphen::Read(HWPFile & hwpf)
     hwpf.Read2b(&width, 1);
     hwpf.Read2b(&dummy, 1);
 
-    if (!(hh == dummy)){
+    if (hh != dummy){
         return hwpf.SetState(HWP_InvalidFileFormat);
      }
     return !hwpf.State();
@@ -802,7 +802,7 @@ bool TocMark::Read(HWPFile & hwpf)
     hwpf.Read2b(&kind, 1);
     hwpf.Read2b(&dummy, 1);
 
-    if (!(hh == dummy)){
+    if (hh != dummy){
         return hwpf.SetState(HWP_InvalidFileFormat);
      }
     return !hwpf.State();
@@ -825,7 +825,7 @@ bool IndexMark::Read(HWPFile & hwpf)
     hwpf.Read2b(&pgno, 1);
     hwpf.Read2b(&dummy, 1);
 
-    if (!(hh == dummy)){
+    if (hh != dummy){
         return hwpf.SetState(HWP_InvalidFileFormat);
      }
     return !hwpf.State();
@@ -851,7 +851,7 @@ bool Outline::Read(HWPFile & hwpf)
     hwpf.Read2b(deco, 14);
     hwpf.Read2b(&dummy, 1);
 
-    if (!(hh == dummy)){
+    if (hh != dummy){
         return hwpf.SetState(HWP_InvalidFileFormat);
      }
     return !hwpf.State();
@@ -870,7 +870,7 @@ bool KeepSpace::Read(HWPFile & hwpf)
 {
     hwpf.Read2b(&dummy, 1);
 
-    if (!(hh == dummy)){
+    if (hh != dummy){
         return hwpf.SetState(HWP_InvalidFileFormat);
      }
     return !hwpf.State();
@@ -889,7 +889,7 @@ bool FixedSpace::Read(HWPFile & hwpf)
 {
     hwpf.Read2b(&dummy, 1);
 
-    if (!(hh == dummy)){
+    if (hh != dummy){
         return hwpf.SetState(HWP_InvalidFileFormat);
      }
     return !hwpf.State();
diff --git a/io/source/stm/odata.cxx b/io/source/stm/odata.cxx
index f25dd8dbbdb2..bfd6a92a20a7 100644
--- a/io/source/stm/odata.cxx
+++ b/io/source/stm/odata.cxx
@@ -284,13 +284,13 @@ OUString ODataInputStream::readUTF()
             case 12: case 13:
                 // 110x xxxx   10xx xxxx
                 nCount += 2;
-                if( ! ( nCount <= nUTFLen ) )
+                if( nCount > nUTFLen )
                 {
                     throw WrongFormatException( );
                 }
 
                 char2 = (sal_uInt8)readByte();
-                if( ! ( (char2 & 0xC0) == 0x80 ) )
+                if( (char2 & 0xC0) != 0x80 )
                 {
                     throw WrongFormatException( );
                 }
@@ -301,7 +301,7 @@ OUString ODataInputStream::readUTF()
             case 14:
             // 1110 xxxx  10xx xxxx  10xx xxxx
                 nCount += 3;
-                if( !( nCount <= nUTFLen) )
+                if( nCount > nUTFLen )
                 {
                     throw WrongFormatException( );
                 }
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx
index a786d9f7f644..a9d84556e158 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx
@@ -85,7 +85,7 @@ bool SunVersion::init(const char *szVersion)
         }
         //if  correct separator then form integer
         else if (
-            ! (nPartPos == 0) // prevents: ".4.1", "..1", part must start with digit
+            (nPartPos != 0) // prevents: ".4.1", "..1", part must start with digit
             && (
                 //separators after maintenance (1.4.1_01, 1.4.1-beta, or 1.4.1)
                 (pCur == pEnd || *pCur == '_' || *pCur == '-')
diff --git a/oox/source/ole/vbainputstream.cxx b/oox/source/ole/vbainputstream.cxx
index 988b87c3e0f5..d00a02f32d7e 100644
--- a/oox/source/ole/vbainputstream.cxx
+++ b/oox/source/ole/vbainputstream.cxx
@@ -122,7 +122,7 @@ bool VbaInputStream::updateChunk()
     if( mbEof ) return false;
 
     // check header signature
-    bool bIgnoreBrokenSig = !( (nHeader & VBACHUNK_SIGMASK) == VBACHUNK_SIG );
+    bool bIgnoreBrokenSig = ( (nHeader & VBACHUNK_SIGMASK) != VBACHUNK_SIG );
 
     // decode length of chunk data and compression flag
     bool bCompressed = getFlag( nHeader, VBACHUNK_COMPRESSED );
diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx
index 172c0313fd9e..947747efb104 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -789,7 +789,7 @@ Any Runtime::pyObject2Any ( const PyRef & source, enum ConversionMode mode ) con
         }
         else if( PyObject_IsInstance( o, getAnyClass( runtime ).get() ) )
         {
-            if( !(ACCEPT_UNO_ANY == mode) )
+            if( ACCEPT_UNO_ANY != mode )
             {
                 throw RuntimeException(
                     "uno.Any instance not accepted during method call, "
diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx
index 6bb013e36ca9..6dec181933ea 100644
--- a/registry/source/regimpl.cxx
+++ b/registry/source/regimpl.cxx
@@ -713,7 +713,7 @@ RegError ORegistry::closeKey(RegKeyHandle hKey)
     REG_GUARD(m_mutex);
 
     OUString const aKeyName (pKey->getName());
-    if (!(m_openKeyTable.count(aKeyName) > 0))
+    if (m_openKeyTable.count(aKeyName) <= 0)
         return RegError::KEY_NOT_OPEN;
 
     if (pKey->isModified())
diff --git a/sal/osl/unx/pipe.cxx b/sal/osl/unx/pipe.cxx
index bbb47368eff9..e577e89608ba 100644
--- a/sal/osl/unx/pipe.cxx
+++ b/sal/osl/unx/pipe.cxx
@@ -441,7 +441,7 @@ oslPipe SAL_CALL osl_acceptPipe(oslPipe pPipe)
 
     /* set close-on-exec flag */
     int flags;
-    if (!((flags = fcntl(s, F_GETFD, 0)) < 0))
+    if ((flags = fcntl(s, F_GETFD, 0)) >= 0)
     {
         flags |= FD_CLOEXEC;
         if (fcntl(s, F_SETFD, flags) < 0)
diff --git a/sal/rtl/digest.cxx b/sal/rtl/digest.cxx
index e784c4d13de3..85d7357ef6fc 100644
--- a/sal/rtl/digest.cxx
+++ b/sal/rtl/digest.cxx
@@ -347,7 +347,7 @@ rtlDigestError SAL_CALL rtl_digest_updateMD2(
     if (!pImpl || !pData)
         return rtl_Digest_E_Argument;
 
-    if (!(pImpl->m_digest.m_algorithm == rtl_Digest_AlgorithmMD2))
+    if (pImpl->m_digest.m_algorithm != rtl_Digest_AlgorithmMD2)
         return rtl_Digest_E_Algorithm;
 
     if (nDatLen == 0)
@@ -406,7 +406,7 @@ rtlDigestError SAL_CALL rtl_digest_getMD2(
     if (pImpl->m_digest.m_algorithm != rtl_Digest_AlgorithmMD2)
         return rtl_Digest_E_Algorithm;
 
-    if (!(pImpl->m_digest.m_length <= nBufLen))
+    if (pImpl->m_digest.m_length > nBufLen)
         return rtl_Digest_E_BufferSize;
 
     ctx = &(pImpl->m_context);
@@ -686,7 +686,7 @@ rtlDigestError SAL_CALL rtl_digest_updateMD5(
     if (!pImpl || !pData)
         return rtl_Digest_E_Argument;
 
-    if (!(pImpl->m_digest.m_algorithm == rtl_Digest_AlgorithmMD5))
+    if (pImpl->m_digest.m_algorithm != rtl_Digest_AlgorithmMD5)
         return rtl_Digest_E_Algorithm;
 
     if (nDatLen == 0)
@@ -760,7 +760,7 @@ rtlDigestError SAL_CALL rtl_digest_getMD5(
     if (pImpl->m_digest.m_algorithm != rtl_Digest_AlgorithmMD5)
         return rtl_Digest_E_Algorithm;
 
-    if (!(pImpl->m_digest.m_length <= nBufLen))
+    if (pImpl->m_digest.m_length > nBufLen)
         return rtl_Digest_E_BufferSize;
 
     ctx = &(pImpl->m_context);
@@ -790,7 +790,7 @@ rtlDigestError SAL_CALL rtl_digest_rawMD5(
     if (pImpl->m_digest.m_algorithm != rtl_Digest_AlgorithmMD5)
         return rtl_Digest_E_Algorithm;
 
-    if (!(pImpl->m_digest.m_length <= nBufLen))
+    if (pImpl->m_digest.m_length > nBufLen)
         return rtl_Digest_E_BufferSize;
 
     ctx = &(pImpl->m_context);
@@ -1201,7 +1201,7 @@ rtlDigestError SAL_CALL rtl_digest_getSHA(
     if (pImpl->m_digest.m_algorithm != rtl_Digest_AlgorithmSHA)
         return rtl_Digest_E_Algorithm;
 
-    if (!(pImpl->m_digest.m_length <= nBufLen))
+    if (pImpl->m_digest.m_length > nBufLen)
         return rtl_Digest_E_BufferSize;
 
     ctx = &(pImpl->m_context);
@@ -1361,7 +1361,7 @@ rtlDigestError SAL_CALL rtl_digest_getSHA1 (
     if (pImpl->m_digest.m_algorithm != rtl_Digest_AlgorithmSHA1)
         return rtl_Digest_E_Algorithm;
 
-    if (!(pImpl->m_digest.m_length <= nBufLen))
+    if (pImpl->m_digest.m_length > nBufLen)
         return rtl_Digest_E_BufferSize;
 
     ctx = &(pImpl->m_context);
@@ -1555,7 +1555,7 @@ rtlDigestError SAL_CALL rtl_digest_getHMAC_MD5(
     if (pImpl->m_digest.m_algorithm != rtl_Digest_AlgorithmHMAC_MD5)
         return rtl_Digest_E_Algorithm;
 
-    if (!(pImpl->m_digest.m_length <= nBufLen))
+    if (pImpl->m_digest.m_length > nBufLen)
         return rtl_Digest_E_BufferSize;
 
     nBufLen = pImpl->m_digest.m_length;
@@ -1751,7 +1751,7 @@ rtlDigestError SAL_CALL rtl_digest_getHMAC_SHA1(
     if (pImpl->m_digest.m_algorithm != rtl_Digest_AlgorithmHMAC_SHA1)
         return rtl_Digest_E_Algorithm;
 
-    if (!(pImpl->m_digest.m_length <= nBufLen))
+    if (pImpl->m_digest.m_length > nBufLen)
         return rtl_Digest_E_BufferSize;
 
     nBufLen = pImpl->m_digest.m_length;
diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 96c5843dcfea..a9b30a4dc498 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -170,7 +170,7 @@ bool isRepresentableInteger(double fAbsValue)
         // this here.
         double fInt;
         return (nInt <= kMaxInt &&
-                (!((fInt = static_cast< double >(nInt)) < fAbsValue) && !(fInt > fAbsValue)));
+                (((fInt = static_cast< double >(nInt)) >= fAbsValue) && (fInt <= fAbsValue)));
     }
     return false;
 }
diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx
index 49c5be8636a9..58d8591e7a27 100644
--- a/sax/source/expatwrap/saxwriter.cxx
+++ b/sax/source/expatwrap/saxwriter.cxx
@@ -611,7 +611,7 @@ inline SaxInvalidCharacterError SaxWriterHelper::startElement(const OUString& rN
             nCurrentPos = writeSequence();
 
         if (!writeString(xAttribs->getValueByIndex( i ), true, true) &&
-            !(eRet == SAX_ERROR))
+            eRet != SAX_ERROR)
             eRet = SAX_WARNING;
 
         mp_Sequence[nCurrentPos] = '"';
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 828e9cd0871d..60795d5bebf4 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -4803,7 +4803,7 @@ void ScDocument::ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
 
 void ScDocument::AddCondFormatData( const ScRangeList& rRange, SCTAB nTab, sal_uInt32 nIndex )
 {
-    if(!(static_cast<size_t>(nTab) < maTabs.size()))
+    if(static_cast<size_t>(nTab) >= maTabs.size())
         return;
 
     if(!maTabs[nTab])
@@ -4814,7 +4814,7 @@ void ScDocument::AddCondFormatData( const ScRangeList& rRange, SCTAB nTab, sal_u
 
 void ScDocument::RemoveCondFormatData( const ScRangeList& rRange, SCTAB nTab, sal_uInt32 nIndex )
 {
-    if(!(static_cast<size_t>(nTab) < maTabs.size()))
+    if(static_cast<size_t>(nTab) >= maTabs.size())
         return;
 
     if(!maTabs[nTab])
diff --git a/sc/source/core/opencl/op_database.cxx b/sc/source/core/opencl/op_database.cxx
index a86a49198a0c..b51712382639 100644
--- a/sc/source/core/opencl/op_database.cxx
+++ b/sc/source/core/opencl/op_database.cxx
@@ -1533,8 +1533,8 @@ void OpDcount2::GenSlidingWindowFunction(std::stringstream &ss,
     GenTmpVariables(ss,vSubArguments);
     int dataCol = 0;
     int dataRow = 0;
-    if(!(vSubArguments[0]->GetFormulaToken()->GetType() ==
-    formula::svDoubleVectorRef))
+    if(vSubArguments[0]->GetFormulaToken()->GetType() !=
+        formula::svDoubleVectorRef)
         throw Unhandled(__FILE__, __LINE__);
 
     formula::FormulaToken *tmpCur = vSubArguments[0]->GetFormulaToken();
diff --git a/sc/source/core/tool/charthelper.cxx b/sc/source/core/tool/charthelper.cxx
index a122be12f155..12e05fa415e9 100644
--- a/sc/source/core/tool/charthelper.cxx
+++ b/sc/source/core/tool/charthelper.cxx
@@ -258,7 +258,7 @@ void ScChartHelper::SetChartRanges( const uno::Reference< chart2::XChartDocument
                 xLabeledSequence->setLabel( xNewSeq );
             }
 
-            if( !(nRange<rRanges.getLength()) )
+            if( nRange >= rRanges.getLength() )
                 break;
 
             if( xValues.is())
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index c64396b5bb7d..36205c5867e9 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -2300,7 +2300,7 @@ void XclImpOptionButtonObj::DoProcessControl( ScfPropertySet& rPropSet ) const
             }
             else
                 pTbxObj = nullptr;
-        } while ( pTbxObj && !( pTbxObj->mnFirstInGroup == 1 ) );
+        } while ( pTbxObj && ( pTbxObj->mnFirstInGroup != 1 ) );
     }
     else
     {
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 5cbbf7a299bc..3ecdcc8de976 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -1069,7 +1069,7 @@ void ScHTMLLayoutParser::TableOn( HtmlImportInfo* pInfo )
             }
         }
         bInCell = false;
-        if ( bTabInTabCell && !(nTableWidth < nLastWidth) )
+        if ( bTabInTabCell && (nTableWidth >= nLastWidth) )
         {   // Multiple tables in one cell, underneath each other
             bTabInTabCell = false;
             NextRow( pInfo );
diff --git a/sc/source/filter/orcus/filterdetect.cxx b/sc/source/filter/orcus/filterdetect.cxx
index d32c84380afe..861c351f0611 100644
--- a/sc/source/filter/orcus/filterdetect.cxx
+++ b/sc/source/filter/orcus/filterdetect.cxx
@@ -75,7 +75,7 @@ OUString OrcusFormatDetect::detect(css::uno::Sequence<css::beans::PropertyValue>
     while(!bEnd)
     {
         sal_Int32 nReadBytes = xInputStream->readBytes(aSeq, nBytes);
-        bEnd = !(nReadBytes == nBytes);
+        bEnd = (nReadBytes != nBytes);
         aContent.append(reinterpret_cast<const char*>(aSeq.getConstArray()), nReadBytes);
     }
 
diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx b/sc/source/filter/xml/XMLStylesExportHelper.cxx
index 3b1e749c6318..dd6b115d4df4 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx
@@ -815,7 +815,7 @@ sal_Int32 ScFormatRangeStyles::GetStyleNameIndex(const sal_Int32 nTable,
     const sal_Int32 nColumn, const sal_Int32 nRow, bool& bIsAutoStyle) const
 {
     OSL_ENSURE(static_cast<size_t>(nTable) < aTables.size(), "wrong table");
-    if (!(static_cast<size_t>(nTable) < aTables.size()))
+    if (static_cast<size_t>(nTable) >= aTables.size())
         return -1;
     ScMyFormatRangeAddresses* pFormatRanges(aTables[nTable]);
     ScMyFormatRangeAddresses::iterator aItr(pFormatRanges->begin());
@@ -840,7 +840,7 @@ sal_Int32 ScFormatRangeStyles::GetStyleNameIndex(const sal_Int32 nTable, const s
     bool& bIsAutoStyle, sal_Int32& nValidationIndex, sal_Int32& nNumberFormat, const sal_Int32 nRemoveBeforeRow)
 {
     OSL_ENSURE(static_cast<size_t>(nTable) < aTables.size(), "wrong table");
-    if (!(static_cast<size_t>(nTable) < aTables.size()))
+    if (static_cast<size_t>(nTable) >= aTables.size())
         return -1;
     ScMyFormatRangeAddresses* pFormatRanges(aTables[nTable]);
     ScMyFormatRangeAddresses::iterator aItr(pFormatRanges->begin());
@@ -1107,7 +1107,7 @@ void ScRowStyles::AddNewTable(const sal_Int32 nTable, const sal_Int32 nFields)
 sal_Int32 ScRowStyles::GetStyleNameIndex(const sal_Int32 nTable, const sal_Int32 nField)
 {
     OSL_ENSURE(static_cast<size_t>(nTable) < aTables.size(), "wrong table");
-    if (!(static_cast<size_t>(nTable) < aTables.size()))
+    if (static_cast<size_t>(nTable) >= aTables.size())
         return -1;
 
     if (maCache.hasCache(nTable, nField))
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index adc713bfbbd0..2fde14330441 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2436,7 +2436,7 @@ void BoundsProvider<IndexType>::Compute(
     SAL_INFO("sc.lok.header", "BoundsProvider: rBottomNearest: index: " << aSecondNearest.first
             << ", pos: " << aSecondNearest.second << ", diff: " << nSecondDiff);
 
-    bool bReverse = !(std::abs(nFirstDiff) < std::abs(nSecondDiff));
+    bool bReverse = (std::abs(nFirstDiff) >= std::abs(nSecondDiff));
 
     if(bReverse)
     {
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 78611447b1d2..7bd2074b7342 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -1120,7 +1120,7 @@ void ScViewData::ResetOldCursor()
 
 SCCOL ScViewData::GetCurXForTab( SCTAB nTabIndex ) const
 {
-    if (!ValidTab(nTabIndex) || !(nTabIndex < static_cast<SCTAB>(maTabData.size())))
+    if (!ValidTab(nTabIndex) || (nTabIndex >= static_cast<SCTAB>(maTabData.size())))
         return -1;
 
     return maTabData[nTabIndex]->nCurX;
@@ -1128,7 +1128,7 @@ SCCOL ScViewData::GetCurXForTab( SCTAB nTabIndex ) const
 
 SCROW ScViewData::GetCurYForTab( SCTAB nTabIndex ) const
 {
-    if (!ValidTab(nTabIndex) || !(nTabIndex < static_cast<SCTAB>(maTabData.size())))
+    if (!ValidTab(nTabIndex) || (nTabIndex >= static_cast<SCTAB>(maTabData.size())))
             return -1;
 
     return maTabData[nTabIndex]->nCurY;
@@ -1136,7 +1136,7 @@ SCROW ScViewData::GetCurYForTab( SCTAB nTabIndex ) const
 
 void ScViewData::SetCurXForTab( SCCOL nNewCurX, SCTAB nTabIndex )
 {
-    if (!ValidTab(nTabIndex) || !(nTabIndex < static_cast<SCTAB>(maTabData.size())))
+    if (!ValidTab(nTabIndex) || (nTabIndex >= static_cast<SCTAB>(maTabData.size())))
             return;
 
     maTabData[nTabIndex]->nCurX = nNewCurX;
@@ -1144,7 +1144,7 @@ void ScViewData::SetCurXForTab( SCCOL nNewCurX, SCTAB nTabIndex )
 
 void ScViewData::SetCurYForTab( SCCOL nNewCurY, SCTAB nTabIndex )
 {
-    if (!ValidTab(nTabIndex) || !(nTabIndex < static_cast<SCTAB>(maTabData.size())))
+    if (!ValidTab(nTabIndex) || (nTabIndex >= static_cast<SCTAB>(maTabData.size())))
             return;
 
     maTabData[nTabIndex]->nCurY = nNewCurY;
@@ -1853,7 +1853,7 @@ void ScViewData::SetTabNo( SCTAB nNewTab )
 
 ScPositionHelper* ScViewData::GetLOKWidthHelper(SCTAB nTabIndex)
 {
-    if (!ValidTab(nTabIndex) || !(nTabIndex < static_cast<SCTAB>(maTabData.size())))
+    if (!ValidTab(nTabIndex) || (nTabIndex >= static_cast<SCTAB>(maTabData.size())))
     {
         return nullptr;
     }
@@ -1862,7 +1862,7 @@ ScPositionHelper* ScViewData::GetLOKWidthHelper(SCTAB nTabIndex)
 
 ScPositionHelper* ScViewData::GetLOKHeightHelper(SCTAB nTabIndex)
 {
-    if (!ValidTab(nTabIndex) || !(nTabIndex < static_cast<SCTAB>(maTabData.size())))
+    if (!ValidTab(nTabIndex) || (nTabIndex >= static_cast<SCTAB>(maTabData.size())))
     {
         return nullptr;
     }
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index 8faee745019e..7667c66db132 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -439,7 +439,7 @@ void SdPageObjsTLB::Fill( const SdDrawDocument* pInDoc, bool bAllPages,
     {
         const SdPage* pPage = static_cast<const SdPage*>( mpDoc->GetPage( nPage ) );
         if(  (mbShowAllPages || pPage->GetPageKind() == PageKind::Standard)
-             && !(pPage->GetPageKind()==PageKind::Handout)   ) //#94954# never list the normal handout page ( handout-masterpage is used instead )
+             && (pPage->GetPageKind() != PageKind::Handout)   ) //#94954# never list the normal handout page ( handout-masterpage is used instead )
         {
             bool bPageExluded = pPage->IsExcluded();
 
diff --git a/sd/source/ui/presenter/PresenterTextView.cxx b/sd/source/ui/presenter/PresenterTextView.cxx
index 4b8494078a5a..e03e9e4bcc55 100644
--- a/sd/source/ui/presenter/PresenterTextView.cxx
+++ b/sd/source/ui/presenter/PresenterTextView.cxx
@@ -117,7 +117,7 @@ void SAL_CALL PresenterTextView::initialize (const Sequence<Any>& rArguments)
 {
     ThrowIfDisposed();
 
-    if (!(rArguments.getLength() == 1))
+    if (rArguments.getLength() != 1)
     {
         throw RuntimeException("PresenterTextView: invalid number of arguments",
                 static_cast<XWeak*>(this));
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index a0f048be99db..0e3f8e54a92b 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -327,7 +327,7 @@ void SfxActionListBox::Recalc()
 VclPtr<PopupMenu> SfxActionListBox::CreateContextMenu()
 {
 
-    if( !( GetSelectionCount() > 0 ) )
+    if(  GetSelectionCount() <= 0 )
     {
         pDialog->EnableEdit( false );
         pDialog->EnableDel( false );
diff --git a/sfx2/source/doc/DocumentMetadataAccess.cxx b/sfx2/source/doc/DocumentMetadataAccess.cxx
index efb3496820aa..bf765366e27f 100644
--- a/sfx2/source/doc/DocumentMetadataAccess.cxx
+++ b/sfx2/source/doc/DocumentMetadataAccess.cxx
@@ -685,7 +685,7 @@ retry:
         readStream(i_rImpl, i_xStorage, s_manifest, i_xBaseURI->getStringValue());
     } catch (const ucb::InteractiveAugmentedIOException & e) {
         // no manifest.rdf: this is not an error in ODF < 1.2
-        if (!(ucb::IOErrorCode_NOT_EXISTING_PATH == e.Code)) {
+        if (ucb::IOErrorCode_NOT_EXISTING_PATH != e.Code) {
             iaioe = e;
             err = true;
         }
diff --git a/solenv/CompilerTest_compilerplugins_clang.mk b/solenv/CompilerTest_compilerplugins_clang.mk
index b21ba3b277e4..c2b78bf8832d 100644
--- a/solenv/CompilerTest_compilerplugins_clang.mk
+++ b/solenv/CompilerTest_compilerplugins_clang.mk
@@ -39,6 +39,7 @@ $(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \
     compilerplugins/clang/test/refcounting \
     compilerplugins/clang/test/salbool \
     compilerplugins/clang/test/salunicodeliteral \
+    compilerplugins/clang/test/simplifybool \
     compilerplugins/clang/test/simplifydynamiccast \
     compilerplugins/clang/test/stringconstant \
     compilerplugins/clang/test/unnecessarycatchthrow \
diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx
index c7e7ad737c60..057d2e0f62f5 100644
--- a/starmath/source/accessibility.cxx
+++ b/starmath/source/accessibility.cxx
@@ -415,7 +415,7 @@ sal_Bool SAL_CALL SmGraphicAccessible::setCaretPosition( sal_Int32 nIndex )
 {
     SolarMutexGuard aGuard;
     OUString aTxt( GetAccessibleText_Impl() );
-    if (!(nIndex < aTxt.getLength()))
+    if (nIndex >= aTxt.getLength())
         throw IndexOutOfBoundsException();
     return false;
 }
@@ -424,7 +424,7 @@ sal_Unicode SAL_CALL SmGraphicAccessible::getCharacter( sal_Int32 nIndex )
 {
     SolarMutexGuard aGuard;
     OUString aTxt( GetAccessibleText_Impl() );
-    if (!(nIndex < aTxt.getLength()))
+    if (nIndex >= aTxt.getLength())
         throw IndexOutOfBoundsException();
     return aTxt[nIndex];
 }
@@ -621,8 +621,8 @@ OUString SAL_CALL SmGraphicAccessible::getTextRange(
     OUString aTxt( GetAccessibleText_Impl() );
     sal_Int32 nStart = std::min(nStartIndex, nEndIndex);
     sal_Int32 nEnd   = std::max(nStartIndex, nEndIndex);
-    if (!(nStart <= aTxt.getLength()) ||
-        !(nEnd   <= aTxt.getLength()))
+    if ((nStart > aTxt.getLength()) ||
+        (nEnd   > aTxt.getLength()))
         throw IndexOutOfBoundsException();
     return aTxt.copy( nStart, nEnd - nStart );
 }
@@ -632,7 +632,7 @@ css::accessibility::TextSegment SAL_CALL SmGraphicAccessible::getTextAtIndex( sa
     SolarMutexGuard aGuard;
     OUString aTxt( GetAccessibleText_Impl() );
     //!! nIndex is allowed to be the string length
-    if (!(nIndex <= aTxt.getLength()))
+    if (nIndex > aTxt.getLength())
         throw IndexOutOfBoundsException();
 
     css::accessibility::TextSegment aResult;
@@ -652,7 +652,7 @@ css::accessibility::TextSegment SAL_CALL SmGraphicAccessible::getTextBeforeIndex
     SolarMutexGuard aGuard;
     OUString aTxt( GetAccessibleText_Impl() );
     //!! nIndex is allowed to be the string length
-    if (!(nIndex <= aTxt.getLength()))
+    if (nIndex > aTxt.getLength())
         throw IndexOutOfBoundsException();
 
     css::accessibility::TextSegment aResult;
@@ -673,7 +673,7 @@ css::accessibility::TextSegment SAL_CALL SmGraphicAccessible::getTextBehindIndex
     SolarMutexGuard aGuard;
     OUString aTxt( GetAccessibleText_Impl() );
     //!! nIndex is allowed to be the string length
-    if (!(nIndex <= aTxt.getLength()))
+    if (nIndex > aTxt.getLength())
         throw IndexOutOfBoundsException();
 
     css::accessibility::TextSegment aResult;
diff --git a/store/source/lockbyte.cxx b/store/source/lockbyte.cxx
index 4c8aa0c5f5eb..09240505a7fb 100644
--- a/store/source/lockbyte.cxx
+++ b/store/source/lockbyte.cxx
@@ -80,11 +80,11 @@ storeError ILockBytes::readAt (sal_uInt32 nOffset, void * pBuffer, sal_uInt32 nB
 {
     // [SECURITY:ValInput]
     sal_uInt8 * dst_lo = static_cast<sal_uInt8*>(pBuffer);
-    if (!(dst_lo != nullptr))
+    if (dst_lo == nullptr)
         return store_E_InvalidParameter;
 
     sal_uInt8 * dst_hi = dst_lo + nBytes;
-    if (!(dst_lo < dst_hi))
+    if (dst_lo >= dst_hi)
         return (dst_lo > dst_hi) ? store_E_InvalidParameter : store_E_None;
 
     OSL_PRECOND(!(nOffset == STORE_PAGE_NULL), "store::ILockBytes::readAt(): invalid Offset");
@@ -102,11 +102,11 @@ storeError ILockBytes::writeAt (sal_uInt32 nOffset, void const * pBuffer, sal_uI
 {
     // [SECURITY:ValInput]
     sal_uInt8 const * src_lo = static_cast<sal_uInt8 const*>(pBuffer);
-    if (!(src_lo != nullptr))
+    if (src_lo == nullptr)
         return store_E_InvalidParameter;
 
     sal_uInt8 const * src_hi = src_lo + nBytes;
-    if (!(src_lo < src_hi))
+    if (src_lo >= src_hi)
         return (src_lo > src_hi) ? store_E_InvalidParameter : store_E_None;
 
     OSL_PRECOND(!(nOffset == STORE_PAGE_NULL), "store::ILockBytes::writeAt(): invalid Offset");
diff --git a/store/source/stordata.cxx b/store/source/stordata.cxx
index 27942d33ca11..d18592fd2bff 100644
--- a/store/source/stordata.cxx
+++ b/store/source/stordata.cxx
@@ -218,7 +218,7 @@ storeError OStoreIndirectionPageObject::read (
 
     // Check arguments.
     sal_uInt16 const nLimit = rPage.capacityCount();
-    if (!(nSingle < nLimit))
+    if (nSingle >= nLimit)
         return store_E_InvalidAccess;
 
     // Obtain data page location.
@@ -308,7 +308,7 @@ storeError OStoreIndirectionPageObject::write (
 
     // Check arguments.
     sal_uInt16 const nLimit = rPage.capacityCount();
-    if (!(nSingle < nLimit))
+    if (nSingle >= nLimit)
         return store_E_InvalidAccess;
 
     // Obtain data page location.
@@ -416,7 +416,7 @@ storeError OStoreIndirectionPageObject::truncate (
 
     // Check arguments.
     sal_uInt16 const nLimit = rPage.capacityCount();
-    if (!(nSingle < nLimit))
+    if (nSingle >= nLimit)
         return store_E_InvalidAccess;
 
     // Truncate.
diff --git a/store/source/storpage.cxx b/store/source/storpage.cxx
index a4b573219a95..d441121e0ac4 100644
--- a/store/source/storpage.cxx
+++ b/store/source/storpage.cxx
@@ -160,7 +160,7 @@ storeError OStorePageManager::remove_Impl (entry & rEntry)
     // Check current page index.
     PageHolderObject< page > xPage (aNode.get());
     sal_uInt16 i = xPage->find (rEntry), n = xPage->usageCount();
-    if (!(i < n))
+    if (i >= n)
     {
         // Path to entry not exists (Must not happen(?)).
         return store_E_NotExists;
@@ -191,7 +191,7 @@ storeError OStorePageManager::remove_Impl (entry & rEntry)
         // Check index.
         i = xPage->find (rEntry);
         n = xPage->usageCount();
-        if (!(i < n))
+        if (i >= n)
         {
             // Path to entry not exists (Must not happen(?)).
             return store_E_NotExists;
@@ -229,7 +229,7 @@ storeError OStorePageManager::namei (
         return store_E_InvalidParameter;
 
     // Check name length.
-    if (!(pName->length < STORE_MAXIMUM_NAMESIZE))
+    if (pName->length >= STORE_MAXIMUM_NAMESIZE)
         return store_E_NameTooLong;
 
     // Transform pathname into key.
diff --git a/store/source/stortree.cxx b/store/source/stortree.cxx
index c4afa028c598..8733e9bf12bf 100644
--- a/store/source/stortree.cxx
+++ b/store/source/stortree.cxx
@@ -232,7 +232,7 @@ storeError OStoreBTreeNodeObject::remove (
     {
         // Check link entry.
         T const aEntryL (rPage.m_pData[nIndexL]);
-        if (!(rEntryL.compare (aEntryL) == T::COMPARE_EQUAL))
+        if (rEntryL.compare (aEntryL) != T::COMPARE_EQUAL)
             return store_E_InvalidAccess;
 
         // Load link node.
@@ -270,7 +270,7 @@ storeError OStoreBTreeNodeObject::remove (
     else
     {
         // Check leaf entry.
-        if (!(rEntryL.compare (rPage.m_pData[nIndexL]) == T::COMPARE_EQUAL))
+        if (rEntryL.compare (rPage.m_pData[nIndexL]) != T::COMPARE_EQUAL)
             return store_E_NotExists;
 
         // Save leaf entry.
@@ -400,7 +400,7 @@ storeError OStoreBTreeRootObject::find_lookup (
         page const & rPage = (*xPage);
         sal_uInt16 const i = rPage.find(entry);
         sal_uInt16 const n = rPage.usageCount();
-        if (!(i < n))
+        if (i >= n)
         {
             // Path to entry not exists (Must not happen(?)).
             return store_E_NotExists;
@@ -423,7 +423,7 @@ storeError OStoreBTreeRootObject::find_lookup (
     // Find index.
     page const & rPage = (*xPage);
     rIndex = rPage.find(entry);
-    if (!(rIndex < rPage.usageCount()))
+    if (rIndex >= rPage.usageCount())
         return store_E_NotExists;
 
     // Compare entry.
@@ -485,7 +485,7 @@ storeError OStoreBTreeRootObject::find_insert (
         page const & rPage = (*xPage);
         sal_uInt16 const i = rPage.find (entry);
         sal_uInt16 const n = rPage.usageCount();
-        if (!(i < n))
+        if (i >= n)
         {
             // Path to entry not exists (Must not happen(?)).
             return store_E_NotExists;
diff --git a/store/source/stortree.hxx b/store/source/stortree.hxx
index 6c8a9fa70f36..547f548c3a95 100644
--- a/store/source/stortree.hxx
+++ b/store/source/stortree.hxx
@@ -176,7 +176,7 @@ struct OStoreBTreeNodeData : public store::PageData
     */
     bool querySplit() const
     {
-        return (!(usageCount() < capacityCount()));
+        return usageCount() >= capacityCount();
     }
 
     /** Operation.
diff --git a/svl/source/misc/inethist.cxx b/svl/source/misc/inethist.cxx
index 3c302e43447b..03f886f39da4 100644
--- a/svl/source/misc/inethist.cxx
+++ b/svl/source/misc/inethist.cxx
@@ -242,7 +242,7 @@ void INetURLHistory_Impl::putUrl (const OUString &rUrl)
         sal_uInt16 nLRU = m_pList[m_aHead.m_nNext].m_nPrev;
 
         sal_uInt16 nSI = find (m_pList[nLRU].m_nHash);
-        if (!(nLRU == m_pHash[nSI].m_nLru))
+        if (nLRU != m_pHash[nSI].m_nLru)
         {
             // Update LRU chain.
             nLRU = m_pHash[nSI].m_nLru;
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 70d16c13ccd3..b38c3c317545 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -1689,8 +1689,8 @@ bool SvNumberFormatter::GetPreviewStringGuess( const OUString& sFormatString,
 
         if ( !bEnglishFormat )
         {
-            if ( !(nCheckPos == 0) || xTransliteration->isEqual( sFormatString,
-                                                                 pEntry->GetFormatstring() ) )
+            if ( nCheckPos != 0 || xTransliteration->isEqual( sFormatString,
+                                                              pEntry->GetFormatstring() ) )
             {
                 // other Format
                 sTmpString = sFormatString;
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index d3e48317f4d0..9a314d40b6aa 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -2368,7 +2368,7 @@ bool SvNumberformat::GetOutputString(double fNumber,
             {
                 if (::rtl::math::isSignBitSet(fNumber))
                 {
-                    if (!(fNumber < 0.0))
+                    if (fNumber >= 0.0)
                         fNumber = -fNumber;     // do not display -0.0
                 }
                 if (fNumber == 0.0)
diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx
index cb12cd85bbb3..f208fa1e0d0c 100644
--- a/svtools/source/control/valueacc.cxx
+++ b/svtools/source/control/valueacc.cxx
@@ -501,7 +501,7 @@ sal_Bool SAL_CALL ValueSetAcc::isAccessibleChildSelected( sal_Int32 nChildIndex
     const SolarMutexGuard aSolarGuard;
     ValueSetItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(nChildIndex));
 
-    if (!(pItem != nullptr))
+    if (pItem == nullptr)
         throw lang::IndexOutOfBoundsException();
 
     bool  bRet = mpParent->IsItemSelected( pItem->mnId );
diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
index d92e34f4e1c2..6cbd9ad03645 100644
--- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx
+++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
@@ -682,7 +682,7 @@ tools::Rectangle SvxGraphCtrlAccessibleContext::GetBoundingBox()
     tools::Rectangle aBounds ( 0, 0, 0, 0 );
 
     vcl::Window* pWindow = mpControl;
-    if (!(pWindow != nullptr))
+    if (pWindow == nullptr)
         throw DisposedException();
 
     aBounds = pWindow->GetWindowExtentsRelative (nullptr);
diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx
index 35a82a04ea57..13e35da7cfa5 100644
--- a/svx/source/dialog/docrecovery.cxx
+++ b/svx/source/dialog/docrecovery.cxx
@@ -98,8 +98,8 @@ bool RecoveryCore::isBrokenTempEntry(const TURLInfo& rInfo)
     // Note: If the original files was recovery ... but a temp file
     // exists ... an error inside the temp file exists!
     if (
-        !(rInfo.RecoveryState == E_RECOVERY_FAILED            ) &&
-        !(rInfo.RecoveryState == E_ORIGINAL_DOCUMENT_RECOVERED)
+        (rInfo.RecoveryState != E_RECOVERY_FAILED            ) &&
+        (rInfo.RecoveryState != E_ORIGINAL_DOCUMENT_RECOVERED)
        )
        return false;
 
diff --git a/svx/source/form/formcontrolfactory.cxx b/svx/source/form/formcontrolfactory.cxx
index c2b31731a8b0..bd5a1596764a 100644
--- a/svx/source/form/formcontrolfactory.cxx
+++ b/svx/source/form/formcontrolfactory.cxx
@@ -425,7 +425,7 @@ namespace svxform
                     lcl_initializeCharacterAttributes( _rxControlModel );
 
                     if  (   !_rControlBoundRect.IsEmpty()
-                        &&  !( _rControlBoundRect.GetWidth() > 4 * _rControlBoundRect.GetHeight() )
+                        &&  ( _rControlBoundRect.GetWidth() <= 4 * _rControlBoundRect.GetHeight() )
                         )
                     {
                         if ( xPSI->hasPropertyByName( FM_PROP_MULTILINE ) )
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index dbd288c0662b..5fc5ada08205 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -2709,7 +2709,7 @@ void DocumentRedlineManager::checkRedlining(RedlineFlags& _rReadlineMode)
     SwEditShell* pEditShell = m_rDoc.GetEditShell();
     vcl::Window* pParent = pEditShell ? pEditShell->GetWin() : nullptr;
     if ( pParent && !mbReadlineChecked && rRedlineTable.size() > MAX_REDLINE_COUNT
-        && !((_rReadlineMode & RedlineFlags::ShowDelete) == RedlineFlags::ShowDelete) )
+        && ((_rReadlineMode & RedlineFlags::ShowDelete) != RedlineFlags::ShowDelete) )
     {
         ScopedVclPtrInstance< MessageDialog > aQuery(pParent, "QueryShowChangesDialog", "modules/swriter/ui/queryshowchangesdialog.ui");
         sal_uInt16 nResult = aQuery->Execute();
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 90c44f70ab60..d63795dfe189 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -903,7 +903,7 @@ void SwDocUpdateField::MakeFieldList_( SwDoc& rDoc, int eGetMode )
                 break;
 
             case SwFieldIds::SetExp:
-                if ( !(eGetMode == GETFLD_EXPAND) ||
+                if ( (eGetMode != GETFLD_EXPAND) ||
                      (nsSwGetSetExpType::GSE_STRING & pField->GetSubType()) )
                 {
                     sFormula = sTrue;
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index c9f3ad9c22ce..4fb732b02da1 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -956,7 +956,7 @@ void SwNodes::SectionUp(SwNodeRange *pRange)
     if( pRange->aStart >= pRange->aEnd ||
         pRange->aEnd >= Count() ||
         !CheckNodesRange( pRange->aStart, pRange->aEnd ) ||
-        !( HighestLevel( *this, *pRange ) > 1 ))
+        ( HighestLevel( *this, *pRange ) <= 1 ))
         return;
 
     // If the beginning of a range is before or at a start node position, so
diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx
index 87d3bba45400..034c3a9fc754 100644
--- a/sw/source/core/layout/flycnt.cxx
+++ b/sw/source/core/layout/flycnt.cxx
@@ -133,8 +133,8 @@ void SwFlyAtContentFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pN
                 else
                     pContent = pContent->GetPrevContentFrame();
             } while ( pContent &&
-                      !( bBodyFootnote == ( pContent->IsInDocBody() ||
-                                       pContent->IsInFootnote() ) ) );
+                      ( bBodyFootnote != ( pContent->IsInDocBody() ||
+                                           pContent->IsInFootnote() ) ) );
             if ( pContent )
                 aOldIdx = *pContent->GetNode();
 
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index 3a1eafa2c746..2b6def165059 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -673,7 +673,7 @@ void SwSectionFrame::MoveContentAndDelete( SwSectionFrame* pDel, bool bSave )
         {   // Here we can insert ourselves at the beginning
             pUp = FirstLeaf( pNxtSct );
             pPrv = nullptr;
-            if( pPrvSct && !( pPrvSct->GetFormat() == pParent ) )
+            if( pPrvSct && ( pPrvSct->GetFormat() != pParent ) )
                 pPrvSct = nullptr; // In order that nothing is merged
         }
         else if( pPrvSct && pPrvSct->GetFormat() == pParent )
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index b028322d8601..1225e6f65f41 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -2242,7 +2242,7 @@ void SwRootFrame::CalcFrameRects(SwShellCursor &rCursor)
             Sub( aRegion, aTmp );
 
             // The next statement means neither ruby nor rotate(90):
-            if( !( MultiPortionType::RUBY == pEnd2Pos->nMultiType ) )
+            if( MultiPortionType::RUBY != pEnd2Pos->nMultiType )
             {
                 SwTwips nTmp = fnRectX.GetTop(pEnd2Pos->aLine);
                 if( fnRectX.GetTop(aEndRect) != nTmp )
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index bd50b93d0012..cb4f6b37711b 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -235,7 +235,7 @@ bool lcl_HasPreviousParaSameNumRule( const SwTextNode& rNode )
     const SwNode* pNode = &rNode;
     const SwNumRule* pNumRule = rNode.GetNumRule();
 
-    while (! (pNode == rNodes.DocumentSectionStartNode(const_cast<SwNode*>(static_cast<SwNode const *>(&rNode))) ) )
+    while (pNode != rNodes.DocumentSectionStartNode(const_cast<SwNode*>(static_cast<SwNode const *>(&rNode))) )
     {
         --aIdx;
 
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index e115bbe2d402..86b38b6d006d 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -602,7 +602,7 @@ void SwLineLayout::MaxAscentDescent( SwTwips& _orAscent,
 
             const bool bFlyCmp = pTmpPortion->IsFlyCntPortion() ?
                                      static_cast<const SwFlyCntPortion*>(pTmpPortion)->IsMax() :
-                                     !( pTmpPortion == _pDontConsiderPortion );
+                                     ( pTmpPortion != _pDontConsiderPortion );
 
             if ( bFlyCmp )
             {
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index e68b019b24d7..193b3a654eb7 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1802,7 +1802,7 @@ void SwTextNode::CopyText( SwTextNode *const pDest,
         SwTextAttr * const pHt = m_pSwpHints->Get(n);
 
         const sal_Int32 nAttrStartIdx = pHt->GetStart();
-        if (!( nAttrStartIdx < nEnd))
+        if ( nAttrStartIdx >= nEnd )
             break;
 
         const sal_Int32 * const pEndIdx = pHt->GetEnd();
@@ -2163,7 +2163,7 @@ void SwTextNode::CutImpl( SwTextNode * const pDest, const SwIndex & rDestStart,
     {
         SwTextAttr * const pHt = m_pSwpHints->Get(nAttrCnt);
         const sal_Int32 nAttrStartIdx = pHt->GetStart();
-        if (!( nAttrStartIdx < nEnd ))
+        if ( nAttrStartIdx >= nEnd )
             break;
         const sal_Int32 * const pEndIdx = pHt->GetEnd();
         const sal_uInt16 nWhich = pHt->Which();
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index d5c26341af07..7f5b6e96242e 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -2985,7 +2985,7 @@ uno::Any SAL_CALL SwXFieldEnumeration::nextElement()
 {
     SolarMutexGuard aGuard;
 
-    if (!(m_pImpl->m_nNextIndex < (sal_Int32)m_pImpl->m_Items.size()))
+    if (m_pImpl->m_nNextIndex >= (sal_Int32)m_pImpl->m_Items.size())
         throw container::NoSuchElementException(
             "SwXFieldEnumeration::nextElement",
             css::uno::Reference<css::uno::XInterface>());
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 86c75d4b22e0..970f53c2e7a2 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -2998,7 +2998,7 @@ void AttributeOutputBase::TextField( const SwFormatField& rField )
                 case REF_SEQUENCEFLD:
                 {
                     // Not implemented for RTF
-                    if(!(GetExport().GetExportFormat() != MSWordExportBase::ExportFormat::RTF))
+                    if(GetExport().GetExportFormat() == MSWordExportBase::ExportFormat::RTF)
                         break;
 
                     switch (pField->GetFormat())
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index d82801072abc..8dc161d582d4 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -2146,7 +2146,7 @@ void WW8FormulaControl::FormulaRead(SwWw8ControlType nWhich,
 
     // we should verify that bits.iType & nWhich concur
     OSL_ENSURE( iType == nWhich, "something wrong, expect control type read from stream doesn't match nWhich passed in");
-    if ( !( iType == nWhich ) )
+    if ( iType != nWhich )
         return; // bail out
 
     sal_uInt8 iRes = (bits1 & 0x7C) >> 2;
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index 88b2e8f5e30e..d2ab2ce96c8d 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -1433,7 +1433,7 @@ sal_Int32 SwFramePage::FillPosLB(const FrameMap* _pMap,
         // i#22341 - add condition to handle map <aVCharMap>
         // that is ambiguous in the alignment.
         if ( _pMap[i].nAlign == _nAlign &&
-             ( !(_pMap == aVCharMap) || _pMap[i].nLBRelations & nLBRelations ) )
+             ( (_pMap != aVCharMap) || _pMap[i].nLBRelations & nLBRelations ) )
         {
             sSelEntry = sEntry;
         }
diff --git a/sw/source/uibase/app/swmodul1.cxx b/sw/source/uibase/app/swmodul1.cxx
index 192511fa587b..49067db87393 100644
--- a/sw/source/uibase/app/swmodul1.cxx
+++ b/sw/source/uibase/app/swmodul1.cxx
@@ -421,7 +421,7 @@ void SwModule::SetRedlineAuthor(const OUString &rAuthor)
 OUString SwModule::GetRedlineAuthor(std::size_t nPos)
 {
     OSL_ENSURE(nPos < m_pAuthorNames.size(), "author not found!"); //#i45342# RTF doc with no author table caused reader to crash
-    while(!(nPos < m_pAuthorNames.size()))
+    while(nPos >= m_pAuthorNames.size())
     {
         InsertRedlineAuthor("nn");
     }
diff --git a/sw/source/uibase/frmdlg/frmmgr.cxx b/sw/source/uibase/frmdlg/frmmgr.cxx
index 7cd7c2702333..2bf04a3cce44 100644
--- a/sw/source/uibase/frmdlg/frmmgr.cxx
+++ b/sw/source/uibase/frmdlg/frmmgr.cxx
@@ -335,8 +335,8 @@ void SwFlyFrameAttrMgr::ValidateMetrics( SvxSwFrameValidation& rVal,
     // aligned at character or top of line in a special case
     else if ((eAnchorType == RndStdIds::FLY_AT_PARA) ||
                 ((eAnchorType == RndStdIds::FLY_AT_CHAR) &&
-                !(rVal.nVRelOrient == text::RelOrientation::CHAR) &&
-                !(rVal.nVRelOrient == text::RelOrientation::TEXT_LINE) ) )
+                (rVal.nVRelOrient != text::RelOrientation::CHAR) &&
+                (rVal.nVRelOrient != text::RelOrientation::TEXT_LINE) ) )
     {
         if (rVal.nHPos + rVal.nWidth > aBoundRect.Right())
         {
diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx
index 94ae920530cf..5e4dfeaef768 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -644,7 +644,7 @@ void SwTextShell::ExecField(SfxRequest &rReq)
                         bIsUrl = pIsUrl->GetValue();
 
                     SwScriptField* pField = static_cast<SwScriptField*>(aMgr.GetCurField());
-                    bNew = !pField || !(pField->GetTyp()->Which() == SwFieldIds::Script);
+                    bNew = !pField || (pField->GetTyp()->Which() != SwFieldIds::Script);
                     bUpdate = pField && ( bIsUrl != (bool)pField->GetFormat() || pField->GetPar2() != aType || pField->GetPar1() != aText );
                 }
                 else
diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx
index a41e1f40b1e2..3cd3772ea3fa 100644
--- a/sw/source/uibase/uno/unomod.cxx
+++ b/sw/source/uibase/uno/unomod.cxx
@@ -354,7 +354,7 @@ void SwXPrintSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo,
             sal_Int16 nTmp = 0;
             rValue >>= nTmp;
             SwPostItMode nVal = static_cast<SwPostItMode>(nTmp);
-            if(!(nVal <= SwPostItMode::EndPage))
+            if(nVal > SwPostItMode::EndPage)
                 throw lang::IllegalArgumentException();
 
             mpPrtOpt->SetPrintPostIts(nVal);
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index f7c6cc627f39..9b59a912c722 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1379,7 +1379,7 @@ void SwContentTree::RequestingChildren( SvTreeListEntry* pParent )
                                 assert(!pChild || lcl_IsContentType(pChild) || dynamic_cast<SwOutlineContent*>(static_cast<SwTypeNumber*>(pChild->GetUserData())));
                                 while(pChild &&
                                         lcl_IsContent(pChild) &&
-                                        !(static_cast<SwOutlineContent*>(pChild->GetUserData())->GetOutlineLevel() < nLevel)
+                                        (static_cast<SwOutlineContent*>(pChild->GetUserData())->GetOutlineLevel() >= nLevel)
                                     )
                                 {
                                     pChild = Prev(pChild);
diff --git a/toolkit/source/helper/formpdfexport.cxx b/toolkit/source/helper/formpdfexport.cxx
index 0b5801396288..a5f8548bf246 100644
--- a/toolkit/source/helper/formpdfexport.cxx
+++ b/toolkit/source/helper/formpdfexport.cxx
@@ -225,7 +225,7 @@ namespace toolkitform
                     }
                 }
 
-                if ( !( i < nCount ) )
+                if (  i >= nCount )
                 {
                     // the loop terminated because there were no more elements
                     // -> step up, if possible
diff --git a/tools/source/generic/b3dtrans.cxx b/tools/source/generic/b3dtrans.cxx
index 1162f24993f6..c65074482529 100644
--- a/tools/source/generic/b3dtrans.cxx
+++ b/tools/source/generic/b3dtrans.cxx
@@ -59,11 +59,11 @@ void B3dTransformationSet::Orientation(basegfx::B3DHomMatrix& rTarget, const bas
 
 void B3dTransformationSet::Frustum(basegfx::B3DHomMatrix& rTarget, double fLeft, double fRight, double fBottom, double fTop, double fNear, double fFar)
 {
-    if(!(fNear > 0.0))
+    if(fNear <= 0.0)
     {
         fNear = 0.001;
     }
-    if(!(fFar > 0.0))
+    if(fFar <= 0.0)
     {
         fFar = 1.0;
     }
diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx
index 06591700ee11..c6351c228097 100644
--- a/vcl/source/font/font.cxx
+++ b/vcl/source/font/font.cxx
@@ -210,7 +210,7 @@ void Font::SetKerning( FontKerning eKerning )
 
 bool Font::IsKerning() const
 {
-    return !(mpImplFont->meKerning == FontKerning::NONE);
+    return mpImplFont->meKerning != FontKerning::NONE;
 }
 
 void Font::SetWeight( FontWeight eWeight )
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index e95502a2d053..e9dfafb02b57 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -7929,7 +7929,7 @@ void PDFWriterImpl::endTransparencyGroup( const tools::Rectangle& rBoundingBox,
     SAL_WARN_IF( nTransparentPercent > 100, "vcl.pdfwriter", "invalid alpha value" );
     nTransparentPercent = nTransparentPercent % 100;
 
-    if( !(m_aContext.Version >= PDFWriter::PDFVersion::PDF_1_4) )
+    if( m_aContext.Version < PDFWriter::PDFVersion::PDF_1_4 )
         return;
 
     // create XObject
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index e48894168ac6..4c8660fb920a 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -348,7 +348,7 @@ namespace
         GLenum nBinaryFormat = GL_NONE;
 
         glGetProgramiv( nProgramID, GL_PROGRAM_BINARY_LENGTH, &nBinaryLength );
-        if( !( nBinaryLength > 0 ) )
+        if( nBinaryLength <= 0 )
         {
             SAL_WARN( "vcl.opengl", "Binary size is zero" );
             return;
diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx
index f7879511b79b..b2c494390d09 100644
--- a/vcl/source/window/decoview.cxx
+++ b/vcl/source/window/decoview.cxx
@@ -531,7 +531,7 @@ void ImplDrawButton( OutputDevice *const pDev, tools::Rectangle aFillRect,
 
         ImplDraw2ColorFrame( pDev, aFillRect, aColor1, aColor2 );
 
-        if ( !((nStyle & BUTTON_DRAW_FLATTEST) == DrawButtonFlags::Flat) )
+        if ( (nStyle & BUTTON_DRAW_FLATTEST) != DrawButtonFlags::Flat )
         {
             if ( nStyle & (DrawButtonFlags::Pressed | DrawButtonFlags::Checked) )
             {
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index bed6fcc45854..bf64ef132cc7 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -583,8 +583,8 @@ bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& xWindow, MouseNotifyEvent
                     pChild->ImplGetFrameData()->mnFirstMouseX      = nMouseX;
                     pChild->ImplGetFrameData()->mnFirstMouseY      = nMouseY;
                     pChild->ImplGetFrameData()->mnFirstMouseCode   = nCode;
-                    pChild->ImplGetFrameData()->mbStartDragCalled  = !((nCode & (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE)) ==
-                                                                (rMSettings.GetStartDragCode() & (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE)));
+                    pChild->ImplGetFrameData()->mbStartDragCalled  = (nCode & (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE)) !=
+                                                                     (rMSettings.GetStartDragCode() & (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE));
                 }
                 pChild->ImplGetFrameData()->mnMouseDownTime = nMsgTime;
             }
diff --git a/vcl/unx/generic/print/common_gfx.cxx b/vcl/unx/generic/print/common_gfx.cxx
index 40894081cbd1..887c4370d356 100644
--- a/vcl/unx/generic/print/common_gfx.cxx
+++ b/vcl/unx/generic/print/common_gfx.cxx
@@ -378,7 +378,7 @@ void
 PrinterGfx::DrawPolygon (sal_uInt32 nPoints, const Point* pPath)
 {
     // premature end of operation
-    if (!(nPoints > 1) || (pPath == nullptr) || !(maFillColor.Is() || maLineColor.Is()))
+    if (nPoints <= 0 || (pPath == nullptr) || !(maFillColor.Is() || maLineColor.Is()))
         return;
 
     // setup closed path
@@ -529,7 +529,7 @@ PrinterGfx::DrawPolygonBezier (sal_uInt32 nPoints, const Point* pPath, const Pol
     const sal_uInt32 nBezString = 1024;
     sal_Char pString[nBezString];
     // premature end of operation
-    if (!(nPoints > 1) || (pPath == nullptr) || !(maFillColor.Is() || maLineColor.Is()))
+    if (nPoints <= 0 || (pPath == nullptr) || !(maFillColor.Is() || maLineColor.Is()))
         return;
 
     snprintf(pString, nBezString, "%li %li moveto\n", pPath[0].X(), pPath[0].Y());
diff --git a/writerfilter/source/dmapper/ConversionHelper.cxx b/writerfilter/source/dmapper/ConversionHelper.cxx
index 3b1ed18eeacc..777fbf9b83da 100644
--- a/writerfilter/source/dmapper/ConversionHelper.cxx
+++ b/writerfilter/source/dmapper/ConversionHelper.cxx
@@ -321,7 +321,7 @@ OUString ConvertMSFormatStringToSO(
         {
             ++nI;
             //While not at the end and not at an unescaped end quote
-            while ((nI < nLen) && (!(aNewFormat[nI] == '\"') && (aNewFormat[nI-1] != '\\')))
+            while ((nI < nLen) && ((aNewFormat[nI] != '\"') && (aNewFormat[nI-1] != '\\')))
                 ++nI;
         }
         else //normal unquoted section
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 895db57dfecf..dbb4f30e0acf 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -1641,7 +1641,7 @@ sal_Int32 SvXMLNumFormatContext::CreateAndInsert( css::uno::Reference< css::util
 
 void SvXMLNumFormatContext::CreateAndInsert(bool /*bOverwrite*/)
 {
-    if (!(nKey > -1))
+    if (nKey <= -1)
         CreateAndInsert(pData->GetNumberFormatter());
 }
 


More information about the Libreoffice-commits mailing list