[Libreoffice-commits] core.git: chart2/qa comphelper/source compilerplugins/clang connectivity/source dbaccess/source drawinglayer/source editeng/source filter/source forms/source sax/source sc/source sd/qa sd/source sfx2/source svtools/source svx/source sw/qa sw/source toolkit/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Thu Jan 9 19:22:35 UTC 2020


 chart2/qa/extras/chart2import.cxx                      |    4 +--
 comphelper/source/property/propertycontainerhelper.cxx |    2 -
 compilerplugins/clang/check.cxx                        |   15 ++++++++++-
 compilerplugins/clang/test/redundantcast.cxx           |   14 ++++++++++
 connectivity/source/drivers/file/FDateFunctions.cxx    |    2 -
 dbaccess/source/core/api/RowSet.cxx                    |    2 -
 dbaccess/source/ui/dlg/queryfilter.cxx                 |    2 -
 drawinglayer/source/dumper/XShapeDumper.cxx            |   10 +++----
 editeng/source/items/paraitem.cxx                      |    2 -
 editeng/source/uno/unofdesc.cxx                        |    2 -
 filter/source/graphicfilter/icgm/actimpr.cxx           |    2 -
 forms/source/component/FormattedField.cxx              |    4 +--
 forms/source/component/formcontrolfont.cxx             |   22 ++++++++---------
 sax/source/expatwrap/saxwriter.cxx                     |    2 -
 sc/source/ui/Accessibility/AccessibleCellBase.cxx      |   10 +++----
 sd/qa/unit/import-tests.cxx                            |    8 +++---
 sd/source/filter/eppt/pptx-text.cxx                    |    2 -
 sfx2/source/doc/oleprops.cxx                           |   12 ++++-----
 svtools/source/filter/exportdialog.cxx                 |    8 +++---
 svx/source/fmcomp/fmgridif.cxx                         |    2 -
 sw/qa/extras/odfexport/odfexport.cxx                   |    2 -
 sw/source/core/edit/edfcol.cxx                         |    8 +++---
 sw/source/filter/xml/xmlimp.cxx                        |    2 -
 toolkit/source/controls/unocontrolmodel.cxx            |    2 -
 24 files changed, 84 insertions(+), 57 deletions(-)

New commits:
commit 6efffbbfce9c27439f54970f7a569b069ce46eba
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Jan 9 19:38:32 2020 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Jan 9 20:21:59 2020 +0100

    Improve loplugin:redundantcast for sal_Int... vs. ::sal_Int...
    
    Change-Id: I1548a76fdc03afee68f1e5c01bc665e616f2edf2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86501
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index c2f8e2a0afee..e44efe636eed 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -305,7 +305,7 @@ void Chart2ImportTest::Fdo60083()
             xErrorBarYProps->getPropertyValue("ErrorBarStyle")
             >>= nErrorBarStyle);
         CPPUNIT_ASSERT_EQUAL(
-            static_cast<sal_Int32>(chart::ErrorBarStyle::RELATIVE),
+            chart::ErrorBarStyle::RELATIVE,
             nErrorBarStyle);
 
         double nVal = 0.0;
@@ -354,7 +354,7 @@ void Chart2ImportTest::testErrorBarRange()
             xErrorBarYProps->getPropertyValue("ErrorBarStyle")
             >>= nErrorBarStyle);
     CPPUNIT_ASSERT_EQUAL(
-            static_cast<sal_Int32>(chart::ErrorBarStyle::FROM_DATA),
+            chart::ErrorBarStyle::FROM_DATA,
             nErrorBarStyle);
 
     OUString aRangePos;
diff --git a/comphelper/source/property/propertycontainerhelper.cxx b/comphelper/source/property/propertycontainerhelper.cxx
index c248a620e1ac..1ba31ec8258f 100644
--- a/comphelper/source/property/propertycontainerhelper.cxx
+++ b/comphelper/source/property/propertycontainerhelper.cxx
@@ -463,7 +463,7 @@ void OPropertyContainerHelper::describeProperties(Sequence< Property >& _rProps)
     {
         pOwnProps->Name = rProp.aProperty.Name;
         pOwnProps->Handle = rProp.aProperty.Handle;
-        pOwnProps->Attributes = static_cast<sal_Int16>(rProp.aProperty.Attributes);
+        pOwnProps->Attributes = rProp.aProperty.Attributes;
         pOwnProps->Type = rProp.aProperty.Type;
         ++pOwnProps;
     }
