From 0e55feea6a6bb516c4198960b14192f363f08601 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Sat, 6 Dec 2014 19:51:04 +0100 Subject: reduce scope of local variables This addresses some cppcheck warnings. Change-Id: I1122494e295af756ef3cc32717fe204505aeb9e3 Reviewed-on: https://gerrit.libreoffice.org/13335 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- canvas/source/cairo/cairo_canvashelper.cxx | 3 +-- canvas/source/directx/dx_canvasbitmap.cxx | 3 +-- canvas/source/directx/dx_surfacegraphics.cxx | 3 +-- canvas/workben/canvasdemo.cxx | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) (limited to 'canvas') diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx index c501d5746448..68e05feb2640 100644 --- a/canvas/source/cairo/cairo_canvashelper.cxx +++ b/canvas/source/cairo/cairo_canvashelper.cxx @@ -670,7 +670,6 @@ namespace cairocanvas static void addColorStops( Pattern* pPattern, const uno::Sequence< uno::Sequence< double > >& rColors, const uno::Sequence< double >& rStops, bool bReverseStops = false ) { - float stop; int i; OSL_ASSERT( rColors.getLength() == rStops.getLength() ); @@ -678,7 +677,7 @@ namespace cairocanvas for( i = 0; i < rColors.getLength(); i++ ) { const uno::Sequence< double >& rColor( rColors[i] ); - stop = bReverseStops ? 1 - rStops[i] : rStops[i]; + float stop = bReverseStops ? 1 - rStops[i] : rStops[i]; if( rColor.getLength() == 3 ) cairo_pattern_add_color_stop_rgb( pPattern, stop, rColor[0], rColor[1], rColor[2] ); else if( rColor.getLength() == 4 ) diff --git a/canvas/source/directx/dx_canvasbitmap.cxx b/canvas/source/directx/dx_canvasbitmap.cxx index 2d14d3f3e75f..952661542111 100644 --- a/canvas/source/directx/dx_canvasbitmap.cxx +++ b/canvas/source/directx/dx_canvasbitmap.cxx @@ -214,10 +214,9 @@ namespace dxcanvas boost::scoped_array pAlphaBits( new sal_uInt8[nScanWidth*aSize.getY()] ); const sal_uInt8* pInBits=(sal_uInt8*)aBmpData.Scan0; pInBits+=3; - sal_uInt8* pOutBits; for( sal_Int32 y=0; y& rSurface ) { - Gdiplus::Graphics* pGraphics; GraphicsSharedPtr pRet; HDC aHDC; if( SUCCEEDED(rSurface->GetDC( &aHDC )) ) { - pGraphics = Gdiplus::Graphics::FromHDC( aHDC ); + Gdiplus::Graphics* pGraphics = Gdiplus::Graphics::FromHDC( aHDC ); if(pGraphics) { tools::setupGraphics( *pGraphics ); diff --git a/canvas/workben/canvasdemo.cxx b/canvas/workben/canvasdemo.cxx index b8ca6b4675c3..d32fe7080d39 100644 --- a/canvas/workben/canvasdemo.cxx +++ b/canvas/workben/canvasdemo.cxx @@ -208,14 +208,13 @@ class DemoRenderer const int VERTICES = 10; const double RADIUS = 60.0; int i, j; - double a; rendering::RenderState maOldRenderState = maRenderState; // push translate( center_x, center_y ); for (i = 0; i < VERTICES; i++) { - a = 2.0 * M_PI * i / VERTICES; + double a = 2.0 * M_PI * i / VERTICES; geometry::RealPoint2D aSrc( RADIUS * cos (a), RADIUS * sin (a) ); for (j = i + 1; j < VERTICES; j++) -- cgit