From 76b114f849645f42311c0553b3320532bb26049c Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 24 Feb 2014 17:25:05 +0100 Subject: implicitboolconversion: warn about implicit conversion of call args to bool ...to be able to find problems like 6e0bdf04add338b7d5b29fc7b3fc9f08cfd5e96f "sal_Bool arg of SetUseImagesInMenus was abused to squeeze '2' through it" earlier when converting occurrences of sal_Bool to bool. Restricting this check to function call arguments avoids too much noise while hopefully still catching all the relevant problems. (This check partially overlaps the pointertobool check, so implicit conversions from pointers to bool call arguments will now generate two loplugin warnings, but that's harmless.) Change-Id: I0b03b1d1615aaf8bc18e7a84c56fff3ef9903508 --- .../source/controller/dialogs/tp_RangeChooser.cxx | 4 +- compilerplugins/clang/implicitboolconversion.cxx | 52 +++++++++++++++++----- forms/source/component/Grid.cxx | 2 +- oox/source/export/vmlexport.cxx | 4 +- sc/source/core/tool/address.cxx | 40 ++++++++--------- sc/source/filter/excel/excrecds.cxx | 2 +- sc/source/filter/excel/xepivot.cxx | 6 +-- sc/source/ui/unoobj/cellsuno.cxx | 2 +- sc/source/ui/unoobj/docuno.cxx | 4 +- sd/source/ui/unoidl/sddetect.cxx | 2 +- sfx2/source/dialog/itemconnect.cxx | 4 +- starmath/source/smdetect.cxx | 2 +- svx/source/table/tablecontroller.cxx | 8 ++-- sw/source/core/txtnode/thints.cxx | 2 +- sw/source/ui/uno/swdetect.cxx | 2 +- sw/source/ui/utlui/unotools.cxx | 4 +- 16 files changed, 85 insertions(+), 55 deletions(-) diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.cxx b/chart2/source/controller/dialogs/tp_RangeChooser.cxx index 720e70d9037e..cc2ed797ff14 100644 --- a/chart2/source/controller/dialogs/tp_RangeChooser.cxx +++ b/chart2/source/controller/dialogs/tp_RangeChooser.cxx @@ -249,9 +249,9 @@ void RangeChooserTabPage::changeDialogModelAccordingToControls() bool RangeChooserTabPage::isValid() { OUString aRange( m_pED_Range->GetText()); - sal_Bool bFirstCellAsLabel = ( m_pCB_FirstColumnAsLabel->IsChecked() && !m_pRB_Columns->IsChecked() ) + bool bFirstCellAsLabel = ( m_pCB_FirstColumnAsLabel->IsChecked() && !m_pRB_Columns->IsChecked() ) || ( m_pCB_FirstRowAsLabel->IsChecked() && !m_pRB_Rows->IsChecked() ); - sal_Bool bHasCategories = ( m_pCB_FirstColumnAsLabel->IsChecked() && m_pRB_Columns->IsChecked() ) + bool bHasCategories = ( m_pCB_FirstColumnAsLabel->IsChecked() && m_pRB_Columns->IsChecked() ) || ( m_pCB_FirstRowAsLabel->IsChecked() && m_pRB_Rows->IsChecked() ); bool bIsValid = ( aRange.isEmpty() ) || m_rDialogModel.getRangeSelectionHelper()->verifyArguments( diff --git a/compilerplugins/clang/implicitboolconversion.cxx b/compilerplugins/clang/implicitboolconversion.cxx index 0327f9fbbef0..6503ca8d2860 100644 --- a/compilerplugins/clang/implicitboolconversion.cxx +++ b/compilerplugins/clang/implicitboolconversion.cxx @@ -26,6 +26,14 @@ template<> struct std::iterator_traits { typedef std::random_access_iterator_tag iterator_category; }; +template<> struct std::iterator_traits { + typedef std::ptrdiff_t difference_type; + typedef Expr const * value_type; + typedef Expr const ** pointer; + typedef Expr const & reference; + typedef std::random_access_iterator_tag iterator_category; +}; + namespace { bool isBool(Expr const * expr, bool allowTypedefs = true) { @@ -147,11 +155,13 @@ private: void reportWarning(ImplicitCastExpr const * expr); std::stack> nested; + std::stack calls; bool externCIntFunctionDefinition = false; }; bool ImplicitBoolConversion::TraverseCallExpr(CallExpr * expr) { nested.push(std::vector()); + calls.push(expr); bool ret = RecursiveASTVisitor::TraverseCallExpr(expr); Decl const * d = expr->getCalleeDecl(); bool ext = false; @@ -203,6 +213,7 @@ bool ImplicitBoolConversion::TraverseCallExpr(CallExpr * expr) { reportWarning(i); } } + calls.pop(); nested.pop(); return ret; } @@ -540,21 +551,40 @@ bool ImplicitBoolConversion::VisitImplicitCastExpr( } else { nested.top().push_back(expr); } - } else { - ExplicitCastExpr const * sub = dyn_cast( - expr->getSubExpr()->IgnoreParenImpCasts()); - if (sub != nullptr - && (sub->getSubExpr()->IgnoreParenImpCasts()->getType().IgnoreParens() - == expr->getType().IgnoreParens()) - && isBool(sub->getSubExpr()->IgnoreParenImpCasts())) + return true; + } + ExplicitCastExpr const * sub = dyn_cast( + expr->getSubExpr()->IgnoreParenImpCasts()); + if (sub != nullptr + && (sub->getSubExpr()->IgnoreParenImpCasts()->getType().IgnoreParens() + == expr->getType().IgnoreParens()) + && isBool(sub->getSubExpr()->IgnoreParenImpCasts())) + { + report( + DiagnosticsEngine::Warning, + "explicit conversion (%0) from %1 to %2 implicitly cast back to %3", + expr->getLocStart()) + << sub->getCastKindName() + << sub->getSubExpr()->IgnoreParenImpCasts()->getType() + << sub->getType() << expr->getType() << expr->getSourceRange(); + return true; + } + if (expr->getType()->isBooleanType() && !isBool(expr->getSubExpr()) + && !calls.empty()) + { + CallExpr const * call = calls.top(); + if (std::find_if( + call->arg_begin(), call->arg_end(), + [expr](Expr const * e) { return expr == e->IgnoreParens(); }) + != call->arg_end()) { report( DiagnosticsEngine::Warning, - "explicit conversion (%0) from %1 to %2 implicitly cast back to %3", + "implicit conversion (%0) of call argument from %1 to %2", expr->getLocStart()) - << sub->getCastKindName() - << sub->getSubExpr()->IgnoreParenImpCasts()->getType() - << sub->getType() << expr->getType() << expr->getSourceRange(); + << expr->getCastKindName() << expr->getSubExpr()->getType() + << expr->getType() << expr->getSourceRange(); + return true; } } return true; diff --git a/forms/source/component/Grid.cxx b/forms/source/component/Grid.cxx index 1be7b6d48ac0..4275ef5a02fc 100644 --- a/forms/source/component/Grid.cxx +++ b/forms/source/component/Grid.cxx @@ -959,7 +959,7 @@ void OGridControlModel::read(const Reference& _rxInStream) t m_bEnable = _rxInStream->readBoolean(); if (nAnyMask & TABSTOP) { - m_aTabStop = makeBoolAny(_rxInStream->readBoolean()); + m_aTabStop = makeBoolAny(_rxInStream->readBoolean() != 0); } if (nVersion > 3) m_bNavigation = _rxInStream->readBoolean(); diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index 0c35c4582ccf..aa4c92a62f3e 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -579,7 +579,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect } if ( rProps.GetOpt( ESCHER_Prop_fNoFillHitTest, nValue ) ) - impl_AddBool( pAttrList, XML_detectmouseclick, nValue ); + impl_AddBool( pAttrList, XML_detectmouseclick, nValue != 0 ); if (rProps.GetOpt(ESCHER_Prop_fillOpacity, nValue)) // Partly undo the transformation at the end of EscherPropertyContainer::CreateFillProperties(): VML opacity is 0..1. @@ -777,7 +777,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect case ESCHER_Prop_fNoLineDrawDash: { // See DffPropertyReader::ApplyLineAttributes(). - impl_AddBool( m_pShapeAttrList, XML_stroked, it->nPropValue & 8 ); + impl_AddBool( m_pShapeAttrList, XML_stroked, (it->nPropValue & 8) != 0 ); bAlreadyWritten[ESCHER_Prop_fNoLineDrawDash] = true; } break; diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index 710fa29f74f4..adb1d654e836 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -1790,16 +1790,16 @@ OUString ScAddress::Format(sal_uInt16 nFlags, const ScDocument* pDoc, case formula::FormulaGrammar::CONV_XL_A1: case formula::FormulaGrammar::CONV_XL_OOX: if( nFlags & SCA_VALID_COL ) - lcl_a1_append_c ( r, nCol, nFlags & SCA_COL_ABSOLUTE ); + lcl_a1_append_c ( r, nCol, (nFlags & SCA_COL_ABSOLUTE) != 0 ); if( nFlags & SCA_VALID_ROW ) - lcl_a1_append_r ( r, nRow, nFlags & SCA_ROW_ABSOLUTE ); + lcl_a1_append_r ( r, nRow, (nFlags & SCA_ROW_ABSOLUTE) != 0 ); break; case formula::FormulaGrammar::CONV_XL_R1C1: if( nFlags & SCA_VALID_ROW ) - lcl_r1c1_append_r ( r, nRow, nFlags & SCA_ROW_ABSOLUTE, rDetails ); + lcl_r1c1_append_r ( r, nRow, (nFlags & SCA_ROW_ABSOLUTE) != 0, rDetails ); if( nFlags & SCA_VALID_COL ) - lcl_r1c1_append_c ( r, nCol, nFlags & SCA_COL_ABSOLUTE, rDetails ); + lcl_r1c1_append_c ( r, nCol, (nFlags & SCA_COL_ABSOLUTE) != 0, rDetails ); break; } return r; @@ -1901,28 +1901,28 @@ OUString ScRange::Format( sal_uInt16 nFlags, const ScDocument* pDoc, if( aStart.Col() == 0 && aEnd.Col() >= MAXCOL ) { // Full col refs always require 2 rows (2:2) - lcl_a1_append_r( r, aStart.Row(), nFlags & SCA_ROW_ABSOLUTE ); + lcl_a1_append_r( r, aStart.Row(), (nFlags & SCA_ROW_ABSOLUTE) != 0 ); r += ":"; - lcl_a1_append_r( r, aEnd.Row(), nFlags & SCA_ROW2_ABSOLUTE ); + lcl_a1_append_r( r, aEnd.Row(), (nFlags & SCA_ROW2_ABSOLUTE) != 0 ); } else if( aStart.Row() == 0 && aEnd.Row() >= MAXROW ) { // Full row refs always require 2 cols (A:A) - lcl_a1_append_c( r, aStart.Col(), nFlags & SCA_COL_ABSOLUTE ); + lcl_a1_append_c( r, aStart.Col(), (nFlags & SCA_COL_ABSOLUTE) != 0 ); r += ":"; - lcl_a1_append_c( r, aEnd.Col(), nFlags & SCA_COL2_ABSOLUTE ); + lcl_a1_append_c( r, aEnd.Col(), (nFlags & SCA_COL2_ABSOLUTE) != 0 ); } else { - lcl_a1_append_c ( r, aStart.Col(), nFlags & SCA_COL_ABSOLUTE ); - lcl_a1_append_r ( r, aStart.Row(), nFlags & SCA_ROW_ABSOLUTE ); + lcl_a1_append_c ( r, aStart.Col(), (nFlags & SCA_COL_ABSOLUTE) != 0 ); + lcl_a1_append_r ( r, aStart.Row(), (nFlags & SCA_ROW_ABSOLUTE) != 0 ); if( aStart.Col() != aEnd.Col() || absrel_differ( nFlags, SCA_COL_ABSOLUTE ) || aStart.Row() != aEnd.Row() || absrel_differ( nFlags, SCA_ROW_ABSOLUTE )) { r += ":"; - lcl_a1_append_c ( r, aEnd.Col(), nFlags & SCA_COL2_ABSOLUTE ); - lcl_a1_append_r ( r, aEnd.Row(), nFlags & SCA_ROW2_ABSOLUTE ); + lcl_a1_append_c ( r, aEnd.Col(), (nFlags & SCA_COL2_ABSOLUTE) != 0 ); + lcl_a1_append_r ( r, aEnd.Row(), (nFlags & SCA_ROW2_ABSOLUTE) != 0 ); } } break; @@ -1931,33 +1931,33 @@ OUString ScRange::Format( sal_uInt16 nFlags, const ScDocument* pDoc, lcl_ScRange_Format_XL_Header( r, *this, nFlags, pDoc, rDetails ); if( aStart.Col() == 0 && aEnd.Col() >= MAXCOL ) { - lcl_r1c1_append_r( r, aStart.Row(), nFlags & SCA_ROW_ABSOLUTE, rDetails ); + lcl_r1c1_append_r( r, aStart.Row(), (nFlags & SCA_ROW_ABSOLUTE) != 0, rDetails ); if( aStart.Row() != aEnd.Row() || absrel_differ( nFlags, SCA_ROW_ABSOLUTE )) { r += ":"; - lcl_r1c1_append_r( r, aEnd.Row(), nFlags & SCA_ROW2_ABSOLUTE, rDetails ); + lcl_r1c1_append_r( r, aEnd.Row(), (nFlags & SCA_ROW2_ABSOLUTE) != 0, rDetails ); } } else if( aStart.Row() == 0 && aEnd.Row() >= MAXROW ) { - lcl_r1c1_append_c( r, aStart.Col(), nFlags & SCA_COL_ABSOLUTE, rDetails ); + lcl_r1c1_append_c( r, aStart.Col(), (nFlags & SCA_COL_ABSOLUTE) != 0, rDetails ); if( aStart.Col() != aEnd.Col() || absrel_differ( nFlags, SCA_COL_ABSOLUTE )) { r += ":"; - lcl_r1c1_append_c( r, aEnd.Col(), nFlags & SCA_COL2_ABSOLUTE, rDetails ); + lcl_r1c1_append_c( r, aEnd.Col(), (nFlags & SCA_COL2_ABSOLUTE) != 0, rDetails ); } } else { - lcl_r1c1_append_r( r, aStart.Row(), nFlags & SCA_ROW_ABSOLUTE, rDetails ); - lcl_r1c1_append_c( r, aStart.Col(), nFlags & SCA_COL_ABSOLUTE, rDetails ); + lcl_r1c1_append_r( r, aStart.Row(), (nFlags & SCA_ROW_ABSOLUTE) != 0, rDetails ); + lcl_r1c1_append_c( r, aStart.Col(), (nFlags & SCA_COL_ABSOLUTE) != 0, rDetails ); if( aStart.Col() != aEnd.Col() || absrel_differ( nFlags, SCA_COL_ABSOLUTE ) || aStart.Row() != aEnd.Row() || absrel_differ( nFlags, SCA_ROW_ABSOLUTE )) { r += ":"; - lcl_r1c1_append_r( r, aEnd.Row(), nFlags & SCA_ROW2_ABSOLUTE, rDetails ); - lcl_r1c1_append_c( r, aEnd.Col(), nFlags & SCA_COL2_ABSOLUTE, rDetails ); + lcl_r1c1_append_r( r, aEnd.Row(), (nFlags & SCA_ROW2_ABSOLUTE) != 0, rDetails ); + lcl_r1c1_append_c( r, aEnd.Col(), (nFlags & SCA_COL2_ABSOLUTE) != 0, rDetails ); } } } diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index a2a246e4f7b1..6c603d700b69 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -468,7 +468,7 @@ void XclExpWsbool::SaveXml( XclExpXmlStream& rStrm ) // OOXTODO: elements XML_tabColor, XML_outlinePr rWorksheet->singleElement( XML_pageSetUpPr, // OOXTODO: XML_autoPageBreaks, - XML_fitToPage, XclXmlUtils::ToPsz( GetValue() & EXC_WSBOOL_FITTOPAGE ), + XML_fitToPage, XclXmlUtils::ToPsz( (GetValue() & EXC_WSBOOL_FITTOPAGE) != 0 ), FSEND ); rWorksheet->endElement( XML_sheetPr ); } diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx index 7a46a23202fc..609133a91a8d 100644 --- a/sc/source/filter/excel/xepivot.cxx +++ b/sc/source/filter/excel/xepivot.cxx @@ -1398,14 +1398,14 @@ void XclExpPivotTable::SaveXml( XclExpXmlStream& rStrm ) // OOXTODO: XML_showMemberPropertyTips, // OOXTODO: XML_showDataTips, // OOXTODO: XML_enableWizard, - XML_enableDrill, XclXmlUtils::ToPsz( maPTExtInfo.mnFlags & EXC_SXEX_DRILLDOWN ), // ??? + XML_enableDrill, XclXmlUtils::ToPsz( (maPTExtInfo.mnFlags & EXC_SXEX_DRILLDOWN) != 0 ), // ??? // OOXTODO: XML_enableFieldProperties, [ SXEx fEnableFieldDialog (maPTExtInfo.mnFlags) ] // OOXTODO: XML_preserveFormatting, [ SXEx fPreserveFormatting (maPTExtInfo.mnFlags) ] // OOXTODO: XML_pageWrap, [ SXEx cWrapPage (maPTExtInfo.mnFlags) ] // OOXTODO: XML_pageOverThenDown, [ SXEx fAcrossPageLay (maPTExtInfo.mnFlags) ] // OOXTODO: XML_subtotalHiddenItems, [ SXEx fSubtotalHiddenPageItems (maPTExtInfo.mnFlags) ] - XML_rowGrandTotals, XclXmlUtils::ToPsz( maPTInfo.mnFlags & EXC_SXVIEW_ROWGRAND ), - XML_colGrandTotals, XclXmlUtils::ToPsz( maPTInfo.mnFlags & EXC_SXVIEW_COLGRAND ), + XML_rowGrandTotals, XclXmlUtils::ToPsz( (maPTInfo.mnFlags & EXC_SXVIEW_ROWGRAND) != 0 ), + XML_colGrandTotals, XclXmlUtils::ToPsz( (maPTInfo.mnFlags & EXC_SXVIEW_COLGRAND) != 0 ), // OOXTODO: XML_fieldPrintTitles, // OOXTODO: XML_itemPrintTitles, // OOXTODO: XML_mergeItem, diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index b63d368afc31..1ef9455f534d 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -8930,7 +8930,7 @@ void ScTableColumnObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE else if ( pEntry->nWID == SC_WID_UNO_MANPAGE ) { ScBreakType nBreak = pDoc->HasColBreak(nCol, nTab); - ScUnoHelpFunctions::SetBoolInAny(rAny, (nBreak & BREAK_MANUAL)); + ScUnoHelpFunctions::SetBoolInAny(rAny, (nBreak & BREAK_MANUAL) != 0); } else ScCellRangeObj::GetOnePropertyValue(pEntry, rAny); diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index b58b3e6f3c8b..61845069c648 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -3165,7 +3165,7 @@ uno::Any SAL_CALL ScTableColumnsObj::getPropertyValue( const OUString& aProperty else if ( aNameString.equalsAscii( SC_UNONAME_MANPAGE ) ) { ScBreakType nBreak = pDoc->HasColBreak(nStartCol, nTab); - ScUnoHelpFunctions::SetBoolInAny( aAny, (nBreak & BREAK_MANUAL) ); + ScUnoHelpFunctions::SetBoolInAny( aAny, (nBreak & BREAK_MANUAL) != 0 ); } return aAny; @@ -3444,7 +3444,7 @@ uno::Any SAL_CALL ScTableRowsObj::getPropertyValue( const OUString& aPropertyNam else if ( aNameString.equalsAscii( SC_UNONAME_MANPAGE ) ) { ScBreakType nBreak = pDoc->HasRowBreak(nStartRow, nTab); - ScUnoHelpFunctions::SetBoolInAny( aAny, (nBreak & BREAK_MANUAL) ); + ScUnoHelpFunctions::SetBoolInAny( aAny, (nBreak & BREAK_MANUAL) != 0 ); } else if ( aNameString.equalsAscii( SC_UNONAME_CELLBACK ) || aNameString.equalsAscii( SC_UNONAME_CELLTRAN ) ) { diff --git a/sd/source/ui/unoidl/sddetect.cxx b/sd/source/ui/unoidl/sddetect.cxx index 8ade5b964c12..853c38e9f2d0 100644 --- a/sd/source/ui/unoidl/sddetect.cxx +++ b/sd/source/ui/unoidl/sddetect.cxx @@ -277,7 +277,7 @@ OUString SAL_CALL SdFilterDetect::detect( Sequence< beans::PropertyValue >& lDes OUString sFilterName; if ( pFilter ) sFilterName = pFilter->GetName(); - aTypeName = SfxFilter::GetTypeFromStorage( xStorage, pFilter ? pFilter->IsOwnTemplateFormat() : sal_False, &sFilterName ); + aTypeName = SfxFilter::GetTypeFromStorage( xStorage, pFilter && pFilter->IsOwnTemplateFormat(), &sFilterName ); } catch( const WrappedTargetException& aWrap ) { diff --git a/sfx2/source/dialog/itemconnect.cxx b/sfx2/source/dialog/itemconnect.cxx index 65ff99133b28..1948ef4b650b 100644 --- a/sfx2/source/dialog/itemconnect.cxx +++ b/sfx2/source/dialog/itemconnect.cxx @@ -246,12 +246,12 @@ bool ItemConnectionBase::DoFillItemSet( SfxItemSet& rDestSet, const SfxItemSet& TriState ItemConnectionBase::GetEnableState( bool bKnown ) const { - return lclConvertToTriState( bKnown, mnFlags & ITEMCONN_ENABLE_KNOWN, mnFlags & ITEMCONN_DISABLE_UNKNOWN ); + return lclConvertToTriState( bKnown, (mnFlags & ITEMCONN_ENABLE_KNOWN) != 0, (mnFlags & ITEMCONN_DISABLE_UNKNOWN) != 0 ); } TriState ItemConnectionBase::GetShowState( bool bKnown ) const { - return lclConvertToTriState( bKnown, mnFlags & ITEMCONN_SHOW_KNOWN, mnFlags & ITEMCONN_HIDE_UNKNOWN ); + return lclConvertToTriState( bKnown, (mnFlags & ITEMCONN_SHOW_KNOWN) != 0, (mnFlags & ITEMCONN_HIDE_UNKNOWN) != 0 ); } // ============================================================================ diff --git a/starmath/source/smdetect.cxx b/starmath/source/smdetect.cxx index cd6a2c760475..d25f0dd54654 100644 --- a/starmath/source/smdetect.cxx +++ b/starmath/source/smdetect.cxx @@ -230,7 +230,7 @@ OUString SAL_CALL SmFilterDetect::detect( Sequence< PropertyValue >& lDescriptor OUString aTmpFilterName; if ( pFilter ) aTmpFilterName = pFilter->GetName(); - aTypeName = SfxFilter::GetTypeFromStorage( xStorage, pFilter ? pFilter->IsAllowedAsTemplate() : sal_False, &aTmpFilterName ); + aTypeName = SfxFilter::GetTypeFromStorage( xStorage, pFilter && pFilter->IsAllowedAsTemplate(), &aTmpFilterName ); } catch( const WrappedTargetException& aWrap ) { diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index 431251cb8769..d70e92f644fe 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -2745,10 +2745,10 @@ void lcl_MergeCommonBorderAttr(LinesState& rLinesState, const SvxBoxItem& rCellB { // current cell is inside the selection - lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetTop(), BOX_LINE_TOP, VALID_TOP, nCellFlags & CELL_TOP); - lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetBottom(), BOX_LINE_BOTTOM, VALID_BOTTOM, nCellFlags & CELL_BOTTOM); - lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetLeft(), BOX_LINE_LEFT, VALID_LEFT, nCellFlags & CELL_LEFT); - lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetRight(), BOX_LINE_RIGHT, VALID_RIGHT, nCellFlags & CELL_RIGHT); + lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetTop(), BOX_LINE_TOP, VALID_TOP, (nCellFlags & CELL_TOP) != 0); + lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetBottom(), BOX_LINE_BOTTOM, VALID_BOTTOM, (nCellFlags & CELL_BOTTOM) != 0); + lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetLeft(), BOX_LINE_LEFT, VALID_LEFT, (nCellFlags & CELL_LEFT) != 0); + lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetRight(), BOX_LINE_RIGHT, VALID_RIGHT, (nCellFlags & CELL_RIGHT) != 0); lcl_MergeDistance(rLinesState, BOX_LINE_TOP, rCellBoxItem.GetDistance(BOX_LINE_TOP)); lcl_MergeDistance(rLinesState, BOX_LINE_BOTTOM, rCellBoxItem.GetDistance(BOX_LINE_BOTTOM)); diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 3d45dfa0a47d..6a8da0ef7789 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -1089,7 +1089,7 @@ SwTxtAttr* MakeTxtAttr( case RES_TXTATR_META: case RES_TXTATR_METAFIELD: pNew = SwTxtMeta::CreateTxtMeta( rDoc.GetMetaFieldManager(), pTxtNode, - static_cast(rNew), nStt, nEnd, bIsCopy ); + static_cast(rNew), nStt, nEnd, bIsCopy == COPY ); break; default: OSL_ENSURE(RES_TXTATR_AUTOFMT == rNew.Which(), "unknown attribute"); diff --git a/sw/source/ui/uno/swdetect.cxx b/sw/source/ui/uno/swdetect.cxx index 35bcd8fb322c..9d03a104240b 100644 --- a/sw/source/ui/uno/swdetect.cxx +++ b/sw/source/ui/uno/swdetect.cxx @@ -236,7 +236,7 @@ OUString SAL_CALL SwFilterDetect::detect( Sequence< PropertyValue >& lDescriptor aTypeName = pPreFilter->GetTypeName(); } - aTypeName = SfxFilter::GetTypeFromStorage( xStorage, pPreFilter ? pPreFilter->IsOwnTemplateFormat() : sal_False, &aFilterName ); + aTypeName = SfxFilter::GetTypeFromStorage( xStorage, pPreFilter && pPreFilter->IsOwnTemplateFormat(), &aFilterName ); } catch (const WrappedTargetException& aWrap) { diff --git a/sw/source/ui/utlui/unotools.cxx b/sw/source/ui/utlui/unotools.cxx index 45ca783c3196..8273264b2316 100644 --- a/sw/source/ui/utlui/unotools.cxx +++ b/sw/source/ui/utlui/unotools.cxx @@ -273,7 +273,7 @@ IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer ) } // set onlinelayout property after setting the zoom - disableScrollBars(xViewProps, nStyleFlags&EX_SHOW_ONLINE_LAYOUT); + disableScrollBars(xViewProps, (nStyleFlags&EX_SHOW_ONLINE_LAYOUT) != 0); bIsInitialized = sal_True; } @@ -369,7 +369,7 @@ IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer ) xWin->setPosSize( 0, 0, aWinSize.Width(), aWinSize.Height(), awt::PosSize::SIZE ); // can only be done here - the SFX changes the ScrollBar values - disableScrollBars(xViewProps, nStyleFlags&EX_SHOW_ONLINE_LAYOUT); + disableScrollBars(xViewProps, (nStyleFlags&EX_SHOW_ONLINE_LAYOUT) != 0); if (aInitializedLink.IsSet()) aInitializedLink.Call(this); -- cgit