diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-19 09:50:11 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-19 11:31:51 +0200 |
commit | 836c40904f4424a5b7ae708171a7aab53141761a (patch) | |
tree | 5f84c7b9d57aface755ef6f4b11ccc1deb1da9c6 /chart2/qa | |
parent | cid#1448351 Use after free (diff) | |
download | core-836c40904f4424a5b7ae708171a7aab53141761a.tar.gz core-836c40904f4424a5b7ae708171a7aab53141761a.zip |
loplugin:referencecasting in canvas..chart2
Change-Id: I3a3671b5c44d1a7e5ca320d3d76dd5d902382cbc
Reviewed-on: https://gerrit.libreoffice.org/75935
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/qa')
-rw-r--r-- | chart2/qa/extras/chart2dump/chart2dump.cxx | 7 | ||||
-rw-r--r-- | chart2/qa/extras/chart2import.cxx | 11 |
2 files changed, 8 insertions, 10 deletions
diff --git a/chart2/qa/extras/chart2dump/chart2dump.cxx b/chart2/qa/extras/chart2dump/chart2dump.cxx index af40472536bf..a2474a2a3453 100644 --- a/chart2/qa/extras/chart2dump/chart2dump.cxx +++ b/chart2/qa/extras/chart2dump/chart2dump.cxx @@ -253,17 +253,16 @@ protected: uno::Reference<drawing::XShape> getShapeByName(const uno::Reference<drawing::XShapes>& rShapes, const OUString& rName, bool (*pCondition)(const uno::Reference<drawing::XShape>&) = nullptr) { - uno::Reference<container::XIndexAccess> XIndexAccess(rShapes, uno::UNO_QUERY); - for (sal_Int32 i = 0; i < XIndexAccess->getCount(); ++i) + for (sal_Int32 i = 0; i < rShapes->getCount(); ++i) { - uno::Reference<drawing::XShapes> xShapes(XIndexAccess->getByIndex(i), uno::UNO_QUERY); + uno::Reference<drawing::XShapes> xShapes(rShapes->getByIndex(i), uno::UNO_QUERY); if (xShapes.is()) { uno::Reference<drawing::XShape> xRet = getShapeByName(xShapes, rName, pCondition); if (xRet.is()) return xRet; } - uno::Reference<container::XNamed> xNamedShape(XIndexAccess->getByIndex(i), uno::UNO_QUERY); + uno::Reference<container::XNamed> xNamedShape(rShapes->getByIndex(i), uno::UNO_QUERY); if (xNamedShape->getName() == rName) { uno::Reference<drawing::XShape> xShape(xNamedShape, uno::UNO_QUERY); diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index 569ba8388d26..107daed69fea 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -230,17 +230,16 @@ getShapeByName(const uno::Reference<drawing::XShapes>& rShapes, const OUString& const std::function<bool(const uno::Reference<drawing::XShape>&)>& pCondition = nullptr) { - uno::Reference<container::XIndexAccess> XIndexAccess(rShapes, uno::UNO_QUERY); - for (sal_Int32 i = 0; i < XIndexAccess->getCount(); ++i) + for (sal_Int32 i = 0; i < rShapes->getCount(); ++i) { - uno::Reference<drawing::XShapes> xShapes(XIndexAccess->getByIndex(i), uno::UNO_QUERY); + uno::Reference<drawing::XShapes> xShapes(rShapes->getByIndex(i), uno::UNO_QUERY); if (xShapes.is()) { uno::Reference<drawing::XShape> xRet = getShapeByName(xShapes, rName, pCondition); if (xRet.is()) return xRet; } - uno::Reference<container::XNamed> xNamedShape(XIndexAccess->getByIndex(i), uno::UNO_QUERY); + uno::Reference<container::XNamed> xNamedShape(rShapes->getByIndex(i), uno::UNO_QUERY); if (xNamedShape->getName() == rName) { uno::Reference<drawing::XShape> xShape(xNamedShape, uno::UNO_QUERY); @@ -961,7 +960,7 @@ void Chart2ImportTest::testTransparentBackground(OUString const & filename) uno::Reference< chart::XChartDocument > xChart2Doc (xChartDoc, uno::UNO_QUERY); CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChart2Doc.is()); - Reference< beans::XPropertySet > xPropSet( xChart2Doc->getArea(), uno::UNO_QUERY); + Reference< beans::XPropertySet > xPropSet = xChart2Doc->getArea(); CPPUNIT_ASSERT_MESSAGE("failed to get Area", xPropSet.is()); css::drawing::FillStyle aStyle; @@ -1982,7 +1981,7 @@ void Chart2ImportTest::testTdf122765() { // The horizontal position of the slices was wrong. load("/chart2/qa/extras/data/pptx/", "tdf122765.pptx"); - Reference<chart::XChartDocument> xChartDoc(getChartDocFromDrawImpress(0, 0), UNO_QUERY); + Reference<chart::XChartDocument> xChartDoc = getChartDocFromDrawImpress(0, 0); Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xChartDoc, UNO_QUERY_THROW); Reference<drawing::XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage(), UNO_SET_THROW); Reference<drawing::XShapes> xShapes(xDrawPage->getByIndex(0), UNO_QUERY_THROW); |