Kaydet (Commit) 640e03da authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:simplifybool re-activate the !! warning

Change-Id: Iac7d82a1c228734177be536e9a6c41803c03637b
Reviewed-on: https://gerrit.libreoffice.org/45035Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst a0ebba3d
......@@ -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();
......
......@@ -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
{
......
......@@ -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)
......
......@@ -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;
}
......
......@@ -36,7 +36,7 @@ ScCsvLayoutData::ScCsvLayoutData() :
mnPosCursor( CSV_POS_INVALID ),
mnColCursor( 0 ),
mnNoRepaint( 0 ),
mbAppRTL( !!AllSettings::GetLayoutRTL() )
mbAppRTL( AllSettings::GetLayoutRTL() )
{
}
......
......@@ -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;
}
}
......
......@@ -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() )
......
......@@ -378,7 +378,7 @@ namespace svt
else
o_formatter = pos->second;
return !!o_formatter;
return bool(o_formatter);
}
}
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -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();
......
......@@ -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 ) )
)
......
......@@ -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();
}
};
......
......@@ -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;
}
};
......
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment