[Libreoffice-commits] core.git: chart2/source comphelper/source compilerplugins/clang cui/source dbaccess/source sdext/source slideshow/source sw/qa sw/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri May 8 16:33:12 UTC 2020


 chart2/source/controller/main/ObjectHierarchy.cxx       |    2 -
 chart2/source/tools/DiagramHelper.cxx                   |   10 +++------
 chart2/source/view/charttypes/VSeriesPlotter.cxx        |    3 --
 chart2/source/view/main/ChartView.cxx                   |    2 -
 comphelper/source/container/embeddedobjectcontainer.cxx |    2 -
 compilerplugins/clang/referencecasting.cxx              |   14 +++++++++++++
 compilerplugins/clang/test/referencecasting.cxx         |    9 ++++++++
 cui/source/options/optdict.cxx                          |    8 +++----
 dbaccess/source/core/api/CRowSetDataColumn.cxx          |    2 -
 dbaccess/source/core/api/SingleSelectQueryComposer.cxx  |    2 -
 dbaccess/source/ui/app/AppControllerGen.cxx             |    2 -
 sdext/source/presenter/PresenterViewFactory.cxx         |    2 -
 slideshow/source/engine/slideshowimpl.cxx               |    2 -
 sw/qa/extras/ooxmlexport/ooxmlexport2.cxx               |    6 ++---
 sw/qa/extras/rtfexport/rtfexport.cxx                    |   10 +++------
 sw/qa/extras/rtfexport/rtfexport2.cxx                   |    4 +--
 sw/qa/extras/ww8export/ww8export.cxx                    |   17 +++++++---------
 sw/source/filter/html/htmlforw.cxx                      |    3 --
 18 files changed, 58 insertions(+), 42 deletions(-)

