summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-03-19 09:21:45 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-03-19 09:04:21 +0100
commite354b3fb803397fef2a6309fc0cf714a315bedee (patch)
tree41cdbb9a00a786e1e4bed2a2f23e509fcaebb6a2
parent238d65f6823012ddc6820a82ace89ab4be43243e (diff)
loplugin:redundantpointerops add some more smart pointer types
Change-Id: Ia7f3441404d8d2e5de501e70da496b6fdc6c9a4a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90728 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--compilerplugins/clang/redundantpointerops.cxx13
-rw-r--r--dbaccess/source/ui/inc/JoinTableView.hxx4
-rw-r--r--desktop/source/splash/splash.cxx2
-rw-r--r--include/sfx2/titledockwin.hxx4
-rw-r--r--include/svx/gridctrl.hxx2
-rw-r--r--reportdesign/source/ui/inc/ScrollHelper.hxx4
-rw-r--r--reportdesign/source/ui/inc/SectionWindow.hxx6
-rw-r--r--reportdesign/source/ui/report/ScrollHelper.cxx8
-rw-r--r--reportdesign/source/ui/report/SectionWindow.cxx22
-rw-r--r--reportdesign/source/ui/report/StartMarker.cxx2
-rw-r--r--sc/source/ui/app/inputwin.cxx2
-rw-r--r--starmath/qa/cppunit/test_starmath.cxx2
-rw-r--r--svx/source/fmcomp/gridcell.cxx4
-rw-r--r--svx/source/fmcomp/gridctrl.cxx10
-rw-r--r--sw/source/uibase/inc/olmenu.hxx2
-rw-r--r--vcl/qa/cppunit/BitmapTest.cxx6
-rw-r--r--vcl/qa/cppunit/svm/svmtest.cxx2
17 files changed, 50 insertions, 45 deletions
diff --git a/compilerplugins/clang/redundantpointerops.cxx b/compilerplugins/clang/redundantpointerops.cxx
index 1539588c1e36..7012365aaef3 100644
--- a/compilerplugins/clang/redundantpointerops.cxx
+++ b/compilerplugins/clang/redundantpointerops.cxx
@@ -178,12 +178,17 @@ bool RedundantPointerOps::isSmartPointerType(const Expr* e)
// written is derived from std::unique_ptr or std::shared_ptr for which the get
// member function is declared at a base class):
auto const tc2 = loplugin::TypeCheck(e->getType());
- if ((tc2.ClassOrStruct("unique_ptr").StdNamespace()
+ if (tc2.ClassOrStruct("unique_ptr").StdNamespace()
|| tc2.ClassOrStruct("shared_ptr").StdNamespace()
- || (tc2.Class("Reference").Namespace("uno").Namespace("star")
- .Namespace("sun").Namespace("com").GlobalNamespace())
+ || tc2.Class("Reference").Namespace("uno").Namespace("star")
+ .Namespace("sun").Namespace("com").GlobalNamespace()
|| tc2.Class("Reference").Namespace("rtl").GlobalNamespace()
- || tc2.Class("SvRef").Namespace("tools").GlobalNamespace()))
+ || tc2.Class("SvRef").Namespace("tools").GlobalNamespace()
+ || tc2.Class("WeakReference").Namespace("tools").GlobalNamespace()
+ || tc2.Class("ScopedReadAccess").Namespace("Bitmap").GlobalNamespace()
+ || tc2.Class("ScopedVclPtrInstance").GlobalNamespace()
+ || tc2.Class("VclPtr").GlobalNamespace()
+ || tc2.Class("ScopedVclPtr").GlobalNamespace())
{
return true;
}
diff --git a/dbaccess/source/ui/inc/JoinTableView.hxx b/dbaccess/source/ui/inc/JoinTableView.hxx
index c1b592074728..4134ebca023f 100644
--- a/dbaccess/source/ui/inc/JoinTableView.hxx
+++ b/dbaccess/source/ui/inc/JoinTableView.hxx
@@ -69,8 +69,8 @@ namespace dbaui
void resetRange(const Point& _aSize);
// own methods
- ScrollBar& GetHScrollBar() { return *m_aHScrollBar.get(); }
- ScrollBar& GetVScrollBar() { return *m_aVScrollBar.get(); }
+ ScrollBar& GetHScrollBar() { return *m_aHScrollBar; }
+ ScrollBar& GetVScrollBar() { return *m_aVScrollBar; }
};
diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx
index 53ca05497ee1..8969ca94dab1 100644
--- a/desktop/source/splash/splash.cxx
+++ b/desktop/source/splash/splash.cxx
@@ -616,7 +616,7 @@ void SplashScreenWindow::Paint(vcl::RenderContext& rRenderContext, const tools::
_vdev->SetTextColor(pSpl->_cProgressTextColor);
_vdev->DrawText(Point(pSpl->_tlx, pSpl->_textBaseline), pSpl->_sProgressText);
}
- rRenderContext.DrawOutDev(Point(), GetOutputSizePixel(), Point(), _vdev->GetOutputSizePixel(), *_vdev.get());
+ rRenderContext.DrawOutDev(Point(), GetOutputSizePixel(), Point(), _vdev->GetOutputSizePixel(), *_vdev);
}
diff --git a/include/sfx2/titledockwin.hxx b/include/sfx2/titledockwin.hxx
index 87d745b639a0..976c4bb9f665 100644
--- a/include/sfx2/titledockwin.hxx
+++ b/include/sfx2/titledockwin.hxx
@@ -47,8 +47,8 @@ namespace sfx2
/** returns the content window, which is to be used as parent window for any content to be displayed
in the docking window.
*/
- vcl::Window& GetContentWindow() { return *m_aContentWindow.get(); }
- const vcl::Window& GetContentWindow() const { return *m_aContentWindow.get(); }
+ vcl::Window& GetContentWindow() { return *m_aContentWindow; }
+ const vcl::Window& GetContentWindow() const { return *m_aContentWindow; }
/** Return the border that is painted around the inner window as
decoration.
diff --git a/include/svx/gridctrl.hxx b/include/svx/gridctrl.hxx
index 28df7caf8ca8..da3f3aa6017e 100644
--- a/include/svx/gridctrl.hxx
+++ b/include/svx/gridctrl.hxx
@@ -434,7 +434,7 @@ public:
bool HasNavigationBar() const {return m_bNavigationBar;}
DbGridControlOptions GetOptions() const {return m_nOptions;}
- NavigationBar& GetNavigationBar() {return *m_aBar.get();}
+ NavigationBar& GetNavigationBar() {return *m_aBar;}
DbGridControlOptions SetOptions(DbGridControlOptions nOpt);
// The new options are interpreted with respect to the current data source. If it is unable
// to update, to insert or to restore, the according options are ignored. If the grid isn't
diff --git a/reportdesign/source/ui/inc/ScrollHelper.hxx b/reportdesign/source/ui/inc/ScrollHelper.hxx
index a42cd269aa98..47e8d715464c 100644
--- a/reportdesign/source/ui/inc/ScrollHelper.hxx
+++ b/reportdesign/source/ui/inc/ScrollHelper.hxx
@@ -81,8 +81,8 @@ namespace rptui
Point getThumbPos() const { return Point(m_aHScroll->GetThumbPos(),m_aVScroll->GetThumbPos())/*m_aScrollOffset*/; }
void setTotalSize(sal_Int32 _nWidth, sal_Int32 _nHeight);
const Size& getTotalSize() const { return m_aTotalPixelSize; }
- ScrollBar& GetHScroll() { return *m_aHScroll.get(); }
- ScrollBar& GetVScroll() { return *m_aVScroll.get(); }
+ ScrollBar& GetHScroll() { return *m_aHScroll; }
+ ScrollBar& GetVScroll() { return *m_aVScroll; }
// forwards
void SetMode( DlgEdMode _eMode );
diff --git a/reportdesign/source/ui/inc/SectionWindow.hxx b/reportdesign/source/ui/inc/SectionWindow.hxx
index 726e4d513c84..9197073f41a1 100644
--- a/reportdesign/source/ui/inc/SectionWindow.hxx
+++ b/reportdesign/source/ui/inc/SectionWindow.hxx
@@ -106,9 +106,9 @@ namespace rptui
virtual ~OSectionWindow() override;
virtual void dispose() override;
- OStartMarker& getStartMarker() { return *m_aStartMarker.get(); }
- OReportSection& getReportSection() { return *m_aReportSection.get(); }
- OEndMarker& getEndMarker() { return *m_aEndMarker.get(); }
+ OStartMarker& getStartMarker() { return *m_aStartMarker; }
+ OReportSection& getReportSection() { return *m_aReportSection; }
+ OEndMarker& getEndMarker() { return *m_aEndMarker; }
OViewsWindow* getViewsWindow() { return m_pParent; }
void setCollapsed(bool _bCollapsed);
diff --git a/reportdesign/source/ui/report/ScrollHelper.cxx b/reportdesign/source/ui/report/ScrollHelper.cxx
index 6d9f2006effc..08c7d22729d7 100644
--- a/reportdesign/source/ui/report/ScrollHelper.cxx
+++ b/reportdesign/source/ui/report/ScrollHelper.cxx
@@ -54,8 +54,8 @@ OScrollWindowHelper::OScrollWindowHelper( ODesignView* _pDesignView)
{
SetMapMode( MapMode( MapUnit::Map100thMM ) );
- impl_initScrollBar( *m_aHScroll.get() );
- impl_initScrollBar( *m_aVScroll.get() );
+ impl_initScrollBar( *m_aHScroll );
+ impl_initScrollBar( *m_aVScroll );
m_aReportWindow->SetMapMode( MapMode( MapUnit::Map100thMM ) );
m_aReportWindow->Show();
@@ -174,11 +174,11 @@ Size OScrollWindowHelper::ResizeScrollBars()
{
Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH*m_pParent->getController().getZoomValue()),100);
const sal_Int32 nNewWidth = aOutPixSz.Width() - aOffset.X() - static_cast<long>(aStartWidth);
- lcl_setScrollBar(nNewWidth,Point( static_cast<long>(aStartWidth) + aOffset.X(), aOutPixSz.Height() ), Size( nNewWidth, nScrSize ), *m_aHScroll.get());
+ lcl_setScrollBar(nNewWidth,Point( static_cast<long>(aStartWidth) + aOffset.X(), aOutPixSz.Height() ), Size( nNewWidth, nScrSize ), *m_aHScroll);
}
{
const sal_Int32 nNewHeight = aOutPixSz.Height() - m_aReportWindow->getRulerHeight();
- lcl_setScrollBar(nNewHeight,Point( aOutPixSz.Width(), m_aReportWindow->getRulerHeight() ), Size( nScrSize,nNewHeight), *m_aVScroll.get());
+ lcl_setScrollBar(nNewHeight,Point( aOutPixSz.Width(), m_aReportWindow->getRulerHeight() ), Size( nScrSize,nNewHeight), *m_aVScroll);
}
return aOutPixSz;
diff --git a/reportdesign/source/ui/report/SectionWindow.cxx b/reportdesign/source/ui/report/SectionWindow.cxx
index cc16aedf9d59..d26735462811 100644
--- a/reportdesign/source/ui/report/SectionWindow.cxx
+++ b/reportdesign/source/ui/report/SectionWindow.cxx
@@ -68,9 +68,9 @@ OSectionWindow::OSectionWindow( OViewsWindow* _pParent,const uno::Reference< rep
m_aStartMarker->setCollapsedHdl(LINK(this,OSectionWindow,Collapsed));
m_aStartMarker->zoom(rMapMode.GetScaleX());
- setZoomFactor(rMapMode.GetScaleX(), *m_aReportSection.get());
- setZoomFactor(rMapMode.GetScaleX(), *m_aSplitter.get());
- setZoomFactor(rMapMode.GetScaleX(), *m_aEndMarker.get());
+ setZoomFactor(rMapMode.GetScaleX(), *m_aReportSection);
+ setZoomFactor(rMapMode.GetScaleX(), *m_aSplitter);
+ setZoomFactor(rMapMode.GetScaleX(), *m_aEndMarker);
m_aSplitter->Show();
m_aStartMarker->Show();
@@ -310,9 +310,9 @@ void OSectionWindow::zoom(const Fraction& _aZoom)
setZoomFactor(_aZoom,*this);
m_aStartMarker->zoom(_aZoom);
- setZoomFactor(_aZoom, *m_aReportSection.get());
- setZoomFactor(_aZoom, *m_aSplitter.get());
- setZoomFactor(_aZoom, *m_aEndMarker.get());
+ setZoomFactor(_aZoom, *m_aReportSection);
+ setZoomFactor(_aZoom, *m_aSplitter);
+ setZoomFactor(_aZoom, *m_aEndMarker);
Invalidate();
}
@@ -375,19 +375,19 @@ void OSectionWindow::scrollChildren(long _nX)
MapMode aMapMode( m_aReportSection->GetMapMode() );
const Point aOld = aMapMode.GetOrigin();
- lcl_setOrigin(*m_aReportSection.get(), aDelta.X(), 0);
+ lcl_setOrigin(*m_aReportSection, aDelta.X(), 0);
aMapMode = m_aReportSection->GetMapMode();
const Point aNew = aMapMode.GetOrigin();
const Point aDiff = aOld - aNew;
{
- lcl_scroll(*m_aReportSection.get(), aDiff);
+ lcl_scroll(*m_aReportSection, aDiff);
}
- lcl_scroll(*m_aEndMarker.get(), m_aEndMarker->PixelToLogic(Point(_nX,0)));
+ lcl_scroll(*m_aEndMarker, m_aEndMarker->PixelToLogic(Point(_nX,0)));
- lcl_setOrigin(*m_aSplitter.get(),_nX, 0);
- lcl_scroll(*m_aSplitter.get(),aDiff);
+ lcl_setOrigin(*m_aSplitter,_nX, 0);
+ lcl_scroll(*m_aSplitter,aDiff);
}
} // rptui
diff --git a/reportdesign/source/ui/report/StartMarker.cxx b/reportdesign/source/ui/report/StartMarker.cxx
index 0e19ed712ba6..9ef341bacd1c 100644
--- a/reportdesign/source/ui/report/StartMarker.cxx
+++ b/reportdesign/source/ui/report/StartMarker.cxx
@@ -295,7 +295,7 @@ void OStartMarker::zoom(const Fraction& _aZoom)
{
setZoomFactor(_aZoom,*this);
m_aVRuler->SetZoom(_aZoom);
- setZoomFactor(_aZoom, *m_aText.get());
+ setZoomFactor(_aZoom, *m_aText);
Resize();
Invalidate();
}
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 2702bb2705f1..1fdb5ad5eddc 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1159,7 +1159,7 @@ long ScTextWndGroup::GetPixelHeightForLines(long nLines)
ScrollBar& ScTextWndGroup::GetScrollBar()
{
- return *maScrollBar.get();
+ return *maScrollBar;
}
const OUString& ScTextWndGroup::GetTextString() const
diff --git a/starmath/qa/cppunit/test_starmath.cxx b/starmath/qa/cppunit/test_starmath.cxx
index 668e7dc8a66d..e26bcd31bdfa 100644
--- a/starmath/qa/cppunit/test_starmath.cxx
+++ b/starmath/qa/cppunit/test_starmath.cxx
@@ -162,7 +162,7 @@ void Test::testSmTmpDeviceRestoreFont()
vcl::Font aNewFont;
{
- SmTmpDevice aTmpDev(*pPrinter.get(), bUseMap100th_mm);
+ SmTmpDevice aTmpDev(*pPrinter, bUseMap100th_mm);
aNewFont = pPrinter->GetFont();
aNewFont.SetFamilyName(aFontName);
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 347ea58b1031..336dd3260cf9 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -2240,13 +2240,13 @@ namespace
OUString DbDateField::GetFormatText(const Reference< css::sdb::XColumn >& _rxField, const Reference< css::util::XNumberFormatter >& /*xFormatter*/, Color** /*ppColor*/)
{
- return lcl_setFormattedDate_nothrow(dynamic_cast<DateField&>(*m_pPainter.get()), _rxField);
+ return lcl_setFormattedDate_nothrow(dynamic_cast<DateField&>(*m_pPainter), _rxField);
}
void DbDateField::UpdateFromField(const Reference< css::sdb::XColumn >& _rxField, const Reference< XNumberFormatter >& /*xFormatter*/)
{
- lcl_setFormattedDate_nothrow(dynamic_cast<DateField&>(*m_pWindow.get()), _rxField);
+ lcl_setFormattedDate_nothrow(dynamic_cast<DateField&>(*m_pWindow), _rxField);
}
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index c0c7ce19beb1..f9f692062368 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -472,11 +472,11 @@ sal_uInt16 DbGridControl::NavigationBar::ArrangeControls()
Point aButtonPos(nX,nY);
const Size aButtonSize(nH,nH);
- SetPosAndSize(*m_aFirstBtn.get(), aButtonPos, aButtonSize);
- SetPosAndSize(*m_aPrevBtn.get(), aButtonPos, aButtonSize);
- SetPosAndSize(*m_aNextBtn.get(), aButtonPos, aButtonSize);
- SetPosAndSize(*m_aLastBtn.get(), aButtonPos, aButtonSize);
- SetPosAndSize(*m_aNewBtn.get(), aButtonPos, aButtonSize);
+ SetPosAndSize(*m_aFirstBtn, aButtonPos, aButtonSize);
+ SetPosAndSize(*m_aPrevBtn, aButtonPos, aButtonSize);
+ SetPosAndSize(*m_aNextBtn, aButtonPos, aButtonSize);
+ SetPosAndSize(*m_aLastBtn, aButtonPos, aButtonSize);
+ SetPosAndSize(*m_aNewBtn, aButtonPos, aButtonSize);
nX = sal::static_int_cast< sal_uInt16 >(aButtonPos.X() + 1);
diff --git a/sw/source/uibase/inc/olmenu.hxx b/sw/source/uibase/inc/olmenu.hxx
index a0ab9d595adc..047c21083e75 100644
--- a/sw/source/uibase/inc/olmenu.hxx
+++ b/sw/source/uibase/inc/olmenu.hxx
@@ -127,7 +127,7 @@ public:
PopupMenu& GetMenu()
{
- return *m_xPopupMenu.get();
+ return *m_xPopupMenu;
}
void Execute( const tools::Rectangle& rPopupPos, vcl::Window* pWin );
diff --git a/vcl/qa/cppunit/BitmapTest.cxx b/vcl/qa/cppunit/BitmapTest.cxx
index b61ad88265e9..640c477e3515 100644
--- a/vcl/qa/cppunit/BitmapTest.cxx
+++ b/vcl/qa/cppunit/BitmapTest.cxx
@@ -624,7 +624,7 @@ void BitmapTest::testOctree()
{
// Reduce to 1 color
Bitmap::ScopedReadAccess pAccess(aBitmap);
- Octree aOctree(*pAccess.get(), 1);
+ Octree aOctree(*pAccess, 1);
auto aBitmapPalette = aOctree.GetPalette();
CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), aBitmapPalette.GetEntryCount());
CPPUNIT_ASSERT_EQUAL(BitmapColor(0x7e, 0x7f, 0x7f), aBitmapPalette[0]);
@@ -633,7 +633,7 @@ void BitmapTest::testOctree()
{
// Reduce to 4 color
Bitmap::ScopedReadAccess pAccess(aBitmap);
- Octree aOctree(*pAccess.get(), 4);
+ Octree aOctree(*pAccess, 4);
auto aBitmapPalette = aOctree.GetPalette();
CPPUNIT_ASSERT_EQUAL(sal_uInt16(4), aBitmapPalette.GetEntryCount());
CPPUNIT_ASSERT_EQUAL(BitmapColor(0x7f, 0x7f, 0x7f), aBitmapPalette[0]);
@@ -645,7 +645,7 @@ void BitmapTest::testOctree()
{
// Reduce to 256 color
Bitmap::ScopedReadAccess pAccess(aBitmap);
- Octree aOctree(*pAccess.get(), 256);
+ Octree aOctree(*pAccess, 256);
auto aBitmapPalette = aOctree.GetPalette();
CPPUNIT_ASSERT_EQUAL(sal_uInt16(74), aBitmapPalette.GetEntryCount());
}
diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx
index e834f5b954f5..ec53523c34e9 100644
--- a/vcl/qa/cppunit/svm/svmtest.cxx
+++ b/vcl/qa/cppunit/svm/svmtest.cxx
@@ -1257,7 +1257,7 @@ void SvmTest::testGradient()
{
GDIMetaFile aGDIMetaFile;
ScopedVclPtrInstance<VirtualDevice> pVirtualDev;
- setupBaseVirtualDevice(*pVirtualDev.get(), aGDIMetaFile);
+ setupBaseVirtualDevice(*pVirtualDev, aGDIMetaFile);
tools::Rectangle aRectangle(Point(1, 2), Size(4,5));