diff --git a/compilerplugins/clang/check.cxx b/compilerplugins/clang/check.cxx
index be1b1f764eb1..472e296907b0 100644
--- a/compilerplugins/clang/check.cxx
+++ b/compilerplugins/clang/check.cxx
@@ -273,6 +273,19 @@ bool isExtraWarnUnusedType(clang::QualType type) {
 
 namespace {
 
+// Make sure Foo and ::Foo are considered equal:
+bool areSameSugaredType(clang::QualType type1, clang::QualType type2) {
+    auto t1 = type1.getLocalUnqualifiedType();
+    if (auto const et = llvm::dyn_cast<clang::ElaboratedType>(t1)) {
+        t1 = et->getNamedType();
+    }
+    auto t2 = type2.getLocalUnqualifiedType();
+    if (auto const et = llvm::dyn_cast<clang::ElaboratedType>(t2)) {
+        t2 = et->getNamedType();
+    }
+    return t1 == t2;
+}
+
 bool isArithmeticOp(clang::Expr const * expr) {
     expr = expr->IgnoreParenImpCasts();
     if (auto const e = llvm::dyn_cast<clang::BinaryOperator>(expr)) {
@@ -311,7 +324,7 @@ bool isOkToRemoveArithmeticCast(
     // suffix like L it could still be either long or long long):
     if ((t1->isIntegralType(context)
          || t1->isRealFloatingType())
-        && ((t1.getLocalUnqualifiedType() != t2.getLocalUnqualifiedType()
+        && ((!areSameSugaredType(t1, t2)
              && (loplugin::TypeCheck(t1).Typedef()
                  || loplugin::TypeCheck(t2).Typedef()
                  || llvm::isa<clang::DecltypeType>(t1) || llvm::isa<clang::DecltypeType>(t2)))
diff --git a/compilerplugins/clang/test/redundantcast.cxx b/compilerplugins/clang/test/redundantcast.cxx
index 2ffd8f93c96f..03ce47796d65 100644
--- a/compilerplugins/clang/test/redundantcast.cxx
+++ b/compilerplugins/clang/test/redundantcast.cxx
@@ -7,8 +7,12 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include <sal/config.h>
+
 #include <cstddef>
 
+#include <sal/types.h>
+
 #include "redundantcast.hxx"
 
 void f1(char *) {}
@@ -418,6 +422,15 @@ auto testNullFunctionPointer(int i, F p) {
     }
 }
 
+void testSalIntTypes() {
+    sal_Int16 const n = 0;
+    (void) static_cast<sal_Int16>(n); // expected-error-re {{static_cast from 'const sal_Int16' (aka 'const {{.+}}') lvalue to 'sal_Int16' (aka '{{.+}}') prvalue is redundant or should be written as an explicit construction of a temporary [loplugin:redundantcast]}}
+    (void) static_cast<::sal_Int16>(n); // expected-error-re {{static_cast from 'const sal_Int16' (aka 'const {{.+}}') lvalue to '::sal_Int16' (aka '{{.+}}') prvalue is redundant or should be written as an explicit construction of a temporary [loplugin:redundantcast]}}
+    (void) static_cast<short>(n); // doesn't warn, even if 'sal_Int16' is 'short'
+    using Other = sal_Int16;
+    (void) static_cast<Other>(n); // doesn't warn either
+}
+
 int main() {
     testConstCast();
     testStaticCast();
@@ -428,6 +441,7 @@ int main() {
     testDynamicCast();
     testIntermediaryStaticCast();
     testArrayDecay();
+    testSalIntTypes();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/file/FDateFunctions.cxx b/connectivity/source/drivers/file/FDateFunctions.cxx
index 7d1caa1c9696..5f9d1441859f 100644
--- a/connectivity/source/drivers/file/FDateFunctions.cxx
+++ b/connectivity/source/drivers/file/FDateFunctions.cxx
@@ -219,7 +219,7 @@ ORowSetValue OOp_Year::operate(const ORowSetValue& lhs) const
         return lhs;
 
     css::util::Date aD = lhs;
-    return static_cast<sal_Int16>(aD.Year);
+    return aD.Year;
 }
 
 ORowSetValue OOp_Hour::operate(const ORowSetValue& lhs) const
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index 6272822bbd10..933530480d55 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -225,7 +225,7 @@ void ORowSet::getPropertyDefaultByHandle( sal_Int32 _nHandle, Any& _rDefault ) c
     switch( _nHandle )
     {
         case PROPERTY_ID_COMMAND_TYPE:
-            _rDefault <<= static_cast<sal_Int32>(CommandType::COMMAND);
+            _rDefault <<= CommandType::COMMAND;
             break;
         case PROPERTY_ID_IGNORERESULT:
             _rDefault <<= false;
diff --git a/dbaccess/source/ui/dlg/queryfilter.cxx b/dbaccess/source/ui/dlg/queryfilter.cxx
index 41c7ced4734d..8f771f5367a3 100644
--- a/dbaccess/source/ui/dlg/queryfilter.cxx
+++ b/dbaccess/source/ui/dlg/queryfilter.cxx
@@ -492,7 +492,7 @@ void DlgFilterCrit::SetLine( int nIdx, const PropertyValue& _rItem, bool _bOr )
         ListSelectHdl( *pColumnListControl );
 
         // select the appropriate condition
-        pPredicateListControl->set_active( GetSelectionPos( static_cast<sal_Int32>(_rItem.Handle), *pPredicateListControl ) );
+        pPredicateListControl->set_active( GetSelectionPos( _rItem.Handle, *pPredicateListControl ) );
 
         // initially normalize this value
         OUString aString( aStr );
diff --git a/drawinglayer/source/dumper/XShapeDumper.cxx b/drawinglayer/source/dumper/XShapeDumper.cxx
index 9ffab8d333cc..be72eeb2b8a9 100644
--- a/drawinglayer/source/dumper/XShapeDumper.cxx
+++ b/drawinglayer/source/dumper/XShapeDumper.cxx
@@ -310,8 +310,8 @@ void dumpFillHatchAsElement(const drawing::Hatch& rHatch, xmlTextWriterPtr xmlWr
             break;
     }
     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("color"), "%06x", static_cast<unsigned int>(rHatch.Color));
-    xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("distance"), "%" SAL_PRIdINT32, static_cast<sal_Int32>(rHatch.Distance));
-    xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("angle"), "%" SAL_PRIdINT32, static_cast<sal_Int32>(rHatch.Angle));
+    xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("distance"), "%" SAL_PRIdINT32, rHatch.Distance);
+    xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("angle"), "%" SAL_PRIdINT32, rHatch.Angle);
     xmlTextWriterEndElement( xmlWriter );
 }
 
@@ -486,10 +486,10 @@ void dumpLineDashAsElement(const drawing::LineDash& rLineDash, xmlTextWriterPtr
             break;
     }
     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("dots"), "%" SAL_PRIdINT32, static_cast<sal_Int32>(rLineDash.Dots));
-    xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("dotLen"), "%" SAL_PRIdINT32, static_cast<sal_Int32>(rLineDash.DotLen));
+    xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("dotLen"), "%" SAL_PRIdINT32, rLineDash.DotLen);
     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("dashes"), "%" SAL_PRIdINT32, static_cast<sal_Int32>(rLineDash.Dashes));
-    xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("dashLen"), "%" SAL_PRIdINT32, static_cast<sal_Int32>(rLineDash.DashLen));
-    xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("distance"), "%" SAL_PRIdINT32, static_cast<sal_Int32>(rLineDash.Distance));
+    xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("dashLen"), "%" SAL_PRIdINT32, rLineDash.DashLen);
+    xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("distance"), "%" SAL_PRIdINT32, rLineDash.Distance);
     xmlTextWriterEndElement( xmlWriter );
 }
 
diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx
index fd20e0835d6b..0e1e94f4d3ca 100644
--- a/editeng/source/items/paraitem.cxx
+++ b/editeng/source/items/paraitem.cxx
@@ -194,7 +194,7 @@ bool SvxLineSpacingItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
             case style::LineSpacingMode::PROP:
             {
                 eLineSpaceRule = SvxLineSpaceRule::Auto;
-                nPropLineSpace = static_cast<sal_Int16>(aLSp.Height);
+                nPropLineSpace = aLSp.Height;
                 if(100 == aLSp.Height)
                     eInterLineSpaceRule = SvxInterLineSpaceRule::Off;
                 else
diff --git a/editeng/source/uno/unofdesc.cxx b/editeng/source/uno/unofdesc.cxx
index 3b37f8032efd..a7042726c41f 100644
--- a/editeng/source/uno/unofdesc.cxx
+++ b/editeng/source/uno/unofdesc.cxx
@@ -105,7 +105,7 @@ void SvxUnoFontDescriptor::FillItemSet( const awt::FontDescriptor& rDesc, SfxIte
 
     {
         SvxUnderlineItem aUnderlineItem( LINESTYLE_NONE, EE_CHAR_UNDERLINE );
-        aTemp <<= static_cast<sal_Int16>(rDesc.Underline);
+        aTemp <<= rDesc.Underline;
         static_cast<SfxPoolItem*>(&aUnderlineItem)->PutValue( aTemp, MID_TL_STYLE );
         rSet.Put( aUnderlineItem );
     }
diff --git a/filter/source/graphicfilter/icgm/actimpr.cxx b/filter/source/graphicfilter/icgm/actimpr.cxx
index c892f5db9b68..d7fe844c066e 100644
--- a/filter/source/graphicfilter/icgm/actimpr.cxx
+++ b/filter/source/graphicfilter/icgm/actimpr.cxx
@@ -768,7 +768,7 @@ void CGMImpressOutAct::DrawText(awt::Point const & rTextPos, awt::Size const & r
 
         if ( nOrientation )
         {
-            maXPropSet->setPropertyValue( "RotationPointX", uno::Any(static_cast<sal_Int32>( aTextPos.X )) );
+            maXPropSet->setPropertyValue( "RotationPointX", uno::Any(aTextPos.X) );
             maXPropSet->setPropertyValue( "RotationPointY", uno::Any(static_cast<sal_Int32>( aTextPos.Y + nHeight )) );
             maXPropSet->setPropertyValue( "RotateAngle", uno::Any(static_cast<sal_Int32>( nOrientation * 100 )) );
         }
diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx
index fb84dcb2e531..8788cde414b6 100644
--- a/forms/source/component/FormattedField.cxx
+++ b/forms/source/component/FormattedField.cxx
@@ -564,9 +564,9 @@ void OFormattedModel::onConnectedDbColumn( const Reference< XInterface >& _rxFor
                     {
                         Locale aApplicationLocale = Application::GetSettings().GetUILanguageTag().getLocale();
                         if (m_bOriginalNumeric)
-                            aFmtKey <<= static_cast<sal_Int32>(xTypes->getStandardFormat(NumberFormat::NUMBER, aApplicationLocale));
+                            aFmtKey <<= xTypes->getStandardFormat(NumberFormat::NUMBER, aApplicationLocale);
                         else
-                            aFmtKey <<= static_cast<sal_Int32>(xTypes->getStandardFormat(NumberFormat::TEXT, aApplicationLocale));
+                            aFmtKey <<= xTypes->getStandardFormat(NumberFormat::TEXT, aApplicationLocale);
                     }
                 }
                 aSupplier >>= m_xOriginalFormatter;
diff --git a/forms/source/component/formcontrolfont.cxx b/forms/source/component/formcontrolfont.cxx
index cbb19a741cc2..1399e2b94971 100644
--- a/forms/source/component/formcontrolfont.cxx
+++ b/forms/source/component/formcontrolfont.cxx
@@ -57,11 +57,11 @@ namespace frm
                 break;
 
             case PROPERTY_ID_FONT_FAMILY:
-                aValue <<= static_cast<sal_Int16>(_rFont.Family);
+                aValue <<= _rFont.Family;
                 break;
 
             case PROPERTY_ID_FONT_CHARSET:
-                aValue <<= static_cast<sal_Int16>(_rFont.CharSet);
+                aValue <<= _rFont.CharSet;
                 break;
 
             case PROPERTY_ID_FONT_CHARWIDTH:
@@ -101,11 +101,11 @@ namespace frm
                 break;
 
             case PROPERTY_ID_FONT_UNDERLINE:
-                aValue <<= static_cast<sal_Int16>(_rFont.Underline);
+                aValue <<= _rFont.Underline;
                 break;
 
             case PROPERTY_ID_FONT_STRIKEOUT:
-                aValue <<= static_cast<sal_Int16>(_rFont.Strikeout);
+                aValue <<= _rFont.Strikeout;
                 break;
 
             case PROPERTY_ID_FONT_WORDLINEMODE:
@@ -287,11 +287,11 @@ namespace frm
             break;
 
         case PROPERTY_ID_FONT_FAMILY:
-            bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, static_cast<sal_Int16>(m_aFont.Family) );
+            bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_aFont.Family );
             break;
 
         case PROPERTY_ID_FONT_CHARSET:
-            bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, static_cast<sal_Int16>(m_aFont.CharSet) );
+            bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_aFont.CharSet );
             break;
 
         case PROPERTY_ID_FONT_CHARWIDTH:
@@ -307,15 +307,15 @@ namespace frm
             break;
 
         case PROPERTY_ID_FONT_PITCH:
-            bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, static_cast<sal_Int16>(m_aFont.Pitch) );
+            bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_aFont.Pitch );
             break;
 
         case PROPERTY_ID_FONT_TYPE:
-            bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, static_cast<sal_Int16>(m_aFont.Type) );
+            bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_aFont.Type );
             break;
 
         case PROPERTY_ID_FONT_WIDTH:
-            bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, static_cast<sal_Int16>(m_aFont.Width) );
+            bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_aFont.Width );
             break;
 
         case PROPERTY_ID_FONT_HEIGHT:
@@ -331,11 +331,11 @@ namespace frm
             break;
 
         case PROPERTY_ID_FONT_UNDERLINE:
-            bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, static_cast<sal_Int16>(m_aFont.Underline) );
+            bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_aFont.Underline );
             break;
 
         case PROPERTY_ID_FONT_STRIKEOUT:
-            bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, static_cast<sal_Int16>(m_aFont.Strikeout) );
+            bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_aFont.Strikeout );
             break;
 
         case PROPERTY_ID_FONT_WORDLINEMODE:
diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx
index 552447dda2e6..ec59324524bf 100644
--- a/sax/source/expatwrap/saxwriter.cxx
+++ b/sax/source/expatwrap/saxwriter.cxx
@@ -618,7 +618,7 @@ SaxInvalidCharacterError SaxWriterHelper::startElement(const OUString& rName, co
     if (!writeString(rName, false, false))
         eRet = SAX_ERROR;
 
-    sal_Int16 nAttribCount = xAttribs.is() ? static_cast<sal_Int16>(xAttribs->getLength()) : 0;
+    sal_Int16 nAttribCount = xAttribs.is() ? xAttribs->getLength() : 0;
     for(sal_Int16 i = 0 ; i < nAttribCount ; i++ )
     {
         mp_Sequence[nCurrentPos] = ' ';
diff --git a/sc/source/ui/Accessibility/AccessibleCellBase.cxx b/sc/source/ui/Accessibility/AccessibleCellBase.cxx
index 551311ad0654..d08b06c50bd5 100644
--- a/sc/source/ui/Accessibility/AccessibleCellBase.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCellBase.cxx
@@ -411,7 +411,7 @@ OUString ScAccessibleCellBase::getShadowAttrs() const
         OUString::number( static_cast<int>(aShadowFmt.IsTransparent) ) +
         sInnerSplit +
         "Color=" +
-        OUString::number( static_cast<sal_Int32>(aShadowFmt.Color) ) +
+        OUString::number( aShadowFmt.Color ) +
         sOuterSplit;
     return sShadowAttrs;
 }
@@ -489,7 +489,7 @@ OUString ScAccessibleCellBase::getBorderAttrs()
     else//add all the border properties to the return string.
     {
         sBorderAttrs += "TopBorder:Color=" +
-            OUString::number( static_cast<sal_Int32>(aTopBorder.Color) ) +
+            OUString::number( aTopBorder.Color ) +
             sInnerSplit +
             "InnerLineWidth=" +
             OUString::number( static_cast<sal_Int32>(aTopBorder.InnerLineWidth) ) +
@@ -509,7 +509,7 @@ OUString ScAccessibleCellBase::getBorderAttrs()
     else
     {
         sBorderAttrs += "BottomBorder:Color=" +
-            OUString::number( static_cast<sal_Int32>(aBottomBorder.Color) ) +
+            OUString::number( aBottomBorder.Color ) +
             sInnerSplit +
             "InnerLineWidth=" +
             OUString::number( static_cast<sal_Int32>(aBottomBorder.InnerLineWidth) ) +
@@ -529,7 +529,7 @@ OUString ScAccessibleCellBase::getBorderAttrs()
     else
     {
         sBorderAttrs += "LeftBorder:Color=" +
-            OUString::number( static_cast<sal_Int32>(aLeftBorder.Color) ) +
+            OUString::number( aLeftBorder.Color ) +
             sInnerSplit +
             "InnerLineWidth=" +
             OUString::number( static_cast<sal_Int32>(aLeftBorder.InnerLineWidth) ) +
@@ -549,7 +549,7 @@ OUString ScAccessibleCellBase::getBorderAttrs()
     else
     {
         sBorderAttrs += "RightBorder:Color=" +
-            OUString::number( static_cast<sal_Int32>(aRightBorder.Color) ) +
+            OUString::number( aRightBorder.Color ) +
             sInnerSplit +
             "InnerLineWidth=" +
             OUString::number( static_cast<sal_Int32>(aRightBorder.InnerLineWidth) ) +
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 512507f65268..b8f65a88aa9d 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -2702,28 +2702,28 @@ void SdImportTest::testTdf51340()
     uno::Reference< beans::XPropertySet > xPropSet( xParagraph, uno::UNO_QUERY_THROW );
     css::style::LineSpacing aSpacing;
     xPropSet->getPropertyValue( "ParaLineSpacing" ) >>= aSpacing;
-    CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16>(css::style::LineSpacingMode::PROP), aSpacing.Mode );
+    CPPUNIT_ASSERT_EQUAL( css::style::LineSpacingMode::PROP, aSpacing.Mode );
     CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16>(90), aSpacing.Height );
 
     // Second paragraph has a 125% line spacing set on slide layout
     xParagraph.set( getParagraphFromShape( 1, xShape ) );
     xPropSet.set( xParagraph, uno::UNO_QUERY_THROW );
     xPropSet->getPropertyValue( "ParaLineSpacing" ) >>= aSpacing;
-    CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16>(css::style::LineSpacingMode::PROP), aSpacing.Mode );
+    CPPUNIT_ASSERT_EQUAL( css::style::LineSpacingMode::PROP, aSpacing.Mode );
     CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16>(125), aSpacing.Height );
 
     // Third paragraph has a 70% line spacing set directly on normal slide (master slide property is overridden)
     xParagraph.set( getParagraphFromShape( 2, xShape ) );
     xPropSet.set( xParagraph, uno::UNO_QUERY_THROW );
     xPropSet->getPropertyValue( "ParaLineSpacing" ) >>= aSpacing;
-    CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16>(css::style::LineSpacingMode::PROP), aSpacing.Mode );
+    CPPUNIT_ASSERT_EQUAL( css::style::LineSpacingMode::PROP, aSpacing.Mode );
     CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16>(70), aSpacing.Height );
 
     // Fourth paragraph has a 190% line spacing set directly on normal slide (slide layout property is overridden)
     xParagraph.set( getParagraphFromShape( 3, xShape ) );
     xPropSet.set( xParagraph, uno::UNO_QUERY_THROW );
     xPropSet->getPropertyValue( "ParaLineSpacing" ) >>= aSpacing;
