binaryurp/source/unmarshal.cxx | 7 - chart2/source/controller/dialogs/DataBrowser.cxx | 2 chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx | 2 chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx | 2 chart2/source/view/axes/VCoordinateSystem.cxx | 4 chart2/source/view/main/VLegend.cxx | 2 compilerplugins/clang/redundantcast.cxx | 42 +++++++++- connectivity/source/commontools/FValue.cxx | 2 cui/source/tabpages/tpbitmap.cxx | 8 - dbaccess/source/core/misc/DatabaseDataProvider.cxx | 3 editeng/source/editeng/editdbg.cxx | 16 +-- extensions/source/propctrlr/usercontrol.cxx | 2 include/rtl/math.hxx | 2 oox/source/drawingml/customshapepresetdata.cxx | 12 +- oox/source/drawingml/textbodyproperties.cxx | 2 registry/source/reflread.cxx | 3 reportdesign/source/core/api/FixedLine.cxx | 4 reportdesign/source/core/api/FixedText.cxx | 4 reportdesign/source/core/api/FormatCondition.cxx | 2 reportdesign/source/core/api/FormattedField.cxx | 4 reportdesign/source/core/api/Function.cxx | 2 reportdesign/source/core/api/Group.cxx | 2 reportdesign/source/core/api/ImageControl.cxx | 4 reportdesign/source/core/api/ReportDefinition.cxx | 4 reportdesign/source/core/api/ReportEngineJFree.cxx | 2 reportdesign/source/core/api/Shape.cxx | 4 reportdesign/source/ui/dlg/DateTime.cxx | 2 sal/qa/rtl/textenc/rtl_tencinfo.cxx | 2 sax/source/tools/converter.cxx | 2 sc/qa/unit/helper/qahelper.hxx | 3 sc/qa/unit/subsequent_filters-test.cxx | 2 sc/qa/unit/tiledrendering/tiledrendering.cxx | 16 +-- sc/qa/unit/ucalc_formula.cxx | 12 +- sc/source/core/data/documen4.cxx | 2 sc/source/core/data/dpobject.cxx | 2 sc/source/core/data/segmenttree.cxx | 4 sc/source/core/data/table4.cxx | 4 sc/source/filter/excel/colrowst.cxx | 4 sc/source/filter/excel/excform8.cxx | 2 sc/source/filter/excel/excimp8.cxx | 2 sc/source/filter/excel/impop.cxx | 2 sc/source/filter/excel/xepivot.cxx | 2 sc/source/filter/excel/xiescher.cxx | 2 sc/source/filter/excel/xistyle.cxx | 2 sc/source/filter/oox/drawingfragment.cxx | 2 sc/source/filter/xml/xmlrowi.cxx | 2 sc/source/ui/Accessibility/AccessibleText.cxx | 2 sc/source/ui/dbgui/csvgrid.cxx | 2 sc/source/ui/dbgui/pvfundlg.cxx | 2 sc/source/ui/dbgui/scuiasciiopt.cxx | 2 sc/source/ui/docshell/docsh4.cxx | 2 sc/source/ui/docshell/docsh8.cxx | 4 sc/source/ui/unoobj/chart2uno.cxx | 2 sc/source/ui/vba/vbaworksheet.cxx | 2 sc/source/ui/view/cellsh4.cxx | 4 sc/source/ui/view/viewfun2.cxx | 2 sd/source/core/annotations/Annotation.cxx | 2 sd/source/ui/func/fuformatpaintbrush.cxx | 2 sdext/source/minimizer/impoptimizer.cxx | 2 sfx2/source/appl/shutdownicon.cxx | 2 sfx2/source/control/thumbnailviewacc.cxx | 2 slideshow/source/engine/shapes/viewappletshape.cxx | 8 - starmath/source/cfgitem.cxx | 4 starmath/source/unomodel.cxx | 2 svl/qa/unit/test_URIHelper.cxx | 4 svtools/source/control/valueacc.cxx | 2 svtools/source/filter/exportdialog.cxx | 4 svx/source/accessibility/AccessibleTextHelper.cxx | 6 - svx/source/items/algitem.cxx | 4 svx/source/styles/CommonStylePreviewRenderer.cxx | 2 svx/source/tbxctrls/tbcontrl.cxx | 2 sw/qa/extras/globalfilter/globalfilter.cxx | 6 - sw/qa/extras/ooxmlexport/ooxmlexport8.cxx | 2 sw/source/core/text/frmcrsr.cxx | 2 sw/source/core/text/txtdrop.cxx | 2 sw/source/filter/ww8/wrtw8nds.cxx | 4 sw/source/ui/frmdlg/wrap.cxx | 4 sw/source/uibase/shells/tabsh.cxx | 2 sw/source/uibase/uiview/view1.cxx | 4 sw/source/uibase/uno/unotxdoc.cxx | 2 unotools/source/config/fontcfg.cxx | 8 - uui/source/iahndl.cxx | 8 - vcl/source/control/imp_listbox.cxx | 2 vcl/source/gdi/dibtools.cxx | 6 - vcl/source/gdi/impgraph.cxx | 4 vcl/workben/vcldemo.cxx | 4 xmloff/source/chart/SchXMLPlotAreaContext.cxx | 6 - xmloff/source/chart/SchXMLTools.cxx | 2 xmloff/source/style/styleexp.cxx | 2 xmloff/source/text/XMLTextMarkImportContext.cxx | 3 xmloff/source/text/txtimp.cxx | 3 xmlscript/source/xmldlg_imexp/xmldlg_export.cxx | 2 xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx | 2 93 files changed, 195 insertions(+), 171 deletions(-)
New commits: commit 6b4a4bab6d21a549ed35fd045eedf7ff05130a71 Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:33:20 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types Change-Id: I6e1f76de4b1ebf76ad02e7d0cd1374b4def83932 diff --git a/compilerplugins/clang/redundantcast.cxx b/compilerplugins/clang/redundantcast.cxx index e157e05668bd..20a04b2176c7 100644 --- a/compilerplugins/clang/redundantcast.cxx +++ b/compilerplugins/clang/redundantcast.cxx @@ -113,6 +113,30 @@ bool isRedundantConstCast(CXXConstCastExpr const * expr) { .getTypePtr()); } +bool isArithmeticOp(Expr const * expr) { + expr = expr->IgnoreParenImpCasts(); + if (auto const e = dyn_cast<BinaryOperator>(expr)) { + switch (e->getOpcode()) { + case BO_Mul: + case BO_Div: + case BO_Rem: + case BO_Add: + case BO_Sub: + case BO_Shl: + case BO_Shr: + case BO_And: + case BO_Xor: + case BO_Or: + return true; + case BO_Comma: + return isArithmeticOp(e->getRHS()); + default: + return false; + } + } + return isa<UnaryOperator>(expr) || isa<AbstractConditionalOperator>(expr); +} + class RedundantCast: public RecursiveASTVisitor<RedundantCast>, public loplugin::RewritePlugin { @@ -348,8 +372,22 @@ bool RedundantCast::VisitCXXStaticCastExpr(CXXStaticCastExpr const * expr) { } auto t1 = getSubExprAsWritten(expr)->getType(); auto t2 = expr->getTypeAsWritten(); - if (t1.getCanonicalType() != t2.getCanonicalType() - || t1->isArithmeticType()) + if (t1.getCanonicalType() != t2.getCanonicalType()) { + return true; + } + // Don't warn if the types are arithmetic (in the C++ meaning), and: either + // at least one is a typedef (and if both are typedefs,they're different), + // or the sub-expression involves some operation that is likely to change + // types through promotion, or the sub-expression is an integer literal (so + // its type generally depends on its value and suffix if any---even with a + // suffix like L it could still be either long or long long): + if ((t1->isIntegralType(compiler.getASTContext()) + || t1->isRealFloatingType()) + && ((t1 != t2 + && (loplugin::TypeCheck(t1).Typedef() + || loplugin::TypeCheck(t2).Typedef())) + || isArithmeticOp(expr->getSubExpr()) + || isa<IntegerLiteral>(expr->getSubExpr()->IgnoreParenImpCasts()))) { return true; } commit 06aa3dd5b47d7eedecc8dd45f12581f2e9fa14ee Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:33:11 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: binaryurp Change-Id: I109c8a2c51c7916ce8f8964b57ee45747868844f diff --git a/binaryurp/source/unmarshal.cxx b/binaryurp/source/unmarshal.cxx index 3f1f5fc42032..9c51a0b619ff 100644 --- a/binaryurp/source/unmarshal.cxx +++ b/binaryurp/source/unmarshal.cxx @@ -145,8 +145,7 @@ css::uno::TypeDescription Unmarshal::readType() { "binaryurp::Unmarshal: cache flag of simple type is set"); } return css::uno::TypeDescription( - *typelib_static_type_getByTypeClass( - static_cast< typelib_TypeClass >(tc))); + *typelib_static_type_getByTypeClass(tc)); case typelib_TypeClass_SEQUENCE: case typelib_TypeClass_ENUM: case typelib_TypeClass_STRUCT: @@ -163,9 +162,7 @@ css::uno::TypeDescription Unmarshal::readType() { } else { OUString const str(readString()); css::uno::TypeDescription t(str); - if (!t.is() || - t.get()->eTypeClass != static_cast< typelib_TypeClass >(tc)) - { + if (!t.is() || t.get()->eTypeClass != tc) { throw css::io::IOException( "binaryurp::Unmarshal: type with unknown name: " + str); commit 0446cca0b6c4a4b3a9dcdaee957b6ff8aaba3135 Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:33:05 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: chart2 Change-Id: I21dd484a2d337d16f59d5a747afaee230a1e7c89 diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx index 1661e0aa1365..678f26cab127 100644 --- a/chart2/source/controller/dialogs/DataBrowser.cxx +++ b/chart2/source/controller/dialogs/DataBrowser.cxx @@ -638,7 +638,7 @@ OUString DataBrowser::GetColString( sal_Int32 nColumnId ) const { OSL_ASSERT( m_apDataBrowserModel.get()); if( nColumnId > 0 ) - return OUString( m_apDataBrowserModel->getRoleOfColumn( static_cast< sal_Int32 >( nColumnId ) - 1 )); + return OUString( m_apDataBrowserModel->getRoleOfColumn( nColumnId - 1 )); return OUString(); } diff --git a/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx b/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx index b220caacce93..ef80018a7bb5 100644 --- a/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx @@ -75,7 +75,7 @@ void lclConvertToItemSetDouble(SfxItemSet& rItemSet, sal_uInt16 nWhichId, const OSL_ASSERT(xProperties.is()); if( xProperties.is() ) { - double aValue = static_cast<double>(static_cast<const SvxDoubleItem&>(rItemSet.Get( nWhichId )).GetValue()); + double aValue = static_cast<const SvxDoubleItem&>(rItemSet.Get( nWhichId )).GetValue(); if(xProperties->getPropertyValue( aPropertyID ) >>= aValue) { rItemSet.Put(SvxDoubleItem( aValue, nWhichId )); diff --git a/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx index 472da2f121d6..dc48db2d0fa9 100644 --- a/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx @@ -208,7 +208,7 @@ void lclConvertToItemSetDouble(SfxItemSet& rItemSet, sal_uInt16 nWhichId, const OSL_ASSERT(xProperties.is()); if( xProperties.is() ) { - double aValue = static_cast<double>(static_cast<const SvxDoubleItem&>(rItemSet.Get( nWhichId )).GetValue()); + double aValue = static_cast<const SvxDoubleItem&>(rItemSet.Get( nWhichId )).GetValue(); if(xProperties->getPropertyValue( aPropertyID ) >>= aValue) { rItemSet.Put(SvxDoubleItem( aValue, nWhichId )); diff --git a/chart2/source/view/axes/VCoordinateSystem.cxx b/chart2/source/view/axes/VCoordinateSystem.cxx index d9440207c956..0cafa1560f5e 100644 --- a/chart2/source/view/axes/VCoordinateSystem.cxx +++ b/chart2/source/view/axes/VCoordinateSystem.cxx @@ -163,8 +163,8 @@ uno::Sequence< sal_Int32 > VCoordinateSystem::getCoordinateSystemResolution( BaseGFXHelper::HomogenMatrixToB3DHomMatrix( m_aMatrixSceneToScreen ) ) ); - double fCoosysWidth = static_cast< double >( fabs(aScale.getX()*FIXED_SIZE_FOR_3D_CHART_VOLUME)); - double fCoosysHeight = static_cast< double >( fabs(aScale.getY()*FIXED_SIZE_FOR_3D_CHART_VOLUME)); + double fCoosysWidth = fabs(aScale.getX()*FIXED_SIZE_FOR_3D_CHART_VOLUME); + double fCoosysHeight = fabs(aScale.getY()*FIXED_SIZE_FOR_3D_CHART_VOLUME); double fPageWidth = rPageSize.Width; double fPageHeight = rPageSize.Height; diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx index e2d9b735cefd..b20fa6e6b075 100644 --- a/chart2/source/view/main/VLegend.cxx +++ b/chart2/source/view/main/VLegend.cxx @@ -897,7 +897,7 @@ void VLegend::createShapes( double fViewFontSize = lcl_CalcViewFontSize( xLegendProp, rPageSize );//todo // #i109336# Improve auto positioning in chart sal_Int32 nSymbolHeight = static_cast< sal_Int32 >( fViewFontSize * 0.6 ); - sal_Int32 nSymbolWidth = static_cast< sal_Int32 >( nSymbolHeight ); + sal_Int32 nSymbolWidth = nSymbolHeight; for (LegendEntryProvider* pLegendEntryProvider : m_aLegendEntryProviderList) { commit b6fb8399524fecc9d8714328d65cee5e75027dd7 Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:32:59 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: connectivity Change-Id: I8156e528b675c5f27c5d6903f17cb62d228d1488 diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx index 71679b253827..721ca95d9a8c 100644 --- a/connectivity/source/commontools/FValue.cxx +++ b/connectivity/source/commontools/FValue.cxx @@ -1603,7 +1603,7 @@ sal_uInt64 ORowSetValue::getULong() const case DataType::DECIMAL: case DataType::NUMERIC: case DataType::LONGVARCHAR: - nRet = static_cast<sal_uInt64>(OUString(m_aValue.m_pString).toUInt64()); + nRet = OUString(m_aValue.m_pString).toUInt64(); break; case DataType::FLOAT: nRet = sal_uInt64(m_aValue.m_nFloat); commit 0791c51c724b07b52b6bf37994cbd3659cfc40e5 Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:32:51 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: cui Change-Id: I2060dc58167e5bf5ee8244a56970c399f53fe237 diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx index 722170ece74e..fcec24ae3356 100644 --- a/cui/source/tabpages/tpbitmap.cxx +++ b/cui/source/tabpages/tpbitmap.cxx @@ -348,7 +348,7 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs ) else if(nWidth < 0) { eRelative = TRISTATE_TRUE; - nWidth = static_cast<long>(std::abs(nWidth)); + nWidth = std::abs(nWidth); } } @@ -360,15 +360,15 @@ void SvxBitmapTabPage::Reset( const SfxItemSet* rAttrs ) else if(nHeight < 0) { eRelative = TRISTATE_TRUE; - nHeight = static_cast<long>(std::abs(nHeight)); + nHeight = std::abs(nHeight); } } m_pTsbScale->SetState(eRelative); if(eRelative != TRISTATE_TRUE) { - nWidth = (OutputDevice::LogicToLogic(static_cast<long>(nWidth), mePoolUnit, MapUnit::Map100thMM )) / fUIScale; - nHeight = (OutputDevice::LogicToLogic(static_cast<long>(nHeight), mePoolUnit, MapUnit::Map100thMM )) / fUIScale; + nWidth = (OutputDevice::LogicToLogic(nWidth, mePoolUnit, MapUnit::Map100thMM )) / fUIScale; + nHeight = (OutputDevice::LogicToLogic(nHeight, mePoolUnit, MapUnit::Map100thMM )) / fUIScale; } if(m_pBitmapStyleLB->GetSelectEntryPos() == 0) commit f4cd4b3cf9a0074a8fa4796cd63c063162e1dced Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:32:47 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: dbaccess Change-Id: Ic6331f8532254c7fc69e15c14b7f44c872ba7c62 diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx index 0a42060403e8..97b5c5a6824f 100644 --- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx +++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx @@ -56,8 +56,7 @@ using ::com::sun::star::uno::RuntimeException; DatabaseDataProvider::DatabaseDataProvider(uno::Reference< uno::XComponentContext > const & context) : TDatabaseDataProvider(m_aMutex), ::cppu::PropertySetMixin< chart2::data::XDatabaseDataProvider >( - context, static_cast< Implements >( - IMPLEMENTS_PROPERTY_SET), uno::Sequence< OUString >()), + context, IMPLEMENTS_PROPERTY_SET, uno::Sequence< OUString >()), m_aParameterManager( m_aMutex, context ), m_aFilterManager(), m_xContext(context), commit a48fadd2618274fd167ceefc88a6db689af01158 Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:32:40 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: editeng Change-Id: I64be28eb18822c29e3d540decb465c9204d16894 diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx index 7929980b92ad..9249c0b2b0d3 100644 --- a/editeng/source/editeng/editdbg.cxx +++ b/editeng/source/editeng/editdbg.cxx @@ -153,7 +153,7 @@ OString DbgOutItem(const SfxItemPool& rPool, const SfxPoolItem& rItem) for (sal_uInt16 i = 0; i < rTabs.Count(); ++i) { const SvxTabStop& rTab = rTabs[i]; - aDebStr.append(static_cast<sal_Int32>(rTab.GetTabPos())); + aDebStr.append(rTab.GetTabPos()); aDebStr.append(' '); } aDebStr.append(')'); @@ -354,7 +354,7 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, bool bInfoBox ) const std::unique_ptr<EditCharAttrib>& rAttr = pPPortion->GetNode()->GetCharAttribs().GetAttribs()[z]; OStringBuffer aCharAttribs; aCharAttribs.append("\nA"); - aCharAttribs.append(static_cast<sal_Int32>(nPortion)); + aCharAttribs.append(nPortion); aCharAttribs.append(": "); aCharAttribs.append(static_cast<sal_Int32>(rAttr->GetItem()->Which())); aCharAttribs.append('\t'); @@ -375,18 +375,18 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, bool bInfoBox ) OStringBuffer aPortionStr("\nText portions: #"); aPortionStr.append(static_cast<sal_Int32>(nTextPortions)); aPortionStr.append(" \nA"); - aPortionStr.append(static_cast<sal_Int32>(nPortion)); + aPortionStr.append(nPortion); aPortionStr.append(": Paragraph Length = "); - aPortionStr.append(static_cast<sal_Int32>(pPPortion->GetNode()->Len())); + aPortionStr.append(pPPortion->GetNode()->Len()); aPortionStr.append("\nA"); - aPortionStr.append(static_cast<sal_Int32>(nPortion)); + aPortionStr.append(nPortion); aPortionStr.append(": "); sal_Int32 n = 0; for ( sal_Int32 z = 0; z < nTextPortions; ++z ) { TextPortion& rPortion = pPPortion->GetTextPortions()[z]; aPortionStr.append(' '); - aPortionStr.append(static_cast<sal_Int32>(rPortion.GetLen())); + aPortionStr.append(rPortion.GetLen()); aPortionStr.append('('); aPortionStr.append(static_cast<sal_Int32>(rPortion.GetSize().Width())); aPortionStr.append(')'); @@ -397,9 +397,9 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, bool bInfoBox ) n += rPortion.GetLen(); } aPortionStr.append("\nA"); - aPortionStr.append(static_cast<sal_Int32>(nPortion)); + aPortionStr.append(nPortion); aPortionStr.append(": Total length: "); - aPortionStr.append(static_cast<sal_Int32>(n)); + aPortionStr.append(n); if ( pPPortion->GetNode()->Len() != n ) aPortionStr.append(" => Error !!!"); fprintf(fp, "%s", aPortionStr.getStr()); commit 9cc130d233dc980bfecd4a485bef0280feff5b18 Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:32:34 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: extensions Change-Id: Ib620223544c2f6fca813dffa912cf773ff5b7c54 diff --git a/extensions/source/propctrlr/usercontrol.cxx b/extensions/source/propctrlr/usercontrol.cxx index ce90e1926514..c5c7c1e85ae7 100644 --- a/extensions/source/propctrlr/usercontrol.cxx +++ b/extensions/source/propctrlr/usercontrol.cxx @@ -124,7 +124,7 @@ namespace pcr { Date aCurrentDate( Date::SYSTEM ); static css::util::Date STANDARD_DB_DATE(30,12,1899); - nValue = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDate(static_cast<sal_Int32>(aCurrentDate.GetDate())),STANDARD_DB_DATE); + nValue = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDate(aCurrentDate.GetDate()),STANDARD_DB_DATE); } break; case css::util::NumberFormat::TIME: commit 1933e2fb022a974a6814469698ba5d3bdc30919a Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:32:23 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: oox Change-Id: I5febd0b28bc3e8beca1034ca151406af1e2034d9 diff --git a/oox/source/drawingml/customshapepresetdata.cxx b/oox/source/drawingml/customshapepresetdata.cxx index 4773eef57c52..4788e297c50a 100644 --- a/oox/source/drawingml/customshapepresetdata.cxx +++ b/oox/source/drawingml/customshapepresetdata.cxx @@ -129,25 +129,25 @@ awt::Rectangle lcl_parseRectangle(const OString& rValue) static const char aExpectedXPrefix[] = "X = (long) "; assert(aToken.startsWith(aExpectedXPrefix)); sal_Int32 nIndex = strlen(aExpectedXPrefix); - aRectangle.X = static_cast<sal_Int32>(aToken.getToken(0, ',', nIndex).toInt32()); + aRectangle.X = aToken.getToken(0, ',', nIndex).toInt32(); static const char aExpectedYPrefix[] = " Y = (long) "; aToken = aToken.copy(nIndex); assert(aToken.startsWith(aExpectedYPrefix)); nIndex = strlen(aExpectedYPrefix); - aRectangle.Y = static_cast<sal_Int32>(aToken.getToken(0, ',', nIndex).toInt32()); + aRectangle.Y = aToken.getToken(0, ',', nIndex).toInt32(); static const char aExpectedWidthPrefix[] = " Width = (long) "; aToken = aToken.copy(nIndex); assert(aToken.startsWith(aExpectedWidthPrefix)); nIndex = strlen(aExpectedWidthPrefix); - aRectangle.Width = static_cast<sal_Int32>(aToken.getToken(0, ',', nIndex).toInt32()); + aRectangle.Width = aToken.getToken(0, ',', nIndex).toInt32(); static const char aExpectedHeightPrefix[] = " Height = (long) "; aToken = aToken.copy(nIndex); assert(aToken.startsWith(aExpectedHeightPrefix)); nIndex = strlen(aExpectedHeightPrefix); - aRectangle.Height = static_cast<sal_Int32>(aToken.copy(nIndex).toInt32()); + aRectangle.Height = aToken.copy(nIndex).toInt32(); return aRectangle; } @@ -160,13 +160,13 @@ awt::Size lcl_parseSize(const OString& rValue) static const char aExpectedWidthPrefix[] = "Width = (long) "; assert(aToken.startsWith(aExpectedWidthPrefix)); sal_Int32 nIndex = strlen(aExpectedWidthPrefix); - aSize.Width = static_cast<sal_Int32>(aToken.getToken(0, ',', nIndex).toInt32()); + aSize.Width = aToken.getToken(0, ',', nIndex).toInt32(); static const char aExpectedHeightPrefix[] = " Height = (long) "; aToken = aToken.copy(nIndex); assert(aToken.startsWith(aExpectedHeightPrefix)); nIndex = strlen(aExpectedHeightPrefix); - aSize.Height = static_cast<sal_Int32>(aToken.copy(nIndex).toInt32()); + aSize.Height = aToken.copy(nIndex).toInt32(); return aSize; } diff --git a/oox/source/drawingml/textbodyproperties.cxx b/oox/source/drawingml/textbodyproperties.cxx index d409a924a5d5..c9914fd3af7e 100644 --- a/oox/source/drawingml/textbodyproperties.cxx +++ b/oox/source/drawingml/textbodyproperties.cxx @@ -89,7 +89,7 @@ void TextBodyProperties::pushRotationAdjustments() if( moInsets[i] ) maPropertyMap.setProperty( aProps[ nOff ], static_cast< sal_Int32 >( *moInsets[i] + nVal )); else if( nVal ) - maPropertyMap.setProperty( aProps[ nOff ], static_cast< sal_Int32 >( nVal )); + maPropertyMap.setProperty( aProps[ nOff ], nVal ); nOff = (nOff+1) % n; } commit 97a50f27ed06fc5d257c595c0bfffba57ddb511f Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:32:17 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: registry Change-Id: I68adf213b6c8c44ad3eaed4cf1e0e0db764739fd diff --git a/registry/source/reflread.cxx b/registry/source/reflread.cxx index a87acfcb8292..de22f988984e 100644 --- a/registry/source/reflread.cxx +++ b/registry/source/reflread.cxx @@ -1218,8 +1218,7 @@ bool TYPEREG_CALLTYPE typereg_reader_create( try { entry.reset( new TypeRegistryEntry( - static_cast< sal_uInt8 const * >(buffer), - static_cast< sal_uInt32 >(length), copy)); + static_cast< sal_uInt8 const * >(buffer), length, copy)); } catch (std::bad_alloc &) { return false; } commit 4538b6d6860df56de155b6e6bc39b7b022ce4180 Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:32:11 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: reportdesign Change-Id: I3ff00ce0536db84144c6f1e9ae1cb4946da84ec8 diff --git a/reportdesign/source/core/api/FixedLine.cxx b/reportdesign/source/core/api/FixedLine.cxx index 0058a43f86db..6b6b76385c91 100644 --- a/reportdesign/source/core/api/FixedLine.cxx +++ b/reportdesign/source/core/api/FixedLine.cxx @@ -129,7 +129,7 @@ uno::Sequence< OUString > lcl_getLineOptionals() OFixedLine::OFixedLine(uno::Reference< uno::XComponentContext > const & _xContext) :FixedLineBase(m_aMutex) -,FixedLinePropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getLineOptionals()) +,FixedLinePropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,lcl_getLineOptionals()) ,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) ,m_LineStyle( drawing::LineStyle_NONE ) ,m_nOrientation(1) @@ -146,7 +146,7 @@ OFixedLine::OFixedLine(uno::Reference< uno::XComponentContext > const & _xContex ,uno::Reference< drawing::XShape >& _xShape ,sal_Int32 _nOrientation) :FixedLineBase(m_aMutex) -,FixedLinePropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getLineOptionals()) +,FixedLinePropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,lcl_getLineOptionals()) ,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) ,m_LineStyle( drawing::LineStyle_NONE ) ,m_nOrientation(_nOrientation) diff --git a/reportdesign/source/core/api/FixedText.cxx b/reportdesign/source/core/api/FixedText.cxx index 9d4a11d611f5..76749b89bea8 100644 --- a/reportdesign/source/core/api/FixedText.cxx +++ b/reportdesign/source/core/api/FixedText.cxx @@ -45,7 +45,7 @@ uno::Sequence< OUString > lcl_getFixedTextOptionals() OFixedText::OFixedText(uno::Reference< uno::XComponentContext > const & _xContext) :FixedTextBase(m_aMutex) -,FixedTextPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getFixedTextOptionals()) +,FixedTextPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,lcl_getFixedTextOptionals()) ,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) { m_aProps.aComponent.m_sName = RPT_RESSTRING(RID_STR_FIXEDTEXT); @@ -56,7 +56,7 @@ OFixedText::OFixedText(uno::Reference< uno::XComponentContext > const & _xContex ,const uno::Reference< lang::XMultiServiceFactory>& _xFactory ,uno::Reference< drawing::XShape >& _xShape) :FixedTextBase(m_aMutex) -,FixedTextPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getFixedTextOptionals()) +,FixedTextPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,lcl_getFixedTextOptionals()) ,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) { m_aProps.aComponent.m_sName = RPT_RESSTRING(RID_STR_FIXEDTEXT); diff --git a/reportdesign/source/core/api/FormatCondition.cxx b/reportdesign/source/core/api/FormatCondition.cxx index 9e9aa0d5d3d7..27d719dd18f7 100644 --- a/reportdesign/source/core/api/FormatCondition.cxx +++ b/reportdesign/source/core/api/FormatCondition.cxx @@ -42,7 +42,7 @@ uno::Reference< uno::XInterface > OFormatCondition::create(uno::Reference< uno:: OFormatCondition::OFormatCondition(uno::Reference< uno::XComponentContext > const & _xContext) :FormatConditionBase(m_aMutex) -,FormatConditionPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< OUString >()) +,FormatConditionPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,uno::Sequence< OUString >()) ,m_bEnabled(true) { } diff --git a/reportdesign/source/core/api/FormattedField.cxx b/reportdesign/source/core/api/FormattedField.cxx index 1644561a8ff1..1daa06b92fdd 100644 --- a/reportdesign/source/core/api/FormattedField.cxx +++ b/reportdesign/source/core/api/FormattedField.cxx @@ -51,7 +51,7 @@ uno::Sequence< OUString > lcl_getFormattedFieldOptionals() OFormattedField::OFormattedField(uno::Reference< uno::XComponentContext > const & _xContext) :FormattedFieldBase(m_aMutex) -,FormattedFieldPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getFormattedFieldOptionals()) +,FormattedFieldPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,lcl_getFormattedFieldOptionals()) ,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) ,m_nFormatKey(0) { @@ -62,7 +62,7 @@ OFormattedField::OFormattedField(uno::Reference< uno::XComponentContext > const ,const uno::Reference< lang::XMultiServiceFactory>& _xFactory ,uno::Reference< drawing::XShape >& _xShape) :FormattedFieldBase(m_aMutex) -,FormattedFieldPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getFormattedFieldOptionals()) +,FormattedFieldPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,lcl_getFormattedFieldOptionals()) ,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) ,m_nFormatKey(0) { diff --git a/reportdesign/source/core/api/Function.cxx b/reportdesign/source/core/api/Function.cxx index e734be1d89ab..366856feb6e9 100644 --- a/reportdesign/source/core/api/Function.cxx +++ b/reportdesign/source/core/api/Function.cxx @@ -39,7 +39,7 @@ uno::Reference< uno::XInterface > OFunction::create(uno::Reference< uno::XCompon OFunction::OFunction(uno::Reference< uno::XComponentContext > const & _xContext) :FunctionBase(m_aMutex) -,FunctionPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< OUString >()) +,FunctionPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,uno::Sequence< OUString >()) ,m_bPreEvaluated(false) ,m_bDeepTraversing(false) { diff --git a/reportdesign/source/core/api/Group.cxx b/reportdesign/source/core/api/Group.cxx index d546f2340137..8a5adae887ee 100644 --- a/reportdesign/source/core/api/Group.cxx +++ b/reportdesign/source/core/api/Group.cxx @@ -41,7 +41,7 @@ namespace reportdesign OGroup::OGroup(const uno::Reference< report::XGroups >& _xParent ,const uno::Reference< uno::XComponentContext >& _xContext) :GroupBase(m_aMutex) -,GroupPropertySet(_xContext,static_cast< GroupPropertySet::Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< OUString >()) +,GroupPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,uno::Sequence< OUString >()) ,m_xContext(_xContext) ,m_xParent(_xParent) { diff --git a/reportdesign/source/core/api/ImageControl.cxx b/reportdesign/source/core/api/ImageControl.cxx index 1dceb29ae5d1..24ec13248e60 100644 --- a/reportdesign/source/core/api/ImageControl.cxx +++ b/reportdesign/source/core/api/ImageControl.cxx @@ -115,7 +115,7 @@ uno::Sequence< OUString > lcl_getImageOptionals() OImageControl::OImageControl(uno::Reference< uno::XComponentContext > const & _xContext) :ImageControlBase(m_aMutex) -,ImageControlPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getImageOptionals()) +,ImageControlPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,lcl_getImageOptionals()) ,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) ,m_nScaleMode(awt::ImageScaleMode::NONE) ,m_bPreserveIRI(true) @@ -127,7 +127,7 @@ OImageControl::OImageControl(uno::Reference< uno::XComponentContext > const & _x ,const uno::Reference< lang::XMultiServiceFactory>& _xFactory ,uno::Reference< drawing::XShape >& _xShape) :ImageControlBase(m_aMutex) -,ImageControlPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getImageOptionals()) +,ImageControlPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,lcl_getImageOptionals()) ,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) ,m_nScaleMode(awt::ImageScaleMode::NONE) ,m_bPreserveIRI(true) diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index f536a1268a40..6d71b73c5c59 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -536,7 +536,7 @@ struct OReportDefinitionImpl OReportDefinition::OReportDefinition(uno::Reference< uno::XComponentContext > const & _xContext) : ReportDefinitionBase(m_aMutex) -,ReportDefinitionPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< OUString >()) +,ReportDefinitionPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,uno::Sequence< OUString >()) ,m_aProps(new OReportComponentProperties(_xContext)) ,m_pImpl(new OReportDefinitionImpl(m_aMutex)) { @@ -555,7 +555,7 @@ OReportDefinition::OReportDefinition(uno::Reference< uno::XComponentContext > co ,const uno::Reference< lang::XMultiServiceFactory>& _xFactory ,uno::Reference< drawing::XShape >& _xShape) : ReportDefinitionBase(m_aMutex) -,ReportDefinitionPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< OUString >()) +,ReportDefinitionPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,uno::Sequence< OUString >()) ,m_aProps(new OReportComponentProperties(_xContext)) ,m_pImpl(new OReportDefinitionImpl(m_aMutex)) { diff --git a/reportdesign/source/core/api/ReportEngineJFree.cxx b/reportdesign/source/core/api/ReportEngineJFree.cxx index d7c4e18720b9..4343f37e29ce 100644 --- a/reportdesign/source/core/api/ReportEngineJFree.cxx +++ b/reportdesign/source/core/api/ReportEngineJFree.cxx @@ -63,7 +63,7 @@ namespace reportdesign OReportEngineJFree::OReportEngineJFree( const uno::Reference< uno::XComponentContext >& context) :ReportEngineBase(m_aMutex) -,ReportEnginePropertySet(context,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< OUString >()) +,ReportEnginePropertySet(context,IMPLEMENTS_PROPERTY_SET,uno::Sequence< OUString >()) ,m_xContext(context) ,m_nMaxRows(0) { diff --git a/reportdesign/source/core/api/Shape.cxx b/reportdesign/source/core/api/Shape.cxx index bc3a29c7acad..ce0b655d3496 100644 --- a/reportdesign/source/core/api/Shape.cxx +++ b/reportdesign/source/core/api/Shape.cxx @@ -54,7 +54,7 @@ uno::Sequence< OUString > lcl_getShapeOptionals() OShape::OShape(uno::Reference< uno::XComponentContext > const & _xContext) :ShapeBase(m_aMutex) -,ShapePropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getShapeOptionals()) +,ShapePropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,lcl_getShapeOptionals()) ,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) ,m_nZOrder(0) ,m_bOpaque(false) @@ -67,7 +67,7 @@ OShape::OShape(uno::Reference< uno::XComponentContext > const & _xContext ,uno::Reference< drawing::XShape >& _xShape ,const OUString& _sServiceName) :ShapeBase(m_aMutex) -,ShapePropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getShapeOptionals()) +,ShapePropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,lcl_getShapeOptionals()) ,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) ,m_nZOrder(0) ,m_bOpaque(false) diff --git a/reportdesign/source/ui/dlg/DateTime.cxx b/reportdesign/source/ui/dlg/DateTime.cxx index 1ebefd570628..895a708da142 100644 --- a/reportdesign/source/ui/dlg/DateTime.cxx +++ b/reportdesign/source/ui/dlg/DateTime.cxx @@ -197,7 +197,7 @@ OUString ODateTimeDialog::getFormatStringByKey(::sal_Int32 _nNumberFormatKey,con { Date aCurrentDate( Date::SYSTEM ); static css::util::Date STANDARD_DB_DATE(30,12,1899); - nValue = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDate(static_cast<sal_Int32>(aCurrentDate.GetDate())),STANDARD_DB_DATE); + nValue = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDate(aCurrentDate.GetDate()),STANDARD_DB_DATE); } uno::Reference< util::XNumberFormatPreviewer> xPreviewer(m_pController->getReportNumberFormatter(),uno::UNO_QUERY); commit de0ea66610a4bda091d0d6103ff251530a7bb60c Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:31:59 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: sal Change-Id: I7caadbc06b2266800666151de75d799c42148aca diff --git a/include/rtl/math.hxx b/include/rtl/math.hxx index 7572c972a91f..fc53828610ee 100644 --- a/include/rtl/math.hxx +++ b/include/rtl/math.hxx @@ -294,7 +294,7 @@ inline bool approxEqual(double a, double b, sal_Int16 nPrec) return true; double x = a - b; return (x < 0.0 ? -x : x) - < ((a < 0.0 ? -a : a) * (1.0 / (pow(static_cast<double>(2.0), nPrec)))); + < ((a < 0.0 ? -a : a) * (1.0 / (pow(2.0, nPrec)))); } /** Add two values. diff --git a/sal/qa/rtl/textenc/rtl_tencinfo.cxx b/sal/qa/rtl/textenc/rtl_tencinfo.cxx index a67fc9cc419c..97719178f96f 100644 --- a/sal/qa/rtl/textenc/rtl_tencinfo.cxx +++ b/sal/qa/rtl/textenc/rtl_tencinfo.cxx @@ -1012,7 +1012,7 @@ namespace { const sal_uInt8 nCharSet = rtl_getBestWindowsCharsetFromTextEncoding(nIn); rtl_TextEncoding eTextEnc = rtl_getTextEncodingFromWindowsCharset(nCharSet); - CPPUNIT_ASSERT_EQUAL_MESSAGE("rtl_getBestWindowsCharsetFromTextEncoding && rtl_getTextEncodingFromWindowsCharset differ", static_cast<rtl_TextEncoding>(nOut), eTextEnc ); + CPPUNIT_ASSERT_EQUAL_MESSAGE("rtl_getBestWindowsCharsetFromTextEncoding && rtl_getTextEncodingFromWindowsCharset differ", nOut, eTextEnc ); } void WindowsCharsetFromTextEncoding_MS_1252() commit 12162c8297b3661bd0bad65df830f42141e94672 Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:31:53 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: sax Change-Id: I4f7c635af8d9d02657d978c08175833fb45adcbf diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index c0e9e1f1dc03..9377e14411b7 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -1242,7 +1242,7 @@ bool Converter::convertDuration(util::Duration& rDuration, rDuration.Hours = static_cast<sal_Int16>(nHours); rDuration.Minutes = static_cast<sal_Int16>(nMinutes); rDuration.Seconds = static_cast<sal_Int16>(nSeconds); - rDuration.NanoSeconds = static_cast<sal_Int32>(nNanoSeconds); + rDuration.NanoSeconds = nNanoSeconds; } return bSuccess; commit 93c0b1f5dafa1c9d01c804f350129dde047bb8dc Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:31:44 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: sc Change-Id: Id56d3e3d7c4485e24dc8fe6349631837101e86fe diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index a4a93c24bee9..8ffcb047919c 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -245,9 +245,6 @@ public: #define ASSERT_DOUBLES_EQUAL_MESSAGE( message, expected, result ) \ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( (message), (expected), (result), 1e-14 ) -#define ASSERT_EQUAL_TYPE( type, expected, result ) \ - CPPUNIT_ASSERT_EQUAL( static_cast<type>(expected), static_cast<type>(result) ); - SCQAHELPER_DLLPUBLIC void checkFormula(ScDocument& rDoc, const ScAddress& rPos, const char* expected, const char* msg, CppUnit::SourceLine const & sourceLine); diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index f9dd4bbb0e12..b27414722eae 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -2811,7 +2811,7 @@ void ScFiltersTest::testCondFormatParentXLSX() const ScPatternAttr* pPattern = rDoc.GetPattern(2, 5, 0); const SfxPoolItem& rPoolItem = pPattern->GetItem(ATTR_VER_JUSTIFY, pCondSet); const SvxVerJustifyItem& rVerJustify = static_cast<const SvxVerJustifyItem&>(rPoolItem); - CPPUNIT_ASSERT_EQUAL(SVX_VER_JUSTIFY_TOP, static_cast<SvxCellVerJustify>(rVerJustify.GetValue())); + CPPUNIT_ASSERT_EQUAL(SVX_VER_JUSTIFY_TOP, rVerJustify.GetValue()); xDocSh->DoClose(); } diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 06fda94ff40b..4ee671a7122f 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -224,7 +224,7 @@ void ScTiledRenderingTest::testRowColumnSelections() aArgs[0].Name = OUString::fromUtf8("Row"); aArgs[0].Value <<= static_cast<sal_Int32>(10 - 1); aArgs[1].Name = OUString::fromUtf8("Modifier"); - aArgs[1].Value <<= static_cast<sal_uInt16>(KEY_SHIFT); + aArgs[1].Value <<= KEY_SHIFT; comphelper::dispatchCommand(".uno:SelectRow", aArgs); // Check if all the rows from 5th to 10th get selected @@ -236,7 +236,7 @@ void ScTiledRenderingTest::testRowColumnSelections() aArgs[0].Name = OUString::fromUtf8("Row"); aArgs[0].Value <<= static_cast<sal_Int32>(13 - 1); aArgs[1].Name = OUString::fromUtf8("Modifier"); - aArgs[1].Value <<= static_cast<sal_uInt16>(KEY_MOD1); + aArgs[1].Value <<= KEY_MOD1; comphelper::dispatchCommand(".uno:SelectRow", aArgs); // When we copy this, we don't get anything useful, but we must not crash @@ -250,7 +250,7 @@ void ScTiledRenderingTest::testRowColumnSelections() aArgs[0].Name = OUString::fromUtf8("Col"); aArgs[0].Value <<= static_cast<sal_Int32>(5 - 1); aArgs[1].Name = OUString::fromUtf8("Modifier"); - aArgs[1].Value <<= static_cast<sal_uInt16>(KEY_MOD1); + aArgs[1].Value <<= KEY_MOD1; comphelper::dispatchCommand(".uno:SelectColumn", aArgs); // When we copy this, we don't get anything useful, but we must not crash @@ -265,21 +265,21 @@ void ScTiledRenderingTest::testRowColumnSelections() aArgs[0].Name = OUString::fromUtf8("Row"); aArgs[0].Value <<= static_cast<sal_Int32>(13 - 1); aArgs[1].Name = OUString::fromUtf8("Modifier"); - aArgs[1].Value <<= static_cast<sal_uInt16>(KEY_MOD1); + aArgs[1].Value <<= KEY_MOD1; comphelper::dispatchCommand(".uno:SelectRow", aArgs); // Deselect row 10 aArgs[0].Name = OUString::fromUtf8("Row"); aArgs[0].Value <<= static_cast<sal_Int32>(10 - 1); aArgs[1].Name = OUString::fromUtf8("Modifier"); - aArgs[1].Value <<= static_cast<sal_uInt16>(KEY_MOD1); + aArgs[1].Value <<= KEY_MOD1; comphelper::dispatchCommand(".uno:SelectRow", aArgs); // Click at row 6 holding shift aArgs[0].Name = OUString::fromUtf8("Row"); aArgs[0].Value <<= static_cast<sal_Int32>(6 - 1); aArgs[1].Name = OUString::fromUtf8("Modifier"); - aArgs[1].Value <<= static_cast<sal_uInt16>(KEY_SHIFT); + aArgs[1].Value <<= KEY_SHIFT; comphelper::dispatchCommand(".uno:SelectRow", aArgs); // only row 5 should remain selected @@ -903,7 +903,7 @@ void ScTiledRenderingTest::testHideColRow() aArgs[0].Name = OUString::fromUtf8("Col"); aArgs[0].Value <<= static_cast<sal_Int32>(2 - 1); aArgs[1].Name = OUString::fromUtf8("Modifier"); - aArgs[1].Value <<= static_cast<sal_uInt16>(KEY_SHIFT); + aArgs[1].Value <<= KEY_SHIFT; comphelper::dispatchCommand(".uno:SelectColumn", aArgs); @@ -934,7 +934,7 @@ void ScTiledRenderingTest::testHideColRow() aArgs[0].Name = OUString::fromUtf8("Row"); aArgs[0].Value <<= static_cast<sal_Int32>(6 - 1); aArgs[1].Name = OUString::fromUtf8("Modifier"); - aArgs[1].Value <<= static_cast<sal_uInt16>(KEY_SHIFT); + aArgs[1].Value <<= KEY_SHIFT; comphelper::dispatchCommand(".uno:SelectRow", aArgs); diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index a3ad3c082289..0c552491fcdc 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -979,17 +979,17 @@ void Test::testFormulaRefData() ScSingleRefData aRef; aRef.InitAddress(aAddr); CPPUNIT_ASSERT_MESSAGE("Wrong ref data state.", !aRef.IsRowRel() && !aRef.IsColRel() && !aRef.IsTabRel()); - ASSERT_EQUAL_TYPE(SCCOL, 4, aRef.Col()); - ASSERT_EQUAL_TYPE(SCROW, 5, aRef.Row()); - ASSERT_EQUAL_TYPE(SCTAB, 3, aRef.Tab()); + CPPUNIT_ASSERT_EQUAL(SCCOL(4), aRef.Col()); + CPPUNIT_ASSERT_EQUAL(SCROW(5), aRef.Row()); + CPPUNIT_ASSERT_EQUAL(SCTAB(3), aRef.Tab()); aRef.SetRowRel(true); aRef.SetColRel(true); aRef.SetTabRel(true); aRef.SetAddress(aAddr, aPos); - ASSERT_EQUAL_TYPE(SCCOL, 2, aRef.Col()); - ASSERT_EQUAL_TYPE(SCROW, 3, aRef.Row()); - ASSERT_EQUAL_TYPE(SCTAB, 1, aRef.Tab()); + CPPUNIT_ASSERT_EQUAL(SCCOL(2), aRef.Col()); + CPPUNIT_ASSERT_EQUAL(SCROW(3), aRef.Row()); + CPPUNIT_ASSERT_EQUAL(SCTAB(1), aRef.Tab()); // Test extension of range reference. diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx index 92df7a1c8f21..97cb5fe7ada7 100644 --- a/sc/source/core/data/documen4.cxx +++ b/sc/source/core/data/documen4.cxx @@ -1269,7 +1269,7 @@ void ScDocument::CompareDocument( ScDocument& rOtherDoc ) // combine if ( nThisCol == nThisEndCol || ValidCol(static_cast<SCCOL>(pOtherCols[nThisCol+1])) ) { - SCCOL nFirstNew = static_cast<SCCOL>(nThisCol); + SCCOL nFirstNew = nThisCol; while ( nFirstNew > 0 && pOtherCols[nFirstNew-1] > MAXCOL ) --nFirstNew; SCCOL nDiff = nThisCol - nFirstNew; diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index 6b1f12a1f4a5..8fee2dd71f45 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -2220,7 +2220,7 @@ void lcl_FillOldFields( ScPivotFieldVector& rFields, uno::Any aOrigAny = xDimProp->getPropertyValue(SC_UNO_DP_ORIGINAL_POS); sal_Int32 nTmp = 0; if (aOrigAny >>= nTmp) - nDupSource = static_cast<sal_Int32>(nTmp); + nDupSource = nTmp; } catch(uno::Exception&) { diff --git a/sc/source/core/data/segmenttree.cxx b/sc/source/core/data/segmenttree.cxx index d76f8a39abbe..b2da05afb10a 100644 --- a/sc/source/core/data/segmenttree.cxx +++ b/sc/source/core/data/segmenttree.cxx @@ -394,7 +394,7 @@ void ScFlatBoolRowSegments::insertSegment(SCROW nRow, SCROW nSize) SCROW ScFlatBoolRowSegments::findLastTrue() const { - return static_cast<SCROW>(mpImpl->findLastTrue(false)); + return mpImpl->findLastTrue(false); } ScFlatBoolColSegments::ScFlatBoolColSegments() : @@ -522,7 +522,7 @@ void ScFlatUInt16RowSegments::insertSegment(SCROW nRow, SCROW nSize) SCROW ScFlatUInt16RowSegments::findLastTrue(sal_uInt16 nValue) const { - return static_cast<SCROW>(mpImpl->findLastTrue(nValue)); + return mpImpl->findLastTrue(nValue); } void ScFlatUInt16RowSegments::enableTreeSearch(bool bEnable) diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index db5b1bebbb40..bd9dd0385773 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -1653,8 +1653,8 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, { if(!RowHidden(nAtRow)) { - aCol[nCol].SetPatternArea( static_cast<SCROW>(nAtRow), - static_cast<SCROW>(nAtRow), *pSrcPattern); + aCol[nCol].SetPatternArea( nAtRow, + nAtRow, *pSrcPattern); for(std::vector<sal_uInt32>::const_iterator itr = rCondFormatIndex.begin(), itrEnd = rCondFormatIndex.end(); itr != itrEnd; ++itr) { diff --git a/sc/source/filter/excel/colrowst.cxx b/sc/source/filter/excel/colrowst.cxx index 285062260d8a..e1d12a0098cf 100644 --- a/sc/source/filter/excel/colrowst.cxx +++ b/sc/source/filter/excel/colrowst.cxx @@ -39,7 +39,7 @@ XclImpColRowSettings::XclImpColRowSettings( const XclImpRoot& rRoot ) : maHiddenRows(0, MAXROWCOUNT, false), mnLastScRow( -1 ), mnDefWidth( STD_COL_WIDTH ), - mnDefHeight( static_cast< sal_uInt16 >( ScGlobal::nStdRowHeight ) ), + mnDefHeight( ScGlobal::nStdRowHeight ), mnDefRowFlags( EXC_DEFROW_DEFAULTFLAGS ), mbHasStdWidthRec( false ), mbHasDefHeight( false ), @@ -106,7 +106,7 @@ void XclImpColRowSettings::SetDefHeight( sal_uInt16 nDefHeight, sal_uInt16 nFlag mnDefRowFlags = nFlags; if( mnDefHeight == 0 ) { - mnDefHeight = static_cast< sal_uInt16 >( ScGlobal::nStdRowHeight ); + mnDefHeight = ScGlobal::nStdRowHeight; ::set_flag( mnDefRowFlags, EXC_DEFROW_HIDDEN ); } mbHasDefHeight = true; diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx index 469a576c4130..f8fbf68ce02f 100644 --- a/sc/source/filter/excel/excform8.cxx +++ b/sc/source/filter/excel/excform8.cxx @@ -1463,7 +1463,7 @@ void ExcelToSc8::ExcRelToScRel8( sal_uInt16 nRow, sal_uInt16 nC, ScSingleRefData // relative column references wrap around nRelCol = static_cast<sal_Int16>(256 + (int)nRelCol); } - rSRD.SetRelCol(static_cast<SCCOL>(nRelCol)); + rSRD.SetRelCol(nRelCol); } else rSRD.SetAbsCol(static_cast<SCCOL>(nCol)); diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx index 959b8b0e77a4..050f59ea4f93 100644 --- a/sc/source/filter/excel/excimp8.cxx +++ b/sc/source/filter/excel/excimp8.cxx @@ -241,7 +241,7 @@ void ImportExcel8::Boundsheet() OUString aName( aIn.ReadUniString( nLen ) ); GetTabInfo().AppendXclTabName( aName, nBdshtTab ); - SCTAB nScTab = static_cast< SCTAB >( nBdshtTab ); + SCTAB nScTab = nBdshtTab; if( nScTab > 0 ) { OSL_ENSURE( !pD->HasTable( nScTab ), "ImportExcel8::Boundsheet - sheet exists already" ); diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx index ee9e04ac8bb2..47962db8ab0b 100644 --- a/sc/source/filter/excel/impop.cxx +++ b/sc/source/filter/excel/impop.cxx @@ -726,7 +726,7 @@ void ImportExcel::Boundsheet() OUString aName( aIn.ReadByteString( false ) ); - SCTAB nScTab = static_cast< SCTAB >( nBdshtTab ); + SCTAB nScTab = nBdshtTab; if( nScTab > 0 ) { OSL_ENSURE( !pD->HasTable( nScTab ), "ImportExcel::Boundsheet - sheet exists already" ); diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx index bd9622c84d8d..53599bb3b2e1 100644 --- a/sc/source/filter/excel/xepivot.cxx +++ b/sc/source/filter/excel/xepivot.cxx @@ -165,7 +165,7 @@ void XclExpPCItem::WriteBody( XclExpStream& rStrm ) else if( const DateTime* pDateTime = GetDateTime() ) { sal_uInt16 nYear = static_cast< sal_uInt16 >( pDateTime->GetYear() ); - sal_uInt16 nMonth = static_cast< sal_uInt16 >( pDateTime->GetMonth() ); + sal_uInt16 nMonth = pDateTime->GetMonth(); sal_uInt8 nDay = static_cast< sal_uInt8 >( pDateTime->GetDay() ); sal_uInt8 nHour = static_cast< sal_uInt8 >( pDateTime->GetHour() ); sal_uInt8 nMin = static_cast< sal_uInt8 >( pDateTime->GetMin() ); diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index aeb46ac33e33..832698f3bd00 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -3221,7 +3221,7 @@ XclImpSimpleDffConverter::~XclImpSimpleDffConverter() bool XclImpSimpleDffConverter::GetColorFromPalette( sal_uInt16 nIndex, Color& rColor ) const { - ColorData nColor = GetPalette().GetColorData( static_cast< sal_uInt16 >( nIndex ) ); + ColorData nColor = GetPalette().GetColorData( nIndex ); if( nColor == COL_AUTO ) return false; diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx index 576d809986d4..9c29a8ef505a 100644 --- a/sc/source/filter/excel/xistyle.cxx +++ b/sc/source/filter/excel/xistyle.cxx @@ -286,7 +286,7 @@ void XclImpFont::ReadCFFontBlock( XclImpStream& rStrm ) if( (mbHeightUsed = (nHeight <= 0x7FFF)) ) maData.mnHeight = static_cast< sal_uInt16 >( nHeight ); if( (mbWeightUsed = !::get_flag( nFontFlags1, EXC_CF_FONT_STYLE ) && (nWeight < 0x7FFF)) ) - maData.mnWeight = static_cast< sal_uInt16 >( nWeight ); + maData.mnWeight = nWeight; if( (mbItalicUsed = !::get_flag( nFontFlags1, EXC_CF_FONT_STYLE )) ) maData.mbItalic = ::get_flag( nStyle, EXC_CF_FONT_STYLE ); if( (mbUnderlUsed = !::get_flag( nFontFlags3, EXC_CF_FONT_UNDERL ) && (nUnderl <= 0x7F)) ) diff --git a/sc/source/filter/oox/drawingfragment.cxx b/sc/source/filter/oox/drawingfragment.cxx index 02944b7096a6..d22c06163240 100644 --- a/sc/source/filter/oox/drawingfragment.cxx +++ b/sc/source/filter/oox/drawingfragment.cxx @@ -293,7 +293,7 @@ void DrawingFragment::onEndElement() SdrObject* pObj = SdrObject::getSdrObjectFromXShape( mxShape->getXShape() ); if ( pObj ) { - ScDrawLayer::SetCellAnchoredFromPosition( *pObj, getScDocument(), static_cast<SCTAB>( getSheetIndex() ) ); + ScDrawLayer::SetCellAnchoredFromPosition( *pObj, getScDocument(), getSheetIndex() ); } } } diff --git a/sc/source/filter/xml/xmlrowi.cxx b/sc/source/filter/xml/xmlrowi.cxx index 0be493426951..815007fe3cd0 100644 --- a/sc/source/filter/xml/xmlrowi.cxx +++ b/sc/source/filter/xml/xmlrowi.cxx @@ -321,7 +321,7 @@ void SAL_CALL ScXMLTableRowsContext::endFastElement(sal_Int32 /*nElement*/) ScOutlineTable* pOutlineTable(pDoc->GetOutlineTable(nSheet, true)); ScOutlineArray& rRowArray(pOutlineTable->GetRowArray()); bool bResized; - rRowArray.Insert(static_cast<SCROW>(nGroupStartRow), static_cast<SCROW>(nGroupEndRow), bResized, !bGroupDisplay); + rRowArray.Insert(nGroupStartRow, nGroupEndRow, bResized, !bGroupDisplay); } } } diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx index d4b339a970db..16d4d3142bd7 100644 --- a/sc/source/ui/Accessibility/AccessibleText.cxx +++ b/sc/source/ui/Accessibility/AccessibleText.cxx @@ -816,7 +816,7 @@ SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder() long nOffsetY = 0; const SvxVerJustifyItem* pVerJustifyItem = static_cast< const SvxVerJustifyItem* >( rDoc.GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_VER_JUSTIFY ) ); - SvxCellVerJustify eVerJust = ( pVerJustifyItem ? static_cast< SvxCellVerJustify >( pVerJustifyItem->GetValue() ) : SVX_VER_JUSTIFY_STANDARD ); + SvxCellVerJustify eVerJust = ( pVerJustifyItem ? pVerJustifyItem->GetValue() : SVX_VER_JUSTIFY_STANDARD ); switch ( eVerJust ) { case SVX_VER_JUSTIFY_STANDARD: diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx index d9490d97d503..1a13fe7fd3b2 100644 --- a/sc/source/ui/dbgui/csvgrid.cxx +++ b/sc/source/ui/dbgui/csvgrid.cxx @@ -554,7 +554,7 @@ void ScCsvGrid::FillColumnDataFix( ScAsciiOptions& rOptions ) const for( sal_uInt32 nColIx = 0; nColIx < nCount; ++nColIx ) { ScCsvExpData& rData = aDataVec[ nColIx ]; - rData.mnIndex = static_cast< sal_Int32 >( GetColumnPos( nColIx ) ); + rData.mnIndex = GetColumnPos( nColIx ); rData.mnType = lcl_GetExtColumnType( GetColumnType( nColIx ) ); } aDataVec[ nCount ].mnIndex = SAL_MAX_INT32; diff --git a/sc/source/ui/dbgui/pvfundlg.cxx b/sc/source/ui/dbgui/pvfundlg.cxx index 74ba3f181dd5..7bf29db6c805 100644 --- a/sc/source/ui/dbgui/pvfundlg.cxx +++ b/sc/source/ui/dbgui/pvfundlg.cxx @@ -737,7 +737,7 @@ void ScDPSubtotalOptDlg::Init( const ScDPNameVec& rDataFields, bool bEnableLayou lclFillListBox( *m_pLbHierarchy, maLabelData.maHiers ); sal_Int32 nHier = maLabelData.mnUsedHier; if( (nHier < 0) || (nHier >= maLabelData.maHiers.getLength()) ) nHier = 0; - m_pLbHierarchy->SelectEntryPos( static_cast< sal_Int32 >( nHier ) ); + m_pLbHierarchy->SelectEntryPos( nHier ); m_pLbHierarchy->SetSelectHdl( LINK( this, ScDPSubtotalOptDlg, SelectHdl ) ); } else diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx index 2b7f7a50cd9c..ebf8ac90867f 100644 --- a/sc/source/ui/dbgui/scuiasciiopt.cxx +++ b/sc/source/ui/dbgui/scuiasciiopt.cxx @@ -595,7 +595,7 @@ void ScImportAsciiDlg::SaveParameters() pCkbQuotedAsText->IsChecked(), pCkbDetectNumber->IsChecked(), pRbFixed->IsChecked(), static_cast<sal_Int32>(pNfRow->GetValue()), - static_cast<sal_Int32>(pLbCharSet->GetSelectEntryPos()), + pLbCharSet->GetSelectEntryPos(), static_cast<sal_Int32>(pLbCustomLang->GetSelectLanguage()), meCall ); } diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 6f7b15ae5e9a..5e986635b820 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -932,7 +932,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) if ( aDlg->Execute() == RET_OK ) { bool bSetShared = aDlg->IsShareDocumentChecked(); - if ( bSetShared != static_cast< bool >( IsDocShared() ) ) + if ( bSetShared != IsDocShared() ) { if ( bSetShared ) { diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index b4f19bbf4889..71e8a86b8865 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -251,7 +251,7 @@ static void lcl_setScalesToColumns(ScDocument& rDoc, const vector<long>& rScales continue; sal_uInt32 nOldFormat; - rDoc.GetNumberFormat(static_cast<SCCOL>(i), 0, 0, nOldFormat); + rDoc.GetNumberFormat(i, 0, 0, nOldFormat); const SvNumberformat* pOldEntry = pFormatter->GetEntry(nOldFormat); if (!pOldEntry) continue; @@ -280,7 +280,7 @@ static void lcl_setScalesToColumns(ScDocument& rDoc, const vector<long>& rScales ScPatternAttr aNewAttrs( rDoc.GetPool() ); SfxItemSet& rSet = aNewAttrs.GetItemSet(); rSet.Put( SfxUInt32Item(ATTR_VALUE_FORMAT, nNewFormat) ); - rDoc.ApplyPatternAreaTab(static_cast<SCCOL>(i), 0, static_cast<SCCOL>(i), MAXROW, 0, aNewAttrs); + rDoc.ApplyPatternAreaTab(i, 0, i, MAXROW, 0, aNewAttrs); } } diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index 8c302a68974f..2a21fd58107a 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -2794,7 +2794,7 @@ void ScChart2DataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint } } - OSL_ENSURE(m_pRangeIndices->size() == static_cast<size_t>(aRanges.size()), + OSL_ENSURE(m_pRangeIndices->size() == aRanges.size(), "range list and range index list have different sizes."); unique_ptr<ScRangeList> pUndoRanges; diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx index 30e9fdb3828b..6f5baf5ff3d6 100644 --- a/sc/source/ui/vba/vbaworksheet.cxx +++ b/sc/source/ui/vba/vbaworksheet.cxx @@ -273,7 +273,7 @@ ScVbaWorksheet::createSheetCopy(uno::Reference<excel::XWorksheet> const & xSheet ScDocShell* pDestDocShell = excel::getDocShell( pDestSheet->getModel() ); ScDocShell* pSrcDocShell = excel::getDocShell( getModel() ); if ( pDestDocShell && pSrcDocShell ) - pDestDocShell->TransferTab( *pSrcDocShell, static_cast<SCTAB>(nSrc), static_cast<SCTAB>(nDest), true, true ); + pDestDocShell->TransferTab( *pSrcDocShell, nSrc, nDest, true, true ); } } // return new sheet diff --git a/sc/source/ui/view/cellsh4.cxx b/sc/source/ui/view/cellsh4.cxx index 51ff1a6abcb6..3b565efeaa3a 100644 --- a/sc/source/ui/view/cellsh4.cxx +++ b/sc/source/ui/view/cellsh4.cxx @@ -375,7 +375,7 @@ void ScCellShell::ExecuteMove( SfxRequest& rReq ) pReqArgs->HasItem( FN_PARAM_2, &pModifierItem ) ) { SCCOL nCol = static_cast<SCCOL>(static_cast<const SfxInt32Item*>(pColItem)->GetValue()); - sal_Int16 nModifier = static_cast<sal_Int16>(static_cast<const SfxInt16Item*>(pModifierItem)->GetValue()); + sal_Int16 nModifier = static_cast<const SfxInt16Item*>(pModifierItem)->GetValue(); pTabViewShell->MarkColumns( nCol, nModifier ); } @@ -392,7 +392,7 @@ void ScCellShell::ExecuteMove( SfxRequest& rReq ) pReqArgs->HasItem( FN_PARAM_2, &pModifierItem ) ) { SCROW nRow = static_cast<SCROW>(static_cast<const SfxInt32Item*>(pRowItem)->GetValue()); - sal_Int16 nModifier = static_cast<sal_Int16>(static_cast<const SfxInt16Item*>(pModifierItem)->GetValue()); + sal_Int16 nModifier = static_cast<const SfxInt16Item*>(pModifierItem)->GetValue(); pTabViewShell->MarkRows( nRow, nModifier ); } diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index a84cc588401d..19e441eade83 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -2698,7 +2698,7 @@ void ScViewFunc::MoveTable( nDestTab1 = nDestTab; for(SCTAB nTab : TheTabs) { - nErrVal = pDestShell->TransferTab( *pDocShell, nTab, static_cast<SCTAB>(nDestTab1), false, false ); + nErrVal = pDestShell->TransferTab( *pDocShell, nTab, nDestTab1, false, false ); nDestTab1++; } } commit ee3e23842e7bb0bfe23b6f070b0677dd3d70fd92 Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:31:39 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: sd Change-Id: I47f6ac62a560b8e6e0e83462ae26caf17160393b diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx index 6d2cdeb185a3..cf1eeb41e703 100644 --- a/sd/source/core/annotations/Annotation.cxx +++ b/sd/source/core/annotations/Annotation.cxx @@ -178,7 +178,7 @@ sal_uInt32 Annotation::m_nLastId = 1; Annotation::Annotation( const Reference< XComponentContext >& context, SdPage* pPage ) : ::cppu::WeakComponentImplHelper< XAnnotation >(m_aMutex) -, ::cppu::PropertySetMixin< XAnnotation >(context, static_cast< Implements >(IMPLEMENTS_PROPERTY_SET), Sequence< OUString >()) +, ::cppu::PropertySetMixin< XAnnotation >(context, IMPLEMENTS_PROPERTY_SET, Sequence< OUString >()) , m_nId( m_nLastId++ ) , mpPage( pPage ) { diff --git a/sd/source/ui/func/fuformatpaintbrush.cxx b/sd/source/ui/func/fuformatpaintbrush.cxx index a234e78f96bb..acb4ea7fbbd5 100644 --- a/sd/source/ui/func/fuformatpaintbrush.cxx +++ b/sd/source/ui/func/fuformatpaintbrush.cxx @@ -65,7 +65,7 @@ void FuFormatPaintBrush::DoExecute( SfxRequest& rReq ) const SfxItemSet *pArgs = rReq.GetArgs(); if( pArgs && pArgs->Count() >= 1 ) { - mbPermanent = static_cast<bool>(static_cast<const SfxBoolItem &>(pArgs->Get(SID_FORMATPAINTBRUSH)).GetValue()); + mbPermanent = static_cast<const SfxBoolItem &>(pArgs->Get(SID_FORMATPAINTBRUSH)).GetValue(); } if( mpView ) commit d373d996e163df68935b5ac3e09a931c32047bc0 Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:31:35 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: sdext Change-Id: Ib9d4c9ee077ffe7e3625818d2468658ee00b9c77 diff --git a/sdext/source/minimizer/impoptimizer.cxx b/sdext/source/minimizer/impoptimizer.cxx index 54580c2f52ac..41d5250370c8 100644 --- a/sdext/source/minimizer/impoptimizer.cxx +++ b/sdext/source/minimizer/impoptimizer.cxx @@ -385,7 +385,7 @@ void CompressGraphics( ImpOptimizer& rOptimizer, const Reference< XComponentCont { i++; sal_Int32 nProgress = static_cast< sal_Int32 >( 40.0 * ( i / static_cast< double >( rGraphicList.size() ) ) ) + 50; - rOptimizer.SetStatusValue( TK_Progress, Any( static_cast< sal_Int32 >( nProgress ) ) ); + rOptimizer.SetStatusValue( TK_Progress, Any( nProgress ) ); rOptimizer.DispatchStatus(); if ( aGraphicIter->maUser.size() ) commit 18d87f5be8e8a20ff21fbf74e11af277dfcfe49b Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:31:29 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: sfx2 Change-Id: Ic524a0fc2c1038202456dcf0aa51a8a3eb9a70b0 diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index 348556520c92..f6a537ec72bb 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -331,7 +331,7 @@ void ShutdownIcon::StartFileDialog() { ::SolarMutexGuard aGuard; - bool bDirty = ( m_bSystemDialogs != static_cast<bool>(SvtMiscOptions().UseSystemFileDialog()) ); + bool bDirty = ( m_bSystemDialogs != SvtMiscOptions().UseSystemFileDialog() ); if ( m_pFileDlg && bDirty ) { diff --git a/sfx2/source/control/thumbnailviewacc.cxx b/sfx2/source/control/thumbnailviewacc.cxx index aab1ba555b1d..74b0dc8d56a5 100644 --- a/sfx2/source/control/thumbnailviewacc.cxx +++ b/sfx2/source/control/thumbnailviewacc.cxx @@ -548,7 +548,7 @@ sal_uInt16 ThumbnailViewAcc::getItemCount() const ThumbnailViewItem* ThumbnailViewAcc::getItem (sal_uInt16 nIndex) const { - return mpParent->ImplGetVisibleItem (static_cast<sal_uInt16>(nIndex)); + return mpParent->ImplGetVisibleItem (nIndex); } void ThumbnailViewAcc::ThrowIfDisposed() commit e40f3cf3302d397ef0dc2d8f0d308f902be3a98d Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:31:23 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: slideshow Change-Id: I5f2031068ef0ab8e777fddfa90e7a15836938b48 diff --git a/slideshow/source/engine/shapes/viewappletshape.cxx b/slideshow/source/engine/shapes/viewappletshape.cxx index c9de11fb34fd..3f13d2259633 100644 --- a/slideshow/source/engine/shapes/viewappletshape.cxx +++ b/slideshow/source/engine/shapes/viewappletshape.cxx @@ -184,8 +184,8 @@ namespace slideshow uno::Reference< awt::XWindow > xSurroundingWindow( mxFrame->getContainerWindow() ); if( xSurroundingWindow.is() ) - xSurroundingWindow->setPosSize( static_cast<sal_Int32>(rPixelBounds.getMinX()), - static_cast<sal_Int32>(rPixelBounds.getMinY()), + xSurroundingWindow->setPosSize( rPixelBounds.getMinX(), + rPixelBounds.getMinY(), static_cast<sal_Int32>(rPixelBounds.getWidth()), static_cast<sal_Int32>(rPixelBounds.getHeight()), awt::PosSize::POSSIZE ); @@ -250,8 +250,8 @@ namespace slideshow uno::Reference< awt::XWindow > xFrameWindow( mxFrame->getContainerWindow() ); if( xFrameWindow.is() ) - xFrameWindow->setPosSize( static_cast<sal_Int32>(rPixelBounds.getMinX()), - static_cast<sal_Int32>(rPixelBounds.getMinY()), + xFrameWindow->setPosSize( rPixelBounds.getMinX(), + rPixelBounds.getMinY(), static_cast<sal_Int32>(rPixelBounds.getWidth()), static_cast<sal_Int32>(rPixelBounds.getHeight()), awt::PosSize::POSSIZE ); commit 1221ee605ac3bcab982bd8e63c5fbf39bbfd605c Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:31:14 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: starmath Change-Id: I59f875a09b4f397c3ba1fe445ed5b3c970e2fc05 diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx index 6e94785d305b..ea4e4c01634a 100644 --- a/starmath/source/cfgitem.cxx +++ b/starmath/source/cfgitem.cxx @@ -518,7 +518,7 @@ void SmMathConfig::SetSymbols( const std::vector< SmSym > &rNewSymbols ) // Char pVal->Name = aNodeNameDelim; pVal->Name += *pName++; - pVal->Value <<= static_cast< sal_UCS4 >( rSymbol.GetCharacter() ); + pVal->Value <<= rSymbol.GetCharacter(); pVal++; // Set pVal->Name = aNodeNameDelim; @@ -903,7 +903,7 @@ void SmMathConfig::SaveFormat() // StandardFormat/Textmode *pValue++ <<= pFormat->IsTextmode(); // StandardFormat/GreekCharStyle - *pValue++ <<= static_cast<sal_Int16>(pFormat->GetGreekCharStyle()); + *pValue++ <<= pFormat->GetGreekCharStyle(); // StandardFormat/ScaleNormalBracket *pValue++ <<= pFormat->IsScaleNormalBrackets(); // StandardFormat/HorizontalAlignment diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 2037b222b163..8e9f584ce64a 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -762,7 +762,7 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu break; case HANDLE_GREEK_CHAR_STYLE : - *pValue <<= static_cast<sal_Int16>(aFormat.GetGreekCharStyle()); + *pValue <<= aFormat.GetGreekCharStyle(); break; case HANDLE_ALIGNMENT : commit f392d3b1233ee0ee74456595e6bd5fdb3853da19 Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:31:07 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: svl Change-Id: I9a99d243173eb2300a57d47097b2eef8c48bb76b diff --git a/svl/qa/unit/test_URIHelper.cxx b/svl/qa/unit/test_URIHelper.cxx index 70e6fcc69da4..dc57dcd51968 100644 --- a/svl/qa/unit/test_URIHelper.cxx +++ b/svl/qa/unit/test_URIHelper.cxx @@ -404,9 +404,9 @@ void Test::testFindFirstURLInText() { buf.append(" != "); buf.append(OUStringToOString(result, RTL_TEXTENCODING_UTF8)); buf.append(" ("); - buf.append(static_cast< sal_Int32 >(begin)); + buf.append(begin); buf.append(", "); - buf.append(static_cast< sal_Int32 >(end)); + buf.append(end); buf.append(')'); msg = buf.makeStringAndClear(); } commit 2ced777e0cdf8240cc8567467b2008c3ae8230e3 Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:31:03 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: svtools Change-Id: Idcd8a32f85788fe0d763c2f72475e3bef4221366 diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx index 8610c3b7f641..1afc813baff6 100644 --- a/svtools/source/control/valueacc.cxx +++ b/svtools/source/control/valueacc.cxx @@ -654,7 +654,7 @@ ValueSetItem* ValueSetAcc::getItem (sal_uInt16 nIndex) const nIndex -= 1; } if (pItem == nullptr) - pItem = mpParent->ImplGetItem (static_cast<sal_uInt16>(nIndex)); + pItem = mpParent->ImplGetItem (nIndex); return pItem; } diff --git a/svtools/source/filter/exportdialog.cxx b/svtools/source/filter/exportdialog.cxx index 645c8df7dd5f..228d265f65ff 100644 --- a/svtools/source/filter/exportdialog.cxx +++ b/svtools/source/filter/exportdialog.cxx @@ -1012,7 +1012,7 @@ IMPL_LINK_NOARG(ExportDialog, UpdateHdlMtfSizeX, Edit&, void) Fraction aFract( 1, 100 ); sal_Int32 nWidth = mpMfSizeX->GetValue(); sal_Int32 nHeight= static_cast< sal_Int32 >( nWidth * fRatio ); - const Size aSource( static_cast< sal_Int32 >( nWidth ), static_cast< sal_Int32 >( nHeight ) ); + const Size aSource( nWidth, nHeight ); MapMode aSourceMapMode( GetMapUnit( mpLbSizeX->GetSelectEntryPos() ),Point(), aFract, aFract ); Size aDest( LogicToLogic( aSource, aSourceMapMode, MapUnit::Map100thMM ) ); @@ -1044,7 +1044,7 @@ IMPL_LINK_NOARG(ExportDialog, UpdateHdlMtfSizeY, Edit&, void) Fraction aFract( 1, 100 ); sal_Int32 nHeight= mpMfSizeY->GetValue(); sal_Int32 nWidth = static_cast< sal_Int32 >( nHeight * fRatio ); - const Size aSource( static_cast< sal_Int32 >( nWidth ), static_cast< sal_Int32 >( nHeight ) ); + const Size aSource( nWidth, nHeight ); MapMode aSourceMapMode( GetMapUnit( mpLbSizeX->GetSelectEntryPos() ),Point(), aFract, aFract ); Size aDest( LogicToLogic( aSource, aSourceMapMode, MapUnit::Map100thMM ) ); commit 42c490fe71595ad692a5364cf15a9608d1abdf80 Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:30:52 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: svx Change-Id: I4705917cd6e583b1209671ca4a9122581f7b4417 diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx b/svx/source/accessibility/AccessibleTextHelper.cxx index c1c93b18ba6c..44daca62b2e6 100644 --- a/svx/source/accessibility/AccessibleTextHelper.cxx +++ b/svx/source/accessibility/AccessibleTextHelper.cxx @@ -536,7 +536,7 @@ namespace accessibility ::std::min( maLastSelection.nEndPara, nMaxValidParaIndex )+1, AccessibleEventId::CARET_CHANGED, uno::makeAny(static_cast<sal_Int32>(-1)), - uno::makeAny(static_cast<sal_Int32>(maLastSelection.nEndPos)) ); + uno::makeAny(maLastSelection.nEndPos) ); } ChangeChildFocus( aSelection.nEndPara ); @@ -560,7 +560,7 @@ namespace accessibility if( maLastSelection.nStartPara != EE_PARA_NOT_FOUND && maLastSelection.nEndPara == aSelection.nEndPara ) { - aOldCursor <<= static_cast<sal_Int32>(maLastSelection.nEndPos); + aOldCursor <<= maLastSelection.nEndPos; } else { @@ -570,7 +570,7 @@ namespace accessibility maParaManager.FireEvent( aSelection.nEndPara, aSelection.nEndPara+1, AccessibleEventId::CARET_CHANGED, - uno::makeAny(static_cast<sal_Int32>(aSelection.nEndPos)), + uno::makeAny(aSelection.nEndPos), aOldCursor ); } diff --git a/svx/source/items/algitem.cxx b/svx/source/items/algitem.cxx index 4fb7c0453f27..d3b416487da6 100644 --- a/svx/source/items/algitem.cxx +++ b/svx/source/items/algitem.cxx @@ -144,13 +144,13 @@ sal_uInt16 SvxOrientationItem::GetValueCount() const bool SvxOrientationItem::IsStacked() const { - return static_cast< SvxCellOrientation >( GetValue() ) == SVX_ORIENTATION_STACKED; + return GetValue() == SVX_ORIENTATION_STACKED; } sal_Int32 SvxOrientationItem::GetRotation( sal_Int32 nStdAngle ) const { sal_Int32 nAngle = nStdAngle; - switch( static_cast< SvxCellOrientation >( GetValue() ) ) + switch( GetValue() ) { case SVX_ORIENTATION_BOTTOMTOP: nAngle = 9000;break; case SVX_ORIENTATION_TOPBOTTOM: nAngle = 27000;break; diff --git a/svx/source/styles/CommonStylePreviewRenderer.cxx b/svx/source/styles/CommonStylePreviewRenderer.cxx index ab7133d8f8a7..a9d4ac52ef3c 100644 --- a/svx/source/styles/CommonStylePreviewRenderer.cxx +++ b/svx/source/styles/CommonStylePreviewRenderer.cxx @@ -96,7 +96,7 @@ bool CommonStylePreviewRenderer::recalculate() } if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_OVERLINE)) != nullptr) { - pFont->SetOverline(static_cast<FontLineStyle>(static_cast<const SvxOverlineItem*>(pItem)->GetValue())); + pFont->SetOverline(static_cast<const SvxOverlineItem*>(pItem)->GetValue()); } if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_STRIKEOUT)) != nullptr) { diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 46443440d640..e21eb758fbee 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -719,7 +719,7 @@ void SvxStyleBox_Impl::SetupEntry(vcl::RenderContext& rRenderContext, vcl::Windo pItem = pItemSet->GetItem( SID_ATTR_CHAR_OVERLINE ); if ( pItem ) - aFont.SetOverline( static_cast< FontLineStyle >( static_cast< const SvxOverlineItem* >( pItem )->GetValue() ) ); + aFont.SetOverline( static_cast< const SvxOverlineItem* >( pItem )->GetValue() ); pItem = pItemSet->GetItem( SID_ATTR_CHAR_STRIKEOUT ); if ( pItem ) commit 8005237d71a75fe9bcfd860111bb0fe1fa6064d6 Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:30:47 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: sw Change-Id: I1d52df4fe3f276ebf017aa7cfb7b313cefaf0844 diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx index 68187a49c4ab..0fcc0a48e2a2 100644 --- a/sw/qa/extras/globalfilter/globalfilter.cxx +++ b/sw/qa/extras/globalfilter/globalfilter.cxx @@ -612,7 +612,7 @@ void Test::testMSCharBackgroundEditing() case 3: nBackColor = 0x00ff00; break; //green case 4: nBackColor = 0xff00ff; break; //magenta } - xRun->setPropertyValue("CharBackColor", uno::makeAny(static_cast<sal_Int32>(nBackColor))); + xRun->setPropertyValue("CharBackColor", uno::makeAny(nBackColor)); // Remove highlighting xRun->setPropertyValue("CharHighlight", uno::makeAny(static_cast<sal_Int32>(COL_TRANSPARENT))); // Remove shading marker @@ -661,11 +661,11 @@ void Test::testMSCharBackgroundEditing() if( strcmp(aFilterNames[nFilter], "writer8") == 0 ) { CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(COL_TRANSPARENT), getProperty<sal_Int32>(xRun,"CharHighlight")); - CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(nBackColor), getProperty<sal_Int32>(xRun,"CharBackColor")); + CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), nBackColor, getProperty<sal_Int32>(xRun,"CharBackColor")); } else { - CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(nBackColor), getProperty<sal_Int32>(xRun,"CharHighlight")); + CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), nBackColor, getProperty<sal_Int32>(xRun,"CharHighlight")); CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(COL_TRANSPARENT), getProperty<sal_Int32>(xRun,"CharBackColor")); } } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx index 166d4658fda0..b954283754a9 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx @@ -2065,7 +2065,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf90810, "tdf90810short.docx") uno::Reference<text::XFootnote> xFootnote(xFootnoteIdxAcc->getByIndex(0), uno::UNO_QUERY); uno::Reference<text::XText> xFootnoteText(xFootnote, uno::UNO_QUERY); rtl::OUString sFootnoteText = xFootnoteText->getString(); - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(90), static_cast<sal_Int32>(sFootnoteText.getLength())); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(90), sFootnoteText.getLength()); } DECLARE_OOXMLEXPORT_TEST(testTdf89165, "tdf89165.docx") diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx index 807507fd743e..18c26d55c591 100644 --- a/sw/source/core/text/frmcrsr.cxx +++ b/sw/source/core/text/frmcrsr.cxx @@ -1238,7 +1238,7 @@ bool SwTextFrame::UnitDown_(SwPaM *pPam, const SwTwips nOffset, if( nFormat <= GetOfst() ) { nFormat = std::min( sal_Int32( GetOfst() + MIN_OFFSET_STEP ), - static_cast<sal_Int32>(nTmpLen) ); + nTmpLen ); if( nFormat <= GetOfst() ) break; } diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx index 23f2d7534b71..2c2df17c0b70 100644 --- a/sw/source/core/text/txtdrop.cxx +++ b/sw/source/core/text/txtdrop.cxx @@ -569,7 +569,7 @@ SwDropPortion *SwTextFormatter::NewDropPortion( SwTextFormatInfo &rInf ) // find next attribute change / script change const sal_Int32 nTmpIdx = nNextChg; - sal_Int32 nNextAttr = std::min( static_cast<sal_Int32>(GetNextAttr()), rInf.GetText().getLength() ); + sal_Int32 nNextAttr = std::min( GetNextAttr(), rInf.GetText().getLength() ); nNextChg = m_pScriptInfo->NextScriptChg( nTmpIdx ); if( nNextChg > nNextAttr ) nNextChg = nNextAttr; diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 0f95e9cb27bc..6c83fae8a43d 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -1516,7 +1516,7 @@ SvxFrameDirection MSWordExportBase::GetDefaultFrameDirection( ) const } else if ( dynamic_cast< const SwTextFormatColl *>( m_pOutFormatNode ) != nullptr ) { - if ( MsLangId::isRightToLeft( static_cast<LanguageType>(GetAppLanguage())) ) + if ( MsLangId::isRightToLeft( GetAppLanguage()) ) nDir = SvxFrameDirection::Horizontal_RL_TB; else nDir = SvxFrameDirection::Horizontal_LR_TB; //what else can we do :-( @@ -1526,7 +1526,7 @@ SvxFrameDirection MSWordExportBase::GetDefaultFrameDirection( ) const if ( nDir == SvxFrameDirection::Environment ) { // fdo#44029 put direction right when the locale are RTL. - if( MsLangId::isRightToLeft( static_cast<LanguageType>(GetAppLanguage())) ) + if( MsLangId::isRightToLeft( GetAppLanguage()) ) nDir = SvxFrameDirection::Horizontal_RL_TB; else nDir = SvxFrameDirection::Horizontal_LR_TB; //Set something diff --git a/sw/source/ui/frmdlg/wrap.cxx b/sw/source/ui/frmdlg/wrap.cxx index 5d2cf4a3bdfc..1a1afc25b1e7 100644 --- a/sw/source/ui/frmdlg/wrap.cxx +++ b/sw/source/ui/frmdlg/wrap.cxx @@ -415,8 +415,8 @@ void SwWrapTabPage::ActivatePage(const SfxItemSet& rSet) const SvxLRSpaceItem& rLR = static_cast<const SvxLRSpaceItem&>(rSet.Get(RES_LR_SPACE)); m_nOldLeftMargin = static_cast< sal_uInt16 >(rLR.GetLeft()); m_nOldRightMargin = static_cast< sal_uInt16 >(rLR.GetRight()); - m_nOldUpperMargin = static_cast< sal_uInt16 >(rUL.GetUpper()); - m_nOldLowerMargin = static_cast< sal_uInt16 >(rUL.GetLower()); + m_nOldUpperMargin = rUL.GetUpper(); + m_nOldLowerMargin = rUL.GetLower(); // position const SwFormatHoriOrient& rHori = static_cast<const SwFormatHoriOrient&>(rSet.Get(RES_HORI_ORIENT)); diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index 45312455c19b..6d744b14c38b 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -952,7 +952,7 @@ void SwTableShell::Execute(SfxRequest &rReq) { const sal_uInt16 nDispatchSlot = (nSlot == FN_TABLE_INSERT_COL_DLG) ? FN_TABLE_INSERT_COL_AFTER : FN_TABLE_INSERT_ROW_AFTER; - SfxUInt16Item aCountItem( nDispatchSlot, static_cast< sal_uInt16 >(pDlg->getInsertCount()) ); + SfxUInt16Item aCountItem( nDispatchSlot, pDlg->getInsertCount() ); SfxBoolItem aAfter( FN_PARAM_INSERT_AFTER, !pDlg->isInsertBefore() ); SfxViewFrame* pVFrame = GetView().GetViewFrame(); if( pVFrame ) diff --git a/sw/source/uibase/uiview/view1.cxx b/sw/source/uibase/uiview/view1.cxx index 98a4be6e7cb5..f8b949368494 100644 --- a/sw/source/uibase/uiview/view1.cxx +++ b/sw/source/uibase/uiview/view1.cxx @@ -149,8 +149,8 @@ void SwView::ExecFormatPaintbrush(SfxRequest& rReq) const SfxItemSet *pArgs = rReq.GetArgs(); if( pArgs && pArgs->Count() >= 1 ) { - bPersistentCopy = static_cast<bool>(static_cast<const SfxBoolItem &>(pArgs->Get( - SID_FORMATPAINTBRUSH)).GetValue()); + bPersistentCopy = static_cast<const SfxBoolItem &>(pArgs->Get( + SID_FORMATPAINTBRUSH)).GetValue(); } m_pFormatClipboard->Copy( GetWrtShell(), GetPool(), bPersistentCopy ); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index af8853741696..07530d82e1bc 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -2094,7 +2094,7 @@ Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName) aAny <<= getRuntimeUID(); break; case WID_DOC_LOCK_UPDATES : - aAny <<= static_cast<bool>( pDocShell->GetDoc()->IsInReading() ); + aAny <<= pDocShell->GetDoc()->IsInReading(); break; case WID_DOC_BUILDID: aAny <<= maBuildId; commit cbb2f42ecc86b3fc327e976f5a1a591b40f40299 Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:30:43 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: unotools Change-Id: I9717a519340f13c852e5e505a906dc15d765b9df diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx index 495d082609d2..37356821911b 100644 --- a/unotools/source/config/fontcfg.cxx +++ b/unotools/source/config/fontcfg.cxx @@ -133,8 +133,8 @@ DefaultFontConfiguration::DefaultFontConfiguration() m_xConfigProvider.clear(); m_xConfigAccess.clear(); } - SAL_INFO("unotools.config", "config provider: " << static_cast<bool>(m_xConfigProvider.is()) - << ", config access: " << static_cast<bool>(m_xConfigAccess.is())); + SAL_INFO("unotools.config", "config provider: " << m_xConfigProvider.is() + << ", config access: " << m_xConfigAccess.is()); } DefaultFontConfiguration::~DefaultFontConfiguration() @@ -386,8 +386,8 @@ FontSubstConfiguration::FontSubstConfiguration() : m_xConfigProvider.clear(); m_xConfigAccess.clear(); } - SAL_INFO("unotools.config", "config provider: " << static_cast<bool>(m_xConfigProvider.is()) - << ", config access: " << static_cast<bool>(m_xConfigAccess.is())); + SAL_INFO("unotools.config", "config provider: " << m_xConfigProvider.is() + << ", config access: " << m_xConfigAccess.is()); } /* commit 643787f22eaf057ee7d0a4f49065834e11b92ce5 Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:30:35 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: uui Change-Id: I2ecf4a804a9fa4056f956bea245b64cb7c087595 diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index e97be349a459..fdbe9eccbc67 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -163,9 +163,7 @@ UUIInteractionHelper::handleRequest( uno::Reference< task::XInteractionRequest > const & rRequest) { if( - // be aware,it is the same type - static_cast< oslThreadIdentifier >( - Application::GetMainThreadIdentifier()) + Application::GetMainThreadIdentifier() != osl::Thread::getCurrentIdentifier() && GetpApp() @@ -217,9 +215,7 @@ UUIInteractionHelper::getStringFromRequest( uno::Reference< task::XInteractionRequest > const & rRequest) { if( - // be aware,it is the same type - static_cast< oslThreadIdentifier >( - Application::GetMainThreadIdentifier()) + Application::GetMainThreadIdentifier() != osl::Thread::getCurrentIdentifier() && GetpApp() commit e2a218114de3fd74848323238188c847a733d9b3 Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:30:29 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: vcl Change-Id: I5c85d3df578d0b7e9ffc54679b73a0ce35de8620 diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx index 96baf7ac1a4f..e7aeca467362 100644 --- a/vcl/source/control/imp_listbox.cxx +++ b/vcl/source/control/imp_listbox.cxx @@ -1801,7 +1801,7 @@ void ImplListBoxWindow::DrawEntry(vcl::RenderContext& rRenderContext, sal_Int32 OUString aStr(mpEntryList->GetEntryText(nPos)); if (!aStr.isEmpty()) { - long nMaxWidth = std::max(static_cast< long >(mnMaxWidth), GetOutputSizePixel().Width() - 2 * mnBorder); + long nMaxWidth = std::max(mnMaxWidth, GetOutputSizePixel().Width() - 2 * mnBorder); // a multiline entry should only be as wide a the window if ((pEntry->mnFlags & ListBoxEntryFlags::MultiLine)) nMaxWidth = GetOutputSizePixel().Width() - 2 * mnBorder; diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx index 123d8ce62181..dc3666978fb7 100644 --- a/vcl/source/gdi/dibtools.cxx +++ b/vcl/source/gdi/dibtools.cxx @@ -503,7 +503,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r { // we can't trust arbitrary-sourced index based formats to have correct indexes, so we exclude the pal formats // from raw read and force checking their colormap indexes - bNative = ( ( static_cast< bool >(rAcc.IsBottomUp()) != bTopDown ) && !bRLE && !bTCMask && ( rAcc.GetScanlineSize() == nAlignedWidth ) ); + bNative = ( ( rAcc.IsBottomUp() != bTopDown ) && !bRLE && !bTCMask && ( rAcc.GetScanlineSize() == nAlignedWidth ) ); break; } @@ -1232,7 +1232,7 @@ bool ImplWriteDIBBits(SvStream& rOStm, BitmapReadAccess& rAcc, BitmapReadAccess* // bitmaps is relatively recent. // #i59239# discretize bitcount for aligned width to 1,4,8,24 // (other cases are not written below) - const sal_uInt16 nBitCount(pAccAlpha ? 32 : discretizeBitcount(static_cast< sal_uInt16 >(rAcc.GetBitCount()))); + const sal_uInt16 nBitCount(pAccAlpha ? 32 : discretizeBitcount(rAcc.GetBitCount())); const sal_uLong nAlignedWidth(AlignedWidth4Bytes(rAcc.Width() * nBitCount)); bool bNative(false); @@ -1418,7 +1418,7 @@ bool ImplWriteDIBBody(const Bitmap& rBitmap, SvStream& rOStm, BitmapReadAccess& // recent. // #i59239# discretize bitcount to 1,4,8,24 (other cases // are not written below) - const sal_uInt16 nBitCount(pAccAlpha ? 32 : discretizeBitcount(static_cast< sal_uInt16 >(rAcc.GetBitCount()))); + const sal_uInt16 nBitCount(pAccAlpha ? 32 : discretizeBitcount(rAcc.GetBitCount())); aHeader.nBitCount = nBitCount; aHeader.nSizeImage = rAcc.Height() * AlignedWidth4Bytes(rAcc.Width() * aHeader.nBitCount); diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 92d29e547068..7a43de2dc1f3 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -49,8 +49,8 @@ #define SYS_OS2METAFILE 0x00000005L #define SYS_MACMETAFILE 0x00000006L -#define GRAPHIC_FORMAT_50 static_cast<sal_uInt32>(COMPAT_FORMAT( 'G', 'R', 'F', '5' )) -#define NATIVE_FORMAT_50 static_cast<sal_uInt32>(COMPAT_FORMAT( 'N', 'A', 'T', '5' )) +#define GRAPHIC_FORMAT_50 COMPAT_FORMAT( 'G', 'R', 'F', '5' ) +#define NATIVE_FORMAT_50 COMPAT_FORMAT( 'N', 'A', 'T', '5' ) const sal_uInt32 nPdfMagic((sal_uInt32('p') << 24) | (sal_uInt32('d') << 16) | (sal_uInt32('f') << 8) | sal_uInt32('0')); diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index b80ed6c5a2d8..12157a59acbf 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -1662,7 +1662,7 @@ double DemoRenderer::getAndResetBenchmark(const RenderStyle style) maRenderers[i]->sumTime = 0; maRenderers[i]->countTime = 0; } - geomean = pow(geomean, static_cast<double>(1.0)/maRenderers.size()); + geomean = pow(geomean, 1.0/maRenderers.size()); fprintf(stderr, "GEOMEAN_%s: %f\n", style == RENDER_THUMB ? "THUMB": "EXPANDED", geomean); return geomean; } @@ -1812,7 +1812,7 @@ public: double thumbGEOMEAN = mrRenderer.getAndResetBenchmark(RENDER_THUMB); - fprintf(stderr, "GEOMEAN_TOTAL: %f\n", pow(thumbGEOMEAN * expandedGEOMEAN, static_cast<double>(0.5))); + fprintf(stderr, "GEOMEAN_TOTAL: %f\n", pow(thumbGEOMEAN * expandedGEOMEAN, 0.5)); Application::Quit(); } }; commit 2f01d679585f9770d81d8e0a8f3eb7a5b4edf2b4 Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:30:23 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: xmloff Change-Id: I67a7f0643b4773c991e780c9a715636bb3e6e6cb diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx index bf3e95b85445..5fdb943556a8 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx @@ -1114,9 +1114,9 @@ void SchXMLStatisticsObjectContext::StartElement( const uno::Reference< xml::sax uno::UNO_QUERY ); xBarProp->setPropertyValue("ErrorBarStyle",uno::makeAny(css::chart::ErrorBarStyle::NONE)); - xBarProp->setPropertyValue("PositiveError",uno::makeAny(static_cast<double>(0.0))); - xBarProp->setPropertyValue("NegativeError",uno::makeAny(static_cast<double>(0.0))); - xBarProp->setPropertyValue("Weight",uno::makeAny(static_cast<double>(1.0))); + xBarProp->setPropertyValue("PositiveError",uno::makeAny(0.0)); + xBarProp->setPropertyValue("NegativeError",uno::makeAny(0.0)); + xBarProp->setPropertyValue("Weight",uno::makeAny(1.0)); xBarProp->setPropertyValue("ShowPositiveError",uno::makeAny(true)); xBarProp->setPropertyValue("ShowNegativeError",uno::makeAny(true)); diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx index f00ce12d94f3..b301a1ed7961 100644 --- a/xmloff/source/chart/SchXMLTools.cxx +++ b/xmloff/source/chart/SchXMLTools.cxx @@ -369,7 +369,7 @@ Reference< chart2::data::XDataSequence > CreateDataSequence( bool bVal = false; uno::Any any = xPropSet->getPropertyValue("UseInternalDataProvider"); if (any >>= bVal) - bUseInternal = static_cast<bool>(bVal); + bUseInternal = bVal; } catch (const beans::UnknownPropertyException&) { diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx index f019e8cb14e7..8aec434b5faf 100644 --- a/xmloff/source/style/styleexp.cxx +++ b/xmloff/source/style/styleexp.cxx @@ -185,7 +185,7 @@ bool XMLStyleExport::exportStyle( if( nOutlineLevel > 0 ) { OUStringBuffer sTmp; - sTmp.append( static_cast<sal_Int32>(nOutlineLevel)); + sTmp.append(nOutlineLevel); GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_DEFAULT_OUTLINE_LEVEL, sTmp.makeStringAndClear() ); diff --git a/xmloff/source/text/XMLTextMarkImportContext.cxx b/xmloff/source/text/XMLTextMarkImportContext.cxx index b73ae0166d6b..3878152e5bae 100644 --- a/xmloff/source/text/XMLTextMarkImportContext.cxx +++ b/xmloff/source/text/XMLTextMarkImportContext.cxx @@ -247,8 +247,7 @@ void XMLTextMarkImportContext::EndElement() { std::shared_ptr< ::xmloff::ParsedRDFaAttributes > xRDFaAttributes; - if (m_bHaveAbout && (TypeBookmarkStart - == static_cast<lcl_MarkType>(nTmp))) + if (m_bHaveAbout && TypeBookmarkStart == nTmp) { xRDFaAttributes = GetImport().GetRDFaImportHelper().ParseRDFa( diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index c1f552df985b..2bd3cace328f 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -1850,9 +1850,8 @@ OUString XMLTextImportHelper::SetStyleAndAttrs( { if ( nCurrentOutlineLevelInheritedFromParagraphStyle != 0 ) { - sal_Int16 nZero = 0; xPropSet->setPropertyValue(s_OutlineLevel, - makeAny( static_cast<sal_Int16>(nZero) )); + makeAny( sal_Int16(0) )); } } } commit f79c466405843fc5ee01b2129c97965bcdd6b3b8 Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:30:16 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: xmlscript Change-Id: I511174aa27bd486e6c046761e481c494c58a67bc diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx index ec7398e38d2f..756424a96c5e 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx @@ -591,7 +591,7 @@ void ElementDescriptor::readDateAttr( OUString const & rPropName, OUString const if (a >>= aUDate) { ::Date aTDate(aUDate); - addAttribute( rAttrName, OUString::number( static_cast<sal_Int32>(aTDate.GetDate()) ) ); + addAttribute( rAttrName, OUString::number( aTDate.GetDate() ) ); } else OSL_FAIL( "### internal error" ); commit 8a18515f7bb1eb6e7d356a1737ac1a339b5ceeab Author: Stephan Bergmann <[email protected]> Date: Thu Apr 6 18:30:09 2017 +0200 Improved loplugin:redundantcast, static_cast on arithmetic types: xmlsecurity Change-Id: I51692b887585d6a64019550aff5f6ea2910ad2fd diff --git a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx index 48e3a021199d..05f8517ffec3 100644 --- a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx +++ b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx @@ -195,7 +195,7 @@ void PDFSigningTest::testPDFAdd() // Make sure the timestamp is correct. DateTime aDateTime(DateTime::SYSTEM); // This was 0 (on Windows), as neither the /M key nor the PKCS#7 blob contained a timestamp. - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(aDateTime.GetYear()), aInfos[0].stDateTime.Year); + CPPUNIT_ASSERT_EQUAL(aDateTime.GetYear(), aInfos[0].stDateTime.Year); // Assert that the digest algorithm is not SHA-1 in the bAdES case. CPPUNIT_ASSERT_EQUAL(xml::crypto::DigestID::SHA256, aInfos[0].nDigestID); } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
