comphelper/source/property/property.cxx | 2 compilerplugins/clang/check.cxx | 9 compilerplugins/clang/check.hxx | 2 compilerplugins/clang/pointerbool.cxx | 124 ++++++++++++ compilerplugins/clang/test/pointerbool.cxx | 32 +++ desktop/source/deployment/dp_persmap.cxx | 2 editeng/source/items/numitem.cxx | 2 forms/source/xforms/submission/serialization_urlencoded.cxx | 2 sc/source/filter/excel/impop.cxx | 2 sc/source/filter/excel/xecontent.cxx | 2 sc/source/ui/navipi/navipi.cxx | 2 sc/source/ui/pagedlg/tptable.cxx | 8 sc/source/ui/view/tabview5.cxx | 2 sd/source/ui/animations/CustomAnimationPane.cxx | 2 sdext/source/pdfimport/wrapper/wrapper.cxx | 2 solenv/CompilerTest_compilerplugins_clang.mk | 1 sw/qa/core/uwriter.cxx | 2 sw/source/core/text/pormulti.cxx | 18 - sw/source/filter/ww8/ww8par.cxx | 2 sw/source/filter/ww8/ww8par3.cxx | 2 sw/source/filter/ww8/ww8par6.cxx | 2 sw/source/uibase/fldui/fldmgr.cxx | 2 sw/source/uibase/lingu/olmenu.cxx | 2 sw/source/uibase/utlui/navipi.cxx | 2 toolkit/source/controls/unocontrols.cxx | 2 vcl/source/control/combobox.cxx | 2 vcl/source/control/edit.cxx | 2 vcl/unx/gtk/gtksalframe.cxx | 2 vcl/unx/gtk3/gtk3gtkframe.cxx | 2 29 files changed, 203 insertions(+), 35 deletions(-)
New commits: commit 91b4e4531621b7afb2dbab1a8aa62c92da66951a Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Sun Jan 21 13:07:10 2018 +0200 new loplugin: pointerbool look for possibly bogus implicit conversions to bool when passing (normally pointer) args to bool params. this plugin comes in the wake of a couple of bugs caused by refactoring, where some of the call sites were not currently updated. Of the changes, the following are real bugs: desktop/../dp_persmap.cxx StartInputFieldDlg in sw/../fldmgr.cxx which occurred as a result of commit 39d719a80d8c87856c84e3ecd569d45fa6f8a30e Date: Tue May 3 11:39:37 2016 +0200 tdf#99529 sw: don't pop up input field dialog before inserting field CSerializationURLEncoded::encode_and_append in forms/../serialization_urlencoded.cxx XclExpCFImpl::XclExpCFImpl in sc/../xecontent.cxx I have no idea how to properly fix this, just made a guess. SwDocTest::test64kPageDescs in sw/qa/core/uwriter.cxx which looks like a simple copy/paste error. Change-Id: I795ebd5ef485a1d36863dc27fe13832989f5a441 Reviewed-on: https://gerrit.libreoffice.org/48291 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/comphelper/source/property/property.cxx b/comphelper/source/property/property.cxx index 8f222f56f8de..6a795d76479a 100644 --- a/comphelper/source/property/property.cxx +++ b/comphelper/source/property/property.cxx @@ -101,7 +101,7 @@ void copyProperties(const Reference<XPropertySet>& _rxSource, } else { - aBuffer.append( typeid( *_rxDest.get() ).name() ); + aBuffer.append( OUString::createFromAscii(typeid( *_rxDest.get() ).name()) ); } aBuffer.append( "' implementation).\n" ); diff --git a/compilerplugins/clang/check.cxx b/compilerplugins/clang/check.cxx index 2a7b0a978348..8b3e409be2d1 100644 --- a/compilerplugins/clang/check.cxx +++ b/compilerplugins/clang/check.cxx @@ -138,6 +138,15 @@ TypeCheck TypeCheck::NotSubstTemplateTypeParmType() const { ? *this : TypeCheck(); } +TypeCheck TypeCheck::SubstTemplateTypeParmType() const { + if (!type_.isNull()) { + if (auto const t = type_->getAs<clang::SubstTemplateTypeParmType>()) { + return TypeCheck(t->desugar()); + } + } + return TypeCheck(); +} + ContextCheck DeclCheck::Operator(clang::OverloadedOperatorKind op) const { assert(op != clang::OO_None); auto f = llvm::dyn_cast_or_null<clang::FunctionDecl>(decl_); diff --git a/compilerplugins/clang/check.hxx b/compilerplugins/clang/check.hxx index af6e8263df39..f31599f1b153 100644 --- a/compilerplugins/clang/check.hxx +++ b/compilerplugins/clang/check.hxx @@ -72,6 +72,8 @@ public: TypeCheck NotSubstTemplateTypeParmType() const; + TypeCheck SubstTemplateTypeParmType() const; + private: TypeCheck() = default; diff --git a/compilerplugins/clang/pointerbool.cxx b/compilerplugins/clang/pointerbool.cxx new file mode 100644 index 000000000000..543e8c6533c8 --- /dev/null +++ b/compilerplugins/clang/pointerbool.cxx @@ -0,0 +1,124 @@ +/* -*- 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 <cassert> +#include <string> +#include <iostream> +#include <fstream> +#include <set> + +#include <clang/AST/CXXInheritance.h> +#include "plugin.hxx" +#include "check.hxx" + +/** + Look for calls where the param is bool but the call-site-arg is pointer. +*/ + +namespace +{ +class PointerBool : public RecursiveASTVisitor<PointerBool>, public loplugin::Plugin +{ +public: + explicit PointerBool(loplugin::InstantiationData const& data) + : Plugin(data) + { + } + + virtual void run() override { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); } + + bool VisitCallExpr(CallExpr const*); + +private: + llvm::Optional<APSInt> getCallValue(const Expr* arg); +}; + +bool PointerBool::VisitCallExpr(CallExpr const* callExpr) +{ + if (ignoreLocation(callExpr)) + return true; + // TODO this doesn't currently work, the args and the params don't seem to line up + if (isa<CXXOperatorCallExpr>(callExpr)) + return true; + const FunctionDecl* functionDecl; + if (isa<CXXMemberCallExpr>(callExpr)) + { + functionDecl = dyn_cast<CXXMemberCallExpr>(callExpr)->getMethodDecl(); + } + else + { + functionDecl = callExpr->getDirectCallee(); + } + if (!functionDecl) + return true; + + unsigned len = std::min(callExpr->getNumArgs(), functionDecl->getNumParams()); + for (unsigned i = 0; i < len; ++i) + { + auto param = functionDecl->getParamDecl(i); + auto paramTC = loplugin::TypeCheck(param->getType()); + if (!paramTC.AnyBoolean()) + continue; + auto arg = callExpr->getArg(i)->IgnoreImpCasts(); + auto argTC = loplugin::TypeCheck(arg->getType()); + if (argTC.AnyBoolean()) + continue; + // sal_Bool is sometimes disguised + if (isa<SubstTemplateTypeParmType>(arg->getType())) + if (arg->getType()->getUnqualifiedDesugaredType()->isSpecificBuiltinType( + clang::BuiltinType::UChar)) + continue; + if (arg->getType()->isDependentType()) + continue; + if (arg->getType()->isIntegerType()) + { + auto ret = getCallValue(arg); + if (ret.hasValue() && (ret.getValue() == 1 || ret.getValue() == 0)) + continue; + // something like: priv->m_nLOKFeatures & LOK_FEATURE_DOCUMENT_PASSWORD + if (isa<BinaryOperator>(arg->IgnoreParenImpCasts())) + continue; + // something like: pbEmbolden ? FcTrue : FcFalse + if (isa<ConditionalOperator>(arg->IgnoreParenImpCasts())) + continue; + } + report(DiagnosticsEngine::Warning, + "possibly unwanted implicit conversion when calling bool param", arg->getExprLoc()) + << arg->getSourceRange(); + report(DiagnosticsEngine::Note, "method here", param->getLocation()) + << param->getSourceRange(); + arg->getType()->dump(); + } + return true; +} + +llvm::Optional<APSInt> PointerBool::getCallValue(const Expr* arg) +{ + arg = arg->IgnoreParenCasts(); + if (auto defArg = dyn_cast<CXXDefaultArgExpr>(arg)) + { + arg = defArg->getExpr()->IgnoreParenCasts(); + } + // ignore this, it seems to trigger an infinite recursion + if (isa<UnaryExprOrTypeTraitExpr>(arg)) + { + return llvm::Optional<APSInt>(); + } + APSInt x1; + if (arg->EvaluateAsInt(x1, compiler.getASTContext())) + { + return x1; + } + return llvm::Optional<APSInt>(); +} + +loplugin::Plugin::Registration<PointerBool> X("pointerbool", true); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/compilerplugins/clang/test/pointerbool.cxx b/compilerplugins/clang/test/pointerbool.cxx new file mode 100644 index 000000000000..276a95ae1e00 --- /dev/null +++ b/compilerplugins/clang/test/pointerbool.cxx @@ -0,0 +1,32 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <sal/types.h> +#include <com/sun/star/uno/Sequence.hxx> + +#define FALSE 0 + +void func_ptr(int*); +void func_bool(bool); // expected-note {{method here [loplugin:pointerbool]}} +void func_salbool(sal_Bool); + +void test1(int* p1) +{ + func_ptr(p1); + func_bool( + p1); // expected-error {{possibly unwanted implicit conversion when calling bool param [loplugin:pointerbool]}} + // no warning expected + func_bool(FALSE); + func_salbool(sal_False); + func_salbool(sal_True); + css::uno::Sequence<sal_Bool> aSeq; + func_bool(aSeq[0]); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/desktop/source/deployment/dp_persmap.cxx b/desktop/source/deployment/dp_persmap.cxx index e254d9b67c0a..2e5a047cd864 100644 --- a/desktop/source/deployment/dp_persmap.cxx +++ b/desktop/source/deployment/dp_persmap.cxx @@ -91,7 +91,7 @@ static OString encodeString( const OString& rStr) c += (c <= 0x09) ? '0' : 'A'-10; } else if( c == '%') aEncStr.append( '%'); - aEncStr.append( c); + aEncStr.append( char(c) ); } return aEncStr.makeStringAndClear(); diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index c57c44df6a10..d18452a7010b 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -228,7 +228,7 @@ SvxNumberFormat::SvxNumberFormat( SvStream &rStream ) ReadColor( rStream, nBulletColor ); rStream.ReadUInt16( nBulletRelSize ); - rStream.ReadUInt16( nTmp16 ); SetShowSymbol( nTmp16 ); + rStream.ReadUInt16( nTmp16 ); SetShowSymbol( nTmp16 != 0 ); rStream.ReadUInt16( nTmp16 ); mePositionAndSpaceMode = static_cast<SvxNumPositionAndSpaceMode>(nTmp16); rStream.ReadUInt16( nTmp16 ); meLabelFollowedBy = static_cast<LabelFollowedBy>(nTmp16); diff --git a/forms/source/xforms/submission/serialization_urlencoded.cxx b/forms/source/xforms/submission/serialization_urlencoded.cxx index 0e96edfb643c..626569aec2aa 100644 --- a/forms/source/xforms/submission/serialization_urlencoded.cxx +++ b/forms/source/xforms/submission/serialization_urlencoded.cxx @@ -80,7 +80,7 @@ void CSerializationURLEncoded::encode_and_append(const OUString& aString, OStri if( *pString < 0x80 ) { if ( is_unreserved(*pString) ) { - aBuffer.append(*pString); + aBuffer.append(char(*pString)); } else if (*pString == 0x20) { aBuffer.append('+'); } else if (*pString == 0x0d && *(pString+1) == 0x0a) { diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx index 7ec10e9f272f..56b2de54f441 100644 --- a/sc/source/filter/excel/impop.cxx +++ b/sc/source/filter/excel/impop.cxx @@ -382,7 +382,7 @@ void ImportExcel::ReadBoolErr() GetXFRangeBuffer().SetXF( aScPos, nXFIdx ); double fValue; - const ScTokenArray* pScTokArr = ErrorToFormula( nType, nValue, fValue ); + const ScTokenArray* pScTokArr = ErrorToFormula( nType != EXC_BOOLERR_BOOL, nValue, fValue ); ScFormulaCell* pCell = pScTokArr ? new ScFormulaCell(pD, aScPos, *pScTokArr) : new ScFormulaCell(pD, aScPos); pCell->SetHybridDouble( fValue ); GetDocImport().setFormulaCell(aScPos, pCell); diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index 29523aa81c9d..7eb0f6854530 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -658,7 +658,7 @@ XclExpCFImpl::XclExpCFImpl( const XclExpRoot& rRoot, const ScCondFormatEntry& rF // pattern mbPattUsed = ScfTools::CheckItem( rItemSet, ATTR_BACKGROUND, true ); if( mbPattUsed ) - maArea.FillFromItemSet( rItemSet, GetPalette(), GetBiff() ); + maArea.FillFromItemSet( rItemSet, GetPalette(), true ); } // *** mode and comparison operator *** diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index bd6c65810f02..2593dd68e6af 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -574,7 +574,7 @@ void ScNavigatorDlg::StateChanged(StateChangedType nStateChange) // When the navigator is displayed in the sidebar, or is otherwise // docked, it has the whole deck to fill. Therefore hide the button that // hides all controls below the top two rows of buttons. - aTbxCmd->ShowItem(nZoomId, SfxChildWindowContext::GetFloatingWindow(GetParent())); + aTbxCmd->ShowItem(nZoomId, SfxChildWindowContext::GetFloatingWindow(GetParent()) != nullptr); } } diff --git a/sc/source/ui/pagedlg/tptable.cxx b/sc/source/ui/pagedlg/tptable.cxx index 43a938b2c33b..2b962a9c8dce 100644 --- a/sc/source/ui/pagedlg/tptable.cxx +++ b/sc/source/ui/pagedlg/tptable.cxx @@ -226,16 +226,16 @@ void ScTablePage::Reset( const SfxItemSet* rCoreSet ) else m_pEdScalePageWidth->SetText(OUString()); - m_pEdScalePageWidth->Enable(nWidth); - m_pCbScalePageWidth->Check(nWidth); + m_pEdScalePageWidth->Enable(nWidth != 0); + m_pCbScalePageWidth->Check(nWidth != 0); if(nHeight) m_pEdScalePageHeight->SetValue(nHeight); else m_pEdScalePageHeight->SetText(OUString()); - m_pEdScalePageHeight->Enable(nHeight); - m_pCbScalePageHeight->Check(nHeight); + m_pEdScalePageHeight->Enable(nHeight != 0); + m_pCbScalePageHeight->Check(nHeight != 0); } nWhich = GetWhich(SID_SCATTR_PAGE_SCALETOPAGES); diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index 0d6a6a9324d0..e11c0ffa6352 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -253,7 +253,7 @@ void ScTabView::MakeDrawView( TriState nForceDesignMode ) // used when switching back from page preview: restore saved design mode state // (otherwise, keep the default from the draw view ctor) if ( nForceDesignMode != TRISTATE_INDET ) - pDrawView->SetDesignMode( nForceDesignMode ); + pDrawView->SetDesignMode( nForceDesignMode != TRISTATE_FALSE ); // register at FormShell FmFormShell* pFormSh = aViewData.GetViewShell()->GetFormShell(); diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx index 17ed3f4b0b36..8ebd2f1ee3e6 100644 --- a/sd/source/ui/animations/CustomAnimationPane.cxx +++ b/sd/source/ui/animations/CustomAnimationPane.cxx @@ -525,7 +525,7 @@ void CustomAnimationPane::updateControls() const int nSelectionCount = maListSelection.size(); mpPBAddEffect->Enable( maViewSelection.hasValue() ); - mpPBRemoveEffect->Enable(nSelectionCount); + mpPBRemoveEffect->Enable(nSelectionCount != 0); bool bIsSelected = (nSelectionCount == 1); if(bIsSelected) diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index f303ab09084b..d9cce4a677fc 100644 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -768,7 +768,7 @@ void Parser::readMask() readInt32(nHeight); readInt32(nInvert); - m_pSink->drawMask( readImageImpl(), nInvert ); + m_pSink->drawMask( readImageImpl(), nInvert != 0); } void Parser::readLink() diff --git a/solenv/CompilerTest_compilerplugins_clang.mk b/solenv/CompilerTest_compilerplugins_clang.mk index 2e5d878a9be6..018740f932a3 100644 --- a/solenv/CompilerTest_compilerplugins_clang.mk +++ b/solenv/CompilerTest_compilerplugins_clang.mk @@ -33,6 +33,7 @@ $(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \ compilerplugins/clang/test/oslendian-3 \ compilerplugins/clang/test/passparamsbyref \ compilerplugins/clang/test/passstuffbyref \ + compilerplugins/clang/test/pointerbool \ compilerplugins/clang/test/redundantcast \ compilerplugins/clang/test/redundantcopy \ compilerplugins/clang/test/redundantinline \ diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index 2ef71ad10f62..e73636139224 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -1929,7 +1929,7 @@ void SwDocTest::test64kPageDescs() rZeroDesc = m_pDoc->GetPageDesc( 0 ); CPPUNIT_ASSERT_EQUAL( aZeroName, rZeroDesc.GetName() ); - m_pDoc->DelPageDesc( aChanged, nPos ); + m_pDoc->DelPageDesc( aChanged, /*bBroadcast*/true ); pDesc = m_pDoc->FindPageDesc( aChanged, &nPos ); // not there anymore CPPUNIT_ASSERT( !pDesc ); diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx index 03f7e8592625..8c92618e7c88 100644 --- a/sw/source/core/text/pormulti.cxx +++ b/sw/source/core/text/pormulti.cxx @@ -1299,18 +1299,18 @@ void SwTextPainter::PaintMultiPortion( const SwRect &rPaint, } SwLayoutModeModifier aLayoutModeModifier( *GetInfo().GetOut() ); - sal_uInt8 nEnvDir = 0; - sal_uInt8 nThisDir = 0; - sal_uInt8 nFrameDir = 0; + bool bEnvDir = false; + bool bThisDir = false; + bool bFrameDir = false; if ( rMulti.IsBidi() ) { // these values are needed for the calculation of the x coordinate // and the layout mode OSL_ENSURE( ! pEnvPor || pEnvPor->IsBidi(), "Oh no, I expected a BidiPortion" ); - nFrameDir = GetInfo().GetTextFrame()->IsRightToLeft() ? 1 : 0; - nEnvDir = pEnvPor ? static_cast<const SwBidiPortion*>(pEnvPor)->GetLevel() % 2 : nFrameDir; - nThisDir = static_cast<SwBidiPortion&>(rMulti).GetLevel() % 2; + bFrameDir = GetInfo().GetTextFrame()->IsRightToLeft(); + bEnvDir = pEnvPor ? ((static_cast<const SwBidiPortion*>(pEnvPor)->GetLevel() % 2) != 0) : bFrameDir; + bThisDir = (static_cast<SwBidiPortion&>(rMulti).GetLevel() % 2) != 0; } #if OSL_DEBUG_LEVEL > 1 @@ -1388,13 +1388,13 @@ void SwTextPainter::PaintMultiPortion( const SwRect &rPaint, { // does the current bidi portion has the same direction // as its environment? - if ( nEnvDir != nThisDir ) + if ( bEnvDir != bThisDir ) { // different directions, we have to adjust the x coordinate SwTwips nMultiWidth = rMulti.Width() + rMulti.CalcSpacing( GetInfo().GetSpaceAdd(), GetInfo() ); - if ( nFrameDir == nThisDir ) + if ( bFrameDir == bThisDir ) GetInfo().X( GetInfo().X() - nMultiWidth ); else GetInfo().X( GetInfo().X() + nMultiWidth ); @@ -1403,7 +1403,7 @@ void SwTextPainter::PaintMultiPortion( const SwRect &rPaint, nOfst = nOldY - rMulti.GetAscent(); // set layout mode - aLayoutModeModifier.Modify( nThisDir ); + aLayoutModeModifier.Modify( bThisDir ); } else nOfst = nOldY - rMulti.GetAscent(); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 9ab1e55a7ef5..dd74a48b4056 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1946,7 +1946,7 @@ void SwWW8ImplReader::ImportDopTypography(const WW8DopTypography &rTypo) m_rDoc.getIDocumentSettingAccess().setForbiddenCharacters(LANGUAGE_JAPANESE,aForbidden); } - m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::KERN_ASIAN_PUNCTUATION, rTypo.fKerningPunct); + m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::KERN_ASIAN_PUNCTUATION, bool(rTypo.fKerningPunct)); m_rDoc.getIDocumentSettingAccess().setCharacterCompressionType(static_cast<CharCompressType>(rTypo.iJustification)); } diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index cc487a888925..f5ceca90a2b2 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -209,7 +209,7 @@ eF_ResT SwWW8ImplReader::Read_F_FormCheckBox( WW8FieldDesc* pF, OUString& rStr ) (*pParameters)[ODF_FORMCHECKBOX_HELPTEXT] <<= aFormula.msToolTip; if(pCheckboxFm) - pCheckboxFm->SetChecked(aFormula.mnChecked); + pCheckboxFm->SetChecked(aFormula.mnChecked != 0); // set field data here... } } diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 5d4506e4a1a8..79b2d165ae6b 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -4368,7 +4368,7 @@ void SwWW8ImplReader::Read_ParaContextualSpacing( sal_uInt16, const sal_uInt8* p return; } SvxULSpaceItem aUL( *static_cast<const SvxULSpaceItem*>(GetFormatAttr( RES_UL_SPACE ))); - aUL.SetContextValue(*pData); + aUL.SetContextValue(*pData != 0); NewAttr( aUL ); } diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx index efc72ec5a2e0..14bb2d4623a4 100644 --- a/sw/source/uibase/fldui/fldmgr.cxx +++ b/sw/source/uibase/fldui/fldmgr.cxx @@ -1497,7 +1497,7 @@ bool SwFieldMgr::InsertField( // start dialog, not before the field is inserted tdf#99529 pCurShell->Left(CRSR_SKIP_CHARS, false, (INP_VAR == (nSubType & 0xff)) ? 1 : 2, false ); - pCurShell->StartInputFieldDlg(pField, false, rData.m_pParent); + pCurShell->StartInputFieldDlg(pField, false, true, rData.m_pParent); pCurShell->Pop(SwCursorShell::PopMode::DeleteCurrent); } diff --git a/sw/source/uibase/lingu/olmenu.cxx b/sw/source/uibase/lingu/olmenu.cxx index f368f9560978..109b4f4d86dc 100644 --- a/sw/source/uibase/lingu/olmenu.cxx +++ b/sw/source/uibase/lingu/olmenu.cxx @@ -615,7 +615,7 @@ void SwSpellPopup::checkRedline() nId = m_nRedlineNextId; else if (nWhich == FN_REDLINE_PREV_CHANGE) nId = m_nRedlinePrevId; - m_xPopupMenu->EnableItem(nId, aSet.Get(nWhich).Which()); + m_xPopupMenu->EnableItem(nId, aSet.Get(nWhich).Which() != 0); } } diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index 26785145dbaf..e8f62ee11be4 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -867,7 +867,7 @@ void SwNavigationPI::StateChanged(StateChangedType nStateChange) // the sidebar or is otherwise docked. While the navigator could change // its size, the sidebar can not, and the navigator would just waste // space. Therefore hide this button. - m_aContentToolBox->ShowItem(m_aContentToolBox->GetItemId("listbox"), SfxChildWindowContext::GetFloatingWindow(GetParent())); + m_aContentToolBox->ShowItem(m_aContentToolBox->GetItemId("listbox"), SfxChildWindowContext::GetFloatingWindow(GetParent()) != nullptr); } else if (nStateChange == StateChangedType::ControlFocus) { diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx index dd2d11eaccd2..98b4b8c0b52a 100644 --- a/toolkit/source/controls/unocontrols.cxx +++ b/toolkit/source/controls/unocontrols.cxx @@ -3638,7 +3638,7 @@ void UnoDateFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rx xField->setFirst( mnFirst ); xField->setLast( mnLast ); if ( mbLongFormat != TRISTATE_INDET ) - xField->setLongFormat( mbLongFormat ); + xField->setLongFormat( mbLongFormat != TRISTATE_FALSE); } diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 531284cf86eb..daf90a3333bc 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -853,7 +853,7 @@ void ComboBox::Impl::ImplUpdateFloatSelection() ::std::set< sal_Int32 > aSelInText; lcl_GetSelectedEntries(aSelInText, m_pSubEdit->GetText(), m_cMultiSep, m_pImplLB->GetEntryList()); for (sal_Int32 n = 0; n < m_pImplLB->GetEntryList()->GetEntryCount(); n++) - m_pImplLB->SelectEntry( n, aSelInText.count( n ) ); + m_pImplLB->SelectEntry( n, aSelInText.count( n ) != 0 ); } m_pImplLB->SetCallSelectionChangedHdl( true ); } diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index fc8d7299780c..4dd99139c2f5 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -1978,7 +1978,7 @@ void Edit::Command( const CommandEvent& rCEvt ) pPopup->EnableItem(pPopup->GetItemId("undo"), maUndoText != maText.getStr()); bool bAllSelected = maSelection.Min() == 0 && maSelection.Max() == maText.getLength(); pPopup->EnableItem(pPopup->GetItemId("selectall"), !bAllSelected); - pPopup->ShowItem(pPopup->GetItemId("specialchar"), pImplFncGetSpecialChars); + pPopup->ShowItem(pPopup->GetItemId("specialchar"), pImplFncGetSpecialChars != nullptr); mbActivePopup = true; Selection aSaveSel = GetSelection(); // if someone changes selection in Get/LoseFocus, e.g. URL bar diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx index d297d7ad7cfd..880e1244bd36 100644 --- a/vcl/unx/gtk/gtksalframe.cxx +++ b/vcl/unx/gtk/gtksalframe.cxx @@ -2894,7 +2894,7 @@ gboolean GtkSalFrame::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer f pThis->m_nKeyModifiers = ModKeyFlags::NONE; if( pThis->m_pIMHandler ) - pThis->m_pIMHandler->focusChanged( pEvent->in ); + pThis->m_pIMHandler->focusChanged( pEvent->in != 0 ); // ask for changed printers like generic implementation if( pEvent->in && pSalInstance->isPrinterInit() ) diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx index 485ef9323d0d..e5236108df1c 100644 --- a/vcl/unx/gtk3/gtk3gtkframe.cxx +++ b/vcl/unx/gtk3/gtk3gtkframe.cxx @@ -3005,7 +3005,7 @@ gboolean GtkSalFrame::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer f pThis->m_nKeyModifiers = ModKeyFlags::NONE; if( pThis->m_pIMHandler ) - pThis->m_pIMHandler->focusChanged( pEvent->in ); + pThis->m_pIMHandler->focusChanged( pEvent->in != 0 ); // ask for changed printers like generic implementation if( pEvent->in && pSalInstance->isPrinterInit() ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits