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


Another path for fixes some cppcheck warnings, sending for review.

revol_
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index eff1a1c..8252d0c 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -3548,11 +3548,11 @@ sal_Bool SvNumberformat::ImpGetNumberOutput(double fNumber,
     sal_uInt16 i, j;
     xub_StrLen k;
     String sStr;
-    long nPrecExp;
     sal_Bool bInteger = sal_False;
     if ( rInfo.nThousand != FLAG_STANDARD_IN_FORMAT )
     {   // special formatting only if no GENERAL keyword in format code
         const sal_uInt16 nThousand = rInfo.nThousand;
+        long nPrecExp;
         for (i = 0; i < nThousand; i++)
         {
            if (fNumber > _D_MIN_M_BY_1000)
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index 2202d3e..1dc1bad 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -467,13 +467,10 @@ void Ruler::ImplInvertLines( sal_Bool bErase )
 
 void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter )
 {
-    long    n = 0;
     long    nTick3 = aImplRulerUnitTab[mnUnitIndex].nTick3;
     long    nTickCount = aImplRulerUnitTab[mnUnitIndex].nTick1;
     Size    aPixSize = maVirDev.LogicToPixel( Size( nTick3, nTick3 ), maMapMode );
     long    nTickWidth;
-    long    nX;
-    long    nY;
     sal_Bool    bNoTicks = sal_False;
 
     //Amelia
@@ -569,6 +566,9 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter )
 
     if ( !bNoTicks )
     {
+        long nX;
+        long nY;
+        long n = 0;
         long nTxtWidth2;
         long nTxtHeight2 = GetTextHeight()/2;
         long nTick = 0;
diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx
index 56be64e..1de01ef 100644
--- a/svtools/source/control/toolbarmenu.cxx
+++ b/svtools/source/control/toolbarmenu.cxx
@@ -1081,12 +1081,12 @@ void ToolbarMenu::MouseMove( const MouseEvent& rMEvt )
 
 void ToolbarMenu::implHighlightEntry( const MouseEvent& rMEvt, bool bMBDown )
 {
-    long nY = 0;
     long nMouseY = rMEvt.GetPosPixel().Y();
     Size aOutSz = GetOutputSizePixel();
     if ( ( nMouseY >= 0 ) && ( nMouseY < aOutSz.Height() ) )
     {
         bool bHighlighted = sal_False;
+        long nY = 0;
         
         const int nEntryCount = mpImpl->maEntryVector.size();
         int nEntry;
diff --git a/svtools/source/filter.vcl/filter/sgvmain.cxx 
b/svtools/source/filter.vcl/filter/sgvmain.cxx
index 5767e6b..28f167b 100644
--- a/svtools/source/filter.vcl/filter/sgvmain.cxx
+++ b/svtools/source/filter.vcl/filter/sgvmain.cxx
@@ -768,7 +768,6 @@ void CircType::Draw(OutputDevice& rOut)
 void BmapType::Draw(OutputDevice& rOut)
 {
     //ifstream aInp;
-    unsigned char      nSgfTyp;
     sal_uInt16                 nVersion;
     String                     aStr(
         reinterpret_cast< char const * >(&Filename[ 1 ]),
@@ -778,7 +777,7 @@ void BmapType::Draw(OutputDevice& rOut)
     SvStream* pInp = ::utl::UcbStreamHelper::CreateStream( aFNam.GetMainURL( 
INetURLObject::NO_DECODE ), STREAM_READ );
     if ( pInp )
     {
-        nSgfTyp=CheckSgfTyp( *pInp,nVersion);
+        unsigned char nSgfTyp=CheckSgfTyp( *pInp,nVersion);
         switch(nSgfTyp) {
             case SGF_BITIMAGE: {
                 GraphicFilter aFlt;
diff --git a/svtools/source/filter.vcl/filter/sgvspln.cxx 
b/svtools/source/filter.vcl/filter/sgvspln.cxx
index 6221264..30ae1ac 100644
--- a/svtools/source/filter.vcl/filter/sgvspln.cxx
+++ b/svtools/source/filter.vcl/filter/sgvspln.cxx
@@ -807,9 +807,6 @@ sal_Bool CalcSpline(Polygon& rPoly, sal_Bool Periodic, sal_uInt16& n,
 *************************************************************************/
 sal_Bool Spline2Poly(Polygon& rSpln, sal_Bool Periodic, Polygon& rPoly)
 {
-    short  MinKoord=-32000; // zur Vermeidung
-    short  MaxKoord=32000;  // von Ueberlaeufen
-
     double* ax;          // Koeffizienten der Polynome
     double* ay;
     double* bx;
@@ -820,19 +817,20 @@ sal_Bool Spline2Poly(Polygon& rSpln, sal_Bool Periodic, Polygon& rPoly)
     double* dy;
     double* tv;
 
-    double  Step;        // Schrittweite fuer t
-    double  dt1,dt2,dt3; // Delta t, y, ^3
-    double  t;
     sal_Bool    bEnde;       // Teilpolynom zu Ende?
     sal_uInt16  n;           // Anzahl der zu zeichnenden Teilpolynome
     sal_uInt16  i;           // aktuelles Teilpolynom
     sal_Bool    bOk;         // noch alles ok?
-    sal_uInt16  PolyMax=16380;// Maximale Anzahl von Polygonpunkten
-    long    x,y;
 
     bOk=CalcSpline(rSpln,Periodic,n,ax,ay,bx,by,cx,cy,dx,dy,tv);
     if (bOk) {
-        Step =10;
+        short  MinKoord=-32000; // zur Vermeidung
+        short  MaxKoord=32000;  // von Ueberlaeufen
+        double Step =10;
+        double  dt1,dt2,dt3; // Delta t, y, ^3
+        double  t;
+        sal_uInt16  PolyMax=16380;// Maximale Anzahl von Polygonpunkten
+        long    x,y;
 
         rPoly.SetSize(1);
         rPoly.SetPoint(Point(short(ax[0]),short(ay[0])),0); // erster Punkt
diff --git a/svtools/source/filter.vcl/filter/sgvtext.cxx 
b/svtools/source/filter.vcl/filter/sgvtext.cxx
index d8b9f5a..17b776d 100644
--- a/svtools/source/filter.vcl/filter/sgvtext.cxx
+++ b/svtools/source/filter.vcl/filter/sgvtext.cxx
@@ -765,7 +765,6 @@ UCHAR ProcessChar(OutputDevice& rOut, UCHAR* TBuf, ProcChrSta& R, ObjTextType& A
                   sal_uInt16& nChars, sal_uInt16 Rest,
                   short* Line, UCHAR* cLine)
 {
-    sal_uInt16       KernDist=0;       // Wert fuer Kerning
     sal_uInt16       ChrWidth;
     UCHAR        c;
     UCHAR        c1;
@@ -775,6 +774,7 @@ UCHAR ProcessChar(OutputDevice& rOut, UCHAR* TBuf, ProcChrSta& R, ObjTextType& A
 
     AbsEnd=(c==AbsatzEnd || c==TextEnd);
     if (AbsEnd==sal_False) {
+        sal_uInt16       KernDist=0;       // Wert fuer Kerning
         R.OutCh=ConvertTextChar(c); // von HardTrenn nach '-', ...
         R.Kapt=(R.Attrib.Schnitt & TextKaptBit) !=0 && UpcasePossible(R.OutCh);
         if (R.Kapt) R.OutCh=Upcase(R.OutCh);
diff --git a/svtools/source/filter.vcl/igif/gifread.cxx b/svtools/source/filter.vcl/igif/gifread.cxx
index 2b84c2f..5fc6f6b 100644
--- a/svtools/source/filter.vcl/igif/gifread.cxx
+++ b/svtools/source/filter.vcl/igif/gifread.cxx
@@ -451,7 +451,7 @@ void GIFReader::FillImages( HPBYTE pBytes, sal_uLong nCount )
         {
             if( bInterlaced )
             {
-                long nT1, nT2;
+                long nT1;
 
                 // falls Interlaced, werden die Zeilen kopiert
                 if( nLastInterCount )
@@ -489,7 +489,7 @@ void GIFReader::FillImages( HPBYTE pBytes, sal_uLong nCount )
 
                 if( nT1 >= nImageHeight )
                 {
-                    nT2 = nImageY - ( ( nImageHeight + 7 ) >> 3 );
+                    long nT2 = nImageY - ( ( nImageHeight + 7 ) >> 3 );
                     nT1 = ( nT2 << 3 ) + 4;
                     nLastInterCount = 3;
 
diff --git a/tools/source/inet/inetstrm.cxx b/tools/source/inet/inetstrm.cxx
index cdb796c..3217959 100644
--- a/tools/source/inet/inetstrm.cxx
+++ b/tools/source/inet/inetstrm.cxx
@@ -1686,9 +1686,9 @@ int INetMIMEMessageStream::PutMsgLine (const sal_Char *pData, sal_uIntPtr 
nSize)
                 for( pOldPos = pChar = (const sal_Char *) pMsgBuffer->GetData(); nBufSize--;
                      pChar++ )
                 {
-                    int status;
                     if( *pChar == '\r' || *pChar == '\n' )
                     {
+                        int status;
                         if( aDelim.CompareTo (pOldPos, aDelim.Len())
                             != COMPARE_EQUAL &&
                             aClose.CompareTo (pOldPos, aClose.Len())

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.