From c54d34f70819c5928fe30585e86d744eda4a254a Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 25 Dec 2017 19:21:12 +0200 Subject: loplugin:passstuffbyref improved return in canvas and svtools and for now, ignore methods with params so we don't fall into the trap of thinking that calls to methods like: Bar& foo(Bar &p) { return p; } can be converted from Bar f() { return foo(Bar()); } to Bar const & f() { return foo(Bar()); } Change-Id: Ia3795eb2baf353cb6bec4ebf40451f2789d66ad7 Reviewed-on: https://gerrit.libreoffice.org/47034 Tested-by: Jenkins Reviewed-by: Noel Grandin --- canvas/source/cairo/cairo_canvasfont.cxx | 2 +- canvas/source/cairo/cairo_canvasfont.hxx | 2 +- canvas/source/cairo/cairo_devicehelper.cxx | 2 +- canvas/source/cairo/cairo_devicehelper.hxx | 2 +- canvas/source/cairo/cairo_spritecanvas.cxx | 4 ++-- canvas/source/cairo/cairo_spritecanvas.hxx | 4 ++-- canvas/source/cairo/cairo_spritedevicehelper.cxx | 2 +- canvas/source/cairo/cairo_spritedevicehelper.hxx | 2 +- canvas/source/tools/canvastools.cxx | 4 ++-- canvas/source/vcl/canvasfont.cxx | 2 +- canvas/source/vcl/canvasfont.hxx | 2 +- canvas/source/vcl/devicehelper.cxx | 2 +- canvas/source/vcl/devicehelper.hxx | 2 +- canvas/source/vcl/spritecanvas.hxx | 4 ++-- 14 files changed, 18 insertions(+), 18 deletions(-) (limited to 'canvas') diff --git a/canvas/source/cairo/cairo_canvasfont.cxx b/canvas/source/cairo/cairo_canvasfont.cxx index cbb9ff8f0d58..896f06f3dbaf 100644 --- a/canvas/source/cairo/cairo_canvasfont.cxx +++ b/canvas/source/cairo/cairo_canvasfont.cxx @@ -146,7 +146,7 @@ namespace cairocanvas return { "com.sun.star.rendering.CanvasFont" }; } - vcl::Font CanvasFont::getVCLFont() const + vcl::Font const & CanvasFont::getVCLFont() const { return *maFont; } diff --git a/canvas/source/cairo/cairo_canvasfont.hxx b/canvas/source/cairo/cairo_canvasfont.hxx index 2bcb97eb2f8b..20bc51b18df3 100644 --- a/canvas/source/cairo/cairo_canvasfont.hxx +++ b/canvas/source/cairo/cairo_canvasfont.hxx @@ -72,7 +72,7 @@ namespace cairocanvas virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; - vcl::Font getVCLFont() const; + vcl::Font const & getVCLFont() const; private: ::canvas::vcltools::VCLObject maFont; diff --git a/canvas/source/cairo/cairo_devicehelper.cxx b/canvas/source/cairo/cairo_devicehelper.cxx index d3a64b343f49..258f81af88e9 100644 --- a/canvas/source/cairo/cairo_devicehelper.cxx +++ b/canvas/source/cairo/cairo_devicehelper.cxx @@ -223,7 +223,7 @@ namespace cairocanvas }; } - uno::Reference DeviceHelper::getColorSpace() const + uno::Reference const & DeviceHelper::getColorSpace() const { // always the same return DeviceColorSpace::get(); diff --git a/canvas/source/cairo/cairo_devicehelper.hxx b/canvas/source/cairo/cairo_devicehelper.hxx index c98ded4d7bc4..f9dab470fbdc 100644 --- a/canvas/source/cairo/cairo_devicehelper.hxx +++ b/canvas/source/cairo/cairo_devicehelper.hxx @@ -83,7 +83,7 @@ namespace cairocanvas css::uno::Any getDeviceHandle() const; css::uno::Any getSurfaceHandle() const; css::uno::Reference< - css::rendering::XColorSpace > getColorSpace() const; + css::rendering::XColorSpace > const & getColorSpace() const; /** called when DumpScreenContent property is enabled on XGraphicDevice, and writes out bitmaps of current screen. diff --git a/canvas/source/cairo/cairo_spritecanvas.cxx b/canvas/source/cairo/cairo_spritecanvas.cxx index 12750d868644..578fa1d12dbc 100644 --- a/canvas/source/cairo/cairo_spritecanvas.cxx +++ b/canvas/source/cairo/cairo_spritecanvas.cxx @@ -173,12 +173,12 @@ namespace cairocanvas return maDeviceHelper.getOutputDevice(); } - SurfaceSharedPtr SpriteCanvas::getBufferSurface() + SurfaceSharedPtr const & SpriteCanvas::getBufferSurface() { return maDeviceHelper.getBufferSurface(); } - SurfaceSharedPtr SpriteCanvas::getWindowSurface() + SurfaceSharedPtr const & SpriteCanvas::getWindowSurface() { return maDeviceHelper.getWindowSurface(); } diff --git a/canvas/source/cairo/cairo_spritecanvas.hxx b/canvas/source/cairo/cairo_spritecanvas.hxx index a26701fea02e..b84086675b19 100644 --- a/canvas/source/cairo/cairo_spritecanvas.hxx +++ b/canvas/source/cairo/cairo_spritecanvas.hxx @@ -142,8 +142,8 @@ namespace cairocanvas const css::rendering::ViewState& viewState, const css::rendering::RenderState& renderState ) override; - ::cairo::SurfaceSharedPtr getWindowSurface(); - ::cairo::SurfaceSharedPtr getBufferSurface(); + ::cairo::SurfaceSharedPtr const & getWindowSurface(); + ::cairo::SurfaceSharedPtr const & getBufferSurface(); const ::basegfx::B2ISize& getSizePixel(); void setSizePixel( const ::basegfx::B2ISize& rSize ); diff --git a/canvas/source/cairo/cairo_spritedevicehelper.cxx b/canvas/source/cairo/cairo_spritedevicehelper.cxx index ef4d6b2d1996..483aaa13bbb2 100644 --- a/canvas/source/cairo/cairo_spritedevicehelper.cxx +++ b/canvas/source/cairo/cairo_spritedevicehelper.cxx @@ -124,7 +124,7 @@ namespace cairocanvas setSize( ::basegfx::B2ISize(rBounds.Width, rBounds.Height) ); } - SurfaceSharedPtr SpriteDeviceHelper::getWindowSurface() + SurfaceSharedPtr const & SpriteDeviceHelper::getWindowSurface() { return DeviceHelper::getSurface(); } diff --git a/canvas/source/cairo/cairo_spritedevicehelper.hxx b/canvas/source/cairo/cairo_spritedevicehelper.hxx index 86eaa34326e5..5336bb7d10f0 100644 --- a/canvas/source/cairo/cairo_spritedevicehelper.hxx +++ b/canvas/source/cairo/cairo_spritedevicehelper.hxx @@ -61,7 +61,7 @@ namespace cairocanvas void setSize( const ::basegfx::B2ISize& rSize ); const ::cairo::SurfaceSharedPtr& getBufferSurface() { return mpBufferSurface; } - ::cairo::SurfaceSharedPtr getWindowSurface(); + ::cairo::SurfaceSharedPtr const & getWindowSurface(); ::cairo::SurfaceSharedPtr createSurface( const ::basegfx::B2ISize& rSize, int aContent ); ::cairo::SurfaceSharedPtr createSurface( BitmapSystemData const & rData, const Size& rSize ); const ::basegfx::B2ISize& getSizePixel() { return maSize; } diff --git a/canvas/source/tools/canvastools.cxx b/canvas/source/tools/canvastools.cxx index d1155243275c..477ba03b3703 100644 --- a/canvas/source/tools/canvastools.cxx +++ b/canvas/source/tools/canvastools.cxx @@ -863,12 +863,12 @@ namespace canvas }; } - uno::Reference getStdColorSpace() + uno::Reference const & getStdColorSpace() { return StandardColorSpaceHolder::get(); } - uno::Reference getStdColorSpaceWithoutAlpha() + uno::Reference const & getStdColorSpaceWithoutAlpha() { return StandardNoAlphaColorSpaceHolder::get(); } diff --git a/canvas/source/vcl/canvasfont.cxx b/canvas/source/vcl/canvasfont.cxx index 2f1dabfe8216..5eb27f9cf0c4 100644 --- a/canvas/source/vcl/canvasfont.cxx +++ b/canvas/source/vcl/canvasfont.cxx @@ -159,7 +159,7 @@ namespace vclcanvas return { "com.sun.star.rendering.CanvasFont" }; } - vcl::Font CanvasFont::getVCLFont() const + vcl::Font const & CanvasFont::getVCLFont() const { return *maFont; } diff --git a/canvas/source/vcl/canvasfont.hxx b/canvas/source/vcl/canvasfont.hxx index 83c37deeed34..1a953447aaff 100644 --- a/canvas/source/vcl/canvasfont.hxx +++ b/canvas/source/vcl/canvasfont.hxx @@ -75,7 +75,7 @@ namespace vclcanvas virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; - vcl::Font getVCLFont() const; + vcl::Font const & getVCLFont() const; private: ::canvas::vcltools::VCLObject maFont; diff --git a/canvas/source/vcl/devicehelper.cxx b/canvas/source/vcl/devicehelper.cxx index f4d6866e39bd..35e78123c6e7 100644 --- a/canvas/source/vcl/devicehelper.cxx +++ b/canvas/source/vcl/devicehelper.cxx @@ -189,7 +189,7 @@ namespace vclcanvas }; } - uno::Reference DeviceHelper::getColorSpace() const + uno::Reference const & DeviceHelper::getColorSpace() const { // always the same return DeviceColorSpace::get(); diff --git a/canvas/source/vcl/devicehelper.hxx b/canvas/source/vcl/devicehelper.hxx index 2a5d7ac2a42e..040fda5ebebb 100644 --- a/canvas/source/vcl/devicehelper.hxx +++ b/canvas/source/vcl/devicehelper.hxx @@ -75,7 +75,7 @@ namespace vclcanvas css::uno::Any getDeviceHandle() const; css::uno::Any getSurfaceHandle() const; css::uno::Reference< - css::rendering::XColorSpace > getColorSpace() const; + css::rendering::XColorSpace > const & getColorSpace() const; const OutDevProviderSharedPtr& getOutDev() const { return mpOutDev; } diff --git a/canvas/source/vcl/spritecanvas.hxx b/canvas/source/vcl/spritecanvas.hxx index 1d59b39adb8b..954d49d662d8 100644 --- a/canvas/source/vcl/spritecanvas.hxx +++ b/canvas/source/vcl/spritecanvas.hxx @@ -143,9 +143,9 @@ namespace vclcanvas const GraphicAttr& rAttr ) const override; /// Get backbuffer for this canvas - OutDevProviderSharedPtr getFrontBuffer() const { return maDeviceHelper.getOutDev(); } + OutDevProviderSharedPtr const & getFrontBuffer() const { return maDeviceHelper.getOutDev(); } /// Get window for this canvas - BackBufferSharedPtr getBackBuffer() const { return maDeviceHelper.getBackBuffer(); } + BackBufferSharedPtr const & getBackBuffer() const { return maDeviceHelper.getBackBuffer(); } private: css::uno::Sequence< css::uno::Any > maArguments; -- cgit