[Libreoffice-commits] core.git: 2 commits - chart2/source sc/source sw/source xmloff/source

Julien Nabet serval2412 at yahoo.fr
Sun Apr 7 13:21:21 PDT 2013


 chart2/source/controller/dialogs/ObjectNameProvider.cxx |    9 +++------
 chart2/source/tools/ObjectIdentifier.cxx                |    7 ++-----
 sc/source/filter/qpro/qpro.cxx                          |    3 +--
 sw/source/ui/shells/textsh1.cxx                         |    3 +--
 xmloff/source/core/xmluconv.cxx                         |    3 +--
 5 files changed, 8 insertions(+), 17 deletions(-)

New commits:
commit 3f3980ff242203e45e10c8fb13f871f968377383
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sun Apr 7 22:18:57 2013 +0200

    Some cppcheck cleaning
    
    Change-Id: I425ed98a721ded162c2ae08d145aaa9dbf548632

diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
index 6ef7bd9..29a3f38 100644
--- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx
+++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
@@ -509,9 +509,8 @@ OUString ObjectNameProvider::getHelpText( const OUString& rObjectCID, const Refe
             sal_Int32 nPointIndex( ObjectIdentifier::getParticleID(rObjectCID).toInt32() );
 
             //replace data point index
-            sal_Int32 nIndex = -1;
             OUString aWildcard(  "%POINTNUMBER" );
-            nIndex = aRet.indexOf( aWildcard );
+            sal_Int32 nIndex = aRet.indexOf( aWildcard );
             if( nIndex != -1 )
             {
                 aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), OUString::valueOf(nPointIndex+1) );
@@ -569,9 +568,8 @@ OUString ObjectNameProvider::getHelpText( const OUString& rObjectCID, const Refe
                         RegressionCurveHelper::initializeCurveCalculator( xCalculator, xSeries, xChartModel );
 
                         // replace formula
-                        sal_Int32 nIndex = -1;
                         OUString aWildcard( "%FORMULA" );
-                        nIndex = aRet.indexOf( aWildcard );
+                        sal_Int32 nIndex = aRet.indexOf( aWildcard );
                         if( nIndex != -1 )
                             aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), xCalculator->getRepresentation());
 
@@ -620,9 +618,8 @@ OUString ObjectNameProvider::getHelpText( const OUString& rObjectCID, const Refe
 
                         sal_Unicode aDecimalSep( '.' );
 
-                        sal_Int32 nIndex = -1;
                         OUString aWildcard( "%AVERAGE_VALUE" );
-                        nIndex = aRet.indexOf( aWildcard );
+                        sal_Int32 nIndex = aRet.indexOf( aWildcard );
                         // as the curve is constant, the value at any x-value is ok
                         if( nIndex != -1 )
                         {
diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx
index 1097984..8d4b3ba 100644
--- a/chart2/source/tools/ObjectIdentifier.cxx
+++ b/chart2/source/tools/ObjectIdentifier.cxx
@@ -764,8 +764,7 @@ bool ObjectIdentifier::isMultiClickObject( const OUString& rClassifiedIdentifier
     //was selected before;
 
     //!!!!! by definition the name of a MultiClickObject starts with "CID/MultiClick:"
-    bool bRet = false;
-    bRet = rClassifiedIdentifier.match( m_aMultiClick, m_aProtocol.getLength() );
+    bool bRet = rClassifiedIdentifier.match( m_aMultiClick, m_aProtocol.getLength() );
     return bRet;
 }
 
@@ -1027,11 +1026,9 @@ OUString ObjectIdentifier::createChildParticleWithIndex( ObjectType eObjectType,
 
 sal_Int32 ObjectIdentifier::getIndexFromParticleOrCID( const OUString& rParticleOrCID )
 {
-    sal_Int32 nRet = -1;
-
     OUString aIndexString = lcl_getIndexStringAfterString( rParticleOrCID, "=" );
     sal_Int32 nCharacterIndex=0;
-    nRet = lcl_StringToIndex( aIndexString.getToken( 0, ',', nCharacterIndex ) );
+    sal_Int32 nRet = lcl_StringToIndex( aIndexString.getToken( 0, ',', nCharacterIndex ) );
 
     return nRet;
 }
diff --git a/sc/source/filter/qpro/qpro.cxx b/sc/source/filter/qpro/qpro.cxx
index 1247ecc..f665884 100644
--- a/sc/source/filter/qpro/qpro.cxx
+++ b/sc/source/filter/qpro/qpro.cxx
@@ -126,9 +126,8 @@ FltError ScQProReader::readSheet( SCTAB nTab, ScDocument* pDoc, ScQProStyle *pSt
 
 FltError ScFormatFilterPluginImpl::ScImportQuattroPro( SfxMedium &rMedium, ScDocument *pDoc )
 {
-    FltError   eRet = eERR_OK;
     ScQProReader aReader( rMedium );
-    eRet = aReader.import( pDoc );
+    FltError eRet = aReader.import( pDoc );
     return eRet;
 }
 
diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx
index 056a5c8..23b8500 100644
--- a/xmloff/source/core/xmluconv.cxx
+++ b/xmloff/source/core/xmluconv.cxx
@@ -431,11 +431,10 @@ sal_Bool SvXMLUnitConverter::convertDateTime( double& fDateTime,
 
     if (bSuccess)
     {
-        double fTempDateTime = 0.0;
         const Date aTmpNullDate(aTempNullDate.Day, aTempNullDate.Month, aTempNullDate.Year);
         const Date aTempDate((sal_uInt16)aDateTime.Day, (sal_uInt16)aDateTime.Month, (sal_uInt16)aDateTime.Year);
         const sal_Int32 nTage = aTempDate - aTmpNullDate;
-        fTempDateTime = nTage;
+        double fTempDateTime = nTage;
         double Hour = aDateTime.Hours;
         double Min = aDateTime.Minutes;
         double Sec = aDateTime.Seconds;
commit 5bd53db1aebc00c19be7dd6fd9c93391baca032f
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sun Apr 7 21:59:04 2013 +0200

    Fix variable reassigned before the old value has been used
    
    Change-Id: I7e862741e576d7a00b0fe09e4e8ab4ce5048e18b

diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx
index f0c07c7..b5e01bd 100644
--- a/sw/source/ui/shells/textsh1.cxx
+++ b/sw/source/ui/shells/textsh1.cxx
@@ -1314,9 +1314,8 @@ void SwTextShell::GetState( SfxItemSet &rSet )
 
                 // get keyboard language
                 String aKeyboardLang;
-                LanguageType nLang = LANGUAGE_DONTKNOW;
                 SwEditWin& rEditWin = GetView().GetEditWin();
-                nLang = rEditWin.GetInputLanguage();
+                LanguageType nLang = rEditWin.GetInputLanguage();
                 if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
                     aKeyboardLang = aLangTable.GetString( nLang );
 


More information about the Libreoffice-commits mailing list