New commits:
commit 11bdb6b9d9df991bb4ee48d4682458facaa2bdd5
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri May 8 14:33:47 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri May 8 18:32:33 2020 +0200

    improve loplugin:referencecasting
    
    to catch a few more cases
    
    Change-Id: I0323fba51bb2b4ba255e1db5aa0d890c5c6a2e1b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93726
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/chart2/source/controller/main/ObjectHierarchy.cxx b/chart2/source/controller/main/ObjectHierarchy.cxx
index bf7c812b16b1..15b5392153b3 100644
--- a/chart2/source/controller/main/ObjectHierarchy.cxx
+++ b/chart2/source/controller/main/ObjectHierarchy.cxx
@@ -433,7 +433,7 @@ void ImplObjectHierarchy::createDataSeriesTree(
 
                     ObjectHierarchy::tChildContainer aSeriesSubContainer;
 
-                    Reference< chart2::XDataSeries > xSeries( aSeriesSeq[nSeriesIdx], uno::UNO_QUERY );
+                    Reference< chart2::XDataSeries > const & xSeries = aSeriesSeq[nSeriesIdx];
 
                     // data labels
                     if( DataSeriesHelper::hasDataLabelsAtSeries( xSeries ) )
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx
index d9b1bf064cdf..ab93f06a8096 100644
--- a/chart2/source/tools/DiagramHelper.cxx
+++ b/chart2/source/tools/DiagramHelper.cxx
@@ -479,20 +479,18 @@ void DiagramHelper::setDimension(
 
         //change all coordinate systems:
         Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY_THROW );
-        Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
-        for( sal_Int32 nCS = 0; nCS < aCooSysList.getLength(); ++nCS )
+        const Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
+        for( Reference<XCoordinateSystem> const & xOldCooSys : aCooSysList )
         {
-            Reference< XCoordinateSystem > xOldCooSys( aCooSysList[nCS], uno::UNO_QUERY );
             Reference< XCoordinateSystem > xNewCooSys;
 
             Reference< XChartTypeContainer > xChartTypeContainer( xOldCooSys, uno::UNO_QUERY );
             if( !xChartTypeContainer.is() )
                 continue;
 
-            Sequence< Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
-            for( sal_Int32 nT = 0; nT < aChartTypeList.getLength(); ++nT )
+            const Sequence< Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
+            for( Reference< XChartType > const & xChartType : aChartTypeList )
             {
-                Reference< XChartType > xChartType( aChartTypeList[nT], uno::UNO_QUERY );
                 bIsSupportingOnlyDeepStackingFor3D = ChartTypeHelper::isSupportingOnlyDeepStackingFor3D( xChartType );
                 if(!xNewCooSys.is())
                 {
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 0696efc9dcbb..484fa4362261 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -609,8 +609,7 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re
             Sequence< uno::Reference< XFormattedString > > aFormattedLabels( aCustomLabels.getLength() );
             for( int i = 0; i < aFormattedLabels.getLength(); i++ )
             {
-                uno::Reference< XFormattedString > xString( aCustomLabels[i], uno::UNO_QUERY );
-                aFormattedLabels[i] = xString;
+                aFormattedLabels[i] = aCustomLabels[i];
             }
 
             // center the text
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index f33f696a898d..84961438c24a 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -544,7 +544,7 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
             uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() );
             for( sal_Int32 nS = 0; nS < aSeriesList.getLength(); ++nS )
             {
-                uno::Reference< XDataSeries > xDataSeries( aSeriesList[nS], uno::UNO_QUERY );
+                uno::Reference< XDataSeries > const & xDataSeries = aSeriesList[nS];
                 if(!xDataSeries.is())
                     continue;
                 if( !bIncludeHiddenCells && !DataSeriesHelper::hasUnhiddenData(xDataSeries) )
diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx
index 0b35e929ba15..311edd303a86 100644
--- a/comphelper/source/container/embeddedobjectcontainer.cxx
+++ b/comphelper/source/container/embeddedobjectcontainer.cxx
@@ -195,7 +195,7 @@ void EmbeddedObjectContainer::CloseEmbeddedObjects()
 {
     for( const auto& rObj : pImpl->maNameToObjectMap )
     {
-        uno::Reference < util::XCloseable > xClose( rObj.second, uno::UNO_QUERY );
+        uno::Reference < util::XCloseable > const & xClose = rObj.second;
         if( xClose.is() )
         {
             try
diff --git a/compilerplugins/clang/referencecasting.cxx b/compilerplugins/clang/referencecasting.cxx
index 1f8e13173811..33997cdb458d 100644
--- a/compilerplugins/clang/referencecasting.cxx
+++ b/compilerplugins/clang/referencecasting.cxx
@@ -329,6 +329,20 @@ static const RecordType* extractTemplateType(const clang::Type* cceType)
             return recordType;
     }
 
+    // extract Foo from Reference<Foo>
+    if (auto subst = dyn_cast<SubstTemplateTypeParmType>(cceType))
+    {
+        if (auto recType = dyn_cast<RecordType>(subst->desugar().getTypePtr()))
+        {
+            if (auto ctsd = dyn_cast<ClassTemplateSpecializationDecl>(recType->getDecl()))
+            {
+                auto const& args = ctsd->getTemplateArgs();
+                if (args.size() > 0 && args[0].getKind() == TemplateArgument::ArgKind::Type)
+                    return dyn_cast_or_null<RecordType>(args[0].getAsType().getTypePtr());
+            }
+        }
+    }
+
     if (auto elaboratedType = dyn_cast<ElaboratedType>(cceType))
         cceType = elaboratedType->desugar().getTypePtr();
     auto cceTST = dyn_cast<TemplateSpecializationType>(cceType);
diff --git a/compilerplugins/clang/test/referencecasting.cxx b/compilerplugins/clang/test/referencecasting.cxx
index 87324bb86fd6..0272bc89cc98 100644
--- a/compilerplugins/clang/test/referencecasting.cxx
+++ b/compilerplugins/clang/test/referencecasting.cxx
@@ -147,4 +147,13 @@ struct Test13
     }
 };
 
+void test14(css::uno::Sequence<css::uno::Reference<css::io::XStreamListener>> seq)
+{
+    for (sal_Int32 i = 0; i < seq.getLength(); ++i)
+    {
+        // expected-error at +1 {{the source reference is already a subtype of the destination reference, just use = [loplugin:referencecasting]}}
+        css::uno::Reference<css::io::XStreamListener> xDataSeries(seq[i], css::uno::UNO_QUERY);
+    }
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx
index f1678a5458e9..58ccf42e3965 100644
--- a/cui/source/options/optdict.cxx
+++ b/cui/source/options/optdict.cxx
@@ -294,7 +294,7 @@ SvxEditDictionaryDialog::SvxEditDictionaryDialog(weld::Window* pParent, const OU
         }
         Reference< XDictionary >  xDic;
         if (nPos != -1)
-            xDic.set( aDics.getConstArray()[ nPos ], UNO_QUERY );
+            xDic = aDics[ nPos ];
         if (xDic.is())
             SetLanguage_Impl( LanguageTag( xDic->getLocale() ).getLanguageType() );
 
@@ -400,7 +400,7 @@ IMPL_LINK_NOARG(SvxEditDictionaryDialog, SelectBookHdl_Impl, weld::ComboBox&, vo
     // display dictionary
     ShowWords_Impl( nPos );
     // enable or disable new and delete button according to file attributes
-    Reference< XDictionary >  xDic( aDics.getConstArray()[ nPos ], UNO_QUERY );
+    Reference< XDictionary > const & xDic = aDics[ nPos ];
     if (xDic.is())
         SetLanguage_Impl( LanguageTag( xDic->getLocale() ).getLanguageType() );
 
@@ -414,7 +414,7 @@ IMPL_LINK_NOARG(SvxEditDictionaryDialog, SelectLangHdl_Impl, weld::ComboBox&, vo
 {
     int nDicPos = m_xAllDictsLB->get_active();
     LanguageType nLang = m_xLangLB->get_active_id();
-    Reference< XDictionary >  xDic( aDics.getConstArray()[ nDicPos ], UNO_QUERY );
+    Reference< XDictionary > const & xDic = aDics[ nDicPos ];
     LanguageType nOldLang = LanguageTag( xDic->getLocale() ).getLanguageType();
 
     if ( nLang == nOldLang )
@@ -606,7 +606,7 @@ bool SvxEditDictionaryDialog::NewDelHdl(const weld::Widget* pBtn)
         if (nPos != -1 && !aNewWord.isEmpty())
         {
             DBG_ASSERT(nPos < aDics.getLength(), "invalid dictionary index");
-            Reference< XDictionary >  xDic( aDics.getConstArray()[ nPos ], UNO_QUERY );
+            Reference< XDictionary > const & xDic = aDics[ nPos ];
             if (xDic.is())
             {
                 // make changes in dic
diff --git a/dbaccess/source/core/api/CRowSetDataColumn.cxx b/dbaccess/source/core/api/CRowSetDataColumn.cxx
index 3c03ad32c2ec..f1d845e11517 100644
--- a/dbaccess/source/core/api/CRowSetDataColumn.cxx
+++ b/dbaccess/source/core/api/CRowSetDataColumn.cxx
@@ -213,7 +213,7 @@ sdbcx::ObjectType ORowSetDataColumns::createObject(const OUString& _rName)
     ::comphelper::UStringMixEqual aCase(isCaseSensitive());
     ::connectivity::OSQLColumns::Vector::const_iterator first =  ::connectivity::find(m_aColumns->begin(),m_aColumns->end(),_rName,aCase);
     if(first != m_aColumns->end())
-        xNamed.set(*first,UNO_QUERY);
+        xNamed = *first;
 
     return xNamed;
 }
diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
index 62709c8e7902..9f96f84295c7 100644
--- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
+++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
@@ -885,7 +885,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns(  )
                 // we can now only look if we found it under the realname property
                 // here we have to make the assumption that the position is correct
                 OSQLColumns::Vector::const_iterator aFind2 = aSelectColumns->begin() + i-1;
-                Reference<XPropertySet> xProp(*aFind2,UNO_QUERY);
+                Reference<XPropertySet> xProp = *aFind2;
                 if ( !xProp.is() || !xProp->getPropertySetInfo()->hasPropertyByName( PROPERTY_REALNAME ) )
                     continue;
 
diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx
index 8eb52b89db76..2466f22df062 100644
--- a/dbaccess/source/ui/app/AppControllerGen.cxx
+++ b/dbaccess/source/ui/app/AppControllerGen.cxx
@@ -701,7 +701,7 @@ void OApplicationController::doAction(sal_uInt16 _nId, const ElementOpenMode _eO
     {
         try
         {
-            Reference< XModel > xModel(component.second,UNO_QUERY);
+            Reference< XModel > xModel = component.second;
 
             // Send document as e-Mail using stored/default type
             eResult = aSendMail.AttachDocument(xModel,component.first);
diff --git a/sdext/source/presenter/PresenterViewFactory.cxx b/sdext/source/presenter/PresenterViewFactory.cxx
index bed41bddc978..d8c2cfbe7667 100644
--- a/sdext/source/presenter/PresenterViewFactory.cxx
+++ b/sdext/source/presenter/PresenterViewFactory.cxx
@@ -289,7 +289,7 @@ Reference<XResource> PresenterViewFactory::GetViewFromCache(
                     = dynamic_cast<CachablePresenterView*>(iView->second.first.get());
                 if (pView != nullptr)
                     pView->ActivatePresenterView();
-                return Reference<XResource>(iView->second.first, UNO_QUERY);
+                return iView->second.first;
             }
 
             // Right view, wrong pane.  Create a new view.
diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx
index 214084710fad..b06a05bf06b1 100644
--- a/slideshow/source/engine/slideshowimpl.cxx
+++ b/slideshow/source/engine/slideshowimpl.cxx
@@ -1410,7 +1410,7 @@ void SlideShowImpl::registerUserPaintPolygons( const uno::Reference< lang::XMult
     {
         PolyPolygonVector aPolygons = rPoly.second;
         //Get shapes for the slide
-        css::uno::Reference< css::drawing::XShapes > Shapes(rPoly.first, css::uno::UNO_QUERY);
+        css::uno::Reference< css::drawing::XShapes > Shapes = rPoly.first;
         //Retrieve polygons for one slide
         for( const auto& pPolyPoly : aPolygons )
         {
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
index 49012edce050..be666192f555 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
@@ -162,7 +162,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo38244, "fdo38244.docx")
      * oPara = oParas.nextElement
      */
 
-    xParaEnumAccess.set(getProperty< uno::Reference<container::XEnumerationAccess> >(xPropertySet, "TextRange"), uno::UNO_QUERY);
+    xParaEnumAccess = getProperty< uno::Reference<container::XEnumerationAccess> >(xPropertySet, "TextRange");
     xParaEnum = xParaEnumAccess->createEnumeration();
     xParaEnum->nextElement();
     bool bCaught = false;
@@ -179,10 +179,10 @@ DECLARE_OOXMLEXPORT_TEST(testFdo38244, "fdo38244.docx")
 
 DECLARE_OOXMLEXPORT_TEST(testCommentsNested, "comments-nested.odt")
 {
-    uno::Reference<beans::XPropertySet> xOuter(getProperty< uno::Reference<beans::XPropertySet> >(getRun(getParagraph(1), 2), "TextField"), uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xOuter = getProperty< uno::Reference<beans::XPropertySet> >(getRun(getParagraph(1), 2), "TextField");
     CPPUNIT_ASSERT_EQUAL(OUString("Outer"), getProperty<OUString>(xOuter, "Content"));
 
-    uno::Reference<beans::XPropertySet> xInner(getProperty< uno::Reference<beans::XPropertySet> >(getRun(getParagraph(1), 4), "TextField"), uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xInner = getProperty< uno::Reference<beans::XPropertySet> >(getRun(getParagraph(1), 4), "TextField");
     CPPUNIT_ASSERT_EQUAL(OUString("Inner"), getProperty<OUString>(xInner, "Content"));
 }
 
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index 535374da8863..c17dfd2ca750 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -186,14 +186,12 @@ DECLARE_RTFEXPORT_TEST(testFdo38244, "fdo38244.rtf")
 
 DECLARE_RTFEXPORT_TEST(testCommentsNested, "comments-nested.odt")
 {
-    uno::Reference<beans::XPropertySet> xOuter(
-        getProperty<uno::Reference<beans::XPropertySet>>(getRun(getParagraph(1), 2), "TextField"),
-        uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xOuter
+        = getProperty<uno::Reference<beans::XPropertySet>>(getRun(getParagraph(1), 2), "TextField");
     CPPUNIT_ASSERT_EQUAL(OUString("Outer"), getProperty<OUString>(xOuter, "Content").trim());
 
-    uno::Reference<beans::XPropertySet> xInner(
-        getProperty<uno::Reference<beans::XPropertySet>>(getRun(getParagraph(1), 4), "TextField"),
-        uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xInner
+        = getProperty<uno::Reference<beans::XPropertySet>>(getRun(getParagraph(1), 4), "TextField");
     CPPUNIT_ASSERT_EQUAL(OUString("Inner"), getProperty<OUString>(xInner, "Content").trim());
 }
 
diff --git a/sw/qa/extras/rtfexport/rtfexport2.cxx b/sw/qa/extras/rtfexport/rtfexport2.cxx
index 932b0ae550b4..e696539c0b1b 100644
--- a/sw/qa/extras/rtfexport/rtfexport2.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport2.cxx
@@ -442,8 +442,8 @@ DECLARE_RTFEXPORT_TEST(testFdo49659, "fdo49659.rtf")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
 
     // The graphic was also empty
-    uno::Reference<beans::XPropertySet> xGraphic(
-        getProperty<uno::Reference<beans::XPropertySet>>(getShape(1), "Graphic"), uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xGraphic
+        = getProperty<uno::Reference<beans::XPropertySet>>(getShape(1), "Graphic");
     CPPUNIT_ASSERT_EQUAL(graphic::GraphicType::PIXEL,
                          getProperty<sal_Int8>(xGraphic, "GraphicType"));
 }
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index 7b2321ffdbd3..cc84bda0f18c 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -644,10 +644,9 @@ DECLARE_WW8EXPORT_TEST(testTdf95576, "tdf95576.doc")
         auto xPara = getParagraph(nPara);
 
         // get the numbering rules effective at this paragraph
-        uno::Reference<container::XIndexReplace> xNumRules(
+        uno::Reference<container::XIndexReplace> xNumRules =
             getProperty< uno::Reference<container::XIndexReplace> >(
-                xPara, "NumberingRules"),
-            uno::UNO_QUERY);
+                xPara, "NumberingRules");
 
         // get the numbering level of this paragraph, and the properties
         // associated with that numbering level
@@ -936,10 +935,10 @@ DECLARE_WW8EXPORT_TEST(testFdo59530, "fdo59530.doc")
 
 DECLARE_WW8EXPORT_TEST(testCommentsNested, "comments-nested.doc")
 {
-    uno::Reference<beans::XPropertySet> xOuter(getProperty< uno::Reference<beans::XPropertySet> >(getRun(getParagraph(1), 2), "TextField"), uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xOuter = getProperty< uno::Reference<beans::XPropertySet> >(getRun(getParagraph(1), 2), "TextField");
     CPPUNIT_ASSERT_EQUAL(OUString("Outer"), getProperty<OUString>(xOuter, "Content"));
 
-    uno::Reference<beans::XPropertySet> xInner(getProperty< uno::Reference<beans::XPropertySet> >(getRun(getParagraph(1), 4), "TextField"), uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xInner = getProperty< uno::Reference<beans::XPropertySet> >(getRun(getParagraph(1), 4), "TextField");
     CPPUNIT_ASSERT_EQUAL(OUString("Inner"), getProperty<OUString>(xInner, "Content"));
 }
 
@@ -1269,7 +1268,7 @@ DECLARE_WW8EXPORT_TEST(testCommentExport, "comment-export.odt")
         else if (sKind == "Annotation")
         {
             // Check if the comment text is correct and save the name of the comment
-            uno::Reference<beans::XPropertySet> xComment(getProperty< uno::Reference<beans::XPropertySet> >(xRun, "TextField"), uno::UNO_QUERY);
+            uno::Reference<beans::XPropertySet> xComment = getProperty< uno::Reference<beans::XPropertySet> >(xRun, "TextField");
             CPPUNIT_ASSERT_EQUAL(aTextPortions[i].sText, getProperty<OUString>(xComment, "Content"));
             sNames[aTextPortions[i].nAnnotationID] = getProperty<OUString>(xComment, "Name");
         }
@@ -1340,10 +1339,10 @@ DECLARE_WW8EXPORT_TEST(testTdf99474, "tdf99474.odt")
 {
     // The bullet colour of paragraph #3 should be COL_AUTO
     auto xPara = getParagraph(3);
-    uno::Reference<container::XIndexReplace> xNumRules(
+    uno::Reference<container::XIndexReplace> xNumRules =
         getProperty< uno::Reference<container::XIndexReplace> >(
-            xPara, "NumberingRules"),
-        uno::UNO_QUERY);
+            xPara, "NumberingRules");
+
     int numLevel = getProperty<sal_Int32>(xPara, "NumberingLevel");
     uno::Sequence< beans::PropertyValue > aPropertyValues;
     xNumRules->getByIndex(numLevel) >>= aPropertyValues;
diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx
index 497d6d3ace11..ab41378d11b5 100644
--- a/sw/source/filter/html/htmlforw.cxx
+++ b/sw/source/filter/html/htmlforw.cxx
@@ -106,8 +106,7 @@ static void lcl_html_outEvents( SvStream& rStrm,
         }
         else if( auto x2 = o3tl::tryAccess<uno::Reference<form::XForm>>(aTmp) )
         {
-            uno::Reference< form::XFormComponent > xFC( *x2, uno::UNO_QUERY );
-            if( rFormComp == xFC )
+            if( rFormComp == *x2 )
                 break;
         }
         else


More information about the Libreoffice-commits mailing list