[Libreoffice-commits] .: 13 commits - autodoc/source connectivity/workben rsc/source slideshow/source tools/source vcl/source

Pierre-André Jacquod pjacquod at kemper.freedesktop.org
Mon Sep 26 13:12:41 PDT 2011


 autodoc/source/display/html/hdimpl.cxx                             |   11 -
 autodoc/source/parser/cpp/cx_c_pp.cxx                              |    4 
 connectivity/workben/testmoz/main.cxx                              |    2 
 rsc/source/res/rscflag.cxx                                         |   22 +-
 slideshow/source/engine/OGLTrans/unx/OGLTrans_TransitionerImpl.cxx |    2 
 tools/source/generic/poly.cxx                                      |   14 -
 vcl/source/fontsubset/cff.cxx                                      |    2 
 vcl/source/fontsubset/sft.cxx                                      |   31 ++-
 vcl/source/gdi/bitmap3.cxx                                         |   25 +-
 vcl/source/gdi/outdev2.cxx                                         |   10 -
 vcl/source/gdi/outdev3.cxx                                         |    9 -
 vcl/source/window/toolbox.cxx                                      |   90 +---------
 12 files changed, 83 insertions(+), 139 deletions(-)

New commits:
commit 1f1607a5e6ea2b88f072ba2109522de671f20dbf
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sat Sep 24 18:08:14 2011 +0200

    cppcheck: reduce scope of var in rsc rscflag.cxx

diff --git a/rsc/source/res/rscflag.cxx b/rsc/source/res/rscflag.cxx
index aeaf2fd..6e224fc 100644
--- a/rsc/source/res/rscflag.cxx
+++ b/rsc/source/res/rscflag.cxx
@@ -69,10 +69,10 @@ sal_uInt32 RscFlag::Size()
 *************************************************************************/
 ERRTYPE RscFlag::SetNotConst( const RSCINST & rInst, Atom nConst )
 {
-    sal_uInt32 i = 0, nFlag = 0;
+    sal_uInt32 i = 0;
 
     if( nEntries != (i = GetConstPos( nConst )) ){
-        nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) );
+        sal_uInt32 nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) );
         i = i / (sizeof( sal_uInt32 ) * 8);
         ((RscFlagInst *)rInst.pData)[ i ].nFlags     &= ~nFlag;
         ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags &= ~nFlag;
@@ -89,10 +89,10 @@ ERRTYPE RscFlag::SetNotConst( const RSCINST & rInst, Atom nConst )
 *************************************************************************/
 ERRTYPE RscFlag::SetConst( const RSCINST & rInst, Atom nConst, sal_Int32 /*nVal*/ )
 {
-    sal_uInt32 i = 0, nFlag = 0;
+    sal_uInt32 i = 0;
 
     if( nEntries != (i = GetConstPos( nConst )) ){
-        nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) );
+        sal_uInt32 nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) );
         i = i / (sizeof( sal_uInt32 ) * 8);
         ((RscFlagInst *)rInst.pData)[ i ].nFlags     |= nFlag;
         ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags &= ~nFlag;