-    CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16>(css::style::LineSpacingMode::PROP), aSpacing.Mode );
+    CPPUNIT_ASSERT_EQUAL( css::style::LineSpacingMode::PROP, aSpacing.Mode );
     CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16>(190), aSpacing.Height );
 
     xDocShRef->DoClose();
diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx
index 6e57dacdd376..8179504de015 100644
--- a/sd/source/filter/eppt/pptx-text.cxx
+++ b/sd/source/filter/eppt/pptx-text.cxx
@@ -1138,7 +1138,7 @@ void ParagraphObj::ImplGetParagraphValues( PPTExBulletProvider* pBuProv, bool bG
 
             case css::style::LineSpacingMode::PROP :
             default:
-                mnLineSpacing = static_cast<sal_Int16>( aLineSpacing.Height );
+                mnLineSpacing = aLineSpacing.Height;
             break;
         }
     }
diff --git a/sfx2/source/doc/oleprops.cxx b/sfx2/source/doc/oleprops.cxx
index e194db7d2671..da6299168171 100644
--- a/sfx2/source/doc/oleprops.cxx
+++ b/sfx2/source/doc/oleprops.cxx
@@ -534,14 +534,14 @@ void SfxOleFileTimeProperty::ImplSave( SvStream& rStrm )
 {
     DateTime aDateTimeUtc(
             Date(
-                static_cast< sal_uInt16 >( maDateTime.Day ),
-                static_cast< sal_uInt16 >( maDateTime.Month ),
+                maDateTime.Day,
+                maDateTime.Month,
                 static_cast< sal_uInt16 >( maDateTime.Year ) ),
             tools::Time(
-                static_cast< sal_uInt16 >( maDateTime.Hours ),
-                static_cast< sal_uInt16 >( maDateTime.Minutes ),
-                static_cast< sal_uInt16 >( maDateTime.Seconds ),
-                static_cast< sal_uInt32 >( maDateTime.NanoSeconds ) ) );
+                maDateTime.Hours,
+                maDateTime.Minutes,
+                maDateTime.Seconds,
+                maDateTime.NanoSeconds ) );
     // invalid time stamp is not converted to UTC
     // heuristic to detect editing durations (which we assume to be < 1 year):
     // check only the year, not the entire date
diff --git a/svtools/source/filter/exportdialog.cxx b/svtools/source/filter/exportdialog.cxx
index 9a04956698f9..fda3e68d731b 100644
--- a/svtools/source/filter/exportdialog.cxx
+++ b/svtools/source/filter/exportdialog.cxx
@@ -192,8 +192,8 @@ uno::Sequence< beans::PropertyValue > ExportDialog::GetFilterData( bool bUpdateC
     const OUString sLogicalHeight("LogicalHeight");
     if ( mbIsPixelFormat )
     {
-        pFilterOptions->WriteInt32("PixelWidth", static_cast< sal_Int32 >( maSize.Width ) );
-        pFilterOptions->WriteInt32("PixelHeight", static_cast< sal_Int32 >( maSize.Height ) );
+        pFilterOptions->WriteInt32("PixelWidth", maSize.Width );
+        pFilterOptions->WriteInt32("PixelHeight", maSize.Height );
         if ( maResolution.Width && maResolution.Height )
         {
             const double f100thmmPerPixelX = 100000.0 / maResolution.Width;
@@ -209,8 +209,8 @@ uno::Sequence< beans::PropertyValue > ExportDialog::GetFilterData( bool bUpdateC
     }
     else
     {
-        pFilterOptions->WriteInt32( sLogicalWidth, static_cast< sal_Int32 >( maSize.Width ) );
-        pFilterOptions->WriteInt32( sLogicalHeight, static_cast< sal_Int32 >( maSize.Height ) );
+        pFilterOptions->WriteInt32( sLogicalWidth, maSize.Width );
+        pFilterOptions->WriteInt32( sLogicalHeight, maSize.Height );
     }
     switch ( mnFormat )
     {
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index d5adc465855f..a4d89a8abc12 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -1281,7 +1281,7 @@ Sequence< Any > SAL_CALL FmXGridPeer::queryFieldData( sal_Int32 nRow, const Type
                 // everything else is requested in the DatabaseVariant
                 case TypeClass_FLOAT            : pReturnArray[i] <<= xFieldContent->getFloat(); break;
                 case TypeClass_DOUBLE           : pReturnArray[i] <<= xFieldContent->getDouble(); break;
-                case TypeClass_SHORT            : pReturnArray[i] <<= static_cast<sal_Int16>(xFieldContent->getShort()); break;
+                case TypeClass_SHORT            : pReturnArray[i] <<= xFieldContent->getShort(); break;
                 case TypeClass_LONG             : pReturnArray[i] <<= static_cast<sal_Int32>(xFieldContent->getLong()); break;
                 case TypeClass_UNSIGNED_SHORT   : pReturnArray[i] <<= static_cast<sal_uInt16>(xFieldContent->getShort()); break;
                 case TypeClass_UNSIGNED_LONG    : pReturnArray[i] <<= static_cast<sal_uInt32>(xFieldContent->getLong()); break;
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index b407bdd3e820..6f47437ee9dd 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -1516,7 +1516,7 @@ DECLARE_ODFEXPORT_TEST(testBtlrFrame, "btlr-frame.odt")
         return;
 
     // Make sure that btlr -> tbrl transition clears the "BT" flag.
-    xTextFrame->setPropertyValue("WritingMode", uno::makeAny(static_cast<sal_Int16>(text::WritingMode2::TB_LR)));
+    xTextFrame->setPropertyValue("WritingMode", uno::makeAny(text::WritingMode2::TB_LR));
     pFlyFrame = dynamic_cast<SwFlyFrame*>(rAnchored[0]);
     CPPUNIT_ASSERT(pFlyFrame);
     CPPUNIT_ASSERT(!pFlyFrame->IsVertLRBT());
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 411857dc0152..92c9d031348f 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -1555,8 +1555,8 @@ static void lcl_placeWatermarkInHeader(const SfxWatermarkItem& rWatermark,
     xPropertySet->setPropertyValue(UNO_NAME_TEXT_MINFRAMEHEIGHT, uno::makeAny(nHeight));
     xPropertySet->setPropertyValue(UNO_NAME_TEXT_MINFRAMEWIDTH, uno::makeAny(nWidth));
     xPropertySet->setPropertyValue(UNO_NAME_TEXT_WRAP, uno::makeAny(text::WrapTextMode_THROUGH));
-    xPropertySet->setPropertyValue(UNO_NAME_HORI_ORIENT_RELATION, uno::makeAny(static_cast<sal_Int16>(text::RelOrientation::PAGE_PRINT_AREA)));
-    xPropertySet->setPropertyValue(UNO_NAME_VERT_ORIENT_RELATION, uno::makeAny(static_cast<sal_Int16>(text::RelOrientation::PAGE_PRINT_AREA)));
+    xPropertySet->setPropertyValue(UNO_NAME_HORI_ORIENT_RELATION, uno::makeAny(text::RelOrientation::PAGE_PRINT_AREA));
+    xPropertySet->setPropertyValue(UNO_NAME_VERT_ORIENT_RELATION, uno::makeAny(text::RelOrientation::PAGE_PRINT_AREA));
     xPropertySet->setPropertyValue(UNO_NAME_CHAR_FONT_NAME, uno::makeAny(sFont));
     xPropertySet->setPropertyValue(UNO_NAME_CHAR_HEIGHT, uno::makeAny(WATERMARK_AUTO_SIZE));
     xPropertySet->setPropertyValue("Transformation", uno::makeAny(aMatrix));
@@ -1588,8 +1588,8 @@ static void lcl_placeWatermarkInHeader(const SfxWatermarkItem& rWatermark,
     xPropertySet->getPropertyValue("Transformation") >>= aMatrix;
     xPropertySet->setPropertyValue("Transformation", uno::makeAny(aMatrix));
 
-    xPropertySet->setPropertyValue(UNO_NAME_HORI_ORIENT, uno::makeAny(static_cast<sal_Int16>(text::HoriOrientation::CENTER)));
-    xPropertySet->setPropertyValue(UNO_NAME_VERT_ORIENT, uno::makeAny(static_cast<sal_Int16>(text::VertOrientation::CENTER)));
+    xPropertySet->setPropertyValue(UNO_NAME_HORI_ORIENT, uno::makeAny(text::HoriOrientation::CENTER));
+    xPropertySet->setPropertyValue(UNO_NAME_VERT_ORIENT, uno::makeAny(text::VertOrientation::CENTER));
 
     uno::Reference<container::XNamed> xNamed(xShape, uno::UNO_QUERY);
     xNamed->setName(sWatermark);
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index eb755dcd11db..a15cc9f9efb1 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -1643,7 +1643,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
         // filters and Word defaults to our new default as well.
         xProps->setPropertyValue(
             "PrinterIndependentLayout",
-            uno::Any(static_cast<sal_Int16>(document::PrinterIndependentLayout::HIGH_RESOLUTION)));
+            uno::Any(document::PrinterIndependentLayout::HIGH_RESOLUTION));
 
     if (!bPropLineSpacingShrinksFirstLine)
         xProps->setPropertyValue("PropLineSpacingShrinksFirstLine", makeAny(false));
diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx
index 4da894bfc299..aa4d55237de0 100644
--- a/toolkit/source/controls/unocontrolmodel.cxx
+++ b/toolkit/source/controls/unocontrolmodel.cxx
@@ -892,7 +892,7 @@ void UnoControlModel::read( const css::uno::Reference< css::io::XObjectInputStre
                     long nEntries = InStream->readLong();
                     css::uno::Sequence<sal_Int16> aSeq( nEntries );
                     for ( long n = 0; n < nEntries; n++ )
-                        aSeq.getArray()[n] = static_cast<sal_Int16>(InStream->readShort());
+                        aSeq.getArray()[n] = InStream->readShort();
                     aValue <<= aSeq;
                 }
                 else if ( pType->getTypeClass() == TypeClass_ENUM )


More information about the Libreoffice-commits mailing list