chart2/source/controller/main/UndoActions.cxx | 2 +- chart2/source/controller/main/UndoGuard.cxx | 4 ++-- chart2/source/view/charttypes/BarChart.cxx | 2 +- compilerplugins/clang/simplifybool.cxx | 10 ++++++++-- sc/source/ui/dbgui/csvcontrol.cxx | 2 +- sfx2/source/appl/workwin.cxx | 4 ++-- starmath/source/document.cxx | 2 +- svtools/source/table/cellvalueconversion.cxx | 2 +- svtools/source/table/gridtablerenderer.cxx | 4 ++-- svtools/source/table/tablecontrol_impl.cxx | 6 +++--- sw/source/uibase/docvw/PostItMgr.cxx | 2 +- ucb/source/core/ucbcmds.cxx | 4 ++-- ucb/source/ucp/file/filtask.hxx | 2 +- ucb/source/ucp/webdav-neon/PropertyMap.hxx | 2 +- vcl/source/gdi/graph.cxx | 2 +- 15 files changed, 28 insertions(+), 22 deletions(-)
New commits: commit 640e03da110d76b2c7d5ed5b8b8ba3b4367865ba Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Tue Nov 21 15:45:31 2017 +0200 loplugin:simplifybool re-activate the !! warning Change-Id: Iac7d82a1c228734177be536e9a6c41803c03637b Reviewed-on: https://gerrit.libreoffice.org/45035 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/chart2/source/controller/main/UndoActions.cxx b/chart2/source/controller/main/UndoActions.cxx index c7cfb74587a7..6206430880b3 100644 --- a/chart2/source/controller/main/UndoActions.cxx +++ b/chart2/source/controller/main/UndoActions.cxx @@ -57,7 +57,7 @@ UndoElement::~UndoElement() void SAL_CALL UndoElement::disposing() { - if ( !!m_pModelClone ) + if ( m_pModelClone ) m_pModelClone->dispose(); m_pModelClone.reset(); m_xDocumentModel.clear(); diff --git a/chart2/source/controller/main/UndoGuard.cxx b/chart2/source/controller/main/UndoGuard.cxx index feaf9df8576a..4d7a85e8ad3a 100644 --- a/chart2/source/controller/main/UndoGuard.cxx +++ b/chart2/source/controller/main/UndoGuard.cxx @@ -45,13 +45,13 @@ UndoGuard::UndoGuard( const OUString& i_undoString, const uno::Reference< docume UndoGuard::~UndoGuard() { - if ( !!m_pDocumentSnapshot ) + if ( m_pDocumentSnapshot ) discardSnapshot(); } void UndoGuard::commit() { - if ( !m_bActionPosted && !!m_pDocumentSnapshot ) + if ( !m_bActionPosted && m_pDocumentSnapshot ) { try { diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx index 27634b283c7e..476dc39d36fb 100644 --- a/chart2/source/view/charttypes/BarChart.cxx +++ b/chart2/source/view/charttypes/BarChart.cxx @@ -139,7 +139,7 @@ awt::Point BarChart::getLabelScreenPositionAndAlignment( double fY = fScaledUpperYValue; double fZ = fScaledZ; bool bReverse = !pPosHelper->isMathematicalOrientationY(); - bool bNormalOutside = (!bReverse == !!(fBaseValue < fScaledUpperYValue)); + bool bNormalOutside = (!bReverse == (fBaseValue < fScaledUpperYValue)); double fDepth = fScaledUpperBarDepth; switch(nLabelPlacement) diff --git a/compilerplugins/clang/simplifybool.cxx b/compilerplugins/clang/simplifybool.cxx index faf0849b3f40..cf5570b60008 100644 --- a/compilerplugins/clang/simplifybool.cxx +++ b/compilerplugins/clang/simplifybool.cxx @@ -90,7 +90,14 @@ bool SimplifyBool::VisitUnaryLNot(UnaryOperator const * expr) { if (e == nullptr) { return true; } -/* hits for OSL_ENSURE(!b, ...); + // 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" @@ -99,7 +106,6 @@ bool SimplifyBool::VisitUnaryLNot(UnaryOperator const * expr) { << e->IgnoreImpCasts()->getType() << e->IgnoreImpCasts()->getType()->isBooleanType() << expr->getSourceRange(); -*/ return true; } diff --git a/sc/source/ui/dbgui/csvcontrol.cxx b/sc/source/ui/dbgui/csvcontrol.cxx index 5af764c32b1a..e79cdad8c076 100644 --- a/sc/source/ui/dbgui/csvcontrol.cxx +++ b/sc/source/ui/dbgui/csvcontrol.cxx @@ -36,7 +36,7 @@ ScCsvLayoutData::ScCsvLayoutData() : mnPosCursor( CSV_POS_INVALID ), mnColCursor( 0 ), mnNoRepaint( 0 ), - mbAppRTL( !!AllSettings::GetLayoutRTL() ) + mbAppRTL( AllSettings::GetLayoutRTL() ) { } diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index e4fb41ad1508..8d0970ed5d81 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -1048,9 +1048,9 @@ bool SfxWorkWindow::IsVisible_Impl( SfxVisibilityFlags nMode ) const return false; case SfxVisibilityFlags::Client: case SfxVisibilityFlags::Server: - return !!(nMode & nUpdateMode); + return bool(nMode & nUpdateMode); default: - return !!(nMode & nOrigMode ) || + return (nMode & nOrigMode ) || nOrigMode == SfxVisibilityFlags::Standard; } } diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index ae8587e9d3ca..64beff94ec16 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -493,7 +493,7 @@ SmPrinterAccess::SmPrinterAccess( SmDocShell &rDocShell ) } } } - if ( !!(pRefDev = rDocShell.GetRefDev()) && pPrinter.get() != pRefDev.get() ) + if ( (pRefDev = rDocShell.GetRefDev()) && pPrinter.get() != pRefDev.get() ) { pRefDev->Push( PushFlags::MAPMODE ); if ( SfxObjectCreateMode::EMBEDDED == rDocShell.GetCreateMode() ) diff --git a/svtools/source/table/cellvalueconversion.cxx b/svtools/source/table/cellvalueconversion.cxx index 6f1b477bc517..3c4728e652d0 100644 --- a/svtools/source/table/cellvalueconversion.cxx +++ b/svtools/source/table/cellvalueconversion.cxx @@ -378,7 +378,7 @@ namespace svt else o_formatter = pos->second; - return !!o_formatter; + return bool(o_formatter); } } diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx index 5098a48e84cf..a3d6e84ddb1b 100644 --- a/svtools/source/table/gridtablerenderer.cxx +++ b/svtools/source/table/gridtablerenderer.cxx @@ -246,8 +246,8 @@ namespace svt { namespace table OUString sHeaderText; PColumnModel const pColumn = m_pImpl->rModel.getColumnModel( _nCol ); - DBG_ASSERT( !!pColumn, "GridTableRenderer::PaintColumnHeader: invalid column model object!" ); - if ( !!pColumn ) + DBG_ASSERT( pColumn, "GridTableRenderer::PaintColumnHeader: invalid column model object!" ); + if ( pColumn ) sHeaderText = pColumn->getName(); Color const textColor = lcl_getEffectiveColor( m_pImpl->rModel.getTextColor(), _rStyle, &StyleSettings::GetFieldTextColor ); diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index b16677314e92..d74de8e2a9df 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -257,7 +257,7 @@ namespace svt { namespace table { SuppressCursor aHideCursor( *this ); - if ( !!m_pModel ) + if ( m_pModel ) m_pModel->removeTableModelListener( shared_from_this() ); m_pModel = _pModel; @@ -1659,8 +1659,8 @@ namespace svt { namespace table void TableControl_Impl::impl_ni_doSwitchCursor( bool _bShow ) { - PTableRenderer pRenderer = !!m_pModel ? m_pModel->getRenderer() : PTableRenderer(); - if ( !!pRenderer ) + PTableRenderer pRenderer = m_pModel ? m_pModel->getRenderer() : PTableRenderer(); + if ( pRenderer ) { tools::Rectangle aCellRect; impl_getCellRect( m_nCurColumn, m_nCurRow, aCellRect ); diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 7a90231b0eef..4e024c731b33 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -448,7 +448,7 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { case SfxHintId::ModeChanged: { - if ( mbReadOnly != !!(mpView->GetDocShell()->IsReadOnly()) ) + if ( mbReadOnly != mpView->GetDocShell()->IsReadOnly() ) { mbReadOnly = !mbReadOnly; SetReadOnlyState(); diff --git a/ucb/source/core/ucbcmds.cxx b/ucb/source/core/ucbcmds.cxx index eecdd5dc1fa2..bcedf21be3d6 100644 --- a/ucb/source/core/ucbcmds.cxx +++ b/ucb/source/core/ucbcmds.cxx @@ -624,11 +624,11 @@ uno::Reference< ucb::XContent > createNew( // (not a and not b) or (a and b) // not( a or b) or (a and b) - if ( ( !!bSourceIsFolder == + if ( ( bSourceIsFolder == !!( nAttribs & ucb::ContentInfoAttribute::KIND_FOLDER ) ) && - ( !!bSourceIsDocument == + ( bSourceIsDocument == !!( nAttribs & ucb::ContentInfoAttribute::KIND_DOCUMENT ) ) ) diff --git a/ucb/source/ucp/file/filtask.hxx b/ucb/source/ucp/file/filtask.hxx index f3a879958fc4..49678e57ede8 100644 --- a/ucb/source/ucp/file/filtask.hxx +++ b/ucb/source/ucp/file/filtask.hxx @@ -211,7 +211,7 @@ namespace fileaccess { bool operator()( const MyProperty& rKey1, const MyProperty& rKey2 ) const { - return !!( rKey1.getPropertyName() == rKey2.getPropertyName() ); + return rKey1.getPropertyName() == rKey2.getPropertyName(); } }; diff --git a/ucb/source/ucp/webdav-neon/PropertyMap.hxx b/ucb/source/ucp/webdav-neon/PropertyMap.hxx index c0c31bb410d4..159651085773 100644 --- a/ucb/source/ucp/webdav-neon/PropertyMap.hxx +++ b/ucb/source/ucp/webdav-neon/PropertyMap.hxx @@ -41,7 +41,7 @@ struct equalPropertyName bool operator()( const css::beans::Property & p1, const css::beans::Property & p2 ) const { - return !!( p1.Name == p2.Name ); + return p1.Name == p2.Name; } }; diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx index 9b2d89489cdd..3477c43e7f33 100644 --- a/vcl/source/gdi/graph.cxx +++ b/vcl/source/gdi/graph.cxx @@ -91,7 +91,7 @@ void ImplDrawDefault( OutputDevice* pOutDev, const OUString* pText, } if ( aSize.Width() > 0 && aSize.Height() > 0 && pFont && pText && pText->getLength() - && !(!pOutDev->IsOutputEnabled() /*&& pOutDev->GetConnectMetaFile() */) ) + && pOutDev->IsOutputEnabled() ) { MapMode aMapMode( MapUnit::MapPoint ); Size aSz = pOutDev->LogicToLogic( Size( 0, 12 ), &aMapMode, nullptr ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits