[Libreoffice-commits] .: 5 commits - i18npool/source rsc/source svl/source svtools/source

Caolán McNamara caolan at kemper.freedesktop.org
Thu Dec 9 05:07:03 PST 2010


 i18npool/source/localedata/saxparser.cxx |   28 ++++------------------------
 rsc/source/tools/rsctools.cxx            |   18 ++++++++++--------
 svl/source/numbers/zforscan.cxx          |    1 -
 svtools/source/control/ruler.cxx         |    2 +-
 svtools/source/edit/texteng.cxx          |    2 +-
 5 files changed, 16 insertions(+), 35 deletions(-)

New commits:
commit b2aec1683e83bd295941da409a7aae2343cf8c15
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Dec 9 12:57:14 2010 +0000

    WaE, unused variable

diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index a456a64..495314a 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -1620,7 +1620,6 @@ xub_StrLen ImpSvNumberformatScan::FinalScan( String& rString, String& rComment )
                         if (rtl::OUString::valueOf(sDiv.toInt32()) == sDiv)
                         {
                             /* Found a Divisor */
-                            sal_Int32 nDiv = sDiv.toInt32();
                             while (i < j)
                                 nTypeArray[i++] = NF_SYMBOLTYPE_FRAC_FDIV;
                             i = j - 1;                            // Stop the loop
commit 69f88f2d01a927e782431a23578644791362988f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Dec 9 12:42:25 2010 +0000

    cppcheck: can reduce the scope of these variables

diff --git a/rsc/source/tools/rsctools.cxx b/rsc/source/tools/rsctools.cxx
index eb97648..7262cf6 100644
--- a/rsc/source/tools/rsctools.cxx
+++ b/rsc/source/tools/rsctools.cxx
@@ -152,18 +152,20 @@ ByteString GetTmpFileName()
 BOOL Append( FILE * fDest, ByteString aTmpFile )
 {
 #define MAX_BUF 4096
-    char	szBuf[ MAX_BUF ];
-    int	    nItems;
-    FILE	*fSource;
-
-    fSource = fopen( aTmpFile.GetBuffer(), "rb" );
-    if( !fDest || !fSource ){
+    FILE *fSource = fopen( aTmpFile.GetBuffer(), "rb" );
+    if( !fDest || !fSource )
+    {
         if( fSource )
             fclose( fSource );
         return FALSE;
     }
-    else{
-        do{ // append
+    else
+    {
+        char szBuf[ MAX_BUF ];
+        int nItems;
+
+        do //appemd
+        {
             nItems = fread( szBuf, sizeof( char ), MAX_BUF, fSource );
             fwrite( szBuf, sizeof( char ), nItems, fDest );
         } while( MAX_BUF == nItems );
commit 8376ca05b66279be7397d1941578bb03081759c7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Dec 9 12:31:30 2010 +0000

    cppcheck: can reduce the scope of this variable

diff --git a/svtools/source/edit/texteng.cxx b/svtools/source/edit/texteng.cxx
index 035e6c2..b3d35d6 100644
--- a/svtools/source/edit/texteng.cxx
+++ b/svtools/source/edit/texteng.cxx
@@ -2091,7 +2091,6 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan
             return;
 
         ULONG nParaHeight = CalcParaHeight( nPara );
-        USHORT nIndex = 0;
         if ( ( !pPaintArea || ( ( nY + (long)nParaHeight ) > pPaintArea->Top() ) )
                 && ( !pPaintRange || ( ( nPara >= pPaintRange->GetStart().GetPara() ) && ( nPara <= pPaintRange->GetEnd().GetPara() ) ) ) )
         {
@@ -2099,6 +2098,7 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan
             // Ueber die Zeilen des Absatzes...
             // --------------------------------------------------
             USHORT nLines = pPortion->GetLines().Count();
+            USHORT nIndex = 0;
             for ( USHORT nLine = 0; nLine < nLines; nLine++ )
             {
                 TextLine* pLine = pPortion->GetLines().GetObject(nLine);
commit e7e86dbafccadf7b3ed2af29a5fc9f1b3431ad9e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Dec 9 12:29:56 2010 +0000

    great hunks of this are unused

diff --git a/i18npool/source/localedata/saxparser.cxx b/i18npool/source/localedata/saxparser.cxx
index a5353d6..98d2e5a 100644
--- a/i18npool/source/localedata/saxparser.cxx
+++ b/i18npool/source/localedata/saxparser.cxx
@@ -144,11 +144,10 @@ class TestDocumentHandler :
     public WeakImplHelper3< XExtendedDocumentHandler , XEntityResolver , XErrorHandler >
 {
 public:
-    TestDocumentHandler(const char* locale, const char* outFile ) :
-      rootNode(0), nError(0), nbOfCurrencies(0), nbOfCalendars(0), nbOfFormatElements(0), 
-      nbOfTransliterations(0), nbOfCollations(0), nbOfDays(50), nbOfMonths(50), nbOfEras(10),
-      flag(-1), of(outFile, locale), isStartDayOfWeek(false), foundDefaultName(false),
-      foundVariant(false), openElement(false)
+    TestDocumentHandler(const char* locale, const char* outFile )
+        : rootNode(0)
+        , nError(0)
+        , of(outFile, locale)
     {
         strncpy( theLocale, locale, sizeof(theLocale) );
         theLocale[sizeof(theLocale)-1] = 0;
@@ -247,10 +246,6 @@ public: // ExtendedDocumentHandler
 
         LocaleNode * l = currentNode.top();
         l->setValue (aChars);
-        ::rtl::OUString str(aChars);
-        sal_Unicode nonBreakSPace[2]= {0xa, 0x0};
-        if(!openElement || str.equals(nonBreakSPace))
-          return;
     }
 
     virtual void SAL_CALL ignorableWhitespace(const OUString& /*aWhitespaces*/) throw (SAXException,RuntimeException)
@@ -303,23 +298,8 @@ public: // ExtendedDocumentHandler
 
 public:
     int nError;
-    ::rtl::OUString currentElement;
-    sal_Int16 nbOfCurrencies;
-    sal_Int16 nbOfCalendars;
-    sal_Int16 nbOfFormatElements;
-    sal_Int16 nbOfTransliterations;
-    sal_Int16 nbOfCollations;
-    Sequence<sal_Int16> nbOfDays;
-    Sequence<sal_Int16> nbOfMonths;
-    Sequence<sal_Int16> nbOfEras;
-    sal_Char *elementTag;
     sal_Char theLocale[50];
-    sal_Int16 flag;
     OFileWriter of;
-    sal_Bool isStartDayOfWeek;
-    sal_Bool foundDefaultName;
-    sal_Bool foundVariant;
-        sal_Bool openElement;
 };
 
 
commit 36256eb83ac4cafc74afe79bac5e163922d53b62
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Dec 9 12:10:29 2010 +0000

    cppcheck: scope of these variables can be reduced

diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index e76231b..340aac4 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -465,7 +465,6 @@ void Ruler::ImplInvertLines( BOOL bErase )
 void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter )
 {
     long    n = 0;
-    long    nTick = 0;
     long    nTick3 = aImplRulerUnitTab[mnUnitIndex].nTick3;
     long    nTickCount = aImplRulerUnitTab[mnUnitIndex].nTick1;
     Size    aPixSize = maVirDev.LogicToPixel( Size( nTick3, nTick3 ), maMapMode );
@@ -568,6 +567,7 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter )
     {
         long nTxtWidth2;
         long nTxtHeight2 = GetTextHeight()/2;
+        long nTick = 0;
         while ( ((nStart-n) >= nMin) || ((nStart+n) <= nMax) )
         {
             // Null-Punkt


More information about the Libreoffice-commits mailing list