diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2014-12-12 20:02:09 +0100 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2014-12-14 11:26:48 +0000 |
commit | ec382367c8dd90a0cd728fb18c03c186416bbaee (patch) | |
tree | 43189be9bee706d93bb4be3be55b6f60332eca15 | |
parent | 4568d1d298bf4fc98dcd86384743a04587a2fe6f (diff) |
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@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r-- | filter/source/graphicfilter/ipcx/ipcx.cxx | 10 | ||||
-rw-r--r-- | filter/source/graphicfilter/ipsd/ipsd.cxx | 2 | ||||
-rw-r--r-- | filter/source/graphicfilter/itiff/itiff.cxx | 3 | ||||
-rw-r--r-- | filter/source/msfilter/msdffimp.cxx | 8 | ||||
-rw-r--r-- | filter/source/msfilter/svdfppt.cxx | 6 | ||||
-rw-r--r-- | filter/source/svg/svgexport.cxx | 3 |
6 files changed, 16 insertions, 16 deletions
diff --git a/filter/source/graphicfilter/ipcx/ipcx.cxx b/filter/source/graphicfilter/ipcx/ipcx.cxx index 0960493291d4..9622e9b9843c 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 95b9e937a429..c6bbca3dc62a 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 c778e807d736..19ab6c7f3527 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 b4fb2f16e375..00320a35ad24 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 c74fc490b3cc..3c0a205ea0d4 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 ca9d4953d35a..f08f9a453da2 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" ); |