[Libreoffice-commits] core.git: basegfx/source chart2/source compilerplugins/clang cui/source extensions/source sc/source sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Feb 27 06:35:37 UTC 2019
basegfx/source/polygon/b2dpolypolygon.cxx | 10 -
basegfx/source/polygon/b3dpolygon.cxx | 12 -
chart2/source/controller/main/ChartController.cxx | 2
compilerplugins/clang/simplifybool.cxx | 150 +++++++++++++---------
compilerplugins/clang/test/simplifybool.cxx | 27 +++
cui/source/tabpages/border.cxx | 4
cui/source/tabpages/page.cxx | 6
cui/source/tabpages/paragrph.cxx | 6
cui/source/tabpages/tabstpge.cxx | 4
extensions/source/propctrlr/eformshelper.cxx | 2
sc/source/core/tool/detdata.cxx | 2
sc/source/ui/attrdlg/tabpages.cxx | 2
sw/source/core/unocore/unoframe.cxx | 2
sw/source/core/unocore/unostyle.cxx | 2
sw/source/filter/html/htmlforw.cxx | 2
15 files changed, 145 insertions(+), 88 deletions(-)
New commits:
commit 4d502ef3559f53d75e4ee3c85b90ea36816049e8
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Feb 26 12:07:24 2019 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Feb 27 07:35:11 2019 +0100
loplugin:simplifybool improve search for negated operator
Change-Id: Id6ac35fefa5c3e1f64c222713791e849b3cb4d34
Reviewed-on: https://gerrit.libreoffice.org/68379
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx
index 14e2d17c6bde..bbdc54a15481 100644
--- a/basegfx/source/polygon/b2dpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dpolypolygon.cxx
@@ -81,15 +81,7 @@ public:
bool operator==(const ImplB2DPolyPolygon& rPolygonList) const
{
- // same polygon count?
- if(maPolygons.size() != rPolygonList.maPolygons.size())
- return false;
-
- // compare polygon content
- if(!(maPolygons == rPolygonList.maPolygons))
- return false;
-
- return true;
+ return maPolygons == rPolygonList.maPolygons;
}
const basegfx::B2DPolygon& getB2DPolygon(sal_uInt32 nIndex) const
diff --git a/basegfx/source/polygon/b3dpolygon.cxx b/basegfx/source/polygon/b3dpolygon.cxx
index 41f5add1f434..9817fb43f6fb 100644
--- a/basegfx/source/polygon/b3dpolygon.cxx
+++ b/basegfx/source/polygon/b3dpolygon.cxx
@@ -1316,17 +1316,17 @@ public:
const sal_uInt32 nIndex(maPoints.count() - 1);
bRemove = (maPoints.getCoordinate(0) == maPoints.getCoordinate(nIndex));
- if(bRemove && mpBColors && !(mpBColors->getBColor(0) == mpBColors->getBColor(nIndex)))
+ if(bRemove && mpBColors && mpBColors->getBColor(0) != mpBColors->getBColor(nIndex))
{
bRemove = false;
}
- if(bRemove && mpNormals && !(mpNormals->getNormal(0) == mpNormals->getNormal(nIndex)))
+ if(bRemove && mpNormals && mpNormals->getNormal(0) != mpNormals->getNormal(nIndex))
{
bRemove = false;
}
- if(bRemove && mpTextureCoordinates && !(mpTextureCoordinates->getTextureCoordinate(0) == mpTextureCoordinates->getTextureCoordinate(nIndex)))
+ if(bRemove && mpTextureCoordinates && mpTextureCoordinates->getTextureCoordinate(0) != mpTextureCoordinates->getTextureCoordinate(nIndex))
{
bRemove = false;
}
@@ -1352,17 +1352,17 @@ public:
const sal_uInt32 nNextIndex(nIndex + 1);
bool bRemove(maPoints.getCoordinate(nIndex) == maPoints.getCoordinate(nNextIndex));
- if(bRemove && mpBColors && !(mpBColors->getBColor(nIndex) == mpBColors->getBColor(nNextIndex)))
+ if(bRemove && mpBColors && mpBColors->getBColor(nIndex) != mpBColors->getBColor(nNextIndex))
{
bRemove = false;
}
- if(bRemove && mpNormals && !(mpNormals->getNormal(nIndex) == mpNormals->getNormal(nNextIndex)))
+ if(bRemove && mpNormals && mpNormals->getNormal(nIndex) != mpNormals->getNormal(nNextIndex))
{
bRemove = false;
}
- if(bRemove && mpTextureCoordinates && !(mpTextureCoordinates->getTextureCoordinate(nIndex) == mpTextureCoordinates->getTextureCoordinate(nNextIndex)))
+ if(bRemove && mpTextureCoordinates && mpTextureCoordinates->getTextureCoordinate(nIndex) != mpTextureCoordinates->getTextureCoordinate(nNextIndex))
{
bRemove = false;
}
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 8484fa347bff..5f9e97148a96 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -889,7 +889,7 @@ void SAL_CALL ChartController::queryClosing(
if( !aModelRef.is() )
return;
- if( !(aModelRef->getModel() == rSource.Source) )
+ if( aModelRef->getModel() != rSource.Source )
{
OSL_FAIL( "queryClosing was called on a controller from an unknown source" );
return;
diff --git a/compilerplugins/clang/simplifybool.cxx b/compilerplugins/clang/simplifybool.cxx
index 895e3eb7b464..ea54b1ef4280 100644
--- a/compilerplugins/clang/simplifybool.cxx
+++ b/compilerplugins/clang/simplifybool.cxx
@@ -8,8 +8,10 @@
*/
#include <cassert>
+#include <iostream>
#include "plugin.hxx"
+#include "clang/AST/CXXInheritance.h"
namespace {
@@ -53,50 +55,102 @@ Expr const * getSubExprOfLogicalNegation(Expr const * expr) {
? nullptr : e->getSubExpr();
}
+clang::Type const * stripConstRef(clang::Type const * type) {
+ auto lvalueType = dyn_cast<LValueReferenceType>(type);
+ if (!lvalueType)
+ return type;
+ return lvalueType->getPointeeType()->getUnqualifiedDesugaredType();
+}
+
+bool isCompatibleTypeForOperator(clang::Type const * paramType, CXXRecordDecl const * argRecordDecl) {
+ paramType = stripConstRef(paramType);
+ auto paramRecordType = dyn_cast<RecordType>(paramType);
+ if (!paramRecordType)
+ return false;
+ CXXRecordDecl const * paramRecordDecl = dyn_cast<CXXRecordDecl>(paramRecordType->getDecl());
+ if (!paramRecordDecl)
+ return false;
+ return argRecordDecl == paramRecordDecl || argRecordDecl->isDerivedFrom(paramRecordDecl);
+}
+
+FunctionDecl const * findMemberOperator(CXXRecordDecl const * recordDecl, OverloadedOperatorKind ooOpcode, CXXRecordDecl const * rhs) {
+ for (auto it = recordDecl->method_begin(); it != recordDecl->method_end(); ++it) {
+ if (it->getOverloadedOperator() == ooOpcode) {
+ if (it->getNumParams() == 1 && isCompatibleTypeForOperator(it->getParamDecl(0)->getType().getTypePtr(), rhs))
+ return *it;
+ }
+ }
+ return nullptr;
+}
+
+// Magic value to indicate we assume this operator exists
+static FunctionDecl const * const ASSUME_OPERATOR_EXISTS = reinterpret_cast<FunctionDecl const *>(-1);
+
// Search for an operator with matching parameter types; while this may miss some operators with
// odd parameter types that would actually be used by the compiler, it is overall better to have too
// many false negatives (i.e., miss valid loplugin:simplifybool warnings) than false positives here:
-FunctionDecl const * findOperator(CompilerInstance& compiler, clang::RecordType const * recordType, BinaryOperator::Opcode opcode, QualType lhs, QualType rhs) {
- auto const clhs = lhs.isNull() ? nullptr : lhs.getCanonicalType().getTypePtr();
- auto const crhs = rhs.getCanonicalType().getTypePtr();
- OverloadedOperatorKind over = BinaryOperator::getOverloadedOperator(opcode);
- CXXRecordDecl const * recordDecl = dyn_cast<CXXRecordDecl>(recordType->getDecl());
- if (!recordDecl)
+FunctionDecl const * findOperator(CompilerInstance& compiler, BinaryOperator::Opcode opcode, clang::Type const * lhsType, clang::Type const * rhsType) {
+ auto lhsRecordType = dyn_cast<RecordType>(lhsType);
+ if (!lhsRecordType)
return nullptr;
- // search for member overloads
- for (auto it = recordDecl->method_begin(); it != recordDecl->method_end(); ++it) {
- if (it->getOverloadedOperator() == over) {
- assert(it->getNumParams() == 1);
- if (it->getParamDecl(0)->getType().getCanonicalType().getTypePtr() == crhs)
- return *it;
- }
+ auto rhsRecordType = dyn_cast<RecordType>(rhsType);
+ if (!rhsRecordType)
+ return nullptr;
+ CXXRecordDecl const * lhsRecordDecl = dyn_cast<CXXRecordDecl>(lhsRecordType->getDecl());
+ if (!lhsRecordDecl)
+ return nullptr;
+ CXXRecordDecl const * rhsRecordDecl = dyn_cast<CXXRecordDecl>(rhsRecordType->getDecl());
+ if (!rhsRecordDecl)
+ return nullptr;
+
+ auto ctx = lhsRecordDecl->getCanonicalDecl()->getDeclContext();
+
+ /*
+ It looks the clang Sema::LookupOverloadedOperatorName is the chunk of functionality I need,
+ but I have no idea how to call it from here.
+ Actually finding the right standard library operators requires doing conversions and other funky stuff.
+ For now, just assume that standard library operators are well-behaved, and have negated operators.
+ */
+ if (ctx->isStdNamespace())
+ return ASSUME_OPERATOR_EXISTS;
+ if (auto namespaceDecl = dyn_cast<NamespaceDecl>(ctx)) {
+ // because, of course, half the standard library is not "in the standard namespace"
+ if (namespaceDecl->getName() == "__gnu_debug")
+ return ASSUME_OPERATOR_EXISTS;
}
+
+ // search for member overloads
+ // (using the hard way here because DeclContext::lookup does not work for member operators)
+ auto ooOpcode = BinaryOperator::getOverloadedOperator(opcode);
+ FunctionDecl const * foundFunction = findMemberOperator(lhsRecordDecl, ooOpcode, rhsRecordDecl);
+ if (foundFunction)
+ return foundFunction;
+ auto ForallBasesCallback = [&](const CXXRecordDecl *baseCXXRecordDecl)
+ {
+ if (baseCXXRecordDecl->isInvalidDecl())
+ return false;
+ foundFunction = findMemberOperator(baseCXXRecordDecl, ooOpcode, rhsRecordDecl);
+ return false;
+ };
+
+ lhsRecordDecl->forallBases(ForallBasesCallback, /*AllowShortCircuit*/true);
+ if (foundFunction)
+ return foundFunction;
+
// search for free function overloads
- auto ctx = recordDecl->getDeclContext();
if (ctx->getDeclKind() == Decl::LinkageSpec) {
ctx = ctx->getParent();
}
- auto declName = compiler.getASTContext().DeclarationNames.getCXXOperatorName(over);
- auto res = ctx->lookup(declName);
+ auto operatorDeclName = compiler.getASTContext().DeclarationNames.getCXXOperatorName(ooOpcode);
+ auto res = ctx->lookup(operatorDeclName);
for (auto d = res.begin(); d != res.end(); ++d) {
FunctionDecl const * f = dyn_cast<FunctionDecl>(*d);
if (!f || f->getNumParams() != 2)
continue;
- if (f->getParamDecl(1)->getType().getCanonicalType().getTypePtr() != crhs)
+ if (!isCompatibleTypeForOperator(f->getParamDecl(0)->getType().getTypePtr(), lhsRecordDecl))
+ continue;
+ if (!isCompatibleTypeForOperator(f->getParamDecl(1)->getType().getTypePtr(), rhsRecordDecl))
continue;
- auto const p0 = f->getParamDecl(0)->getType().getCanonicalType().getTypePtr();
- if (clhs) {
- if (p0 != clhs)
- continue;
- } else {
- if (p0 != recordType) {
- auto lvalue = dyn_cast<LValueReferenceType>(p0);
- if (!lvalue)
- continue;
- if (lvalue->getPointeeType().getTypePtr() != recordType)
- continue;
- }
- }
return f;
}
return nullptr;
@@ -248,32 +302,15 @@ bool SimplifyBool::VisitUnaryLNot(UnaryOperator const * expr) {
if (!(op == OO_EqualEqual || op == OO_ExclaimEqual))
return true;
BinaryOperator::Opcode negatedOpcode = BinaryOperator::negateComparisonOp(BinaryOperator::getOverloadedOpcode(op));
- auto t = binaryOp->getArg(0)->IgnoreImpCasts()->getType()->getUnqualifiedDesugaredType();
- // we need to verify that a negated operator actually existed
- if (!t->isRecordType())
- return true;
- auto recordType = dyn_cast<RecordType>(t);
- auto const fdecl = binaryOp->getDirectCallee();
- if (!fdecl) // e.g. CXXOperatorCallExpr with UnresolvedLookupExpr
- return true;
- QualType lhs;
- QualType rhs;
- if (auto const mdecl = dyn_cast<CXXMethodDecl>(fdecl)) {
- assert(fdecl->getNumParams() == 1);
- rhs = fdecl->getParamDecl(0)->getType();
- } else {
- assert(fdecl->getNumParams() == 2);
- lhs = fdecl->getParamDecl(0)->getType();
- rhs = fdecl->getParamDecl(1)->getType();
- }
- auto const negOp = findOperator(compiler, recordType, negatedOpcode, lhs, rhs);
+ auto lhs = binaryOp->getArg(0)->IgnoreImpCasts()->getType()->getUnqualifiedDesugaredType();
+ auto rhs = binaryOp->getArg(1)->IgnoreImpCasts()->getType()->getUnqualifiedDesugaredType();
+ auto const negOp = findOperator(compiler, negatedOpcode, lhs, rhs);
if (!negOp)
return true;
// if we are inside a similar operator, ignore, eg. operator!= is often defined by calling !operator==
if (m_insideFunctionDecl && m_insideFunctionDecl->getNumParams() >= 1) {
- auto qt = m_insideFunctionDecl->getParamDecl(0)->getType();
- auto lvalue = dyn_cast<LValueReferenceType>(qt.getTypePtr());
- if (lvalue && lvalue->getPointeeType()->getUnqualifiedDesugaredType() == recordType)
+ auto t = stripConstRef(m_insideFunctionDecl->getParamDecl(0)->getType().getTypePtr());
+ if (t == lhs)
return true;
}
// QA code
@@ -285,10 +322,11 @@ bool SimplifyBool::VisitUnaryLNot(UnaryOperator const * expr) {
("logical negation of comparison operator, can be simplified by inverting operator"),
compat::getBeginLoc(expr))
<< expr->getSourceRange();
- report(
- DiagnosticsEngine::Note, "the presumed corresponding negated operator is declared here",
- negOp->getLocation())
- << negOp->getSourceRange();
+ if (negOp != ASSUME_OPERATOR_EXISTS)
+ report(
+ DiagnosticsEngine::Note, "the presumed corresponding negated operator is declared here",
+ negOp->getLocation())
+ << negOp->getSourceRange();
}
return true;
}
diff --git a/compilerplugins/clang/test/simplifybool.cxx b/compilerplugins/clang/test/simplifybool.cxx
index 8428502ff01d..75a26d22aa27 100644
--- a/compilerplugins/clang/test/simplifybool.cxx
+++ b/compilerplugins/clang/test/simplifybool.cxx
@@ -9,6 +9,12 @@
#include <rtl/ustring.hxx>
// expected-note at rtl/ustring.hxx:* 2 {{the presumed corresponding negated operator is declared here [loplugin:simplifybool]}}
+#include <rtl/string.hxx>
+// expected-note at rtl/string.hxx:* {{the presumed corresponding negated operator is declared here [loplugin:simplifybool]}}
+#include <basegfx/vector/b3dvector.hxx>
+// expected-note at basegfx/tuple/b3dtuple.hxx:* {{the presumed corresponding negated operator is declared here [loplugin:simplifybool]}}
+
+#include <map>
namespace group1
{
@@ -105,6 +111,16 @@ void testRecord()
OUString d2;
v = !(d1 == d2);
// expected-error at -1 {{logical negation of comparison operator, can be simplified by inverting operator [loplugin:simplifybool]}}
+ OString e1;
+ OString e2;
+ v = !(e1 == e2);
+ // expected-error at -1 {{logical negation of comparison operator, can be simplified by inverting operator [loplugin:simplifybool]}}
+
+ // the operator != is in a base-class, and the param is a base-type
+ basegfx::B3DVector f1;
+ basegfx::B3DVector f2;
+ v = !(f1 == f2);
+ // expected-error at -1 {{logical negation of comparison operator, can be simplified by inverting operator [loplugin:simplifybool]}}
}
struct Record4
@@ -143,4 +159,15 @@ bool foo3(int a, bool b)
}
};
+namespace group5
+{
+bool foo1(std::map<int, int>* pActions, int aKey)
+{
+ auto aIter = pActions->find(aKey);
+ //TODO this doesn't work yet because I'd need to implement conversion operators during method/func lookup
+ return !(aIter == pActions->end());
+ // expected-error at -1 {{logical negation of comparison operator, can be simplified by inverting operator [loplugin:simplifybool]}}
+}
+};
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index 0812c656bbf0..a66b3481943a 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -983,14 +983,14 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs )
if ( bPut )
{
- if ( !pOldBoxItem || !( *pOldBoxItem == aBoxItem ) )
+ if ( !pOldBoxItem || *pOldBoxItem != aBoxItem )
{
rCoreAttrs->Put( aBoxItem );
bAttrsChanged = true;
}
const SfxPoolItem* pOld = GetOldItem( *rCoreAttrs, SID_ATTR_BORDER_INNER, false );
- if ( !pOld || !( *static_cast<const SvxBoxInfoItem*>(pOld) == aBoxInfoItem ) )
+ if ( !pOld || *static_cast<const SvxBoxInfoItem*>(pOld) != aBoxInfoItem )
{
rCoreAttrs->Put( aBoxInfoItem );
bAttrsChanged = true;
diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
index 81ad11e810f6..b7893372aa7f 100644
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
@@ -595,7 +595,7 @@ bool SvxPageDescPage::FillItemSet( SfxItemSet* rSet )
{
pOld = GetOldItem( *rSet, SID_ATTR_LRSPACE );
- if ( !pOld || !( *static_cast<const SvxLRSpaceItem*>(pOld) == aMargin ) )
+ if ( !pOld || *static_cast<const SvxLRSpaceItem*>(pOld) != aMargin )
rSet->Put( aMargin );
else
bModified = false;
@@ -621,7 +621,7 @@ bool SvxPageDescPage::FillItemSet( SfxItemSet* rSet )
{
pOld = GetOldItem( *rSet, SID_ATTR_ULSPACE );
- if ( !pOld || !( *static_cast<const SvxULSpaceItem*>(pOld) == aTopMargin ) )
+ if ( !pOld || *static_cast<const SvxULSpaceItem*>(pOld) != aTopMargin )
{
bModified = true;
rSet->Put( aTopMargin );
@@ -706,7 +706,7 @@ bool SvxPageDescPage::FillItemSet( SfxItemSet* rSet )
{
pOld = GetOldItem( *rSet, SID_ATTR_PAGE );
- if ( !pOld || !( *static_cast<const SvxPageItem*>(pOld) == aPage ) )
+ if ( !pOld || *static_cast<const SvxPageItem*>(pOld) != aPage )
{
rSet->Put( aPage );
bModified = true;
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index 4ceb0c88b0a7..6b00615c5776 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -304,7 +304,7 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
aMargin.SetContextValue(m_xContextualCB->get_active());
eState = GetItemSet().GetItemState( nWhich );
- if ( !pOld || !( *static_cast<const SvxULSpaceItem*>(pOld) == aMargin ) ||
+ if ( !pOld || *static_cast<const SvxULSpaceItem*>(pOld) != aMargin ||
SfxItemState::DONTCARE == eState )
{
rOutSet->Put( aMargin );
@@ -359,7 +359,7 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
bNullTab = true;
eState = GetItemSet().GetItemState( nWhich );
- if ( !pOld || !( *static_cast<const SvxLRSpaceItem*>(pOld) == aMargin ) ||
+ if ( !pOld || *static_cast<const SvxLRSpaceItem*>(pOld) != aMargin ||
SfxItemState::DONTCARE == eState )
{
rOutSet->Put( aMargin );
@@ -1376,7 +1376,7 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
aHyphen.GetMaxHyphens() = static_cast<sal_uInt8>(m_xMaxHyphenEdit->get_value());
if ( !pOld ||
- !( *static_cast<const SvxHyphenZoneItem*>(pOld) == aHyphen ) ||
+ *static_cast<const SvxHyphenZoneItem*>(pOld) != aHyphen ||
m_xHyphenBox->get_state_changed_from_saved())
{
rOutSet->Put( aHyphen );
diff --git a/cui/source/tabpages/tabstpge.cxx b/cui/source/tabpages/tabstpge.cxx
index 1d7f009419fc..6d35e70e501f 100644
--- a/cui/source/tabpages/tabstpge.cxx
+++ b/cui/source/tabpages/tabstpge.cxx
@@ -201,13 +201,13 @@ bool SvxTabulatorTabPage::FillItemSet(SfxItemSet* rSet)
aTmp.Insert(aTmpStop);
}
- if (!pOld || !(*static_cast<const SvxTabStopItem*>(pOld) == aTmp))
+ if (!pOld || *static_cast<const SvxTabStopItem*>(pOld) != aTmp)
{
rSet->Put(aTmp);
bModified = true;
}
}
- else if (!pOld || !( *static_cast<const SvxTabStopItem*>(pOld) == aNewTabs))
+ else if (!pOld || *static_cast<const SvxTabStopItem*>(pOld) != aNewTabs)
{
rSet->Put(aNewTabs);
bModified = true;
diff --git a/extensions/source/propctrlr/eformshelper.cxx b/extensions/source/propctrlr/eformshelper.cxx
index 00408ddd57f6..686913645c4c 100644
--- a/extensions/source/propctrlr/eformshelper.cxx
+++ b/extensions/source/propctrlr/eformshelper.cxx
@@ -677,7 +677,7 @@ namespace pcr
Reference< xforms::XModel > xElementsModel;
xElement->getPropertyValue( PROPERTY_MODEL ) >>= xElementsModel;
OSL_ENSURE( xElementsModel == xModel, "EFormsHelper::getAllElementUINames: inconsistency in the model-element relationship!" );
- if ( !( xElementsModel == xModel ) )
+ if ( xElementsModel != xModel )
xElement->setPropertyValue( PROPERTY_MODEL, makeAny( xModel ) );
}
#endif
diff --git a/sc/source/core/tool/detdata.cxx b/sc/source/core/tool/detdata.cxx
index e822d51e3100..aec1d032d0c2 100644
--- a/sc/source/core/tool/detdata.cxx
+++ b/sc/source/core/tool/detdata.cxx
@@ -79,7 +79,7 @@ bool ScDetOpList::operator==( const ScDetOpList& r ) const
size_t nCount = Count();
bool bEqual = ( nCount == r.Count() );
for (size_t i=0; i<nCount && bEqual; i++) // order has to be the same
- if ( !(aDetOpDataVector[i] == r.aDetOpDataVector[i]) ) // entries are different ?
+ if ( aDetOpDataVector[i] != r.aDetOpDataVector[i] ) // entries are different ?
bEqual = false;
return bEqual;
diff --git a/sc/source/ui/attrdlg/tabpages.cxx b/sc/source/ui/attrdlg/tabpages.cxx
index 8e1bf7572f18..d974baf6bcf2 100644
--- a/sc/source/ui/attrdlg/tabpages.cxx
+++ b/sc/source/ui/attrdlg/tabpages.cxx
@@ -127,7 +127,7 @@ bool ScTabPageProtection::FillItemSet( SfxItemSet* rCoreAttrs )
if ( bTriEnabled )
bAttrsChanged = true; // DontCare -> properly value
else
- bAttrsChanged = !pOldItem || !( aProtAttr == *static_cast<const ScProtectionAttr*>(pOldItem) );
+ bAttrsChanged = !pOldItem || aProtAttr != *static_cast<const ScProtectionAttr*>(pOldItem);
}
if ( bAttrsChanged )
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 0ca98cda81e5..01a9f3790bf4 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1773,7 +1773,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
aChangedBrushItem.PutValue(aValue, nMemberId);
- if(!(aChangedBrushItem == aOriginalBrushItem))
+ if(aChangedBrushItem != aOriginalBrushItem)
{
setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, aSet);
pFormat->GetDoc()->SetFlyFrameAttr( *pFormat, aSet );
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 74fb4be9512c..2a3f9e228275 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -3645,7 +3645,7 @@ uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle(
aChangedBrushItem.PutValue(aValue, nMemberId);
- if(!(aChangedBrushItem == aOriginalBrushItem))
+ if(aChangedBrushItem != aOriginalBrushItem)
{
setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, aSet);
}
diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx
index 573663220d3a..88c6cabe2bd0 100644
--- a/sw/source/filter/html/htmlforw.cxx
+++ b/sw/source/filter/html/htmlforw.cxx
@@ -325,7 +325,7 @@ void SwHTMLWriter::OutForm( bool bTag_On, const SwStartNode *pStartNd )
}
if( xNewFormComps.is() &&
- (!mxFormComps.is() || !(xNewFormComps == mxFormComps)) )
+ (!mxFormComps.is() || xNewFormComps != mxFormComps) )
{
// A form should be opened ...
if( mxFormComps.is() )
More information about the Libreoffice-commits
mailing list