@@ -129,7 +129,6 @@ RSCINST RscFlag::CreateBasic( RSCINST * pInst )
 RSCINST RscFlag::Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool bOwnClass )
 {
     RSCINST aInst = CreateBasic( pInst );
-    sal_uInt32  i = 0;
 
     if( !bOwnClass && rDflt.IsInst() )
         bOwnClass = rDflt.pClass->InHierarchy( this );
@@ -138,7 +137,7 @@ RSCINST RscFlag::Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool bOwnCl
         memmove( aInst.pData, rDflt.pData, Size() );
     else
     {
-        for( i = 0; i < Size() / sizeof( RscFlagInst ); i++ )
+        for( sal_uInt32 i = 0; i < Size() / sizeof( RscFlagInst ); i++ )
         {
             ((RscFlagInst *)aInst.pData)[ i ].nFlags = 0;
             ((RscFlagInst *)aInst.pData)[ i ].nDfltFlags = 0xFFFFFFFF;
@@ -157,13 +156,14 @@ RSCINST RscFlag::CreateClient( RSCINST * pInst, const RSCINST & rDfltI,
                                sal_Bool bOwnClass, Atom nConstId )
 {
     RSCINST aInst = CreateBasic( pInst );
-    sal_uInt32 i = 0, nFlag = 0;
+    sal_uInt32 i = 0;
 
     if( !bOwnClass && rDfltI.IsInst() )
         bOwnClass = rDfltI.pClass->InHierarchy( this );
 
-    if( nEntries != (i = GetConstPos( nConstId )) ){
-        nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) );
+    if( nEntries != (i = GetConstPos( nConstId )) )
+    {
+        sal_uInt32 nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) );
         i = i / (sizeof( sal_uInt32 ) * 8);
         if( bOwnClass ){
             ((RscFlagInst *)aInst.pData)[ i ].nFlags &=
@@ -251,13 +251,11 @@ sal_Bool RscFlag::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef,
 
 sal_Bool RscFlag::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef )
 {
-    sal_uInt32 i = 0;
-
     if( pDef ){
         sal_uInt32  Flag = 0, nIndex = 0;
 
         Flag = 1;
-        for( i = 0; i < nEntries; i++ ){
+        for( sal_uInt32 i = 0; i < nEntries; i++ ){
             nIndex = i / (sizeof( sal_uInt32 ) * 8);
             if( (((RscFlagInst *)rInst.pData)[ nIndex ].nFlags & Flag)
               != (((RscFlagInst *)pDef)[ nIndex ].nFlags & Flag)  )
commit d04bd631731c45627caa4b7f5dc4aea2c4fa9f9e
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sat Sep 24 17:58:01 2011 +0200

    cppcheck: reduce scope of var in tools/ poly.cxx

diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index 419575d..4ba1ef0 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -1674,11 +1674,6 @@ SvStream& operator>>( SvStream& rIStream, Polygon& rPoly )
     sal_uInt16          nStart;
     sal_uInt16          nCurPoints;
     sal_uInt16          nPoints;
-    unsigned char   bShort;
-    short           nShortX;
-    short           nShortY;
-    long            nLongX;
-    long            nLongY;
 
     // Anzahl der Punkte einlesen und Array erzeugen
     rIStream >> nPoints;
@@ -1695,12 +1690,15 @@ SvStream& operator>>( SvStream& rIStream, Polygon& rPoly )
     if ( rIStream.GetCompressMode() == COMPRESSMODE_FULL )
     {
         i = 0;
+        unsigned char bShort;
         while ( i < nPoints )
         {
             rIStream >> bShort >> nCurPoints;
 
             if ( bShort )
             {
+                short nShortX;
+                short nShortY;
                 for ( nStart = i; i < nStart+nCurPoints; i++ )
                 {
                     rIStream >> nShortX >> nShortY;
@@ -1710,6 +1708,8 @@ SvStream& operator>>( SvStream& rIStream, Polygon& rPoly )
             }
             else
             {
+                long nLongX;
+                long nLongY;
                 for ( nStart = i; i < nStart+nCurPoints; i++ )
                 {
                     rIStream >> nLongX >> nLongY;
@@ -1752,8 +1752,6 @@ SvStream& operator<<( SvStream& rOStream, const Polygon& rPoly )
     DBG_CHKOBJ( &rPoly, Polygon, NULL );
     DBG_ASSERTWARNING( rOStream.GetVersion(), "Polygon::<< - Solar-Version not set on rOStream" );
 
-    unsigned char   bShort;
-    unsigned char   bCurShort;
     sal_uInt16          nStart;
     sal_uInt16          i;
     sal_uInt16          nPoints = rPoly.GetSize();
@@ -1765,6 +1763,7 @@ SvStream& operator<<( SvStream& rOStream, const Polygon& rPoly )
     if ( rOStream.GetCompressMode() == COMPRESSMODE_FULL )
     {
         i = 0;
+        unsigned char bShort;
         while ( i < nPoints )
         {
             nStart = i;
@@ -1777,6 +1776,7 @@ SvStream& operator<<( SvStream& rOStream, const Polygon& rPoly )
                 bShort = sal_True;
             else
                 bShort = sal_False;
+            unsigned char bCurShort;
             while ( i < nPoints )
             {
                 // Feststellen, welcher Typ geschrieben werden soll
commit 764b47e8a1cf2db19b21aa5ebc8cf6492af31bc4
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sat Sep 24 17:41:04 2011 +0200

    cppcheck: reduce scope of var in vcl bitmap3.cxx

diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index 0ae8e63..28ab1b1 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -1933,7 +1933,6 @@ void Bitmap::ImplMedianCut( sal_uLong* pColBuf, BitmapPalette& rPal,
     const long  nRLen = nR2 - nR1;
     const long  nGLen = nG2 - nG1;
     const long  nBLen = nB2 - nB1;
-    long        nR, nG, nB;
     sal_uLong*      pBuf = pColBuf;
 
     if( !nRLen && !nGLen && !nBLen )
@@ -1952,11 +1951,11 @@ void Bitmap::ImplMedianCut( sal_uLong* pColBuf, BitmapPalette& rPal,
         {
             long nPixSum = 0, nRSum = 0, nGSum = 0, nBSum = 0;
 
-            for( nR = nR1; nR <= nR2; nR++ )
+            for( long nR = nR1; nR <= nR2; nR++ )
             {
-                for( nG = nG1; nG <= nG2; nG++ )
+                for( long nG = nG1; nG <= nG2; nG++ )
                 {
-                    for( nB = nB1; nB <= nB2; nB++ )
+                    for( long nB = nB1; nB <= nB2; nB++ )
                     {
                         nPixSum = pBuf[ RGB15( nR, nG, nB ) ];
 
@@ -1983,13 +1982,13 @@ void Bitmap::ImplMedianCut( sal_uLong* pColBuf, BitmapPalette& rPal,
 
             if( nBLen > nGLen && nBLen > nRLen )
             {
-                nB = nB1 - 1;
+                long nB = nB1 - 1;
 
                 while( nPixNew < nTest )
                 {
                     nB++, nPixOld = nPixNew;
-                    for( nR = nR1; nR <= nR2; nR++ )
-                        for( nG = nG1; nG <= nG2; nG++ )
+                    for( long nR = nR1; nR <= nR2; nR++ )
+                        for( long nG = nG1; nG <= nG2; nG++ )
                             nPixNew += pBuf[ RGB15( nR, nG, nB ) ];
                 }
 
@@ -2006,13 +2005,13 @@ void Bitmap::ImplMedianCut( sal_uLong* pColBuf, BitmapPalette& rPal,
             }
             else if( nGLen > nRLen )
             {
-                nG = nG1 - 1;
+                long nG = nG1 - 1;
 
                 while( nPixNew < nTest )
                 {
                     nG++, nPixOld = nPixNew;
-                    for( nR = nR1; nR <= nR2; nR++ )
-                        for( nB = nB1; nB <= nB2; nB++ )
+                    for( long nR = nR1; nR <= nR2; nR++ )
+                        for( long nB = nB1; nB <= nB2; nB++ )
                             nPixNew += pBuf[ RGB15( nR, nG, nB ) ];
                 }
 
@@ -2029,13 +2028,13 @@ void Bitmap::ImplMedianCut( sal_uLong* pColBuf, BitmapPalette& rPal,
             }
             else
             {
-                nR = nR1 - 1;
+                long nR = nR1 - 1;
 
                 while( nPixNew < nTest )
                 {
                     nR++, nPixOld = nPixNew;
-                    for( nG = nG1; nG <= nG2; nG++ )
-                        for( nB = nB1; nB <= nB2; nB++ )
+                    for( long nG = nG1; nG <= nG2; nG++ )
+                        for( long nB = nB1; nB <= nB2; nB++ )
                             nPixNew += pBuf[ RGB15( nR, nG, nB ) ];
                 }
 
commit 9e1966d9ac537ac23d96e8bf28059fe60a40b92d
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sat Sep 24 17:29:57 2011 +0200

    cppcheck: reduce scope of var in vcl sft.cxx

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 443b93d..7b8fbf5 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -950,7 +950,6 @@ static int BSplineToPSPath(ControlPoint *srcA, int srcCount, PSPathElement **pat
 
 static char *nameExtract( const sal_uInt8* name, int nTableSize, int n, int dbFlag, sal_uInt16** ucs2result )
 {
-    int i;
     char *res;
     const sal_uInt8* ptr = name + GetUInt16(name, 4, 1) + GetUInt16(name + 6, 12 * n + 10, 1);
     int len = GetUInt16(name+6, 12 * n + 8, 1);
@@ -968,12 +967,14 @@ static char *nameExtract( const sal_uInt8* name, int nTableSize, int n, int dbFl
     if (dbFlag) {
         res = (char*)malloc(1 + len/2);
         assert(res != 0);
-        for (i = 0; i < len/2; i++) res[i] = *(ptr + i * 2 + 1);
+        for (int i = 0; i < len/2; i++)
+            res[i] = *(ptr + i * 2 + 1);
         res[len/2] = 0;
         if( ucs2result )
         {
             *ucs2result = (sal_uInt16*)malloc( len+2 );
-            for (i = 0; i < len/2; i++ ) (*ucs2result)[i] = GetUInt16( ptr, 2*i, 1 );
+            for (int i = 0; i < len/2; i++ )
+                (*ucs2result)[i] = GetUInt16( ptr, 2*i, 1 );
             (*ucs2result)[len/2] = 0;
         }
     } else {
@@ -1595,7 +1596,7 @@ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t )
     int i;
     sal_uInt32 length, tag;
     sal_uInt32 tdoffset = 0;        /* offset to TableDirectory in a TTC file. For TTF files is 0 */
-    int indexfmt, k;
+    int indexfmt;
 
     sal_uInt32 version = GetInt32(t->ptr, 0, 1);
 
@@ -1678,9 +1679,9 @@ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t )
         sal_uInt8* p = NULL;
         for( p = pHead + 12; p > t->ptr; --p ) {
             if( p[0]==0x5F && p[1]==0x0F && p[2]==0x3C && p[3]==0xF5 ) {
-                int nDelta = (pHead + 12) - p, j;
+                int nDelta = (pHead + 12) - p;
                 if( nDelta )
-                    for( j=0; j<NUM_TAGS; ++j )
+                    for( int j = 0; j < NUM_TAGS; ++j )
                         if( t->tables[j] )
                             *(char**)&t->tables[j] -= nDelta;
                 break;
@@ -1743,8 +1744,9 @@ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t )
         return SF_TTFORMAT;
     }
 
-    if( getTable(t, O_glyf) && getTable(t, O_loca) ) {  /* TTF or TTF-OpenType */
-        k = (getTableSize(t, O_loca) / (indexfmt ? 4 : 2)) - 1;
+    if( getTable(t, O_glyf) && getTable(t, O_loca) ) /* TTF or TTF-OpenType */
+    {
+        int k = (getTableSize(t, O_loca) / (indexfmt ? 4 : 2)) - 1;
         if( k < (int)t->nglyphs )       /* Hack for broken Chinese fonts */
             t->nglyphs = k;
 
@@ -2603,7 +2605,7 @@ GlyphData *GetTTRawGlyphData(TrueTypeFont *ttf, sal_uInt32 glyphID)
 {
     const sal_uInt8* glyf = getTable(ttf, O_glyf);
     const sal_uInt8* hmtx = getTable(ttf, O_hmtx);
-    int i, n, m;
+    int n;
 
     if( glyphID >= ttf->nglyphs )
         return 0;
@@ -2633,10 +2635,13 @@ GlyphData *GetTTRawGlyphData(TrueTypeFont *ttf, sal_uInt32 glyphID)
     /* now calculate npoints and ncontours */
     ControlPoint *cp;
     n = GetTTGlyphPoints(ttf, glyphID, &cp);
-    if (n != -1) {
-        m = 0;
-        for (i = 0; i < n; i++) {
-            if (cp[i].flags & 0x8000) m++;
+    if (n != -1)
+    {
+        int m = 0;
+        for (int i = 0; i < n; i++)
+        {
+            if (cp[i].flags & 0x8000)
+                m++;
         }
         d->npoints = (sal_uInt16)n;
         d->ncontours = (sal_uInt16)m;
commit f9dd399a574a06fb79812d2a29a7c862c46026da
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sat Sep 24 17:12:26 2011 +0200

    cppcheck: reduce scope of variabl.e in vcl, cff.cxx

diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx
index 231fe4e..85e710f 100644
--- a/vcl/source/fontsubset/cff.cxx
+++ b/vcl/source/fontsubset/cff.cxx
@@ -595,7 +595,6 @@ void CffSubsetterContext::setCharStringType( int nVal)
 void CffSubsetterContext::readDictOp( void)
 {
     ValType nVal = 0;
-    int nInt = 0;
     const U8 c = *mpReadPtr;
     if( c <= 21 ) {
         int nOpId = *(mpReadPtr++);
@@ -613,6 +612,7 @@ void CffSubsetterContext::readDictOp( void)
             return;
 
         //TODO: if( nStackIdx > 0)
+        int nInt = 0;
         switch( *pCmdName) {
         default: fprintf( stderr, "unsupported DictOp.type=\'%c\'\n", *pCmdName); break;
         case 'b':   // bool
commit ae21e90fe8edde305008f01ed838ab49313a31c2
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Fri Sep 23 17:31:00 2011 +0200

    dead code deleted in vcl toolbox.cxx

diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 2ecd61c..c19e6fb 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -1184,7 +1184,7 @@ void ToolBox::ImplLineSizing( ToolBox* pThis, const Point& rPos, Rectangle& rRec
         rRect.Bottom() = rRect.Top()+nSize-1;
     else if ( nLineMode & DOCK_LINELEFT )
         rRect.Left() = rRect.Right()-nSize;
-    else //if ( nLineMode & DOCK_LINETOP )
+    else
         rRect.Top() = rRect.Bottom()-nSize;
 
     pThis->mnDockLines = i;
@@ -2271,12 +2271,6 @@ sal_uInt16 ToolBox::ImplCalcBreaks( long nWidth, long* pMaxLineWidth, sal_Bool b
             if( nMaxLineWidth < aMinWidth )
                 nMaxLineWidth = aMinWidth;
         }
-
-        // Wegen Separatoren kann MaxLineWidth > Width werden, hat aber
-        // auf die Umbrueche keine Auswirkung
-        //if ( nMaxLineWidth > nWidth )
-        //    nMaxLineWidth = nWidth;
-
         *pMaxLineWidth = nMaxLineWidth;
     }
 
@@ -2539,16 +2533,6 @@ void ToolBox::ImplFormat( sal_Bool bResize )
         while ( it != mpData->m_aItems.end() )
         {
             it->maRect = aEmptyRect;
-
-            // For items not visible, release resources only needed during
-            // painting the items (on Win98, for example, these are system-wide
-            // resources that are easily exhausted, so be nice):
-
-            /* !!!
-                it->maImage.ClearCaches();
-                it->maHighImage.ClearCaches();
-            */
-
             ++it;
         }
 
@@ -2883,17 +2867,7 @@ void ToolBox::ImplFormat( sal_Bool bResize )
         while ( it != mpData->m_aItems.end() )
         {
             it->maRect = it->maCalcRect;
-            if (!it->maRect.IsOver(aVisibleRect))
-            {
-                // For items not visible, release resources only needed during
-                // painting the items (on Win98, for example, these are system-
-                // wide resources that are easily exhausted, so be nice):
-
-                /* !!!
-                it->maImage.ClearCaches();
-                it->maHighImage.ClearCaches();
-                */
-            }
+            it->maRect.IsOver(aVisibleRect);
             ++it;
         }
     }
@@ -3618,8 +3592,6 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_uInt16 nHighlight, sal_Bool bPa
 
         // #i35563# the dontknow state indicates different states at the same time
         // which should not be rendered disabled but normal
-        //if ( pItem->meState == STATE_DONTKNOW )
-        //    nImageStyle |= IMAGE_DRAW_DISABLE;
 
         // draw the image
         nImageOffX = nOffX;
@@ -3668,26 +3640,15 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_uInt16 nHighlight, sal_Bool bPa
             bRotate = sal_True;
 
             Font aRotateFont = aOldFont;
-            /*
-            if ( meAlign == WINDOWALIGN_LEFT )
-            {
-                aRotateFont.SetOrientation( 900 );
-                nTextOffX += (nBtnWidth-aTxtSize.Height())/2;
-                nTextOffY += aTxtSize.Width();
-                nTextOffY += (nBtnHeight-aTxtSize.Width())/2;
-            }
-            else*/
-            {
-                aRotateFont.SetOrientation( 2700 );
+            aRotateFont.SetOrientation( 2700 );
 
-                // center horizontally
-                nTextOffX += aTxtSize.Height();
-                nTextOffX += (nBtnWidth-aTxtSize.Height())/2;
+            // center horizontally
+            nTextOffX += aTxtSize.Height();
+            nTextOffX += (nBtnWidth-aTxtSize.Height())/2;
 
-                // add in image offset
-                if( bImage )
-                    nTextOffY = nImageOffY + aImageSize.Height() + TB_IMAGETEXTOFFSET;
-            }
+            // add in image offset
+            if( bImage )
+                nTextOffY = nImageOffY + aImageSize.Height() + TB_IMAGETEXTOFFSET;
 
             SetFont( aRotateFont );
         }
@@ -3699,7 +3660,6 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_uInt16 nHighlight, sal_Bool bPa
             // add in image offset
             if( bImage )
                 nTextOffX = nImageOffX + aImageSize.Width() + TB_IMAGETEXTOFFSET;
-            //nTextOffX += TB_TEXTOFFSET/2;
         }
 
         // draw selection only if not already drawn during image output (see above)
@@ -4096,19 +4056,6 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt )
     Window *pWin = Application::GetFocusWindow();
     if( pWin && pWin->ImplGetWindowImpl()->mbToolBox && pWin != this )
         bDrawHotSpot = sal_False;
-    /*
-    else
-        if( pWin && !pWin->ImplGetWindowImpl()->mbToolBox )
-            while( pWin )
-            {
-                pWin = pWin->GetParent();
-                if( pWin && pWin->ImplGetWindowImpl()->mbToolBox )
-                {
-                    bDrawHotSpot = sal_False;
-                    break;
-                }
-            }
-            */
 
     if ( mbSelection && bDrawHotSpot )
     {
commit 83ad767defb890c7557b99ce7c46aaed2d16980c
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Fri Sep 23 17:16:44 2011 +0200

    cppcheck: reduce scope of var in vcl toolbox.cxx

diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 742d821..2ecd61c 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -1877,7 +1877,6 @@ sal_Bool ToolBox::ImplCalcItem()
     long            nDefHeight;
     long            nMaxWidth = 0;
     long            nMaxHeight = 0;
-    long            nHeight;
     long            nMinWidth   = 6;
     long            nMinHeight  = 6;
     long            nDropDownArrowWidth = TB_DROPDOWNARROWWIDTH;
@@ -2038,7 +2037,7 @@ sal_Bool ToolBox::ImplCalcItem()
                 // Gegebenenfalls die Fensterhoehe mit beruecksichtigen
                 if ( it->mpWindow )
                 {
-                    nHeight = it->mpWindow->GetSizePixel().Height();
+                    long nHeight = it->mpWindow->GetSizePixel().Height();
                     if ( nHeight > mnWinHeight )
                         mnWinHeight = nHeight;
                 }
@@ -2387,12 +2386,8 @@ void ToolBox::ImplFormat( sal_Bool bResize )
     Rectangle       aEmptyRect;
     long            nLineSize;
     long            nLeft;
-    long            nRight;
     long            nTop;
-    long            nBottom;
     long            nMax;   // width of layoutarea in pixels
-    long            nX;
-    long            nY;
     sal_uInt16          nFormatLine;
     sal_Bool            bMustFullPaint;
     sal_Bool            bLastSep;
@@ -2438,6 +2433,7 @@ void ToolBox::ImplFormat( sal_Bool bResize )
     // Horizontal
     if ( mbHorz )
     {
+        long nBottom;
         // nLineSize: height of a single line, will fit highest item
         nLineSize = mnMaxItemHeight;
 
@@ -2488,6 +2484,7 @@ void ToolBox::ImplFormat( sal_Bool bResize )
     }
     else
     {
+        long nRight;
         nLineSize = mnMaxItemWidth;
 
         if ( mbScroll )
@@ -2562,8 +2559,8 @@ void ToolBox::ImplFormat( sal_Bool bResize )
     else
     {
         // init start values
-        nX          = nLeft;    // top-left offset
-        nY          = nTop;
+        long nX = nLeft;    // top-left offset
+        long nY = nTop;
         nFormatLine = 1;
         bLastSep    = sal_True;
 
@@ -3464,8 +3461,6 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_uInt16 nHighlight, sal_Bool bPa
     long    nOffY       = SMALLBUTTON_OFF_NORMAL_Y;
     long    nImageOffX  = 0;
     long    nImageOffY  = 0;
-    long    nTextOffX   = 0;
-    long    nTextOffY   = 0;
     sal_uInt16  nStyle      = 0;
 
     // draw separators in flat style only
@@ -3662,8 +3657,8 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_uInt16 nHighlight, sal_Bool bPa
     sal_Bool bRotate = sal_False;
     if ( bText )
     {
-        nTextOffX = nOffX;
-        nTextOffY = nOffY;
+        long nTextOffX = nOffX;
+        long nTextOffY = nOffY;
 
         // rotate text when vertically docked
         Font aOldFont = GetFont();
commit b01f94c5ae9e3bb0c5ed1660b460b117431ff7a4
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Fri Sep 23 16:51:29 2011 +0200

    cppcheck: scope reduction of var in vcl outdev3.cxx
    
    and deletion of a varialbe used as constant since 2002

diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index 24ab4b8..b0f59cd 100755
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -613,12 +613,14 @@ Font OutputDevice::GetDefaultFont( sal_uInt16 nType, LanguageType eLang,
         {
             if ( nFlags & DEFAULTFONT_FLAGS_ONLYONE )
             {
-                xub_StrLen nIndex = 0;
 
                 if( !pOutDev )
                     pOutDev = (const OutputDevice *)ImplGetSVData()->mpDefaultWin;
                 if( !pOutDev )
+                {
+                    xub_StrLen nIndex = 0;
                     aFont.SetName( aSearch.GetToken( 0, ';', nIndex ) );
+                }
                 else
                 {
                     pOutDev->ImplInitFontList();
@@ -4408,12 +4410,9 @@ void OutputDevice::ImplDrawEmphasisMark( long nBaseX, long nX, long nY,
                                          const PolyPolygon& rPolyPoly, sal_Bool bPolyLine,
                                          const Rectangle& rRect1, const Rectangle& rRect2 )
 {
-    // TODO: pass nWidth as width of this mark
-    long nWidth = 0;
-
     if( IsRTLEnabled() )
         // --- RTL --- mirror at basex
-        nX = nBaseX - nWidth - (nX - nBaseX - 1);
+        nX = nBaseX - (nX - nBaseX - 1);
 
     nX -= mnOutOffX;
     nY -= mnOutOffY;
commit a267506512cdebae2272009a07637345f719bfa5
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Fri Sep 23 16:36:15 2011 +0200

    cppcheck: reduce scope of var in vcl outdev2.cxx

diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx
index d1a76a9..ea57043 100644
--- a/vcl/source/gdi/outdev2.cxx
+++ b/vcl/source/gdi/outdev2.cxx
@@ -1639,7 +1639,7 @@ Bitmap OutputDevice::ImplBlendWithAlpha( Bitmap              aBmp,
 {
     BitmapColor aDstCol,aSrcCol;
     Bitmap      res;
-    int         nX, nOutX, nY, nOutY;
+    int         nX, nY;
 
     OSL_ENSURE(mpAlphaVDev,
                "ImplBlendWithAlpha(): call me only with valid alpha VDev!" );
@@ -1659,10 +1659,13 @@ Bitmap OutputDevice::ImplBlendWithAlpha( Bitmap              aBmp,
 
         if( pB && pP && pA && pW && pAlphaW )
         {
+            int nOutY;
+
             for( nY = 0, nOutY = nOffY; nY < nDstHeight; nY++, nOutY++ )
             {
                 const long nMapY = pMapY[ nY ];
                 const long nModY = ( nOutY & 0x0FL ) << 4L;
+                int nOutX;
 
                 for( nX = 0, nOutX = nOffX; nX < nDstWidth; nX++, nOutX++ )
                 {
@@ -1765,7 +1768,7 @@ Bitmap OutputDevice::ImplBlend( Bitmap              aBmp,
 {
     BitmapColor aDstCol;
     Bitmap      res;
-    int         nX, nOutX, nY, nOutY;
+    int         nX, nY;
 
     if( GetBitCount() <= 8 )
     {
@@ -1776,10 +1779,13 @@ Bitmap OutputDevice::ImplBlend( Bitmap              aBmp,
 
         if( pB && pP && pA && pW )
         {
+            int nOutY;
+
             for( nY = 0, nOutY = nOffY; nY < nDstHeight; nY++, nOutY++ )
             {
                 const long nMapY = pMapY[ nY ];
                 const long nModY = ( nOutY & 0x0FL ) << 4L;
+                int nOutX;
 
                 for( nX = 0, nOutX = nOffX; nX < nDstWidth; nX++, nOutX++ )
                 {
commit bd4200dc20f6b26f71a358cf219f61d579689f31
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Wed Sep 21 17:44:35 2011 +0200

    cppcheck: delete unneeded variable in connectivity testmoz/main.cxx

diff --git a/connectivity/workben/testmoz/main.cxx b/connectivity/workben/testmoz/main.cxx
index 86e991e..798bbca 100644
--- a/connectivity/workben/testmoz/main.cxx
+++ b/connectivity/workben/testmoz/main.cxx
@@ -100,7 +100,6 @@ void printColumns( Reference<XResultSet> &xRes )
 {
     if(xRes.is()) {
         char* aPat = " %-22s ";
-        char* aPat_Short = " %-12s ";
         Reference<XResultSetMetaData> xMeta = Reference<XResultSetMetaDataSupplier>(xRes,UNO_QUERY)->getMetaData();
         printf( "ColumnCount = %d\n", xMeta->getColumnCount());
         for(sal_Int32 i=1;i<=xMeta->getColumnCount();++i)
@@ -117,7 +116,6 @@ void printColumns( Reference<XResultSet> &xRes )
 void printXResultSet( Reference<XResultSet> &xRes )
 {
     if(xRes.is()) {
-        char* aPat = " %-22s ";
         char* aPat_Short = " %-12s ";
         Reference<XRow> xRow(xRes,UNO_QUERY);
         Reference<XResultSetMetaData> xMeta = Reference<XResultSetMetaDataSupplier>(xRes,UNO_QUERY)->getMetaData();
commit 162800bbafc27ecc3117f43077811868f08af5d5
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sun Sep 11 15:35:59 2011 +0200

    cppcheck: delete unneded variable in slideshow, OGLTrans_Tran...Impl.cxx
    
    but left the call to the function behind, since not sure there is
    no effect on data

diff --git a/slideshow/source/engine/OGLTrans/unx/OGLTrans_TransitionerImpl.cxx b/slideshow/source/engine/OGLTrans/unx/OGLTrans_TransitionerImpl.cxx
index d03d0e3..c8cad45 100644
--- a/slideshow/source/engine/OGLTrans/unx/OGLTrans_TransitionerImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/unx/OGLTrans_TransitionerImpl.cxx
@@ -533,7 +533,7 @@ bool OGLTransitionerImpl::createWindow( Window* pPWindow )
       SystemWindowData winData;
       winData.nSize = sizeof(winData);
       pWindow=new SystemChildWindow(pPWindow, 0, &winData, sal_False);
-      const SystemEnvData* pChildSysData = pWindow->GetSystemData();
+      pWindow->GetSystemData();
 #endif
 
       if( pWindow )
commit 97fb350c10a1448590292c20192b31f245a69622
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sat Sep 10 15:15:58 2011 +0200

    cppcheck: unread Var deleted in autodoc, cx_c_pp.cxx

diff --git a/autodoc/source/parser/cpp/cx_c_pp.cxx b/autodoc/source/parser/cpp/cx_c_pp.cxx
index 9c81fe7..afb389e 100644
--- a/autodoc/source/parser/cpp/cx_c_pp.cxx
+++ b/autodoc/source/parser/cpp/cx_c_pp.cxx
@@ -98,9 +98,7 @@ Context_Preprocessor::ReadDefine( CharacterSource & io_rText )
           cNext = io_rText.MoveOn() )
     { }
 
-    bool bMacro = cNext == '(';
-
-    if ( NOT bMacro )
+    if ( NOT (cNext == '(') )
     {
         SetNewToken( new Tok_DefineName(io_rText.CutToken()) );
         SetFollowUpContext( pContext_PP_Definition.Ptr() );
commit 35579b7f6e9cb761dea98bf33beb4f43d0b51dac
Author: Pierre-André Jacquod <pjacquod at alumni.ethz.ch>
Date:   Sat Sep 10 14:35:57 2011 +0200

    cppcheck: deleted unread Var in autodoc, hdimpl.cxx

diff --git a/autodoc/source/display/html/hdimpl.cxx b/autodoc/source/display/html/hdimpl.cxx
index f9d2b0f..c3d5bd8 100644
--- a/autodoc/source/display/html/hdimpl.cxx
+++ b/autodoc/source/display/html/hdimpl.cxx
@@ -226,12 +226,11 @@ Get_LinkedTypeText( csi::xml::Element &             o_rOut,
      const char * sName = "";
      const char * sPostName = "";
 
-    bool bTypeExists = Get_TypeText( sPreName,
-                                     sName,
-                                     sPostName,
-                                     i_nId,
-                                     i_rEnv.Gate() );
-    if ( NOT bTypeExists )
+    if ( NOT Get_TypeText( sPreName,
+                           sName,
+                           sPostName,
+                           i_nId,
+                           i_rEnv.Gate() ) )
         return;
 
     if ( NOT i_bWithAbsolutifier AND strncmp(sPreName,"::",2) == 0 )


More information about the Libreoffice-commits mailing list