Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


This patch should fix the cppcheck style warnings for grfmgr.cxx:

core/svtools/source/graphic/grfmgr.cxx
278     variableScope   style   The scope of the variable 'nNewLeft' can be reduced
278     variableScope   style   The scope of the variable 'nNewTop' can be reduced
278     variableScope   style   The scope of the variable 'nNewRight' can be reduced
278     variableScope   style   The scope of the variable 'nNewBottom' can be reduced
279     variableScope   style   The scope of the variable 'fScale' can be reduced

patch is released under LGPLv3.

-- Kenneth
diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx
index 43b8687..4e3d994 100644
--- a/svtools/source/graphic/grfmgr.cxx
+++ b/svtools/source/graphic/grfmgr.cxx
@@ -275,8 +275,6 @@ sal_Bool GraphicObject::ImplGetCropParams( OutputDevice* pOut, Point& rPt, Size&
         const MapMode   aMap100( MAP_100TH_MM );
         Size            aSize100;
         long            nTotalWidth, nTotalHeight;
-        long            nNewLeft, nNewTop, nNewRight, nNewBottom;
-        double          fScale;
 
         if( nRot10 )
         {
@@ -301,17 +299,17 @@ sal_Bool GraphicObject::ImplGetCropParams( OutputDevice* pOut, Point& rPt, 
Size&
 
         if( aSize100.Width() > 0 && aSize100.Height() > 0 && nTotalWidth > 0 && nTotalHeight > 0 )
         {
-            fScale = (double) aSize100.Width() / nTotalWidth;
-            nNewLeft = -FRound( ( ( pAttr->GetMirrorFlags() & BMP_MIRROR_HORZ ) ? 
pAttr->GetRightCrop() : pAttr->GetLeftCrop() ) * fScale );
-            nNewRight = nNewLeft + FRound( aSize100.Width() * fScale ) - 1;
+            double fScale = (double) aSize100.Width() / nTotalWidth;
+            const long nNewLeft = -FRound( ( ( pAttr->GetMirrorFlags() & BMP_MIRROR_HORZ ) ? 
pAttr->GetRightCrop() : pAttr->GetLeftCrop() ) * fScale );
+            const long nNewRight = nNewLeft + FRound( aSize100.Width() * fScale ) - 1;
 
             fScale = (double) rSz.Width() / aSize100.Width();
             rPt.X() += FRound( nNewLeft * fScale );
             rSz.Width() = FRound( ( nNewRight - nNewLeft + 1 ) * fScale );
 
             fScale = (double) aSize100.Height() / nTotalHeight;
-            nNewTop = -FRound( ( ( pAttr->GetMirrorFlags() & BMP_MIRROR_VERT ) ? 
pAttr->GetBottomCrop() : pAttr->GetTopCrop() ) * fScale );
-            nNewBottom = nNewTop + FRound( aSize100.Height() * fScale ) - 1;
+            const long nNewTop = -FRound( ( ( pAttr->GetMirrorFlags() & BMP_MIRROR_VERT ) ? 
pAttr->GetBottomCrop() : pAttr->GetTopCrop() ) * fScale );
+            const long nNewBottom = nNewTop + FRound( aSize100.Height() * fScale ) - 1;
 
             fScale = (double) rSz.Height() / aSize100.Height();
             rPt.Y() += FRound( nNewTop * fScale );

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.