[Libreoffice-commits] core.git: 46 commits - accessibility/source basctl/source basic/source canvas/source chart2/source compilerplugins/clang connectivity/source cui/source dbaccess/source desktop/source drawinglayer/source editeng/source extensions/source filter/source forms/source framework/source hwpfilter/source i18npool/source idlc/source idl/source include/connectivity include/editeng include/filter include/o3tl include/oox include/svx include/tools include/vcl lotuswordpro/source mysqlc/source oox/source package/source reportdesign/source rsc/inc sc/source sdext/source sd/source sfx2/source slideshow/source sot/source starmath/inc starmath/source svl/source svtools/source svx/source sw/inc sw/source toolkit/source tools/source ucb/source unotools/source vcl/generic vcl/inc vcl/osx vcl/source vcl/unx writerfilter/source xmloff/source xmlsecurity/source
Stephan Bergmann
sbergman at redhat.com
Fri Apr 24 03:37:42 PDT 2015
accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx | 4
accessibility/source/extended/accessibletablistboxtable.cxx | 2
basctl/source/basicide/basidesh.cxx | 4
basctl/source/basicide/basobj3.cxx | 2
basctl/source/basicide/macrodlg.cxx | 8
basic/source/classes/sb.cxx | 2
basic/source/comp/token.cxx | 2
basic/source/runtime/methods.cxx | 2
basic/source/runtime/methods1.cxx | 4
canvas/source/cairo/cairo_canvasfont.cxx | 2
canvas/source/cairo/cairo_spritecanvas.cxx | 2
canvas/source/tools/page.hxx | 2
canvas/source/vcl/canvasfont.cxx | 2
canvas/source/vcl/spritecanvas.cxx | 2
chart2/source/controller/dialogs/res_ErrorBar.cxx | 4
chart2/source/controller/dialogs/res_LegendPosition.cxx | 4
chart2/source/controller/dialogs/tp_DataSource.cxx | 4
chart2/source/controller/dialogs/tp_RangeChooser.cxx | 4
chart2/source/tools/ExplicitCategoriesProvider.cxx | 2
chart2/source/view/main/GL3DRenderer.cxx | 4
compilerplugins/clang/simplifybool.cxx | 1029 ++++++++++
connectivity/source/commontools/TSortIndex.cxx | 2
connectivity/source/drivers/kab/KStatement.cxx | 4
connectivity/source/drivers/mork/MQueryHelper.cxx | 16
cui/source/dialogs/cuifmsearch.cxx | 6
cui/source/dialogs/cuihyperdlg.cxx | 2
cui/source/options/connpooloptions.cxx | 2
cui/source/tabpages/backgrnd.cxx | 2
cui/source/tabpages/page.cxx | 10
cui/source/tabpages/swpossizetabpage.cxx | 4
cui/source/tabpages/transfrm.cxx | 8
dbaccess/source/core/api/RowSetBase.cxx | 2
dbaccess/source/filter/xml/xmlComponent.cxx | 2
dbaccess/source/ui/app/AppController.cxx | 2
dbaccess/source/ui/app/AppControllerDnD.cxx | 2
dbaccess/source/ui/app/AppDetailView.cxx | 5
dbaccess/source/ui/control/TableGrantCtrl.cxx | 2
dbaccess/source/ui/dlg/dbwiz.cxx | 2
dbaccess/source/ui/dlg/dbwizsetup.cxx | 2
dbaccess/source/ui/misc/WCPage.cxx | 2
dbaccess/source/ui/querydesign/JoinTableView.cxx | 2
dbaccess/source/ui/querydesign/QueryDesignView.cxx | 2
desktop/source/app/check_ext_deps.cxx | 2
desktop/source/deployment/gui/dp_gui_dialog2.cxx | 2
drawinglayer/source/primitive2d/textbreakuphelper.cxx | 2
drawinglayer/source/primitive2d/textlayoutdevice.cxx | 2
editeng/source/accessibility/AccessibleEditableTextPara.cxx | 2
editeng/source/editeng/editdoc.cxx | 5
editeng/source/editeng/editdoc.hxx | 7
editeng/source/editeng/editeng.cxx | 2
editeng/source/editeng/editobj.cxx | 4
editeng/source/editeng/edtspell.cxx | 2
editeng/source/editeng/eehtml.cxx | 2
editeng/source/editeng/eertfpar.cxx | 4
editeng/source/editeng/impedit.cxx | 4
editeng/source/editeng/impedit.hxx | 2
editeng/source/editeng/impedit2.cxx | 19
editeng/source/editeng/impedit3.cxx | 8
editeng/source/editeng/impedit4.cxx | 15
editeng/source/items/bulitem.cxx | 2
editeng/source/items/numitem.cxx | 2
editeng/source/items/paperinf.cxx | 2
editeng/source/items/paraitem.cxx | 5
editeng/source/misc/hangulhanja.cxx | 2
editeng/source/misc/svxacorr.cxx | 4
editeng/source/misc/txtrange.cxx | 2
editeng/source/outliner/outliner.cxx | 2
editeng/source/outliner/paralist.cxx | 6
extensions/source/plugin/inc/plugin/impl.hxx | 2
extensions/source/scanner/sane.cxx | 2
extensions/source/scanner/sane.hxx | 4
extensions/source/scanner/sanedlg.cxx | 4
filter/source/msfilter/escherex.cxx | 4
filter/source/msfilter/msdffimp.cxx | 8
filter/source/msfilter/svdfppt.cxx | 2
filter/source/pdf/impdialog.cxx | 2
filter/source/svg/svgexport.cxx | 6
forms/source/component/navigationbar.cxx | 12
framework/source/uielement/menubarmanager.cxx | 6
hwpfilter/source/drawing.h | 4
hwpfilter/source/hinfo.cxx | 6
hwpfilter/source/hwpfile.cxx | 8
i18npool/source/localedata/localedata.cxx | 2
idl/source/objects/bastype.cxx | 4
idlc/source/astexpression.cxx | 40
include/connectivity/FValue.hxx | 2
include/editeng/svxacorr.hxx | 2
include/filter/msfilter/svdfppt.hxx | 2
include/o3tl/cow_wrapper.hxx | 4
include/oox/helper/helper.hxx | 2
include/svx/graphctl.hxx | 2
include/tools/bigint.hxx | 2
include/vcl/combobox.hxx | 2
include/vcl/lstbox.hxx | 2
include/vcl/menu.hxx | 2
include/vcl/texteng.hxx | 2
lotuswordpro/source/filter/lwpdivinfo.hxx | 4
lotuswordpro/source/filter/lwplayout.cxx | 33
lotuswordpro/source/filter/lwppara.cxx | 6
lotuswordpro/source/filter/lwptblcell.hxx | 6
lotuswordpro/source/filter/lwptoc.cxx | 4
lotuswordpro/source/filter/lwptoc.hxx | 4
lotuswordpro/source/filter/lwptools.hxx | 4
mysqlc/source/mysqlc_connection.cxx | 2
mysqlc/source/mysqlc_databasemetadata.cxx | 4
mysqlc/source/mysqlc_preparedstatement.cxx | 2
mysqlc/source/mysqlc_statement.cxx | 2
oox/source/drawingml/chart/seriescontext.cxx | 2
oox/source/ppt/timenodelistcontext.cxx | 2
package/source/zipapi/XUnbufferedStream.cxx | 4
package/source/zippackage/ZipPackageStream.cxx | 2
reportdesign/source/core/sdr/ReportUndoFactory.cxx | 8
reportdesign/source/core/sdr/UndoActions.cxx | 2
reportdesign/source/ui/report/dlgedfunc.cxx | 2
rsc/inc/rscdb.hxx | 6
sc/source/core/data/attrib.cxx | 2
sc/source/core/data/column.cxx | 2
sc/source/core/data/dptabres.cxx | 2
sc/source/core/data/patattr.cxx | 2
sc/source/core/opencl/formulagroupcl.cxx | 8
sc/source/core/tool/interpr3.cxx | 6
sc/source/core/tool/rangeseq.cxx | 4
sc/source/filter/excel/excrecds.cxx | 2
sc/source/filter/excel/xeescher.cxx | 2
sc/source/filter/excel/xicontent.cxx | 4
sc/source/ui/app/inputwin.cxx | 2
sc/source/ui/dbgui/imoptdlg.cxx | 2
sc/source/ui/dbgui/scuiimoptdlg.cxx | 5
sc/source/ui/dbgui/validate.cxx | 2
sc/source/ui/miscdlgs/namecrea.cxx | 8
sc/source/ui/unoobj/docuno.cxx | 2
sc/source/ui/vba/vbarange.cxx | 2
sc/source/ui/view/cellsh1.cxx | 34
sc/source/ui/view/cellsh2.cxx | 6
sc/source/ui/view/cellsh3.cxx | 10
sc/source/ui/view/editsh.cxx | 4
sc/source/ui/view/tabview3.cxx | 2
sc/source/ui/view/tabvwsh3.cxx | 4
sc/source/ui/view/tabvwsha.cxx | 2
sc/source/ui/view/tabvwshc.cxx | 4
sd/source/core/drawdoc4.cxx | 2
sd/source/core/undo/undoobjects.cxx | 4
sd/source/filter/eppt/pptx-stylesheet.cxx | 2
sd/source/filter/html/pubdlg.cxx | 2
sd/source/ui/animations/CustomAnimationDialog.cxx | 6
sd/source/ui/animations/CustomAnimationPane.cxx | 4
sd/source/ui/animations/SlideTransitionPane.cxx | 2
sd/source/ui/annotations/annotationmanager.cxx | 4
sd/source/ui/dlg/LayerTabBar.cxx | 2
sd/source/ui/func/fudraw.cxx | 6
sd/source/ui/func/fupage.cxx | 4
sd/source/ui/func/fuparagr.cxx | 2
sd/source/ui/func/smarttag.cxx | 4
sd/source/ui/slideshow/slideshowimpl.cxx | 2
sd/source/ui/unoidl/unoobj.cxx | 6
sd/source/ui/view/ViewShellBase.cxx | 2
sd/source/ui/view/sdruler.cxx | 2
sd/source/ui/view/sdview.cxx | 9
sd/source/ui/view/sdview2.cxx | 2
sdext/source/pdfimport/pdfparse/pdfparse.cxx | 4
sdext/source/presenter/PresenterPaneFactory.cxx | 2
sfx2/source/appl/newhelp.cxx | 6
sfx2/source/appl/opengrf.cxx | 2
sfx2/source/dialog/filtergrouping.cxx | 2
sfx2/source/dialog/templdlg.cxx | 12
sfx2/source/dialog/tplcitem.cxx | 2
sfx2/source/doc/doctemplates.cxx | 2
sfx2/source/doc/objmisc.cxx | 2
sfx2/source/doc/oleprops.cxx | 2
sfx2/source/doc/sfxbasemodel.cxx | 2
sfx2/source/inc/statcach.hxx | 2
sfx2/source/menu/virtmenu.cxx | 2
sfx2/source/sidebar/SidebarController.cxx | 6
sfx2/source/view/viewfrm.cxx | 2
sfx2/source/view/viewfrm2.cxx | 2
slideshow/source/engine/shapes/drawshape.cxx | 3
slideshow/source/inc/interruptabledelayevent.hxx | 2
sot/source/sdstor/storage.cxx | 16
starmath/inc/parse.hxx | 2
starmath/source/mathmlexport.cxx | 2
svl/source/numbers/zforfind.cxx | 8
svtools/source/config/menuoptions.cxx | 4
svtools/source/contnr/imivctl1.cxx | 2
svtools/source/control/filectrl.cxx | 10
svtools/source/misc/templatefoldercache.cxx | 4
svtools/source/table/tablecontrol.cxx | 2
svtools/source/uno/toolboxcontroller.cxx | 2
svtools/source/uno/treecontrolpeer.cxx | 4
svx/source/dialog/_contdlg.cxx | 2
svx/source/dialog/imapdlg.cxx | 2
svx/source/dialog/langbox.cxx | 4
svx/source/dialog/rlrcitem.cxx | 20
svx/source/dialog/svxruler.cxx | 4
svx/source/dialog/swframeexample.cxx | 2
svx/source/fmcomp/fmgridcl.cxx | 2
svx/source/form/fmshell.cxx | 4
svx/source/form/fmshimp.cxx | 4
svx/source/form/fmview.cxx | 2
svx/source/form/formcontroller.cxx | 4
svx/source/sidebar/paragraph/ParaPropertyPanel.cxx | 2
svx/source/svdraw/svdfmtf.cxx | 2
svx/source/svdraw/svdmrkv.cxx | 3
svx/source/svdraw/svdocirc.cxx | 2
svx/source/svdraw/svdotext.cxx | 12
svx/source/svdraw/svdotextpathdecomposition.cxx | 2
svx/source/svdraw/svdundo.cxx | 14
svx/source/table/svdotable.cxx | 2
svx/source/table/tablecontroller.cxx | 2
svx/source/tbxctrls/tbxcolorupdate.cxx | 2
svx/source/unodraw/unoshap2.cxx | 4
svx/source/unodraw/unoshtxt.cxx | 4
svx/source/xml/xmlgrhlp.cxx | 2
sw/inc/calbck.hxx | 2
sw/inc/ndtxt.hxx | 2
sw/inc/printdata.hxx | 2
sw/source/core/access/accfrmobj.cxx | 3
sw/source/core/crsr/crstrvl.cxx | 2
sw/source/core/crsr/pam.cxx | 8
sw/source/core/doc/DocumentRedlineManager.cxx | 2
sw/source/core/doc/doc.cxx | 4
sw/source/core/docnode/section.cxx | 2
sw/source/core/edit/acorrect.cxx | 2
sw/source/core/fields/docufld.cxx | 2
sw/source/core/layout/objectformatter.cxx | 5
sw/source/core/layout/objectformatterlayfrm.cxx | 2
sw/source/core/layout/paintfrm.cxx | 4
sw/source/core/text/txtfld.cxx | 2
sw/source/core/txtnode/fmtatr2.cxx | 4
sw/source/core/txtnode/ndtxt.cxx | 6
sw/source/core/txtnode/thints.cxx | 3
sw/source/core/undo/undel.cxx | 5
sw/source/core/unocore/unofield.cxx | 5
sw/source/core/unocore/unoobj.cxx | 5
sw/source/core/unocore/unoportenum.cxx | 6
sw/source/core/view/printdata.cxx | 2
sw/source/filter/html/htmlnumreader.cxx | 2
sw/source/filter/ww8/docxattributeoutput.cxx | 2
sw/source/filter/ww8/rtfattributeoutput.cxx | 2
sw/source/filter/ww8/writerwordglue.cxx | 2
sw/source/filter/ww8/wrtw8nds.cxx | 5
sw/source/filter/ww8/wrtww8.cxx | 4
sw/source/filter/ww8/ww8atr.cxx | 8
sw/source/filter/ww8/ww8graf.cxx | 2
sw/source/filter/ww8/ww8graf2.cxx | 2
sw/source/filter/ww8/ww8par.cxx | 12
sw/source/filter/ww8/ww8par.hxx | 8
sw/source/filter/ww8/ww8par2.cxx | 12
sw/source/filter/ww8/ww8par3.cxx | 2
sw/source/filter/ww8/ww8par4.cxx | 2
sw/source/filter/ww8/ww8par5.cxx | 2
sw/source/filter/ww8/ww8par6.cxx | 4
sw/source/filter/ww8/ww8scan.cxx | 16
sw/source/filter/ww8/ww8scan.hxx | 2
sw/source/ui/dbui/selectdbtabledialog.cxx | 2
sw/source/uibase/app/swmodul1.cxx | 6
sw/source/uibase/docvw/PostItMgr.cxx | 2
sw/source/uibase/lingu/hhcwrp.cxx | 2
sw/source/uibase/sidebar/PageMarginControl.cxx | 2
sw/source/uibase/uiview/view2.cxx | 3
toolkit/source/awt/vclxfont.cxx | 2
toolkit/source/awt/vclxwindows.cxx | 6
toolkit/source/controls/unocontrolmodel.cxx | 2
toolkit/source/helper/property.cxx | 2
toolkit/source/helper/unopropertyarrayhelper.cxx | 2
toolkit/source/helper/unowrapper.cxx | 2
tools/source/generic/bigint.cxx | 2
tools/source/zcodec/zcodec.cxx | 2
ucb/source/ucp/ftp/ftpcontent.cxx | 6
ucb/source/ucp/webdav-neon/DateTimeHelper.cxx | 2
unotools/source/config/configvaluecontainer.cxx | 2
unotools/source/config/searchopt.cxx | 2
vcl/generic/fontmanager/fontmanager.cxx | 4
vcl/generic/print/common_gfx.cxx | 2
vcl/generic/print/genprnpsp.cxx | 8
vcl/generic/print/printerjob.cxx | 9
vcl/inc/ilstbox.hxx | 2
vcl/inc/openglgdiimpl.hxx | 2
vcl/osx/salframeview.mm | 2
vcl/osx/salnativewidgets.cxx | 6
vcl/source/app/svapp.cxx | 2
vcl/source/control/button.cxx | 7
vcl/source/control/combobox.cxx | 4
vcl/source/control/ilstbox.cxx | 4
vcl/source/control/lstbox.cxx | 6
vcl/source/control/scrbar.cxx | 14
vcl/source/control/spinfld.cxx | 2
vcl/source/edit/textdat2.hxx | 2
vcl/source/edit/texteng.cxx | 4
vcl/source/edit/textview.cxx | 2
vcl/source/filter/ixpm/xpmread.cxx | 2
vcl/source/gdi/bitmap4.cxx | 2
vcl/source/gdi/bitmapex.cxx | 2
vcl/source/gdi/pdfwriter_impl2.cxx | 4
vcl/source/gdi/print.cxx | 2
vcl/source/gdi/print2.cxx | 4
vcl/source/gdi/virdev.cxx | 2
vcl/source/opengl/OpenGLHelper.cxx | 2
vcl/source/outdev/bitmap.cxx | 2
vcl/source/window/brdwin.cxx | 4
vcl/source/window/menu.cxx | 6
vcl/source/window/menufloatingwindow.cxx | 2
vcl/source/window/splitwin.cxx | 4
vcl/source/window/stacking.cxx | 2
vcl/source/window/toolbox.cxx | 6
vcl/source/window/toolbox2.cxx | 2
vcl/source/window/window.cxx | 10
vcl/unx/generic/dtrans/X11_selection.cxx | 4
vcl/unx/generic/printer/ppdparser.cxx | 2
vcl/unx/generic/window/salframe.cxx | 4
vcl/unx/gtk/window/gtksalmenu.cxx | 2
writerfilter/source/dmapper/DomainMapper.cxx | 16
writerfilter/source/dmapper/GraphicImport.cxx | 2
writerfilter/source/dmapper/SettingsTable.cxx | 4
xmloff/source/draw/shapeimport.cxx | 2
xmloff/source/meta/xmlmetae.cxx | 2
xmloff/source/style/WordWrapPropertyHdl.cxx | 4
xmloff/source/text/txtlists.cxx | 6
xmloff/source/transform/Oasis2OOo.cxx | 4
xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx | 4
319 files changed, 1670 insertions(+), 672 deletions(-)
New commits:
commit 2d855ab9d09d09c26aa68b854a79be2a13faa8d5
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Apr 24 12:35:53 2015 +0200
loplugin:simplifybool
Change-Id: I44b563269a68cd2d57a906e10939ac290a0a2ebd
diff --git a/compilerplugins/clang/simplifybool.cxx b/compilerplugins/clang/simplifybool.cxx
new file mode 100644
index 0000000..5bdb4cf
--- /dev/null
+++ b/compilerplugins/clang/simplifybool.cxx
@@ -0,0 +1,1029 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ */
+
+#include "plugin.hxx"
+
+namespace {
+
+Expr const * ignoreParenImpCastAndComma(Expr const * expr) {
+ for (;;) {
+ expr = expr->IgnoreParenImpCasts();
+ auto e = dyn_cast<BinaryOperator>(expr);
+ if (e == nullptr || e->getOpcode() != BO_Comma) {
+ return expr;
+ }
+ expr = e->getRHS();
+ }
+}
+
+Expr const * getSubExprOfLogicalNegation(Expr const * expr) {
+ auto e = dyn_cast<UnaryOperator>(ignoreParenImpCastAndComma(expr));
+ return e == nullptr || e->getOpcode() != UO_LNot
+ ? nullptr : e->getSubExpr();
+}
+
+enum class Value { Unknown, False, True };
+
+Value getValue(Expr const * expr) {
+ if (expr->getType()->isBooleanType()) {
+ auto lit
+ = dyn_cast<CXXBoolLiteralExpr>(ignoreParenImpCastAndComma(expr));
+ if (lit != nullptr) {
+ return lit->getValue() ? Value::True : Value::False;
+ }
+ }
+ return Value::Unknown;
+}
+
+class SimplifyBool:
+ public RecursiveASTVisitor<SimplifyBool>, public loplugin::Plugin
+{
+public:
+ explicit SimplifyBool(InstantiationData const & data): Plugin(data) {}
+
+ void run() override;
+
+ bool VisitUnaryLNot(UnaryOperator const * expr);
+
+ bool VisitBinLT(BinaryOperator const * expr);
+
+ bool VisitBinGT(BinaryOperator const * expr);
+
+ bool VisitBinLE(BinaryOperator const * expr);
+
+ bool VisitBinGE(BinaryOperator const * expr);
+
+ bool VisitBinEQ(BinaryOperator const * expr);
+
+ bool VisitBinNE(BinaryOperator const * expr);
+
+ bool VisitConditionalOperator(ConditionalOperator const * expr);
+};
+
+void SimplifyBool::run() {
+ if (compiler.getLangOpts().CPlusPlus) {
+ TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+ }
+}
+
+bool SimplifyBool::VisitUnaryLNot(UnaryOperator const * expr) {
+ if (ignoreLocation(expr)) {
+ return true;
+ }
+ auto e = getSubExprOfLogicalNegation(expr->getSubExpr());
+ if (e == nullptr) {
+ return true;
+ }
+/* hits for OSL_ENSURE(!b, ...);
+ 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;
+}
+
+bool SimplifyBool::VisitBinLT(BinaryOperator const * expr) {
+ if (ignoreLocation(expr)) {
+ return true;
+ }
+ if (!(expr->getLHS()->IgnoreImpCasts()->getType()->isBooleanType()
+ && expr->getRHS()->IgnoreImpCasts()->getType()->isBooleanType()))
+ {
+ return true;
+ }
+ auto v1 = getValue(expr->getLHS());
+ auto v2 = getValue(expr->getRHS());
+ switch (v1) {
+ case Value::Unknown:
+ switch (v2) {
+ case Value::Unknown:
+ break;
+ case Value::False:
+ report(
+ DiagnosticsEngine::Warning,
+ ("less-than expression of the form 'A < false' (with A of type"
+ " %0) can logically be simplified as 'false'"),
+ expr->getLocStart())
+ << expr->getLHS()->IgnoreImpCasts()->getType()
+ << expr->getSourceRange();
+ break;
+ case Value::True:
+ {
+ auto e = getSubExprOfLogicalNegation(expr->getLHS());
+ if (e == nullptr) {
+ report(
+ DiagnosticsEngine::Warning,
+ ("less-than expression of the form 'A < true' (with A"
+ " of type %0) can %select{logically|literally}1 be"
+ " simplified as '!A'"),
+ expr->getLocStart())
+ << expr->getLHS()->IgnoreImpCasts()->getType()
+ << (expr->getLHS()->IgnoreImpCasts()->getType()
+ ->isBooleanType())
+ << expr->getSourceRange();
+ } else {
+ report(
+ DiagnosticsEngine::Warning,
+ ("less-than expression of the form '!A < true' (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();
+ }
+ break;
+ }
+ }
+ break;
+ case Value::False:
+ switch (v2) {
+ case Value::Unknown:
+ report(
+ DiagnosticsEngine::Warning,
+ ("less-than expression of the form 'false < A' (with A of type"
+ " %0) can %select{logically|literally}1 be simplified as 'A'"),
+ expr->getLocStart())
+ << expr->getRHS()->IgnoreImpCasts()->getType()
+ << expr->getRHS()->IgnoreImpCasts()->getType()->isBooleanType()
+ << expr->getSourceRange();
+ break;
+ case Value::False:
+ report(
+ DiagnosticsEngine::Warning,
+ ("less-than expression of the form 'false < false' can"
+ " literally be simplified as 'false'"),
+ expr->getLocStart())
+ << expr->getSourceRange();
+ break;
+ case Value::True:
+ report(
+ DiagnosticsEngine::Warning,
+ ("less-than expression of the form 'false < true' can"
+ " literally be simplified as 'true'"),
+ expr->getLocStart())
+ << expr->getSourceRange();
+ break;
+ }
+ break;
+ case Value::True:
+ switch (v2) {
+ case Value::Unknown:
+ report(
+ DiagnosticsEngine::Warning,
+ ("less-than expression of the form 'true < A' (with A of type"
+ " %0) can logically be simplified as 'false'"),
+ expr->getLocStart())
+ << expr->getRHS()->IgnoreImpCasts()->getType()
+ << expr->getSourceRange();
+ break;
+ case Value::False:
+ report(
+ DiagnosticsEngine::Warning,
+ ("less-than expression of the form 'true < false' can"
+ " literally be simplified as 'false'"),
+ expr->getLocStart())
+ << expr->getSourceRange();
+ break;
+ case Value::True:
+ report(
+ DiagnosticsEngine::Warning,
+ ("less-than expression of the form 'true < true' can"
+ " literally be simplified as 'false'"),
+ expr->getLocStart())
+ << expr->getSourceRange();
+ break;
+ }
+ break;
+ }
+ return true;
+}
+
+bool SimplifyBool::VisitBinGT(BinaryOperator const * expr) {
+ if (ignoreLocation(expr)) {
+ return true;
+ }
+ if (!(expr->getLHS()->IgnoreImpCasts()->getType()->isBooleanType()
+ && expr->getRHS()->IgnoreImpCasts()->getType()->isBooleanType()))
+ {
+ return true;
+ }
+ auto v1 = getValue(expr->getLHS());
+ auto v2 = getValue(expr->getRHS());
+ switch (v1) {
+ case Value::Unknown:
+ switch (v2) {
+ case Value::Unknown:
+ break;
+ case Value::False:
+ report(
+ DiagnosticsEngine::Warning,
+ ("greater-than expression of the form 'A > false' (with A of"
+ " type %0) can %select{logically|literally}1 be simplified as"
+ " 'A'"),
+ expr->getLocStart())
+ << expr->getLHS()->IgnoreImpCasts()->getType()
+ << expr->getLHS()->IgnoreImpCasts()->getType()->isBooleanType()
+ << expr->getSourceRange();
+ break;
+ case Value::True:
+ report(
+ DiagnosticsEngine::Warning,
+ ("greater-than expression of the form 'A > true' (with A of"
+ " type %0) can logically be simplified as 'false'"),
+ expr->getLocStart())
+ << expr->getLHS()->IgnoreImpCasts()->getType()
+ << expr->getSourceRange();
+ break;
+ }
+ break;
+ case Value::False:
+ switch (v2) {
+ case Value::Unknown:
+ report(
+ DiagnosticsEngine::Warning,
+ ("greater-than expression of the form 'false > A' (with A of"
+ " type %0) can logically be simplified as 'false'"),
+ expr->getLocStart())
+ << expr->getRHS()->IgnoreImpCasts()->getType()
+ << expr->getSourceRange();
+ break;
+ case Value::False:
+ report(
+ DiagnosticsEngine::Warning,
+ ("greater-than expression of the form 'false > false' can"
+ " literally be simplified as 'false'"),
+ expr->getLocStart())
+ << expr->getSourceRange();
+ break;
+ case Value::True:
+ report(
+ DiagnosticsEngine::Warning,
+ ("greater-than expression of the form 'false > true' can"
+ " literally be simplified as 'false'"),
+ expr->getLocStart())
+ << expr->getSourceRange();
+ break;
+ }
+ break;
+ case Value::True:
+ switch (v2) {
+ case Value::Unknown:
+ {
+ auto e = getSubExprOfLogicalNegation(expr->getRHS());
+ if (e == nullptr) {
+ report(
+ DiagnosticsEngine::Warning,
+ ("greater-than expression of the form 'true > A' (with"
+ " A of type %0) can %select{logically|literally}1 be"
+ " simplified as '!A'"),
+ expr->getLocStart())
+ << expr->getRHS()->IgnoreImpCasts()->getType()
+ << (expr->getRHS()->IgnoreImpCasts()->getType()
+ ->isBooleanType())
+ << expr->getSourceRange();
+ } else {
+ report(
+ DiagnosticsEngine::Warning,
+ ("greater-than expression of the form 'true > !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();
+ }
+ break;
+ }
+ case Value::False:
+ report(
+ DiagnosticsEngine::Warning,
+ ("greater-than expression of the form 'true > false' can"
+ " literally be simplified as 'true'"),
+ expr->getLocStart())
+ << expr->getSourceRange();
+ break;
+ case Value::True:
+ report(
+ DiagnosticsEngine::Warning,
+ ("greater-than expression of the form 'true > true' can"
+ " literally be simplified as 'false'"),
+ expr->getLocStart())
+ << expr->getSourceRange();
+ break;
+ }
+ break;
+ }
+ return true;
+}
+
+bool SimplifyBool::VisitBinLE(BinaryOperator const * expr) {
+ if (ignoreLocation(expr)) {
+ return true;
+ }
+ if (!(expr->getLHS()->IgnoreImpCasts()->getType()->isBooleanType()
+ && expr->getRHS()->IgnoreImpCasts()->getType()->isBooleanType()))
+ {
+ return true;
+ }
+ auto v1 = getValue(expr->getLHS());
+ auto v2 = getValue(expr->getRHS());
+ switch (v1) {
+ case Value::Unknown:
+ switch (v2) {
+ case Value::Unknown:
+ break;
+ case Value::False:
+ {
+ auto e = getSubExprOfLogicalNegation(expr->getLHS());
+ if (e == nullptr) {
+ report(
+ DiagnosticsEngine::Warning,
+ ("less-than-or-equal-to expression of the form 'A <="
+ " false' (with A of type %0) can"
+ " %select{logically|literally}1 be simplified as"
+ " '!A'"),
+ expr->getLocStart())
+ << expr->getLHS()->IgnoreImpCasts()->getType()
+ << (expr->getLHS()->IgnoreImpCasts()->getType()
+ ->isBooleanType())
+ << expr->getSourceRange();
+ } else {
+ report(
+ DiagnosticsEngine::Warning,
+ ("less-than-or-equal-to expression of the form '!A <="
+ " false' (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();
+ }
+ break;
+ }
+ case Value::True:
+ report(
+ DiagnosticsEngine::Warning,
+ ("less-than-or-equal-to expression of the form 'A <= true'"
+ " (with A of type %0) can logically be simplified as 'true'"),
+ expr->getLocStart())
+ << expr->getLHS()->IgnoreImpCasts()->getType()
+ << expr->getSourceRange();
+ break;
+ }
+ break;
+ case Value::False:
+ switch (v2) {
+ case Value::Unknown:
+ report(
+ DiagnosticsEngine::Warning,
+ ("less-than-or-equal-to expression of the form 'false <= A'"
+ " (with A of type %0) can logically be simplified as 'true'"),
+ expr->getLocStart())
+ << expr->getRHS()->IgnoreImpCasts()->getType()
+ << expr->getSourceRange();
+ break;
+ case Value::False:
+ report(
+ DiagnosticsEngine::Warning,
+ ("less-than-or-equal-to expression of the form 'false <= false'"
+ " can literally be simplified as 'true'"),
+ expr->getLocStart())
+ << expr->getSourceRange();
+ break;
+ case Value::True:
+ report(
+ DiagnosticsEngine::Warning,
+ ("less-than-or-equal-to expression of the form 'false <= true'"
+ " can literally be simplified as 'true'"),
+ expr->getLocStart())
+ << expr->getSourceRange();
+ break;
+ }
+ break;
+ case Value::True:
+ switch (v2) {
+ case Value::Unknown:
+ report(
+ DiagnosticsEngine::Warning,
+ ("less-than-or-equal-to expression of the form 'true <= A'"
+ " (with A of type %0) can %select{logically|literally}1 be"
+ " simplified as 'A'"),
+ expr->getLocStart())
+ << expr->getRHS()->IgnoreImpCasts()->getType()
+ << expr->getRHS()->IgnoreImpCasts()->getType()->isBooleanType()
+ << expr->getSourceRange();
+ break;
+ case Value::False:
+ report(
+ DiagnosticsEngine::Warning,
+ ("less-than-or-equal-to expression of the form 'true <= false'"
+ " can literally be simplified as 'false'"),
+ expr->getLocStart())
+ << expr->getSourceRange();
+ break;
+ case Value::True:
+ report(
+ DiagnosticsEngine::Warning,
+ ("less-than-or-equal-to expression of the form 'true <= true'"
+ " can literally be simplified as 'true'"),
+ expr->getLocStart())
+ << expr->getSourceRange();
+ break;
+ }
+ break;
+ }
+ return true;
+}
+
+bool SimplifyBool::VisitBinGE(BinaryOperator const * expr) {
+ if (ignoreLocation(expr)) {
+ return true;
+ }
+ if (!(expr->getLHS()->IgnoreImpCasts()->getType()->isBooleanType()
+ && expr->getRHS()->IgnoreImpCasts()->getType()->isBooleanType()))
+ {
+ return true;
+ }
+ auto v1 = getValue(expr->getLHS());
+ auto v2 = getValue(expr->getRHS());
+ switch (v1) {
+ case Value::Unknown:
+ switch (v2) {
+ case Value::Unknown:
+ break;
+ case Value::False:
+ report(
+ DiagnosticsEngine::Warning,
+ ("greater-than-or-equal-to expression of the form 'A >= false'"
+ " (with A of type %0) can logically be simplified as 'true'"),
+ expr->getLocStart())
+ << expr->getLHS()->IgnoreImpCasts()->getType()
+ << expr->getSourceRange();
+ break;
+ case Value::True:
+ report(
+ DiagnosticsEngine::Warning,
+ ("greater-than-or-equal-to expression of the form 'A >= true'"
+ " (with A of type %0) can %select{logically|literally}1 be"
+ " simplified as 'A'"),
+ expr->getLocStart())
+ << expr->getLHS()->IgnoreImpCasts()->getType()
+ << expr->getLHS()->IgnoreImpCasts()->getType()->isBooleanType()
+ << expr->getSourceRange();
+ break;
+ }
+ break;
+ case Value::False:
+ switch (v2) {
+ case Value::Unknown:
+ {
+ auto e = getSubExprOfLogicalNegation(expr->getRHS());
+ if (e == nullptr) {
+ report(
+ DiagnosticsEngine::Warning,
+ ("greater-than-or-equal-to expression of the form"
+ " 'false >= A' (with A of type %0) can"
+ " %select{logically|literally}1 be simplified as"
+ " '!A'"),
+ expr->getLocStart())
+ << expr->getRHS()->IgnoreImpCasts()->getType()
+ << (expr->getRHS()->IgnoreImpCasts()->getType()
+ ->isBooleanType())
+ << expr->getSourceRange();
+ } else {
+ report(
+ DiagnosticsEngine::Warning,
+ ("greater-than-or-equal-to expression of the form"
+ " 'false >= !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();
+ }
+ break;
+ }
+ case Value::False:
+ report(
+ DiagnosticsEngine::Warning,
+ ("greater-than-or-equal-to expression of the form 'false >="
+ " false' can literally be simplified as 'true'"),
+ expr->getLocStart())
+ << expr->getSourceRange();
+ break;
+ case Value::True:
+ report(
+ DiagnosticsEngine::Warning,
+ ("greater-than-or-equal-to expression of the form 'false >="
+ " true' can literally be simplified as 'false'"),
+ expr->getLocStart())
+ << expr->getSourceRange();
+ break;
+ }
+ break;
+ case Value::True:
+ switch (v2) {
+ case Value::Unknown:
+ report(
+ DiagnosticsEngine::Warning,
+ ("greater-than-or-equal-to expression of the form 'true >= A'"
+ " (with A of type %0) can logically be simplified as 'true'"),
+ expr->getLocStart())
+ << expr->getRHS()->IgnoreImpCasts()->getType()
+ << expr->getSourceRange();
+ break;
+ case Value::False:
+ report(
+ DiagnosticsEngine::Warning,
+ ("greater-than-or-equal-to expression of the form 'true >="
+ " false' can literally be simplified as 'true'"),
+ expr->getLocStart())
+ << expr->getSourceRange();
+ break;
+ case Value::True:
+ report(
+ DiagnosticsEngine::Warning,
+ ("greater-than-or-equal-to expression of the form 'true >="
+ " true' can literally be simplified as 'true'"),
+ expr->getLocStart())
+ << expr->getSourceRange();
+ break;
+ }
+ break;
+ }
+ return true;
+}
+
+bool SimplifyBool::VisitBinEQ(BinaryOperator const * expr) {
+ if (ignoreLocation(expr)) {
+ return true;
+ }
+ if (!(expr->getLHS()->IgnoreImpCasts()->getType()->isBooleanType()
+ && expr->getRHS()->IgnoreImpCasts()->getType()->isBooleanType()))
+ {
+ return true;
+ }
+ auto v1 = getValue(expr->getLHS());
+ auto v2 = getValue(expr->getRHS());
+ switch (v1) {
+ case Value::Unknown:
+ switch (v2) {
+ case Value::Unknown:
+ break;
+ case Value::False:
+ {
+ auto e = getSubExprOfLogicalNegation(expr->getLHS());
+ if (e == nullptr) {
+ report(
+ DiagnosticsEngine::Warning,
+ ("equal-to expression of the form 'A == false' (with A"
+ " of type %0) can %select{logically|literally}1 be"
+ " simplified as '!A'"),
+ expr->getLocStart())
+ << expr->getLHS()->IgnoreImpCasts()->getType()
+ << (expr->getLHS()->IgnoreImpCasts()->getType()
+ ->isBooleanType())
+ << expr->getSourceRange();
+ } else {
+ report(
+ DiagnosticsEngine::Warning,
+ ("equal-to expression of the form '!A == false' (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();
+ }
+ break;
+ }
+ case Value::True:
+ report(
+ DiagnosticsEngine::Warning,
+ ("equal-to expression of the form 'A == true' (with A of type"
+ " %0) can %select{logically|literally}1 be simplified as 'A'"),
+ expr->getLocStart())
+ << expr->getLHS()->IgnoreImpCasts()->getType()
+ << expr->getLHS()->IgnoreImpCasts()->getType()->isBooleanType()
+ << expr->getSourceRange();
+ break;
+ }
+ break;
+ case Value::False:
+ switch (v2) {
+ case Value::Unknown:
+ {
+ auto e = getSubExprOfLogicalNegation(expr->getRHS());
+ if (e == nullptr) {
+ report(
+ DiagnosticsEngine::Warning,
+ ("equal-to expression of the form 'false == A' (with A"
+ " of type %0) can %select{logically|literally}1 be"
+ " simplified as '!A'"),
+ expr->getLocStart())
+ << expr->getRHS()->IgnoreImpCasts()->getType()
+ << (expr->getRHS()->IgnoreImpCasts()->getType()
+ ->isBooleanType())
+ << expr->getSourceRange();
+ } else {
+ report(
+ DiagnosticsEngine::Warning,
+ ("equal-to expression of the form 'false == !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();
+ }
+ break;
+ }
+ case Value::False:
+ report(
+ DiagnosticsEngine::Warning,
+ ("equal-to expression of the form 'false == false' can"
+ " literally be simplified as 'true'"),
+ expr->getLocStart())
+ << expr->getSourceRange();
+ break;
+ case Value::True:
+ report(
+ DiagnosticsEngine::Warning,
+ ("equal-to expression of the form 'false == true' can"
+ " literally be simplified as 'false'"),
+ expr->getLocStart())
+ << expr->getSourceRange();
+ break;
+ }
+ break;
+ case Value::True:
+ switch (v2) {
+ case Value::Unknown:
+ report(
+ DiagnosticsEngine::Warning,
+ ("equal-to expression of the form 'true == A' (with A of type"
+ " %0) can %select{logically|literally}1 be simplified as 'A'"),
+ expr->getLocStart())
+ << expr->getRHS()->IgnoreImpCasts()->getType()
+ << expr->getRHS()->IgnoreImpCasts()->getType()->isBooleanType()
+ << expr->getSourceRange();
+ break;
+ case Value::False:
+ report(
+ DiagnosticsEngine::Warning,
+ ("equal-to expression of the form 'true == false' can"
+ " literally be simplified as 'false'"),
+ expr->getLocStart())
+ << expr->getSourceRange();
+ break;
+ case Value::True:
+ report(
+ DiagnosticsEngine::Warning,
+ ("equal-to expression of the form 'true == true' can"
+ " literally be simplified as 'true'"),
+ expr->getLocStart())
+ << expr->getSourceRange();
+ break;
+ }
+ break;
+ }
+ return true;
+}
+
+bool SimplifyBool::VisitBinNE(BinaryOperator const * expr) {
+ if (ignoreLocation(expr)) {
+ return true;
+ }
+ if (!(expr->getLHS()->IgnoreImpCasts()->getType()->isBooleanType()
+ && expr->getRHS()->IgnoreImpCasts()->getType()->isBooleanType()))
+ {
+ return true;
+ }
+ auto v1 = getValue(expr->getLHS());
+ auto v2 = getValue(expr->getRHS());
+ switch (v1) {
+ case Value::Unknown:
+ switch (v2) {
+ case Value::Unknown:
+ break;
+ case Value::False:
+ report(
+ DiagnosticsEngine::Warning,
+ ("not-equal-to expression of the form 'A != false' (with A of"
+ " type %0) can %select{logically|literally}1 be simplified as"
+ " 'A'"),
+ expr->getLocStart())
+ << expr->getLHS()->IgnoreImpCasts()->getType()
+ << expr->getLHS()->IgnoreImpCasts()->getType()->isBooleanType()
+ << expr->getSourceRange();
+ break;
+ case Value::True:
+ {
+ auto e = getSubExprOfLogicalNegation(expr->getLHS());
+ if (e == nullptr) {
+ report(
+ DiagnosticsEngine::Warning,
+ ("not-equal-to expression of the form 'A != true' (with"
+ " A of type %0) can %select{logically|literally}1 be"
+ " simplified as '!A'"),
+ expr->getLocStart())
+ << expr->getLHS()->IgnoreImpCasts()->getType()
+ << (expr->getLHS()->IgnoreImpCasts()->getType()
+ ->isBooleanType())
+ << expr->getSourceRange();
+ } else {
+ report(
+ DiagnosticsEngine::Warning,
+ ("not-equal-to expression of the form '!A != true'"
+ " (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();
+ }
+ break;
+ }
+ }
+ break;
+ case Value::False:
+ switch (v2) {
+ case Value::Unknown:
+ report(
+ DiagnosticsEngine::Warning,
+ ("not-equal-to expression of the form 'false != A' (with A of"
+ " type %0) can %select{logically|literally}1 be simplified as"
+ " 'A'"),
+ expr->getLocStart())
+ << expr->getRHS()->IgnoreImpCasts()->getType()
+ << expr->getRHS()->IgnoreImpCasts()->getType()->isBooleanType()
+ << expr->getSourceRange();
+ break;
+ case Value::False:
+ report(
+ DiagnosticsEngine::Warning,
+ ("not-equal-to expression of the form 'false != false' can"
+ " literally be simplified as 'false'"),
+ expr->getLocStart())
+ << expr->getSourceRange();
+ break;
+ case Value::True:
+ report(
+ DiagnosticsEngine::Warning,
+ ("not-equal-to expression of the form 'false != true' can"
+ " literally be simplified as 'true'"),
+ expr->getLocStart())
+ << expr->getSourceRange();
+ break;
+ }
+ break;
+ case Value::True:
+ switch (v2) {
+ case Value::Unknown:
+ {
+ auto e = getSubExprOfLogicalNegation(expr->getRHS());
+ if (e == nullptr) {
+ report(
+ DiagnosticsEngine::Warning,
+ ("not-equal-to expression of the form 'true != A' (with"
+ " A of type %0) can %select{logically|literally}1 be"
+ " simplified as '!A'"),
+ expr->getLocStart())
+ << expr->getRHS()->IgnoreImpCasts()->getType()
+ << (expr->getRHS()->IgnoreImpCasts()->getType()
+ ->isBooleanType())
+ << expr->getSourceRange();
+ } else {
+ report(
+ DiagnosticsEngine::Warning,
+ ("not-equal-to expression of the form 'true != !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();
+ }
+ break;
+ }
+ case Value::False:
+ report(
+ DiagnosticsEngine::Warning,
+ ("not-equal-to expression of the form 'true != false' can"
+ " literally be simplified as 'true'"),
+ expr->getLocStart())
+ << expr->getSourceRange();
+ break;
+ case Value::True:
+ report(
+ DiagnosticsEngine::Warning,
+ ("not-equal-to expression of the form 'true != true' can"
+ " literally be simplified as 'false'"),
+ expr->getLocStart())
+ << expr->getSourceRange();
+ break;
+ }
+ break;
+ }
+ return true;
+}
+
+bool SimplifyBool::VisitConditionalOperator(ConditionalOperator const * expr) {
+ if (ignoreLocation(expr)) {
+ return true;
+ }
+ auto v1 = getValue(expr->getTrueExpr());
+ auto v2 = getValue(expr->getFalseExpr());
+ switch (v1) {
+ case Value::Unknown:
+ switch (v2) {
+ case Value::Unknown:
+ break;
+ case Value::False:
+ report(
+ DiagnosticsEngine::Warning,
+ ("conditional expression of the form 'A ? B : false' (with A of"
+ " type %0 and B of type %1) can %select{logically|literally}2"
+ " be simplified as 'A && B'"),
+ expr->getLocStart())
+ << expr->getCond()->IgnoreImpCasts()->getType()
+ << expr->getTrueExpr()->IgnoreImpCasts()->getType()
+ << ((expr->getCond()->IgnoreImpCasts()->getType()
+ ->isBooleanType())
+ && (expr->getTrueExpr()->IgnoreImpCasts()->getType()
+ ->isBooleanType()))
+ << expr->getSourceRange();
+ break;
+ case Value::True:
+ {
+ auto e = getSubExprOfLogicalNegation(expr->getCond());
+ if (e == nullptr) {
+ report(
+ DiagnosticsEngine::Warning,
+ ("conditional expression of the form 'A ? B : true'"
+ " (with A of type %0 and B of type %1) can"
+ " %select{logically|literally}2 be simplified as '!A"
+ " || B'"),
+ expr->getLocStart())
+ << expr->getCond()->IgnoreImpCasts()->getType()
+ << expr->getTrueExpr()->IgnoreImpCasts()->getType()
+ << ((expr->getCond()->IgnoreImpCasts()->getType()
+ ->isBooleanType())
+ && (expr->getTrueExpr()->IgnoreImpCasts()->getType()
+ ->isBooleanType()))
+ << expr->getSourceRange();
+ } else {
+ report(
+ DiagnosticsEngine::Warning,
+ ("conditional expression of the form '!A ? B : true'"
+ " (with A of type %0 and B of type %1) can"
+ " %select{logically|literally}2 be simplified as 'A ||"
+ " B'"),
+ expr->getLocStart())
+ << e->IgnoreImpCasts()->getType()
+ << expr->getTrueExpr()->IgnoreImpCasts()->getType()
+ << (e->IgnoreImpCasts()->getType()->isBooleanType()
+ && (expr->getTrueExpr()->IgnoreImpCasts()
+ ->getType()->isBooleanType()))
+ << expr->getSourceRange();
+ }
+ break;
+ }
+ }
+ break;
+ case Value::False:
+ switch (v2) {
+ case Value::Unknown:
+ {
+ auto e = getSubExprOfLogicalNegation(expr->getCond());
+ if (e == nullptr) {
+ report(
+ DiagnosticsEngine::Warning,
+ ("conditional expression of the form 'A ? false : B'"
+ " (with A of type %0 and B of type %1) can"
+ " %select{logically|literally}2 be simplified as '!A"
+ " && B'"),
+ expr->getLocStart())
+ << expr->getCond()->IgnoreImpCasts()->getType()
+ << expr->getFalseExpr()->IgnoreImpCasts()->getType()
+ << ((expr->getCond()->IgnoreImpCasts()->getType()
+ ->isBooleanType())
+ && (expr->getFalseExpr()->IgnoreImpCasts()
+ ->getType()->isBooleanType()))
+ << expr->getSourceRange();
+ } else {
+ report(
+ DiagnosticsEngine::Warning,
+ ("conditional expression of the form '!A ? false : B'"
+ " (with A of type %0 and B of type %1) can"
+ " %select{logically|literally}2 be simplified as 'A &&"
+ " B'"),
+ expr->getLocStart())
+ << e->IgnoreImpCasts()->getType()
+ << expr->getFalseExpr()->IgnoreImpCasts()->getType()
+ << (e->IgnoreImpCasts()->getType()->isBooleanType()
+ && (expr->getFalseExpr()->IgnoreImpCasts()
+ ->getType()->isBooleanType()))
+ << expr->getSourceRange();
+ }
+ break;
+ }
+ case Value::False:
+ report(
+ DiagnosticsEngine::Warning,
+ ("conditional expression of the form 'A ? false : false' (with"
+ " A of type %0) can logically be simplified as 'false'"),
+ expr->getLocStart())
+ << expr->getCond()->IgnoreImpCasts()->getType()
+ << expr->getSourceRange();
+ break;
+ case Value::True:
+ {
+ auto e = getSubExprOfLogicalNegation(expr->getCond());
+ if (e == nullptr) {
+ report(
+ DiagnosticsEngine::Warning,
+ ("conditional expression of the form 'A ? false : true'"
+ " (with A of type %0) can"
+ " %select{logically|literally}1 be simplified as"
+ " '!A'"),
+ expr->getLocStart())
+ << expr->getCond()->IgnoreImpCasts()->getType()
+ << (expr->getCond()->IgnoreImpCasts()->getType()
+ ->isBooleanType())
+ << expr->getSourceRange();
+ } else {
+ report(
+ DiagnosticsEngine::Warning,
+ ("conditional expression of the form '!A ? false :"
+ " true' (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();
+ }
+ break;
+ }
+ }
+ break;
+ case Value::True:
+ switch (v2) {
+ case Value::Unknown:
+ report(
+ DiagnosticsEngine::Warning,
+ ("conditional expression of the form 'A ? true : B' (with A of"
+ " type %0 and B of type %1) can %select{logically|literally}2"
+ " be simplified as 'A || B'"),
+ expr->getLocStart())
+ << expr->getCond()->IgnoreImpCasts()->getType()
+ << expr->getFalseExpr()->IgnoreImpCasts()->getType()
+ << ((expr->getCond()->IgnoreImpCasts()->getType()
+ ->isBooleanType())
+ && (expr->getFalseExpr()->IgnoreImpCasts()->getType()
+ ->isBooleanType()))
+ << expr->getSourceRange();
+ break;
+ case Value::False:
+ report(
+ DiagnosticsEngine::Warning,
+ ("conditional expression of the form 'A ? true : false' (with A"
+ " of type %0) can %select{logically|literally}1 be simplified"
+ " as 'A'"),
+ expr->getLocStart())
+ << expr->getCond()->IgnoreImpCasts()->getType()
+ << expr->getCond()->IgnoreImpCasts()->getType()->isBooleanType()
+ << expr->getSourceRange();
+ break;
+ case Value::True:
+ report(
+ DiagnosticsEngine::Warning,
+ ("conditional expression of the form 'A ? true : true' (with A"
+ " of type %0) can logically be simplified as 'true'"),
+ expr->getLocStart())
+ << expr->getCond()->IgnoreImpCasts()->getType()
+ << expr->getSourceRange();
+ break;
+ }
+ break;
+ }
+ return true;
+}
+
+loplugin::Plugin::Registration<SimplifyBool> X("simplifybool");
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 6ef8f9de0257b712d43634d389d8021c7bf67833
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Apr 24 12:35:17 2015 +0200
loplugin:simplifybool
Change-Id: I54f9e6d879c973c8d47226bd87a4b38404ed8f45
diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
index 5329700..27c12ae 100644
--- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
@@ -204,7 +204,7 @@ OUString SAL_CALL X509Certificate_NssImpl :: getSubjectName() throw ( ::com::sun
if( (*extns)->critical.data == NULL )
crit = false ;
else
- crit = ( (*extns)->critical.data[0] == 0xFF ) ? true : false ;
+ crit = (*extns)->critical.data[0] == 0xFF;
pExtn->setCertExtn( (*extns)->value.data, (*extns)->value.len, reinterpret_cast<unsigned char *>(const_cast<char *>(objID.getStr())), objID.getLength(), crit ) ;
xExtns[len] = pExtn ;
@@ -238,7 +238,7 @@ OUString SAL_CALL X509Certificate_NssImpl :: getSubjectName() throw ( ::com::sun
if( (*extns)->critical.data == NULL )
crit = false ;
else
- crit = ( (*extns)->critical.data[0] == 0xFF ) ? true : false ;
+ crit = (*extns)->critical.data[0] == 0xFF;
pExtn->setCertExtn( (*extns)->value.data, (*extns)->value.len, (*extns)->id.data, (*extns)->id.len, crit ) ;
break;
}
commit ba15d30e8d0bf74de621df9744a47fb768782a2e
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Apr 24 12:35:11 2015 +0200
loplugin:simplifybool
Change-Id: I4a7ba9192956941f05e68ae8df3263d609a7c4dc
diff --git a/xmloff/source/draw/shapeimport.cxx b/xmloff/source/draw/shapeimport.cxx
index 73e8904..c8dc20c 100644
--- a/xmloff/source/draw/shapeimport.cxx
+++ b/xmloff/source/draw/shapeimport.cxx
@@ -526,7 +526,7 @@ SvXMLShapeContext* XMLShapeImportHelper::CreateGroupChildContext(
{
// draw:polygon or draw:polyline inside group context
pContext = new SdXMLPolygonShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes,
- rTokenMap.Get(p_nPrefix, rLocalName) == XML_TOK_GROUP_POLYGON ? true : false, bTemporaryShape );
+ rTokenMap.Get(p_nPrefix, rLocalName) == XML_TOK_GROUP_POLYGON, bTemporaryShape );
break;
}
case XML_TOK_GROUP_PATH:
diff --git a/xmloff/source/meta/xmlmetae.cxx b/xmloff/source/meta/xmlmetae.cxx
index 6309389..77ece02 100644
--- a/xmloff/source/meta/xmlmetae.cxx
+++ b/xmloff/source/meta/xmlmetae.cxx
@@ -443,7 +443,7 @@ SvXMLMetaExport::startElement(const OUString & i_rName,
// finally, start the element
// #i107240# no whitespace here, because the DOM may already contain
// whitespace, which is not cleared when loading and thus accumulates.
- mrExport.StartElement(i_rName, (m_level > 1) ? false : true);
+ mrExport.StartElement(i_rName, m_level <= 1);
++m_level;
}
diff --git a/xmloff/source/style/WordWrapPropertyHdl.cxx b/xmloff/source/style/WordWrapPropertyHdl.cxx
index aa2205d..fa99c66 100644
--- a/xmloff/source/style/WordWrapPropertyHdl.cxx
+++ b/xmloff/source/style/WordWrapPropertyHdl.cxx
@@ -64,10 +64,10 @@ bool XMLWordWrapPropertyHdl::importXML( const OUString& rStrImpValue, Any& rValu
if( nUPD == 300 )
{
if( ( nBuildId > 0 ) && (nBuildId < 9316 ) )
- bValue = bValue ? false : true; // treat OOo 3.0 beta1 as OOo 2.x
+ bValue = !bValue; // treat OOo 3.0 beta1 as OOo 2.x
}
else if( ( nUPD == 680 ) || ( nUPD >= 640 && nUPD <= 645 ) )
- bValue = bValue ? false : true;
+ bValue = !bValue;
}
rValue <<= bValue;
}
diff --git a/xmloff/source/text/txtlists.cxx b/xmloff/source/text/txtlists.cxx
index 95b207a..5c2e139 100644
--- a/xmloff/source/text/txtlists.cxx
+++ b/xmloff/source/text/txtlists.cxx
@@ -327,9 +327,7 @@ void XMLTextListsHelper::PopListFromStack()
bool XMLTextListsHelper::EqualsToTopListStyleOnStack( const OUString& sListId ) const
{
- return mpListStack != 0
- ? sListId == mpListStack->back().second
- : false;
+ return mpListStack != 0 && sListId == mpListStack->back().second;
}
OUString
@@ -472,7 +470,7 @@ XMLTextListsHelper::MakeNumRule(
}
}
- bool bSetDefaults(io_pSetDefaults ? *io_pSetDefaults : false);
+ bool bSetDefaults(io_pSetDefaults && *io_pSetDefaults);
if ( !xNumRules.is() )
{
// If no style name has been specified for this style and for any
diff --git a/xmloff/source/transform/Oasis2OOo.cxx b/xmloff/source/transform/Oasis2OOo.cxx
index 56bc8c6..028b3ce 100644
--- a/xmloff/source/transform/Oasis2OOo.cxx
+++ b/xmloff/source/transform/Oasis2OOo.cxx
@@ -1654,8 +1654,8 @@ XMLTransformerContext *Oasis2OOoTransformer::CreateUserDefinedContext(
{
const XMLTransformerContext *pCurrent = GetCurrentContext();
return new XMLControlOASISTransformerContext( *this, rQName,
- pCurrent ? pCurrent->HasQName( XML_NAMESPACE_FORM,
- XML_FORM ) : false );
+ pCurrent && pCurrent->HasQName( XML_NAMESPACE_FORM,
+ XML_FORM ) );
}
case XML_ETACTION_FORM_PROPERTY:
return new XMLFormPropOASISTransformerContext( *this, rQName,
commit b919eeaa2f59cd36b87f80b8922d32c23e09b764
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Apr 24 12:35:07 2015 +0200
loplugin:simplifybool
Change-Id: Ie145292074b39fae5da40a7337737dd753b4d2ea
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 9a8dca1..70a59ed 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -526,7 +526,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
break;
case NS_ooxml::LN_CT_EastAsianLayout_combine:
if (m_pImpl->GetTopContext())
- m_pImpl->GetTopContext()->Insert(PROP_CHAR_COMBINE_IS_ON, uno::makeAny ( nIntValue ? true : false ));
+ m_pImpl->GetTopContext()->Insert(PROP_CHAR_COMBINE_IS_ON, uno::makeAny ( nIntValue != 0 ));
break;
case NS_ooxml::LN_CT_EastAsianLayout_combineBrackets:
if (m_pImpl->GetTopContext())
@@ -546,7 +546,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
break;
case NS_ooxml::LN_CT_EastAsianLayout_vertCompress:
if (m_pImpl->GetTopContext())
- m_pImpl->GetTopContext()->Insert(PROP_CHAR_ROTATION_IS_FIT_TO_LINE, uno::makeAny ( nIntValue ? true : false));
+ m_pImpl->GetTopContext()->Insert(PROP_CHAR_ROTATION_IS_FIT_TO_LINE, uno::makeAny ( nIntValue != 0 ));
break;
case NS_ooxml::LN_CT_PageSz_code:
@@ -1171,10 +1171,10 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext )
handleParaJustification(nIntValue, rContext, ExchangeLeftRight( rContext, m_pImpl ));
break;
case NS_ooxml::LN_CT_PPrBase_keepLines:
- rContext->Insert(PROP_PARA_SPLIT, uno::makeAny(nIntValue ? false : true));
+ rContext->Insert(PROP_PARA_SPLIT, uno::makeAny(nIntValue == 0));
break;
case NS_ooxml::LN_CT_PPrBase_keepNext:
- rContext->Insert(PROP_PARA_KEEP_TOGETHER, uno::makeAny( nIntValue ? true : false) );
+ rContext->Insert(PROP_PARA_KEEP_TOGETHER, uno::makeAny( nIntValue != 0 ) );
break;
case NS_ooxml::LN_CT_PPrBase_pageBreakBefore:
rContext->Insert(PROP_BREAK_TYPE, uno::makeAny(nIntValue ? style::BreakType_PAGE_BEFORE : style::BreakType_NONE));
@@ -1235,7 +1235,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext )
}
break;
case NS_ooxml::LN_CT_PPrBase_suppressLineNumbers:
- rContext->Insert(PROP_PARA_LINE_NUMBER_COUNT, uno::makeAny( nIntValue ? false : true) );
+ rContext->Insert(PROP_PARA_LINE_NUMBER_COUNT, uno::makeAny( nIntValue == 0 ) );
break;
case NS_ooxml::LN_inTbl:
break;
@@ -1301,7 +1301,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext )
case NS_ooxml::LN_CT_PBdr_bar:
break;
case NS_ooxml::LN_CT_PPrBase_suppressAutoHyphens:
- rContext->Insert(PROP_PARA_IS_HYPHENATION, uno::makeAny( nIntValue ? false : true ));
+ rContext->Insert(PROP_PARA_IS_HYPHENATION, uno::makeAny( nIntValue == 0 ));
break;
case NS_ooxml::LN_CT_FramePr_h:
break;
@@ -1340,7 +1340,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext )
}
break; // sprmPFWidowControl
case NS_ooxml::LN_CT_PPrBase_overflowPunct:
- rContext->Insert(PROP_PARA_IS_HANGING_PUNCTUATION, uno::makeAny( nIntValue ? false : true ));
+ rContext->Insert(PROP_PARA_IS_HANGING_PUNCTUATION, uno::makeAny( nIntValue == 0 ));
break;
case NS_ooxml::LN_CT_PPrBase_topLinePunct:
break;
@@ -1552,7 +1552,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext )
case NS_ooxml::LN_EG_RPrBase_shadow:
case NS_ooxml::LN_EG_RPrBase_vanish:
case NS_ooxml::LN_EG_RPrBase_webHidden:
- rContext->Insert(ePropertyId, uno::makeAny( nIntValue ? true : false ));
+ rContext->Insert(ePropertyId, uno::makeAny( nIntValue != 0 ));
break;
case NS_ooxml::LN_EG_RPrBase_smallCaps:
// If smallcaps would be just disabled and an other casemap is already inserted, don't do anything.
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index 7d31cd2..f2099c9 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -551,7 +551,7 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
m_pImpl->aBorders[m_pImpl->nCurrentBorderLine].nLineDistance = nIntValue;
break;
case NS_ooxml::LN_CT_Border_shadow:
- m_pImpl->aBorders[m_pImpl->nCurrentBorderLine].bHasShadow = nIntValue ? true : false;
+ m_pImpl->aBorders[m_pImpl->nCurrentBorderLine].bHasShadow = nIntValue != 0;
break;
case NS_ooxml::LN_CT_Border_frame:
break;
diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx
index fd04dce..cd73226 100644
--- a/writerfilter/source/dmapper/SettingsTable.cxx
+++ b/writerfilter/source/dmapper/SettingsTable.cxx
@@ -219,13 +219,13 @@ void SettingsTable::lcl_sprm(Sprm& rSprm)
m_pImpl->m_bEvenAndOddHeaders = nIntValue;
break;
case NS_ooxml::LN_CT_Settings_noPunctuationKerning: // 92526;
- m_pImpl->m_bNoPunctuationKerning = nIntValue ? true : false;
+ m_pImpl->m_bNoPunctuationKerning = nIntValue != 0;
break;
case NS_ooxml::LN_CT_Settings_characterSpacingControl: // 92527;
m_pImpl->m_sCharacterSpacing = sStringValue; // doNotCompress, compressPunctuation, compressPunctuationAndJapaneseKana
break;
case NS_ooxml::LN_CT_Settings_doNotIncludeSubdocsInStats: // 92554; // Do Not Include Content in Text Boxes, Footnotes, and Endnotes in Document Statistics)
- m_pImpl->m_doNotIncludeSubdocsInStats = nIntValue ? true : false;
+ m_pImpl->m_doNotIncludeSubdocsInStats = nIntValue != 0;
break;
case NS_ooxml::LN_CT_Settings_decimalSymbol: // 92562;
m_pImpl->m_sDecimalSymbol = sStringValue;
commit a9a4d46ce74fc3c4ff1b7399ea6be6ffeeeb8863
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Apr 24 12:34:53 2015 +0200
loplugin:simplifybool
Change-Id: I8276e8b356ff26241613de64bcd90b5dbcd92f29
diff --git a/include/vcl/combobox.hxx b/include/vcl/combobox.hxx
index c7a8cef..34e6702 100644
--- a/include/vcl/combobox.hxx
+++ b/include/vcl/combobox.hxx
@@ -88,7 +88,7 @@ protected:
SAL_DLLPRIVATE long getMaxWidthScrollBarAndDownButton() const;
protected:
- bool IsDropDownBox() const { return mpFloatWin ? true : false; }
+ bool IsDropDownBox() const { return mpFloatWin != nullptr; }
virtual void FillLayoutData() const SAL_OVERRIDE;
public:
diff --git a/include/vcl/lstbox.hxx b/include/vcl/lstbox.hxx
index 29d2199..775e72c 100644
--- a/include/vcl/lstbox.hxx
+++ b/include/vcl/lstbox.hxx
@@ -72,7 +72,7 @@ protected:
SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle );
SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId );
- bool IsDropDownBox() const { return mpFloatWin ? true : false; }
+ bool IsDropDownBox() const { return mpFloatWin != nullptr; }
protected:
explicit ListBox( WindowType nType );
diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index cd058db..ef4f1ee 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -332,7 +332,7 @@ public:
void SetSelectHdl( const Link& rLink ) { aSelectHdl = rLink; }
const Link& GetSelectHdl() const { return aSelectHdl; }
- bool HasLogo() const { return pLogo ? true : false; }
+ bool HasLogo() const { return pLogo != nullptr; }
void AddEventListener( const Link& rEventListener );
void RemoveEventListener( const Link& rEventListener );
diff --git a/include/vcl/texteng.hxx b/include/vcl/texteng.hxx
index 5df2098..3464b246 100644
--- a/include/vcl/texteng.hxx
+++ b/include/vcl/texteng.hxx
@@ -270,7 +270,7 @@ public:
void SetRightToLeft( bool bR2L );
bool IsRightToLeft() const { return mbRightToLeft; }
- bool HasUndoManager() const { return mpUndoManager ? true : false; }
+ bool HasUndoManager() const { return mpUndoManager != nullptr; }
::svl::IUndoManager&
GetUndoManager();
void UndoActionStart( sal_uInt16 nId = 0 );
diff --git a/vcl/generic/fontmanager/fontmanager.cxx b/vcl/generic/fontmanager/fontmanager.cxx
index a357c78..87027d4 100644
--- a/vcl/generic/fontmanager/fontmanager.cxx
+++ b/vcl/generic/fontmanager/fontmanager.cxx
@@ -1571,7 +1571,7 @@ bool PrintFontManager::getFontInfo( fontID nFontID, PrintFontInfo& rInfo ) const
rInfo.m_nID = nFontID;
fillPrintFontInfo( pFont, rInfo );
}
- return pFont ? true : false;
+ return pFont != nullptr;
}
bool PrintFontManager::getFontFastInfo( fontID nFontID, FastPrintFontInfo& rInfo ) const
@@ -1582,7 +1582,7 @@ bool PrintFontManager::getFontFastInfo( fontID nFontID, FastPrintFontInfo& rInfo
rInfo.m_nID = nFontID;
fillPrintFontInfo( pFont, rInfo );
}
- return pFont ? true : false;
+ return pFont != nullptr;
}
bool PrintFontManager::getFontBoundingBox( fontID nFontID, int& xMin, int& yMin, int& xMax, int& yMax )
diff --git a/vcl/generic/print/common_gfx.cxx b/vcl/generic/print/common_gfx.cxx
index 769bb98..ffe1e25 100644
--- a/vcl/generic/print/common_gfx.cxx
+++ b/vcl/generic/print/common_gfx.cxx
@@ -76,7 +76,7 @@ PrinterGfx::Init (const JobData& rData)
mpPageBody = NULL;
mnDepth = rData.m_nColorDepth;
mnPSLevel = rData.m_nPSLevel ? rData.m_nPSLevel : (rData.m_pParser ? rData.m_pParser->getLanguageLevel() : 2 );
- mbColor = rData.m_nColorDevice ? ( rData.m_nColorDevice != -1 ) : ( rData.m_pParser ? rData.m_pParser->isColorDevice() : true );
+ mbColor = rData.m_nColorDevice ? ( rData.m_nColorDevice != -1 ) : ( rData.m_pParser == nullptr || rData.m_pParser->isColorDevice() );
int nRes = rData.m_aContext.getRenderResolution();
mnDpi = nRes;
mfScaleX = (double)72.0 / (double)mnDpi;
diff --git a/vcl/generic/print/genprnpsp.cxx b/vcl/generic/print/genprnpsp.cxx
index 7a0ab922..71f35eb 100644
--- a/vcl/generic/print/genprnpsp.cxx
+++ b/vcl/generic/print/genprnpsp.cxx
@@ -251,7 +251,7 @@ static bool passFileToCommandLine( const OUString& rFilename, const OUString& rC
OString aCmdLine(OUStringToOString(rCommandLine, aEncoding));
OString aFilename(OUStringToOString(rFilename, aEncoding));
- bool bPipe = aCmdLine.indexOf( "(TMP)" ) != -1 ? false : true;
+ bool bPipe = aCmdLine.indexOf( "(TMP)" ) == -1;
// setup command line for exec
if( ! bPipe )
@@ -277,7 +277,7 @@ static bool passFileToCommandLine( const OUString& rFilename, const OUString& rC
int pid, fd[2];
if( bPipe )
- bHavePipes = pipe( fd ) ? false : true;
+ bHavePipes = pipe( fd ) == 0;
if( ( pid = fork() ) > 0 )
{
if( bPipe && bHavePipes )
@@ -919,7 +919,7 @@ bool PspSalPrinter::StartJob(
#endif
m_aPrinterGfx.Init( m_aJobData );
- return m_aPrintJob.StartJob( ! m_aTmpFile.isEmpty() ? m_aTmpFile : m_aFileName, nMode, rJobName, rAppName, m_aJobData, &m_aPrinterGfx, bDirect ) ? true : false;
+ return m_aPrintJob.StartJob( ! m_aTmpFile.isEmpty() ? m_aTmpFile : m_aFileName, nMode, rJobName, rAppName, m_aJobData, &m_aPrinterGfx, bDirect );
}
bool PspSalPrinter::EndJob()
@@ -944,7 +944,7 @@ bool PspSalPrinter::EndJob()
bool PspSalPrinter::AbortJob()
{
- bool bAbort = m_aPrintJob.AbortJob() ? true : false;
+ bool bAbort = m_aPrintJob.AbortJob();
GetSalData()->m_pInstance->jobEndedPrinterUpdate();
return bAbort;
}
diff --git a/vcl/generic/print/printerjob.cxx b/vcl/generic/print/printerjob.cxx
index f3aa39d..ba0da71 100644
--- a/vcl/generic/print/printerjob.cxx
+++ b/vcl/generic/print/printerjob.cxx
@@ -720,8 +720,8 @@ static bool writeFeature( osl::File* pFile, const PPDKey* pKey, const PPDValue*
}
aFeature.append( "\n} stopped cleartomark\n" );
sal_uInt64 nWritten = 0;
- return pFile->write( aFeature.getStr(), aFeature.getLength(), nWritten )
- || nWritten != (sal_uInt64)aFeature.getLength() ? false : true;
+ return !(pFile->write( aFeature.getStr(), aFeature.getLength(), nWritten )
+ || nWritten != (sal_uInt64)aFeature.getLength());
}
bool PrinterJob::writeFeatureList( osl::File* pFile, const JobData& rJob, bool bDocumentSetup )
@@ -1014,9 +1014,8 @@ bool PrinterJob::writeSetup( osl::File* pFile, const JobData& rJob )
aLine.append(static_cast<sal_Int32>(rJob.m_nCopies));
aLine.append(" def\n");
sal_uInt64 nWritten = 0;
- bSuccess = pFile->write(aLine.getStr(), aLine.getLength(), nWritten)
- || nWritten != static_cast<sal_uInt64>(aLine.getLength()) ?
- false : true;
+ bSuccess = !(pFile->write(aLine.getStr(), aLine.getLength(), nWritten)
+ || nWritten != static_cast<sal_uInt64>(aLine.getLength()));
if( bSuccess && GetPostscriptLevel( &rJob ) >= 2 )
WritePS (pFile, "<< /NumCopies null /Policies << /NumCopies 1 >> >> setpagedevice\n" );
diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx
index 2fec055..0efc7e1 100644
--- a/vcl/inc/ilstbox.hxx
+++ b/vcl/inc/ilstbox.hxx
@@ -128,7 +128,7 @@ public:
long GetEntryHeight( sal_Int32 nPos ) const;
sal_Int32 GetEntryCount() const { return (sal_Int32 )maEntries.size(); }
- bool HasImages() const { return mnImages ? true : false; }
+ bool HasImages() const { return mnImages != 0; }
OUString GetEntryText( sal_Int32 nPos ) const;
diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx
index c5a7abc..9abc4f9 100644
--- a/vcl/inc/openglgdiimpl.hxx
+++ b/vcl/inc/openglgdiimpl.hxx
@@ -115,7 +115,7 @@ public:
GLfloat GetHeight() const { return mpProvider ? mpProvider->GetHeight() : 1; }
// check whether this instance is used for offscreen rendering
- bool IsOffscreen() const { return mpProvider ? mpProvider->IsOffScreen() : true; }
+ bool IsOffscreen() const { return mpProvider == nullptr || mpProvider->IsOffScreen(); }
// operations to do before painting
void PreDraw();
diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm
index 37b4602..4a51663 100644
--- a/vcl/osx/salframeview.mm
+++ b/vcl/osx/salframeview.mm
@@ -1497,7 +1497,7 @@ private:
nRet = mpFrame->CallCallback( SALEVENT_KEYINPUT, &aEvent );
std::map< NSEvent*, bool >::iterator it = GetSalData()->maKeyEventAnswer.find( mpLastEvent );
if( it != GetSalData()->maKeyEventAnswer.end() )
- it->second = nRet ? true : false;
+ it->second = nRet != 0;
if( AquaSalFrame::isAlive( mpFrame ) )
mpFrame->CallCallback( SALEVENT_KEYUP, &aEvent );
}
diff --git a/vcl/osx/salnativewidgets.cxx b/vcl/osx/salnativewidgets.cxx
index 041df33..72e035f 100644
--- a/vcl/osx/salnativewidgets.cxx
+++ b/vcl/osx/salnativewidgets.cxx
@@ -333,7 +333,7 @@ bool AquaSalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart
*/
UInt32 AquaSalGraphics::getState( ControlState nState )
{
- const bool bDrawActive = mpFrame ? ([mpFrame->getNSWindow() isKeyWindow] ? true : false) : true;
+ const bool bDrawActive = mpFrame == nullptr || [mpFrame->getNSWindow() isKeyWindow];
if( !(nState & ControlState::ENABLED) || ! bDrawActive )
{
if( ! (nState & ControlState::HIDDEN) )
@@ -353,7 +353,7 @@ UInt32 AquaSalGraphics::getState( ControlState nState )
UInt32 AquaSalGraphics::getTrackState( ControlState nState )
{
- const bool bDrawActive = mpFrame ? ([mpFrame->getNSWindow() isKeyWindow] ? true : false) : true;
+ const bool bDrawActive = mpFrame == nullptr || [mpFrame->getNSWindow() isKeyWindow];
if( ! (nState & ControlState::ENABLED) || ! bDrawActive )
return kThemeTrackInactive;
@@ -419,7 +419,7 @@ bool AquaSalGraphics::drawNativeControl(ControlType nType,
#else
if (rControlRegion.Top() == 0 && nPart == PART_DRAW_BACKGROUND_HORZ)
{
- const bool bDrawActive = mpFrame ? ([mpFrame->getNSWindow() isKeyWindow] ? true : false) : true;
+ const bool bDrawActive = mpFrame == nullptr || [mpFrame->getNSWindow() isKeyWindow];
CGFloat unifiedHeight = rControlRegion.GetHeight();
CGRect drawRect = CGRectMake(rControlRegion.Left(), rControlRegion.Top(), rControlRegion.GetWidth(), rControlRegion.GetHeight());
CUIDraw([NSWindow coreUIRenderer], drawRect, mrContext,
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 64b0336..3d22d7c 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1102,7 +1102,7 @@ unsigned int Application::GetScreenCount()
bool Application::IsUnifiedDisplay()
{
SalSystem* pSys = ImplGetSalSystem();
- return pSys ? pSys->IsUnifiedDisplay() : true;
+ return pSys == nullptr || pSys->IsUnifiedDisplay();
}
unsigned int Application::GetDisplayBuiltInScreen()
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 30e111a..09abe44 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -239,7 +239,7 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos,
OUString aText( GetText() );
bool bDrawImage = HasImage() && ! ( ImplGetButtonState() & BUTTON_DRAW_NOIMAGE );
bool bDrawText = !aText.isEmpty() && ! ( ImplGetButtonState() & BUTTON_DRAW_NOTEXT );
- bool bHasSymbol = pSymbolRect ? true : false;
+ bool bHasSymbol = pSymbolRect != nullptr;
// No text and no image => nothing to do => return
if ( !bDrawImage && !bDrawText && !bHasSymbol )
@@ -684,9 +684,8 @@ void PushButton::ImplInitSettings( bool bFont,
EnableChildTransparentMode( true );
SetParentClipMode( PARENTCLIPMODE_NOCLIP );
SetPaintTransparent( true );
- mpWindowImpl->mbUseNativeFocus = (GetStyle() & WB_FLATBUTTON)
- ? false
- : ImplGetSVData()->maNWFData.mbNoFocusRects;
+ mpWindowImpl->mbUseNativeFocus = (GetStyle() & WB_FLATBUTTON) == 0
+ && ImplGetSVData()->maNWFData.mbNoFocusRects;
}
else
{
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 16d1ccc..3d5a41f 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -122,7 +122,7 @@ void ComboBox::ImplInit( vcl::Window* pParent, WinBits nStyle )
{
ImplInitStyle( nStyle );
- bool bNoBorder = ( nStyle & WB_NOBORDER ) ? true : false;
+ bool bNoBorder = ( nStyle & WB_NOBORDER ) != 0;
if ( !(nStyle & WB_DROPDOWN) )
{
nStyle &= ~WB_BORDER;
@@ -647,7 +647,7 @@ void ComboBox::StateChanged( StateChangedType nType )
else if ( nType == StateChangedType::STYLE )
{
SetStyle( ImplInitStyle( GetStyle() ) );
- mpImplLB->GetMainWindow().EnableSort( ( GetStyle() & WB_SORT ) ? true : false );
+ mpImplLB->GetMainWindow().EnableSort( ( GetStyle() & WB_SORT ) != 0 );
}
else if( nType == StateChangedType::MIRRORING )
{
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index e5d29ea..0500a46 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -459,7 +459,7 @@ bool ImplEntryList::IsEntryPosSelected( sal_Int32 nIndex ) const
bool ImplEntryList::IsEntrySelectable( sal_Int32 nPos ) const
{
ImplEntryType* pImplEntry = GetEntry( nPos );
- return pImplEntry ? ((pImplEntry->mnFlags & LISTBOX_ENTRY_FLAG_DISABLE_SELECTION) == 0) : true;
+ return pImplEntry == nullptr || ((pImplEntry->mnFlags & LISTBOX_ENTRY_FLAG_DISABLE_SELECTION) == 0);
}
sal_Int32 ImplEntryList::FindFirstSelectable( sal_Int32 nPos, bool bForward /* = true */ )
@@ -2538,7 +2538,7 @@ bool ImplListBox::HandleWheelAsCursorTravel( const CommandEvent& rCEvt )
void ImplListBox::SetMRUEntries( const OUString& rEntries, sal_Unicode cSep )
{
- bool bChanges = GetEntryList()->GetMRUCount() ? true : false;
+ bool bChanges = GetEntryList()->GetMRUCount() != 0;
// Remove old MRU entries
for ( sal_Int32 n = GetEntryList()->GetMRUCount();n; )
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index 3669e18..131d0fe 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -853,8 +853,8 @@ void ListBox::StateChanged( StateChangedType nType )
else if ( nType == StateChangedType::STYLE )
{
SetStyle( ImplInitStyle( GetStyle() ) );
- mpImplLB->GetMainWindow().EnableSort( ( GetStyle() & WB_SORT ) ? true : false );
- bool bSimpleMode = ( GetStyle() & WB_SIMPLEMODE ) ? true : false;
+ mpImplLB->GetMainWindow().EnableSort( ( GetStyle() & WB_SORT ) != 0 );
+ bool bSimpleMode = ( GetStyle() & WB_SIMPLEMODE ) != 0;
mpImplLB->SetMultiSelectionSimpleMode( bSimpleMode );
}
else if( nType == StateChangedType::MIRRORING )
@@ -1175,7 +1175,7 @@ void ListBox::EnableMultiSelection( bool bMulti, bool bStackSelection )
// WB_SIMPLEMODE:
// The MultiListBox behaves just like a normal ListBox
// MultiSelection is possible via corresponding additional keys
- bool bSimpleMode = ( GetStyle() & WB_SIMPLEMODE ) ? true : false;
+ bool bSimpleMode = ( GetStyle() & WB_SIMPLEMODE ) != 0;
mpImplLB->SetMultiSelectionSimpleMode( bSimpleMode );
// In a MultiSelection, we can't see us travelling without focus
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index 98d7533..e31391d 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -456,7 +456,7 @@ bool ScrollBar::ImplDrawNative( sal_uInt16 nDrawFlags )
if( !bNativeOK )
return false;
- bool bHorz = (GetStyle() & WB_HORZ) ? true : false;
+ bool bHorz = (GetStyle() & WB_HORZ) != 0;
// Draw the entire background if the control supports it
if( IsNativeControlSupported(CTRL_SCROLLBAR, bHorz ? PART_DRAW_BACKGROUND_HORZ : PART_DRAW_BACKGROUND_VERT) )
@@ -786,7 +786,7 @@ void ScrollBar::ImplDoMouseAction( const Point& rMousePos, bool bCallAction )
{
sal_uInt16 nOldStateFlags = mnStateFlags;
bool bAction = false;
- bool bHorizontal = ( GetStyle() & WB_HORZ ) ? true: false;
+ bool bHorizontal = ( GetStyle() & WB_HORZ ) != 0;
bool bIsInside = false;
Point aPoint( 0, 0 );
@@ -896,7 +896,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt )
{
const Point& rMousePos = rMEvt.GetPosPixel();
sal_uInt16 nTrackFlags = 0;
- bool bHorizontal = ( GetStyle() & WB_HORZ ) ? true: false;
+ bool bHorizontal = ( GetStyle() & WB_HORZ ) != 0;
bool bIsInside = false;
bool bDragToMouse = false;
@@ -972,9 +972,9 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt )
ImplDraw( mnDragDraw, this );
}
}
- else if(bPage && (HitTestNativeControl( CTRL_SCROLLBAR, bHorizontal? PART_TRACK_HORZ_AREA : PART_TRACK_VERT_AREA,
- aControlRegion, rMousePos, bIsInside ) ?
- bIsInside : true) )
+ else if(bPage && (!HitTestNativeControl( CTRL_SCROLLBAR, bHorizontal? PART_TRACK_HORZ_AREA : PART_TRACK_VERT_AREA,
+ aControlRegion, rMousePos, bIsInside ) ||
+ bIsInside) )
{
nTrackFlags = STARTTRACK_BUTTONREPEAT;
@@ -1231,7 +1231,7 @@ void ScrollBar::DataChanged( const DataChangedEvent& rDCEvt )
Rectangle* ScrollBar::ImplFindPartRect( const Point& rPt )
{
- bool bHorizontal = ( GetStyle() & WB_HORZ ) ? true: false;
+ bool bHorizontal = ( GetStyle() & WB_HORZ ) != 0;
bool bIsInside = false;
Point aPoint( 0, 0 );
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index 85aa37b..15ae57f 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -407,7 +407,7 @@ void SpinField::MouseButtonDown( const MouseEvent& rMEvt )
else if ( maDropDownRect.IsInside( rMEvt.GetPosPixel() ) )
{
// put DropDownButton to the right
- mbInDropDown = ShowDropDown( mbInDropDown ? false : true );
+ mbInDropDown = ShowDropDown( !mbInDropDown );
Paint( Rectangle( Point(), GetOutputSizePixel() ) );
}
diff --git a/vcl/source/edit/textdat2.hxx b/vcl/source/edit/textdat2.hxx
index 81785cf..c1cdded 100644
--- a/vcl/source/edit/textdat2.hxx
+++ b/vcl/source/edit/textdat2.hxx
@@ -154,7 +154,7 @@ public:
void SetInvalid() { mbInvalid = true; }
void SetValid() { mbInvalid = false; }
- bool IsEmpty() const { return (mnEnd > mnStart) ? false : true; }
+ bool IsEmpty() const { return mnEnd <= mnStart; }
short GetStartX() const { return mnStartX; }
void SetStartX( short n ) { mnStartX = n; }
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index bac8fdb..f4a11a2 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -2520,7 +2520,7 @@ bool TextEngine::Read( SvStream& rInput, const TextSelection* pSel )
SetUpdateMode( bUpdate );
FormatAndUpdate( GetActiveView() );
- return rInput.GetError() ? false : true;
+ return rInput.GetError() == 0;
}
bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML )
@@ -2608,7 +2608,7 @@ bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML
rOutput.WriteLine( "</HTML>" );
}
- return rOutput.GetError() ? false : true;
+ return rOutput.GetError() == 0;
}
void TextEngine::RemoveAttribs( sal_uLong nPara, bool bIdleFormatAndUpdate )
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index cafbbf5..768125b 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -1841,7 +1841,7 @@ bool TextView::SetCursorAtPoint( const Point& rPosPixel )
ShowSelection( aTmpNewSel );
}
- bool bForceCursor = mpImpl->mpDDInfo ? false : true; // && !mbInSelection
+ bool bForceCursor = mpImpl->mpDDInfo == nullptr; // && !mbInSelection
ImpShowCursor( mpImpl->mbAutoScroll, bForceCursor, false );
return true;
}
diff --git a/vcl/source/filter/ixpm/xpmread.cxx b/vcl/source/filter/ixpm/xpmread.cxx
index 338069b..6d7646c 100644
--- a/vcl/source/filter/ixpm/xpmread.cxx
+++ b/vcl/source/filter/ixpm/xpmread.cxx
@@ -398,7 +398,7 @@ bool XPMReader::ImplGetColKey( sal_uInt8 nKey )
}
}
}
- return ( mnParaSize ) ? true : false;
+ return mnParaSize != 0;
}
// ImplGetRGBHex translates the ASCII-Hexadecimalvalue belonging to mpPara
diff --git a/vcl/source/gdi/bitmap4.cxx b/vcl/source/gdi/bitmap4.cxx
index d5dc470..8790b2b 100644
--- a/vcl/source/gdi/bitmap4.cxx
+++ b/vcl/source/gdi/bitmap4.cxx
@@ -943,7 +943,7 @@ extern "C" int SAL_CALL ImplPopArtCmpFnc( const void* p1, const void* p2 )
bool Bitmap::ImplPopArt( const BmpFilterParam* /*pFilterParam*/, const Link* /*pProgress*/ )
{
- bool bRet = ( GetBitCount() > 8 ) ? Convert( BMP_CONVERSION_8BIT_COLORS ) : true;
+ bool bRet = ( GetBitCount() <= 8 ) || Convert( BMP_CONVERSION_8BIT_COLORS );
if( bRet )
{
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index d75d674..79ae295 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -157,7 +157,7 @@ BitmapEx::BitmapEx( const Bitmap& rBmp, const AlphaMask& rAlphaMask ) :
aMask ( rAlphaMask.ImplGetBitmap() ),
aBitmapSize ( aBitmap.GetSizePixel() ),
eTransparent ( !rAlphaMask ? TRANSPARENT_NONE : TRANSPARENT_BITMAP ),
- bAlpha ( !rAlphaMask ? false : true )
+ bAlpha ( !rAlphaMask.IsEmpty() )
{
if(!!aBitmap && !!aMask && aBitmap.GetSizePixel() != aMask.GetSizePixel())
{
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index 1bcd5cf..0c6714e 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -1968,8 +1968,8 @@ void PDFWriterImpl::writeG4Stream( BitmapReadAccess* i_pBitmap )
{
const Scanline pCurLine = i_pBitmap->GetScanline( nY );
long nLineIndex = 0;
- bool bRunSet = (*pCurLine & 0x80) ? true : false;
- bool bRefSet = (*pRefLine & 0x80) ? true : false;
+ bool bRunSet = (*pCurLine & 0x80) != 0;
+ bool bRefSet = (*pRefLine & 0x80) != 0;
long nRunIndex1 = bRunSet ? 0 : findBitRun( pCurLine, 0, nW, bRunSet );
long nRefIndex1 = bRefSet ? 0 : findBitRun( pRefLine, 0, nW, bRefSet );
for( ; nLineIndex < nW; )
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 658363d..e96e14b 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -643,7 +643,7 @@ bool Printer::AcquireGraphics() const
mpGraphics->setAntiAliasB2DDraw(mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW);
}
- return mpGraphics ? true : false;
+ return mpGraphics != nullptr;
}
void Printer::ImplReleaseFonts()
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
index 76a471b..4b5a2f1 100644
--- a/vcl/source/gdi/print2.cxx
+++ b/vcl/source/gdi/print2.cxx
@@ -282,8 +282,8 @@ void ImplConvertTransparentAction( GDIMetaFile& o_rMtf,
// Returns true, if given action creates visible (i.e. non-transparent) output
bool ImplIsNotTransparent( const MetaAction& rAct, const OutputDevice& rOut )
{
- const bool bLineTransparency( rOut.IsLineColor() ? rOut.GetLineColor().GetTransparency() == 255 : true );
- const bool bFillTransparency( rOut.IsFillColor() ? rOut.GetFillColor().GetTransparency() == 255 : true );
+ const bool bLineTransparency( !rOut.IsLineColor() || rOut.GetLineColor().GetTransparency() == 255 );
+ const bool bFillTransparency( !rOut.IsFillColor() || rOut.GetFillColor().GetTransparency() == 255 );
bool bRet( false );
switch( rAct.GetType() )
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index eec2fa9..b94b6c2 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -89,7 +89,7 @@ bool VirtualDevice::AcquireGraphics() const
mpGraphics->setAntiAliasB2DDraw(mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW);
}
- return mpGraphics ? true : false;
+ return mpGraphics != nullptr;
}
void VirtualDevice::ReleaseGraphics( bool bRelease )
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index e692584..3acb0c6 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -539,7 +539,7 @@ GLXFBConfig OpenGLHelper::GetPixmapFBConfig( Display* pDisplay, bool& bInverted
}
glXGetFBConfigAttrib( pDisplay, aFbConfigs[i], GLX_Y_INVERTED_EXT, &nValue );
- bInverted = (nValue == True) ? true : false;
+ bInverted = nValue == True;
break;
}
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 35ef02d..9f13a24 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -1263,7 +1263,7 @@ void OutputDevice::DrawImage( const Point& rPos, const Image& rImage, sal_uInt16
void OutputDevice::DrawImage( const Point& rPos, const Size& rSize,
const Image& rImage, sal_uInt16 nStyle )
{
- bool bIsSizeValid = (rSize.getWidth() == 0 || rSize.getHeight() == 0) ? false : true;
+ bool bIsSizeValid = rSize.getWidth() != 0 && rSize.getHeight() != 0;
if( rImage.mpImplData && !ImplIsRecordLayout() )
{
diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx
index 882818f..5818d11 100644
--- a/vcl/source/window/brdwin.cxx
+++ b/vcl/source/window/brdwin.cxx
@@ -127,7 +127,7 @@ static void ImplDrawBrdWinSymbolButton( OutputDevice* pDev,
pWin->SetFillColor( pDev->GetSettings().GetStyleSettings().GetWindowColor() );
pWin->SetLineColor();
pWin->DrawRect( rRect );
- pWin->DrawSelectionBackground( rRect, 2, (nState & BUTTON_DRAW_PRESSED) ? true : false,
+ pWin->DrawSelectionBackground( rRect, 2, (nState & BUTTON_DRAW_PRESSED) != 0,
true, false );
}
aTempRect = rRect;
@@ -1777,7 +1777,7 @@ void ImplBorderWindow::ImplInit( vcl::Window* pParent,
{
mpWindowImpl->mbOverlapWin = true;
mpWindowImpl->mbFrame = true;
- mbFrameBorder = (nOrgStyle & WB_NOBORDER) ? false : true;
+ mbFrameBorder = (nOrgStyle & WB_NOBORDER) == 0;
}
else
{
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index d32c86f..597e662 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2551,7 +2551,7 @@ bool MenuBar::ImplHandleKeyEvent( const KeyEvent& rKEvent, bool bFromMenu )
if (pWin && pWin->IsEnabled() && pWin->IsInputEnabled() && !pWin->IsInModalMode())
{
IMenuBarWindow* pMenuWin = getMenuBarWindow();
- bDone = pMenuWin ? pMenuWin->HandleKeyEvent(rKEvent, bFromMenu) : false;
+ bDone = pMenuWin && pMenuWin->HandleKeyEvent(rKEvent, bFromMenu);
}
return bDone;
}
@@ -2682,7 +2682,7 @@ void MenuBar::RemoveMenuBarButton( sal_uInt16 nId )
bool MenuBar::HandleMenuButtonEvent( Menu *, sal_uInt16 i_nButtonId )
{
IMenuBarWindow* pMenuWin = getMenuBarWindow();
- return pMenuWin ? pMenuWin->HandleMenuButtonEvent(i_nButtonId) : false;
+ return pMenuWin && pMenuWin->HandleMenuButtonEvent(i_nButtonId);
}
// bool PopupMenu::bAnyPopupInExecute = false;
@@ -2754,7 +2754,7 @@ void PopupMenu::ClosePopup(Menu* pMenu)
bool PopupMenu::IsInExecute()
{
- return GetActivePopupMenu() ? true : false;
+ return GetActivePopupMenu() != nullptr;
}
PopupMenu* PopupMenu::GetActivePopupMenu()
diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx
index e4b1124..19e709d 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -317,7 +317,7 @@ IMPL_LINK( MenuFloatingWindow, HighlightChanged, Timer*, pTimer )
Menu* pTest = pActivePopup;
sal_uLong nOldFlags = GetPopupModeFlags();
SetPopupModeFlags( GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE );
- sal_uInt16 nRet = pActivePopup->ImplExecute( this, Rectangle( aItemTopLeft, aItemBottomRight ), FLOATWIN_POPUPMODE_RIGHT, pMenu, pTimer ? false : true );
+ sal_uInt16 nRet = pActivePopup->ImplExecute( this, Rectangle( aItemTopLeft, aItemBottomRight ), FLOATWIN_POPUPMODE_RIGHT, pMenu, pTimer == nullptr );
SetPopupModeFlags( nOldFlags );
// nRet != 0, wenn es waerend Activate() abgeschossen wurde...
diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx
index 86db812..c18e1d0 100644
--- a/vcl/source/window/splitwin.cxx
+++ b/vcl/source/window/splitwin.cxx
@@ -2433,8 +2433,8 @@ void SplitWindow::Tracking( const TrackingEvent& rTEvt )
if ( bSplit )
{
- bool bPropSmaller = (mnMouseModifier & KEY_SHIFT) ? true : false;
- bool bPropGreater = (mnMouseModifier & KEY_MOD1) ? true : false;
+ bool bPropSmaller = (mnMouseModifier & KEY_SHIFT) != 0;
+ bool bPropGreater = (mnMouseModifier & KEY_MOD1) != 0;
long nDelta = mnMSplitPos-mnMStartPos;
if ( (mnSplitTest & SPLIT_WINDOW) && !mpMainSet->mpItems )
diff --git a/vcl/source/window/stacking.cxx b/vcl/source/window/stacking.cxx
index ee29a8d..f20c0ec 100644
--- a/vcl/source/window/stacking.cxx
+++ b/vcl/source/window/stacking.cxx
@@ -647,7 +647,7 @@ bool Window::IsTopWindow() const
uno::Reference< XTopWindow > xTopWindow( pThisWin->GetComponentInterface(), UNO_QUERY );
pThisWin->mpWindowImpl->mpWinData->mnIsTopWindow = xTopWindow.is() ? 1 : 0;
}
- return mpWindowImpl->mpWinData->mnIsTopWindow == 1 ? true : false;
+ return mpWindowImpl->mpWinData->mnIsTopWindow == 1;
}
vcl::Window* Window::FindWindow( const Point& rPos ) const
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 7cf7a23..34ad659 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -894,7 +894,7 @@ void ToolBox::ImplSetMinMaxFloatSize( ToolBox *pThis )
{
pWrapper->SetMinOutputSizePixel( aMinSize );
pWrapper->SetMaxOutputSizePixel( aMaxSize );
- pWrapper->ShowTitleButton( TITLE_BUTTON_MENU, ( pThis->GetMenuType() & TOOLBOX_MENUTYPE_CUSTOMIZE) ? true : false );
+ pWrapper->ShowTitleButton( TITLE_BUTTON_MENU, ( pThis->GetMenuType() & TOOLBOX_MENUTYPE_CUSTOMIZE) != 0 );
}
else
{
@@ -4476,7 +4476,7 @@ void ToolBox::SetStyle(WinBits nNewStyle)
if (!ImplIsFloatingMode())
{
bool bOldScroll = mbScroll;
- mbScroll = (mnWinStyle & WB_SCROLL) ? true : false;
+ mbScroll = (mnWinStyle & WB_SCROLL) != 0;
if (mbScroll != bOldScroll)
{
mbFormat = true;
@@ -4505,7 +4505,7 @@ void ToolBox::ToggleFloatingMode()
}
else
{
- mbScroll = (mnWinStyle & WB_SCROLL) ? true : false;
+ mbScroll = (mnWinStyle & WB_SCROLL) != 0;
if ( (meAlign == WINDOWALIGN_TOP) || (meAlign == WINDOWALIGN_BOTTOM) )
mbHorz = true;
else
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 2c9a9d0..80b2bf9 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -1731,7 +1731,7 @@ void ToolBox::SetMenuType( sal_uInt16 aType )
// the menu button may have to be moved into the decoration which changes the layout
ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( this );
if( pWrapper )
- pWrapper->ShowTitleButton( TITLE_BUTTON_MENU, ( aType & TOOLBOX_MENUTYPE_CUSTOMIZE) ? true : false );
+ pWrapper->ShowTitleButton( TITLE_BUTTON_MENU, ( aType & TOOLBOX_MENUTYPE_CUSTOMIZE) != 0 );
mbFormat = true;
ImplFormat();
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 6fdb764..4a898ee 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -796,7 +796,7 @@ bool Window::AcquireGraphics() const
mpGraphics->setAntiAliasB2DDraw(mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW);
}
- return mpGraphics ? true : false;
+ return mpGraphics != nullptr;
}
void Window::ReleaseGraphics( bool bRelease )
@@ -1259,7 +1259,7 @@ ImplWinData* Window::ImplGetWinData() const
mpWindowImpl->mpWinData->mnTrackFlags = 0;
mpWindowImpl->mpWinData->mnIsTopWindow = (sal_uInt16) ~0; // not initialized yet, 0/1 will indicate TopWindow (see IsTopWindow())
mpWindowImpl->mpWinData->mbMouseOver = false;
- mpWindowImpl->mpWinData->mbEnableNativeWidget = (pNoNWF && *pNoNWF) ? false : true; // true: try to draw this control with native theme API
+ mpWindowImpl->mpWinData->mbEnableNativeWidget = !(pNoNWF && *pNoNWF); // true: try to draw this control with native theme API
}
return mpWindowImpl->mpWinData;
@@ -2423,7 +2423,7 @@ void Window::Show( bool bVisible, sal_uInt16 nFlags )
mpWindowImpl->mbPaintFrame = true;
if (!Application::GetSettings().GetMiscSettings().GetPseudoHeadless())
{
- bool bNoActivate = (nFlags & (SHOW_NOACTIVATE|SHOW_NOFOCUSCHANGE)) ? true : false;
+ bool bNoActivate = (nFlags & (SHOW_NOACTIVATE|SHOW_NOFOCUSCHANGE)) != 0;
mpWindowImpl->mpFrame->Show( true, bNoActivate );
}
if( aDogTag.IsDead() )
@@ -2564,7 +2564,7 @@ void Window::Enable( bool bEnable, bool bChild )
void Window::SetCallHandlersOnInputDisabled( bool bCall )
{
- mpWindowImpl->mbCallHandlersDuringInputDisabled = bCall ? true : false;
+ mpWindowImpl->mbCallHandlersDuringInputDisabled = bCall;
vcl::Window* pChild = mpWindowImpl->mpFirstChild;
while ( pChild )
@@ -3752,7 +3752,7 @@ Reference< css::rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscr
else
aArg[ 2 ] = makeAny( css::awt::Rectangle( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight ) );
- aArg[ 3 ] = makeAny( mpWindowImpl->mbAlwaysOnTop ? true : false );
+ aArg[ 3 ] = makeAny( mpWindowImpl->mbAlwaysOnTop );
aArg[ 4 ] = makeAny( Reference< css::awt::XWindow >(
const_cast<vcl::Window*>(this)->GetComponentInterface(),
UNO_QUERY ));
diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx
index 1dfac09..427bd54 100644
--- a/vcl/unx/generic/dtrans/X11_selection.cxx
+++ b/vcl/unx/generic/dtrans/X11_selection.cxx
@@ -1347,7 +1347,7 @@ bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor >
}
if( (pFlavors - rTypes.getArray()) < rTypes.getLength() )
rTypes.realloc(pFlavors - rTypes.getArray());
- bSuccess = rTypes.getLength() ? true : false;
+ bSuccess = rTypes.hasElements();
if( bHaveText && ! bHaveUTF16 )
{
int i = 0;
@@ -2562,7 +2562,7 @@ bool SelectionManager::handleDragEvent( XEvent& rMessage )
dsde.DragSource = static_cast< XDragSource* >( this );
dsde.UserAction = getUserDragAction();
dsde.DropAction = DNDConstants::ACTION_NONE;
- m_bDropSuccess = rMessage.xclient.data.l[1] & 1 ? true : false;
+ m_bDropSuccess = (rMessage.xclient.data.l[1] & 1) != 0;
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "status drop action: accept = %s, %s\n",
m_bDropSuccess ? "true" : "false",
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index 3c573ae..c1de369 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -356,7 +356,7 @@ bool PPDDecompressStream::IsOpen() const
bool PPDDecompressStream::IsEof() const
{
- return ( mpMemStream ? mpMemStream->IsEof() : ( mpFileStream ? mpFileStream->IsEof() : true ) );
+ return ( mpMemStream ? mpMemStream->IsEof() : ( mpFileStream == nullptr || mpFileStream->IsEof() ) );
}
OString PPDDecompressStream::ReadLine()
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index b39dd8e..f93883a 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -1752,8 +1752,8 @@ void X11SalFrame::SetWindowState( const SalFrameState *pState )
Maximize();
else
{
- bool bHorz = (pState->mnState & WINDOWSTATE_STATE_MAXIMIZED_HORZ) ? true : false;
- bool bVert = (pState->mnState & WINDOWSTATE_STATE_MAXIMIZED_VERT) ? true : false;
+ bool bHorz = (pState->mnState & WINDOWSTATE_STATE_MAXIMIZED_HORZ) != 0;
+ bool bVert = (pState->mnState & WINDOWSTATE_STATE_MAXIMIZED_VERT) != 0;
GetDisplay()->getWMAdaptor()->maximizeFrame( this, bHorz, bVert );
}
maRestorePosSize.Left() = pState->mnX;
diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx
index f2ea9f2..97727a7 100644
--- a/vcl/unx/gtk/window/gtksalmenu.cxx
+++ b/vcl/unx/gtk/window/gtksalmenu.cxx
@@ -792,7 +792,7 @@ void GtkSalMenu::Display( bool bVisible )
bMenuVisibility = bVisible;
- bool bVCLMenuVisible = ( bVisible ) ? false : true;
+ bool bVCLMenuVisible = !bVisible;
MenuBar* pMenuBar = static_cast< MenuBar* >( mpVCLMenu );
pMenuBar->SetDisplayable( bVCLMenuVisible );
commit 9796e52ab3bbf64fa751c71e695c64d6215e1df6
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Apr 24 12:34:46 2015 +0200
loplugin:simplifybool
Change-Id: I56557cd02bbb97d3c3aa4053608cf2dd48c35e7a
diff --git a/unotools/source/config/configvaluecontainer.cxx b/unotools/source/config/configvaluecontainer.cxx
index 1b1cfa5..ff046cd 100644
--- a/unotools/source/config/configvaluecontainer.cxx
+++ b/unotools/source/config/configvaluecontainer.cxx
@@ -234,7 +234,7 @@ namespace utl
_rConfigLocation,
_nLevels,
( _nAccessFlags & CVC_UPDATE_ACCESS ) ? OConfigurationTreeRoot::CM_UPDATABLE : OConfigurationTreeRoot::CM_READONLY,
- ( _nAccessFlags & CVC_IMMEDIATE_UPDATE ) ? false : true
+ ( _nAccessFlags & CVC_IMMEDIATE_UPDATE ) == 0
);
SAL_WARN_IF(!m_pImpl->aConfigRoot.isValid(), "unotools.config",
"Could not access the configuration node located at " << _rConfigLocation);
diff --git a/unotools/source/config/searchopt.cxx b/unotools/source/config/searchopt.cxx
index d577130..3c442ab 100644
--- a/unotools/source/config/searchopt.cxx
+++ b/unotools/source/config/searchopt.cxx
@@ -91,7 +91,7 @@ void SvtSearchOptions_Impl::Notify( const Sequence< OUString >& )
bool SvtSearchOptions_Impl::GetFlag( sal_uInt16 nOffset ) const
{
DBG_ASSERT( nOffset <= MAX_FLAGS_OFFSET, "offset out of range");
- return ((nFlags >> nOffset) & 0x01) ? true : false;
+ return ((nFlags >> nOffset) & 0x01) != 0;
}
void SvtSearchOptions_Impl::SetFlag( sal_uInt16 nOffset, bool bVal )
commit 40b16e07c855521302e472eae4974524e39e2d3c
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Apr 24 12:34:42 2015 +0200
loplugin:simplifybool
Change-Id: I1890703bf1277ad83f578e1527db81a6e8f49fd3
diff --git a/ucb/source/ucp/ftp/ftpcontent.cxx b/ucb/source/ucp/ftp/ftpcontent.cxx
index dc2f999..59c889a 100644
--- a/ucb/source/ucp/ftp/ftpcontent.cxx
+++ b/ucb/source/ucp/ftp/ftpcontent.cxx
@@ -850,10 +850,8 @@ Reference< XRow > FTPContent::getPropertyValues(
: OUString(FTP_FILE) );
else if(Name == "IsReadOnly")
xRow->appendBoolean(seqProp[i],
- aDirEntry.m_nMode
- & INETCOREFTP_FILEMODE_WRITE
- ? false
- : true );
+ (aDirEntry.m_nMode
+ & INETCOREFTP_FILEMODE_WRITE) == 0 );
else if(Name == "IsDocument")
xRow->appendBoolean(seqProp[i],
(aDirEntry.m_nMode &
diff --git a/ucb/source/ucp/webdav-neon/DateTimeHelper.cxx b/ucb/source/ucp/webdav-neon/DateTimeHelper.cxx
index af39ae9..2b240eb 100644
--- a/ucb/source/ucp/webdav-neon/DateTimeHelper.cxx
+++ b/ucb/source/ucp/webdav-neon/DateTimeHelper.cxx
@@ -232,7 +232,7 @@ bool DateTimeHelper::RFC2068_To_DateTime (const OUString& s,
}
}
- return (found) ? true : false;
+ return found != 0;
}
bool DateTimeHelper::convert (const OUString& s, DateTime& dateTime)
commit 877fe59c4e398e6b9b2d4a8ea9904a59203fcd26
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Apr 24 12:34:10 2015 +0200
loplugin:simplifybool
Change-Id: Id1c743da4294b667438a2c075de4634bb2c85ff3
diff --git a/include/tools/bigint.hxx b/include/tools/bigint.hxx
index cabff6b..ac0cb92 100644
--- a/include/tools/bigint.hxx
+++ b/include/tools/bigint.hxx
@@ -114,7 +114,7 @@ public:
operator sal_uInt16() const;
operator sal_uIntPtr() const;
- void Set( bool bSet ) { bIsSet = bSet ? true : false; }
+ void Set( bool bSet ) { bIsSet = bSet; }
bool IsSet() const { return (bool)bIsSet; }
bool IsNeg() const;
diff --git a/tools/source/generic/bigint.cxx b/tools/source/generic/bigint.cxx
index fd21f55..ff8ea88 100644
--- a/tools/source/generic/bigint.cxx
+++ b/tools/source/generic/bigint.cxx
@@ -507,7 +507,7 @@ BigInt::BigInt( const OUString& rString )
p++;
}
if ( bIsBig )
- bIsNeg = bNeg ? true : false;
+ bIsNeg = bNeg;
else if( bNeg )
nVal = -nVal;
}
diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx
index fdb28829..d6bce14 100644
--- a/tools/source/zcodec/zcodec.cxx
+++ b/tools/source/zcodec/zcodec.cxx
@@ -380,7 +380,7 @@ void ZCodec::InitDecompress(SvStream & inStream)
if ( nFlags & GZ_HEAD_CRC )
inStream.SeekRel( 2 );
if ( mbStatus )
- mbStatus = ( inflateInit2( PZSTREAM, -MAX_WBITS) != Z_OK ) ? false : true;
+ mbStatus = inflateInit2( PZSTREAM, -MAX_WBITS) == Z_OK;
}
else
{
commit e710c1dbfb87a54d666752db1106b76e9e05ba43
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Apr 24 12:34:07 2015 +0200
loplugin:simplifybool
Change-Id: Ib238714477fdeadad07c470e1d9ed64b2b18f25d
diff --git a/toolkit/source/awt/vclxfont.cxx b/toolkit/source/awt/vclxfont.cxx
index a0628c0..9aece8b 100644
--- a/toolkit/source/awt/vclxfont.cxx
+++ b/toolkit/source/awt/vclxfont.cxx
@@ -66,7 +66,7 @@ bool VCLXFont::ImplAssertValidFontMetric()
pOutDev->SetFont( aOldFont );
}
}
- return mpFontMetric ? true : false;
+ return mpFontMetric != nullptr;
}
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index e0cedc4..a8c8cc0 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -1140,7 +1140,7 @@ void VCLXRadioButton::setProperty( const OUString& PropertyName, const ::com::su
sal_Int16 n = sal_Int16();
if ( Value >>= n )
{
- bool b = n ? true : false;
+ bool b = n != 0;
if ( pButton->IsRadioCheckEnabled() )
pButton->Check( b );
else
@@ -1807,7 +1807,7 @@ void VCLXListBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
if( pListBox )
{
- bool bDropDown = ( pListBox->GetStyle() & WB_DROPDOWN ) ? true : false;
+ bool bDropDown = ( pListBox->GetStyle() & WB_DROPDOWN ) != 0;
if ( bDropDown && !IsSynthesizingVCLEvent() && maActionListeners.getLength() )
{
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list