[Libreoffice-commits] core.git: filter/source

Michael Weghorn m.weghorn at posteo.de
Sun Dec 14 03:27:21 PST 2014


 filter/source/graphicfilter/ipcx/ipcx.cxx   |   10 +++++-----
 filter/source/graphicfilter/ipsd/ipsd.cxx   |    2 +-
 filter/source/graphicfilter/itiff/itiff.cxx |    3 +--
 filter/source/msfilter/msdffimp.cxx         |    8 ++++----
 filter/source/msfilter/svdfppt.cxx          |    6 ++++--
 filter/source/svg/svgexport.cxx             |    3 +--
 6 files changed, 16 insertions(+), 16 deletions(-)

New commits:
commit ec382367c8dd90a0cd728fb18c03c186416bbaee
Author: Michael Weghorn <m.weghorn at posteo.de>
Date:   Fri Dec 12 20:02:09 2014 +0100

    fdo#39440 reduce scope of local variables
    
    This addresses some cppcheck warnings.
    
    Change-Id: I09fa7d6f87a73a2ecee9b84e792d5df82ca5b420
    Reviewed-on: https://gerrit.libreoffice.org/13457
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
    Tested-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/filter/source/graphicfilter/ipcx/ipcx.cxx b/filter/source/graphicfilter/ipcx/ipcx.cxx
index 09604932..9622e9b 100644
--- a/filter/source/graphicfilter/ipcx/ipcx.cxx
+++ b/filter/source/graphicfilter/ipcx/ipcx.cxx
@@ -212,7 +212,7 @@ void PCXReader::ImplReadHeader()
 
 void PCXReader::ImplReadBody(BitmapWriteAccess * pAcc)
 {
-    sal_uInt8   *pPlane[ 4 ], * pDest, * pSource1, * pSource2, * pSource3, *pSource4;
+    sal_uInt8   *pPlane[ 4 ], * pDest;
     sal_uLong   i, nx, ny, np, nCount, nPercent;
     sal_uLong   nLastPercent = 0;
     sal_uInt8   nDat = 0, nCol = 0;
@@ -292,10 +292,10 @@ void PCXReader::ImplReadBody(BitmapWriteAccess * pAcc)
                 }
             }
         }
-        pSource1 = pPlane[ 0 ];
-        pSource2 = pPlane[ 1 ];
-        pSource3 = pPlane[ 2 ];
-        pSource4 = pPlane[ 3 ];
+        sal_uInt8 *pSource1 = pPlane[ 0 ];
+        sal_uInt8 *pSource2 = pPlane[ 1 ];
+        sal_uInt8 *pSource3 = pPlane[ 2 ];
+        sal_uInt8 *pSource4 = pPlane[ 3 ];
         switch ( nBitsPerPlanePix + ( nPlanes << 8 ) )
         {
             // 2 colors
diff --git a/filter/source/graphicfilter/ipsd/ipsd.cxx b/filter/source/graphicfilter/ipsd/ipsd.cxx
index 95b9e93..c6bbca3 100644
--- a/filter/source/graphicfilter/ipsd/ipsd.cxx
+++ b/filter/source/graphicfilter/ipsd/ipsd.cxx
@@ -339,7 +339,6 @@ bool PSDReader::ImplReadBody()
 {
     sal_uLong       nX, nY;
     char        nRunCount = 0;
-    signed char nBitCount = -1;
     sal_uInt8       nDat = 0, nDummy, nRed, nGreen, nBlue;
     BitmapColor aBitmapColor;
     nX = nY = 0;
@@ -348,6 +347,7 @@ bool PSDReader::ImplReadBody()
     {
         case 1 :
         {
+            signed char nBitCount = -1;
             while ( nY < mpFileHeader->nRows )
             {
                 if ( nBitCount == -1 )
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx
index c778e80..19ab6c7 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -878,7 +878,6 @@ bool TIFFReader::ConvertScanline( sal_uLong nY )
             {
                 sal_uInt8   nSamp[ 4 ];
                 sal_uInt8   nSampLast[ 4 ] = { 0, 0, 0, 0 };
-                long    nBlack;
 
                 for( nx = 0; nx < nImageWidth; nx++ )
                 {
@@ -904,7 +903,7 @@ bool TIFFReader::ConvertScanline( sal_uLong nY )
                                 nSamp[ ns ]= (sal_uInt8) GetBits( pMap[ ns ], nx * nBitsPerSample, nBitsPerSample );
                         }
                     }
-                    nBlack = nSamp[ 3 ];
+                    const long nBlack = nSamp[ 3 ];
                     nRed = (sal_uInt8) std::max( 0L, 255L - ( ( (long) nSamp[ 0 ] + nBlack - ( ( (long) nMinSampleValue ) << 1 ) ) *
                                 255L/(long)(nMaxSampleValue-nMinSampleValue) ) );
                     nGreen = (sal_uInt8) std::max( 0L, 255L - ( ( (long) nSamp[ 1 ] + nBlack - ( ( (long) nMinSampleValue ) << 1 ) ) *
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index b4fb2f1..00320a3 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -446,12 +446,12 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver )
                     Reference< XShape > aXConnector( pPtr->pCObj->getUnoShape(), UNO_QUERY );
                     SdrGluePointList* pList = pO->ForceGluePointList();
 
-                    bool bValidGluePoint = false;
                     sal_Int32 nId = nC;
                     sal_uInt32 nInventor = pO->GetObjInventor();
 
                     if( nInventor == SdrInventor )
                     {
+                        bool bValidGluePoint = false;
                         sal_uInt32 nObjId = pO->GetObjIdentifier();
                         switch( nObjId )
                         {
@@ -3591,12 +3591,12 @@ void SvxMSDffManager::ReadObjText( const OUString& rText, SdrObject* pObj )
 
         sal_Int32 nParaIndex = 0;
         sal_Int32 nParaSize;
-        const sal_Unicode* pCurrent, *pBuf = rText.getStr();
+        const sal_Unicode* pBuf = rText.getStr();
         const sal_Unicode* pEnd = rText.getStr() + rText.getLength();
 
         while( pBuf < pEnd )
         {
-            pCurrent = pBuf;
+            const sal_Unicode* pCurrent = pBuf;
 
             for ( nParaSize = 0; pBuf < pEnd; )
             {
@@ -5758,12 +5758,12 @@ void SvxMSDffManager::GetCtrlData( sal_uInt32 nOffsDgg_ )
     sal_uInt32  nLength;
     if( !ReadCommonRecordHeader( rStCtrl, nVer, nInst, nFbt, nLength ) ) return;
 
-    bool bOk;
     sal_uLong nPos = nOffsDggL + DFF_COMMON_RECORD_HEADER_SIZE;
 
     // case A: first Drawing Group Container, then n times Drawing Container
     if( DFF_msofbtDggContainer == nFbt )
     {
+        bool bOk;
         GetDrawingGroupContainerData( rStCtrl, nLength );
 
         rStCtrl.Seek( STREAM_SEEK_TO_END );
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index c74fc49..3c0a205 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -1288,7 +1288,6 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
     ePageColorsKind     ( PPT_MASTERPAGE ),
     eAktPageKind        ( PPT_MASTERPAGE )
 {
-    DffRecordHeader* pHd;
     if ( bOk )
     {
         rStCtrl.Seek( STREAM_SEEK_TO_END );
@@ -1307,6 +1306,7 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
             rStCtrl.Seek( 0 );
             DffRecordManager aPptRecManager;                            // contains all first level container and atoms
             aPptRecManager.Consume( rStCtrl, false, nStreamLen );
+            DffRecordHeader* pHd;
             for ( pHd = aPptRecManager.Last(); pHd; pHd = aPptRecManager.Prev() )
             {
                 if ( pHd->nRecType == PPT_PST_UserEditAtom )
@@ -6343,7 +6343,6 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
     DffRecordHeader aExtParaHd;
     aExtParaHd.nRecType = 0;    // set empty
 
-    bool bStatus = true;
 
     DffRecordHeader aShapeContainerHd;
     ReadDffRecordHeader( rIn, aShapeContainerHd );
@@ -6379,6 +6378,9 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
         // ClientTextBox
         if ( rSdrPowerPointImport.maShapeRecords.SeekToContent( rIn, DFF_msofbtClientTextbox, SEEK_FROM_CURRENT_AND_RESTART ) )
         {
+            bool bStatus = true;
+
+
             DffRecordHeader aClientTextBoxHd( *rSdrPowerPointImport.maShapeRecords.Current() );
             sal_uInt32  nTextRulerAtomOfs = 0;  // case of zero -> this atom may be found in aClientDataContainerHd;
                                             // case of -1 -> there is no atom of this kind
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index ca9d495..f08f9a4 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -1715,8 +1715,6 @@ bool SVGFilter::implExportShape( const Reference< XShape >& rxShape,
 
             if( !bRet && mpObjects->find( rxShape ) !=  mpObjects->end() )
             {
-                const OUString*                    pElementId = NULL;
-
                 ::com::sun::star::awt::Rectangle    aBoundRect;
                 const GDIMetaFile&                  rMtf = (*mpObjects)[ rxShape ].GetRepresentation();
 
@@ -1728,6 +1726,7 @@ bool SVGFilter::implExportShape( const Reference< XShape >& rxShape,
                 if( rMtf.GetActionSize() )
                 {   // for text field shapes we set up text-adjust attributes
                     // and set visibility to hidden
+                    const OUString* pElementId = NULL;
                     if( mbPresentation )
                     {
                         bool bIsPageNumber  = ( aShapeClass == "Slide_Number" );


More information about the Libreoffice-commits mailing list