[Libreoffice-commits] .: 2 commits - filter/source
Caolán McNamara
caolan at kemper.freedesktop.org
Mon Nov 29 03:15:06 PST 2010
filter/source/graphicfilter/icgm/class4.cxx | 12 ++---
filter/source/graphicfilter/ipbm/ipbm.cxx | 62 ++++++++++++++--------------
2 files changed, 37 insertions(+), 37 deletions(-)
New commits:
commit aeaf494b23740a4827d2fa5893263c676f74e815
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Nov 29 11:14:34 2010 +0000
tidy this up, replace pointer with reference
diff --git a/filter/source/graphicfilter/ipbm/ipbm.cxx b/filter/source/graphicfilter/ipbm/ipbm.cxx
index b7b0b08..6487f42 100644
--- a/filter/source/graphicfilter/ipbm/ipbm.cxx
+++ b/filter/source/graphicfilter/ipbm/ipbm.cxx
@@ -39,7 +39,7 @@ class PBMReader {
private:
- SvStream* mpPBM; // Die einzulesende PBM-Datei
+ SvStream& mrPBM; // Die einzulesende PBM-Datei
BOOL mbStatus;
BOOL mbRemark; // FALSE wenn sich stream in einem Kommentar befindet
@@ -55,18 +55,19 @@ private:
BOOL ImplReadHeader();
public:
- PBMReader();
+ PBMReader(SvStream & rPBM);
~PBMReader();
- BOOL ReadPBM( SvStream & rPBM, Graphic & rGraphic );
+ BOOL ReadPBM(Graphic & rGraphic );
};
//=================== Methoden von PBMReader ==============================
-PBMReader::PBMReader() :
- mbStatus ( TRUE ),
- mbRemark ( FALSE ),
- mbRaw ( TRUE ),
- mpAcc ( NULL )
+PBMReader::PBMReader(SvStream & rPBM)
+ : mrPBM( rPBM )
+ , mbStatus( TRUE )
+ , mbRemark( FALSE )
+ , mbRaw( TRUE )
+ , mpAcc( NULL )
{
}
@@ -81,7 +82,7 @@ BOOL PBMReader::ImplCallback( USHORT /*nPercent*/ )
{
if ( ( (*pCallback)( pCallerData, nPercent ) ) == TRUE )
{
- mpPBM->SetError( SVSTREAM_FILEFORMAT_ERROR );
+ mrPBM.SetError( SVSTREAM_FILEFORMAT_ERROR );
return TRUE;
}
}
@@ -89,15 +90,14 @@ BOOL PBMReader::ImplCallback( USHORT /*nPercent*/ )
return FALSE;
}
-BOOL PBMReader::ReadPBM( SvStream & rPBM, Graphic & rGraphic )
+BOOL PBMReader::ReadPBM(Graphic & rGraphic )
{
USHORT i;
- if ( rPBM.GetError() )
+ if ( mrPBM.GetError() )
return FALSE;
- mpPBM = &rPBM;
- mpPBM->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+ mrPBM.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
// Kopf einlesen:
@@ -167,7 +167,7 @@ BOOL PBMReader::ImplReadHeader()
BYTE nMax, nCount = 0;
BOOL bFinished = FALSE;
- *mpPBM >> nID[ 0 ] >> nID[ 1 ];
+ mrPBM >> nID[ 0 ] >> nID[ 1 ];
if ( nID[ 0 ] != 'P' )
return FALSE;
mnMaxVal = mnWidth = mnHeight = 0;
@@ -197,10 +197,10 @@ BOOL PBMReader::ImplReadHeader()
}
while ( bFinished == FALSE )
{
- if ( mpPBM->GetError() )
+ if ( mrPBM.GetError() )
return FALSE;
- *mpPBM >> nDat;
+ mrPBM >> nDat;
if ( nDat == '#' )
{
@@ -262,10 +262,10 @@ BOOL PBMReader::ImplReadBody()
ULONG nGrey, nRGB[3];
ULONG nWidth = 0;
ULONG nHeight = 0;
- signed char nShift = 0;
if ( mbRaw )
{
+ signed char nShift = 0;
switch ( mnMode )
{
@@ -273,12 +273,12 @@ BOOL PBMReader::ImplReadBody()
case 0 :
while ( nHeight != mnHeight )
{
- if ( mpPBM->IsEof() || mpPBM->GetError() )
+ if ( mrPBM.IsEof() || mrPBM.GetError() )
return FALSE;
if ( --nShift < 0 )
{
- *mpPBM >> nDat;
+ mrPBM >> nDat;
nShift = 7;
}
mpAcc->SetPixel( nHeight, nWidth, nDat >> nShift );
@@ -296,10 +296,10 @@ BOOL PBMReader::ImplReadBody()
case 1 :
while ( nHeight != mnHeight )
{
- if ( mpPBM->IsEof() || mpPBM->GetError() )
+ if ( mrPBM.IsEof() || mrPBM.GetError() )
return FALSE;
- *mpPBM >> nDat;
+ mrPBM >> nDat;
mpAcc->SetPixel( nHeight, nWidth++, nDat);
if ( nWidth == mnWidth )
@@ -315,12 +315,12 @@ BOOL PBMReader::ImplReadBody()
case 2 :
while ( nHeight != mnHeight )
{
- if ( mpPBM->IsEof() || mpPBM->GetError() )
+ if ( mrPBM.IsEof() || mrPBM.GetError() )
return FALSE;
BYTE nR, nG, nB;
ULONG nRed, nGreen, nBlue;
- *mpPBM >> nR >> nG >> nB;
+ mrPBM >> nR >> nG >> nB;
nRed = 255 * nR / mnMaxVal;
nGreen = 255 * nG / mnMaxVal;
nBlue = 255 * nB / mnMaxVal;
@@ -341,10 +341,10 @@ BOOL PBMReader::ImplReadBody()
case 0 :
while ( bFinished == FALSE )
{
- if ( mpPBM->IsEof() || mpPBM->GetError() )
+ if ( mrPBM.IsEof() || mrPBM.GetError() )
return FALSE;
- *mpPBM >> nDat;
+ mrPBM >> nDat;
if ( nDat == '#' )
{
@@ -402,10 +402,10 @@ BOOL PBMReader::ImplReadBody()
continue;
}
- if ( mpPBM->IsEof() || mpPBM->GetError() )
+ if ( mrPBM.IsEof() || mrPBM.GetError() )
return FALSE;
- *mpPBM >> nDat;
+ mrPBM >> nDat;
if ( nDat == '#' )
{
@@ -478,10 +478,10 @@ BOOL PBMReader::ImplReadBody()
continue;
}
- if ( mpPBM->IsEof() || mpPBM->GetError() )
+ if ( mrPBM.IsEof() || mrPBM.GetError() )
return FALSE;
- *mpPBM >> nDat;
+ mrPBM >> nDat;
if ( nDat == '#' )
{
@@ -532,9 +532,9 @@ BOOL PBMReader::ImplReadBody()
extern "C" BOOL __LOADONCALLAPI GraphicImport(SvStream & rStream, Graphic & rGraphic, FilterConfigItem*, BOOL )
{
- PBMReader aPBMReader;
+ PBMReader aPBMReader(rStream);
- return aPBMReader.ReadPBM( rStream, rGraphic );
+ return aPBMReader.ReadPBM(rGraphic );
}
//================== ein bischen Muell fuer Windows ==========================
commit 051742bd8b0fbe4360ff0b392578a74957916598
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Nov 29 10:37:48 2010 +0000
cppcheck: can reduce the scope of these variables
diff --git a/filter/source/graphicfilter/icgm/class4.cxx b/filter/source/graphicfilter/icgm/class4.cxx
index fbff0e4..6d39d8a 100644
--- a/filter/source/graphicfilter/icgm/class4.cxx
+++ b/filter/source/graphicfilter/icgm/class4.cxx
@@ -376,8 +376,6 @@ void CGM::ImplDoClass4()
case 0x0d : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Circular Arc 3 Point" )
{
- int nSwitch = 0;
-
FloatPoint aStartingPoint, aIntermediatePoint, aEndingPoint, aCenterPoint;
ImplGetPoint( aStartingPoint, sal_True );
ImplGetPoint( aIntermediatePoint, sal_True );
@@ -402,6 +400,8 @@ void CGM::ImplDoClass4()
double fInterAngle = ImplGetOrientation( aCenterPoint, aIntermediatePoint );
double fEndAngle = ImplGetOrientation( aCenterPoint, aEndingPoint );
+ int nSwitch = 0;
+
if ( fStartAngle > fEndAngle )
{
nSwitch ^=1;
@@ -447,8 +447,6 @@ void CGM::ImplDoClass4()
case 0x0e : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Circular Arc 3 Point Close" )
{
- int nSwitch = 0;
-
if ( mbFigure )
mpOutAct->CloseRegion();
@@ -476,6 +474,8 @@ void CGM::ImplDoClass4()
double fInterAngle = ImplGetOrientation( aCenterPoint, aIntermediatePoint );
double fEndAngle = ImplGetOrientation( aCenterPoint, aEndingPoint );
+ int nSwitch = 0;
+
if ( fStartAngle > fEndAngle )
{
nSwitch ^=1;
@@ -513,7 +513,7 @@ void CGM::ImplDoClass4()
case 0x0f : ComOut( CGM_LEVEL1 | CGM_EXTENDED_PRIMITIVES_SET, "Circular Arc Centre" )
{
- double fOrientation, fStartAngle, fEndAngle, vector[ 4 ];
+ double fStartAngle, fEndAngle, vector[ 4 ];
FloatPoint aCenter, aRadius;
if ( mbFigure )
@@ -557,7 +557,7 @@ void CGM::ImplDoClass4()
}
else
{
- fOrientation = 0;
+ double fOrientation = 0;
mpOutAct->DrawEllipticalArc( aCenter, aRadius, fOrientation, 2, fStartAngle, fEndAngle );
}
mnParaSize = mnElementSize;
More information about the Libreoffice-commits
mailing list