bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-arm.cxx | 4 +--- bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx | 4 +--- bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx | 4 +--- bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx | 8 ++++---- 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 +-- 8 files changed, 11 insertions(+), 21 deletions(-)
New commits: commit 0e55feea6a6bb516c4198960b14192f363f08601 Author: Michael Weghorn <m.wegh...@posteo.de> Date: Sat Dec 6 19:51:04 2014 +0100 reduce scope of local variables This addresses some cppcheck warnings. Change-Id: I1122494e295af756ef3cc32717fe204505aeb9e3 Reviewed-on: https://gerrit.libreoffice.org/13335 Reviewed-by: Noel Grandin <noelgran...@gmail.com> Tested-by: Noel Grandin <noelgran...@gmail.com> diff --git a/bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-arm.cxx b/bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-arm.cxx index 9060584..a8f27b6 100644 --- a/bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-arm.cxx +++ b/bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-arm.cxx @@ -357,11 +357,9 @@ static void cpp_call( void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion - bool bSimpleReturn = true; if (pReturnTypeDescr) { - if (arm::return_in_hidden_param( pReturnTypeRef ) ) - bSimpleReturn = false; + bool bSimpleReturn = !arm::return_in_hidden_param( pReturnTypeRef ); if (bSimpleReturn) pCppReturn = pUnoReturn; // direct way for simple types diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx index 752137f..0a25f48 100644 --- a/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx @@ -406,11 +406,9 @@ static void cpp_call( void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion - bool bSimpleReturn = true; if (pReturnTypeDescr) { - if (arm::return_in_hidden_param( pReturnTypeRef ) ) - bSimpleReturn = false; + bool bSimpleReturn = !arm::return_in_hidden_param( pReturnTypeRef ) if (bSimpleReturn) pCppReturn = pUnoReturn; // direct way for simple types diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx index 01bb74a..342ab9c 100644 --- a/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx @@ -316,15 +316,13 @@ static void cpp_call( void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion bool bOverflow = false; - bool bSimpleReturn = true; if (pReturnTypeDescr) { #if OSL_DEBUG_LEVEL > 2 fprintf(stderr, "return type is %d\n", pReturnTypeDescr->eTypeClass); #endif - if (ppc64::return_in_hidden_param(pReturnTypeRef)) - bSimpleReturn = false; + bool bSimpleReturn =!ppc64::return_in_hidden_param(pReturnTypeRef); if (bSimpleReturn) { diff --git a/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx index ed0e6cf..c1815b4 100644 --- a/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx @@ -42,10 +42,11 @@ static sal_Int32 invoke_count_words(char * pPT) { sal_Int32 overflow = 0, gpr = 0, fpr = 0; - int c; // character of parameter type being decoded while (*pPT != 'X') { - c = *pPT; + // character of parameter type being decoded + const int c = *pPT; + switch (c) { case 'D': /* type is double */ if (fpr < 2) fpr++; else overflow+=2; @@ -84,10 +85,9 @@ invoke_copy_to_stack(sal_Int32 * pStackLongs, char * pPT, sal_Int32* d_ov, sal_I sal_Int32 *d_gpr = d_ov + overflow; sal_Int64 *d_fpr = (sal_Int64 *)(d_gpr + 5); sal_Int32 gpr = 0, fpr = 0; - char c; while (*pPT != 'X') { - c = *pPT; + const char c = *pPT; switch (c) { case 'D': /* type is double */ if (fpr < 2) diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx index c501d57..68e05fe 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 2d14d3f..9526615 100644 --- a/canvas/source/directx/dx_canvasbitmap.cxx +++ b/canvas/source/directx/dx_canvasbitmap.cxx @@ -214,10 +214,9 @@ namespace dxcanvas boost::scoped_array<sal_uInt8> 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<aSize.getY(); ++y ) { - pOutBits=pAlphaBits.get()+y*nScanWidth; + sal_uInt8* pOutBits=pAlphaBits.get()+y*nScanWidth; for( sal_Int32 x=0; x<aSize.getX(); ++x ) { *pOutBits++ = 255-*pInBits; diff --git a/canvas/source/directx/dx_surfacegraphics.cxx b/canvas/source/directx/dx_surfacegraphics.cxx index 5442672..06182b5 100644 --- a/canvas/source/directx/dx_surfacegraphics.cxx +++ b/canvas/source/directx/dx_surfacegraphics.cxx @@ -53,12 +53,11 @@ namespace dxcanvas GraphicsSharedPtr createSurfaceGraphics(const COMReference<surface_type>& 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 b8ca6b4..d32fe70 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++) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits