[Libreoffice-commits] core.git: 9 commits - sc/source

Eike Rathke erack at redhat.com
Tue Jul 15 08:31:59 PDT 2014


 sc/source/core/data/attarray.cxx |   10 ++++------
 sc/source/core/tool/chgtrack.cxx |    4 ++--
 sc/source/core/tool/interpr1.cxx |   12 +++++-------
 sc/source/core/tool/interpr2.cxx |    2 +-
 sc/source/core/tool/interpr3.cxx |    4 ++--
 sc/source/core/tool/interpr4.cxx |    3 +--
 6 files changed, 15 insertions(+), 20 deletions(-)

New commits:
commit b409aaa7d65151106236058d3c478bd7f87dd296
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Jul 15 17:27:16 2014 +0200

    CID#703984 Unchecked return value (CHECKED_RETURN)
    
    Change-Id: I5b0c633e25326272aed3bae0bf0847839a45d723

diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index a18d0d3..db032e1 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -2973,8 +2973,8 @@ void ScChangeTrack::Dependencies( ScChangeAction* pAct )
         if ( ScChangeActionContent::GetContentCellType(rCell) == SC_CACCT_MATREF )
         {
             ScAddress aOrg;
-            rCell.mpFormula->GetMatrixOrigin(aOrg);
-            ScChangeActionContent* pContent = SearchContentAt( aOrg, pAct );
+            bool bOrgFound = rCell.mpFormula->GetMatrixOrigin(aOrg);
+            ScChangeActionContent* pContent = (bOrgFound ? SearchContentAt( aOrg, pAct ) : NULL);
             if ( pContent && pContent->IsMatrixOrigin() )
             {
                 AddDependentWithNotify( pContent, pAct );
commit 9d929e5682b2dd70c6ede90d117fa3f24fb01f86
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Jul 15 17:23:26 2014 +0200

    CID#703986 Unchecked return value (CHECKED_RETURN)
    
    Change-Id: I44149fca38e36be6d4302b2af93e72ae9093796a

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index f1d2227..544f173 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -2608,10 +2608,10 @@ void ScInterpreter::ScIsNV()
         case svSingleRef :
         {
             ScAddress aAdr;
-            PopDoubleRefOrSingleRef( aAdr );
+            bool bOk = PopDoubleRefOrSingleRef( aAdr );
             if ( nGlobalError == NOTAVAILABLE )
                 nRes = true;
-            else
+            else if (bOk)
             {
                 ScRefCellValue aCell;
                 aCell.assign(*pDok, aAdr);
commit 94b3b4fdf1023396287894c0d985683b48f55099
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Jul 15 17:20:25 2014 +0200

    CID#703987 Unchecked return value (CHECKED_RETURN)
    
    Change-Id: I0e5bf12f1b874e3aa5428c92487cb58ef16c9cc3

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index e365966..f1d2227 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -2656,8 +2656,8 @@ void ScInterpreter::ScIsErr()
         case svSingleRef :
         {
             ScAddress aAdr;
-            PopDoubleRefOrSingleRef( aAdr );
-            if ( nGlobalError && nGlobalError != NOTAVAILABLE )
+            bool bOk = PopDoubleRefOrSingleRef( aAdr );
+            if ( !bOk || (nGlobalError && nGlobalError != NOTAVAILABLE) )
                 nRes = true;
             else
             {
commit 6b84beb590417c6e8df024099537ddccb8a984e1
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Jul 15 17:12:58 2014 +0200

    pDok can't be NULL, remove superfluous check
    
    Change-Id: I639d6e27dd1a44ff878a2e0188fc42e27993b39f

diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 55b7ccb..c6df5fc 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -3746,8 +3746,7 @@ const ScCalcConfig& ScInterpreter::GetGlobalConfig()
 void ScInterpreter::MergeCalcConfig()
 {
     maCalcConfig = maGlobalConfig;
-    if (pDok)
-        maCalcConfig.MergeDocumentSpecific( pDok->GetCalcConfig());
+    maCalcConfig.MergeDocumentSpecific( pDok->GetCalcConfig());
 }
 
 void ScInterpreter::GlobalExit()
commit b057b1f5697477046d731a234489e1d213efc9e6
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Jul 15 17:11:03 2014 +0200

    CID#735794 Dereference after null check (FORWARD_NULL)
    
    pDok can't be NULL, remove superfluous check.
    
    Change-Id: Ica1708f1b2c37bffbe388f22e8ac19a81b144f6d

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index df65daa..e365966 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -4357,9 +4357,7 @@ void ScInterpreter::ScMatch()
             }
             if (rItem.meType == ScQueryEntry::ByString)
             {
-                bool bIsVBAMode = false;
-                if ( pDok )
-                    bIsVBAMode = pDok->IsInVBAMode();
+                bool bIsVBAMode = pDok->IsInVBAMode();
 
                 // #TODO handle MSO wildcards
                 if ( bIsVBAMode )
commit 945c16c52794b50ce41e813e095e01222991091d
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Jul 15 17:08:03 2014 +0200

    CID#1000520 Logically dead code (DEADCODE)
    
    Change-Id: Ib33dcd05dd6a9216c6138eafc550a257af97d8ab

diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 8cea1ac..050b486 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -1114,9 +1114,8 @@ bool ScAttrArray::ApplyFrame( const SvxBoxItem*     pBoxItem,
         {
             if ( pBoxInfoItem->IsValid(VALID_LEFT) )
                 aNewFrame.SetLine( pBoxItem->GetLeft(), BOX_LINE_RIGHT );
-            if ( (nDistRight==0) ? pBoxInfoItem->IsValid(VALID_RIGHT) : pBoxInfoItem->IsValid(VALID_VERT) )
-                aNewFrame.SetLine( (nDistRight==0) ? pBoxItem->GetRight() : pBoxInfoItem->GetVert(),
-                    BOX_LINE_LEFT );
+            if ( pBoxInfoItem->IsValid(VALID_RIGHT) )
+                aNewFrame.SetLine( pBoxItem->GetRight(), BOX_LINE_LEFT );
         }
         else
         {
commit e57d98227da6c15c9970fc64658ffa3dcf9115fc
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Jul 15 17:01:35 2014 +0200

    CID#1000519 Logically dead code (DEADCODE)
    
    Change-Id: I785901d6694fe914325965136852ed3098e59434

diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 3cfc9be..8cea1ac 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -1112,9 +1112,8 @@ bool ScAttrArray::ApplyFrame( const SvxBoxItem*     pBoxItem,
     {
         if( bLeft && nDistRight==0)
         {
-            if ( bLeft ? pBoxInfoItem->IsValid(VALID_LEFT) : pBoxInfoItem->IsValid(VALID_VERT) )
-                aNewFrame.SetLine( bLeft ? pBoxItem->GetLeft() : pBoxInfoItem->GetVert(),
-                    BOX_LINE_RIGHT );
+            if ( pBoxInfoItem->IsValid(VALID_LEFT) )
+                aNewFrame.SetLine( pBoxItem->GetLeft(), BOX_LINE_RIGHT );
             if ( (nDistRight==0) ? pBoxInfoItem->IsValid(VALID_RIGHT) : pBoxInfoItem->IsValid(VALID_VERT) )
                 aNewFrame.SetLine( (nDistRight==0) ? pBoxItem->GetRight() : pBoxInfoItem->GetVert(),
                     BOX_LINE_LEFT );
commit ffe7faf8950eba541606d22ce7a50483fd4c84f4
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Jul 15 16:56:37 2014 +0200

    CID#1038293 Division or modulo by float zero (DIVIDE_BY_ZERO)
    
    Change-Id: I9115f34d5957fc974a8f693f97b27f4534344f62

diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 567b728..e695d57 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -1134,7 +1134,7 @@ void ScInterpreter::ScMIRR()
             {
                 double fResult = -fNPV_reinvest / fNPV_invest;
                 fResult *= pow( fRate1_reinvest, (double) nCount - 1 );
-                fResult = pow( fResult, 1.0 / (nCount - 1) );
+                fResult = pow( fResult, div( 1.0, (nCount - 1)) );
                 PushDouble( fResult - 1.0 );
             }
         }
commit 8d3454072d0f68c780e28eb56111d4fe2f84736d
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Jul 15 16:51:58 2014 +0200

    CID#1169815 Division or modulo by float zero (DIVIDE_BY_ZERO)
    
    Change-Id: Id90a018645ae37be600f942a8391dd56ff156b68

diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index a94fe10..0a3ac92 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -3596,7 +3596,7 @@ double ScInterpreter::GetPercentrank( ::std::vector<double> & rArray, double fVa
         if ( fVal == rArray[ i ] )
         {
             if ( bInclusive )
-                fRes = ( double )nOldCount / ( double )( nSize - 1 );
+                fRes = div( nOldCount, nSize - 1 );
             else
                 fRes = ( double )( i + 1 ) / ( double )( nSize + 1 );
         }
@@ -3615,7 +3615,7 @@ double ScInterpreter::GetPercentrank( ::std::vector<double> & rArray, double fVa
                 double fFract = ( fVal - rArray[ nOldCount - 1 ] ) /
                     ( rArray[ nOldCount ] - rArray[ nOldCount - 1 ] );
                 if ( bInclusive )
-                    fRes = ( ( double )( nOldCount - 1 ) + fFract ) / ( double )( nSize - 1 );
+                    fRes = div( ( double )( nOldCount - 1 ) + fFract, nSize - 1 );
                 else
                     fRes = ( ( double )nOldCount + fFract ) / ( double )( nSize + 1 );
             }


More information about the Libreoffice-commits mailing list