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

Takeshi Abe tabe at fixedpoint.jp
Thu Feb 6 04:20:53 PST 2014


 sc/source/core/inc/interpre.hxx  |    2 +-
 sc/source/core/tool/interpr2.cxx |    4 ++--
 sc/source/core/tool/interpr3.cxx |   14 +++++++-------
 3 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 0c0ed0579e85ab9705485db347f0fac4a191ab26
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Thu Feb 6 21:17:45 2014 +0900

    Mark as static & const
    
    Change-Id: Icd8b1b65c6cb4834832290e88709380aeceab1c9

diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 43b5e02..e340a9e 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -706,7 +706,7 @@ void ScBadName();
 // Statistics:
 double phi(double x);
 double integralPhi(double x);
-double taylor(double* pPolynom, sal_uInt16 nMax, double x);
+double taylor(const double* pPolynom, sal_uInt16 nMax, double x);
 double gauss(double x);
 double gaussinv(double x);
 double GetBetaDist(double x, double alpha, double beta);  //cumulative distribution function
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index fa8f21b..13d4627 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -2544,7 +2544,7 @@ static bool lclConvertMoney( const OUString& aSearchUnit, double& rfRate, int& r
         double          fRate;
         int             nDec;
     };
-    ConvertInfo aConvertTable[] = {
+    static const ConvertInfo aConvertTable[] = {
         { "EUR", 1.0,      2 },
         { "ATS", 13.7603,  2 },
         { "BEF", 40.3399,  0 },
@@ -2566,7 +2566,7 @@ static bool lclConvertMoney( const OUString& aSearchUnit, double& rfRate, int& r
         { "LVL", 0.702804, 2 }
     };
 
-    const size_t nConversionCount = sizeof( aConvertTable ) / sizeof( aConvertTable[0] );
+    static const size_t nConversionCount = sizeof( aConvertTable ) / sizeof( aConvertTable[0] );
     for ( size_t i = 0; i < nConversionCount; ++i )
         if ( aSearchUnit.equalsIgnoreAsciiCaseAscii( aConvertTable[i].pCurrText ) )
         {
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 4a01b07..df6f990 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -188,7 +188,7 @@ double ScInterpreter::integralPhi(double x)
     return 0.5 * ::rtl::math::erfc(-x * 0.7071067811865475); // * 1/sqrt(2)
 }
 
-double ScInterpreter::taylor(double* pPolynom, sal_uInt16 nMax, double x)
+double ScInterpreter::taylor(const double* pPolynom, sal_uInt16 nMax, double x)
 {
     double nVal = pPolynom[nMax];
     for (short i = nMax-1; i >= 0; i--)
@@ -206,7 +206,7 @@ double ScInterpreter::gauss(double x)
     double nVal = 0.0;
     if (xShort == 0)
     {
-        double t0[] =
+        static const double t0[] =
         { 0.39894228040143268, -0.06649038006690545,  0.00997355701003582,
          -0.00118732821548045,  0.00011543468761616, -0.00000944465625950,
           0.00000066596935163, -0.00000004122667415,  0.00000000227352982,
@@ -215,7 +215,7 @@ double ScInterpreter::gauss(double x)
     }
     else if ((xShort >= 1) && (xShort <= 2))
     {
-        double t2[] =
+        static const double t2[] =
         { 0.47724986805182079,  0.05399096651318805, -0.05399096651318805,
           0.02699548325659403, -0.00449924720943234, -0.00224962360471617,
           0.00134977416282970, -0.00011783742691370, -0.00011515930357476,
@@ -228,7 +228,7 @@ double ScInterpreter::gauss(double x)
     }
     else if ((xShort >= 3) && (xShort <= 4))
     {
-       double t4[] =
+        static const double t4[] =
        { 0.49996832875816688,  0.00013383022576489, -0.00026766045152977,
          0.00033457556441221, -0.00028996548915725,  0.00018178605666397,
         -0.00008252863922168,  0.00002551802519049, -0.00000391665839292,
@@ -240,7 +240,7 @@ double ScInterpreter::gauss(double x)
     }
     else
     {
-        double asympt[] = { -1.0, 1.0, -3.0, 15.0, -105.0 };
+        static const double asympt[] = { -1.0, 1.0, -3.0, 15.0, -105.0 };
         nVal = 0.5 + phi(xAbs) * taylor(asympt, 4, 1.0 / (xAbs * xAbs)) / xAbs;
     }
     if (x < 0.0)
@@ -478,7 +478,7 @@ double ScInterpreter::BinomKoeff(double n, double k)
     Uses a variant of the Lanczos sum with a rational function. */
 static double lcl_getLanczosSum(double fZ)
 {
-    const double fNum[13] ={
+    static const double fNum[13] ={
         23531376880.41075968857200767445163675473,
         42919803642.64909876895789904700198885093,
         35711959237.35566804944018545154716670596,
@@ -493,7 +493,7 @@ static double lcl_getLanczosSum(double fZ)
         210.8242777515793458725097339207133627117,
         2.506628274631000270164908177133837338626
         };
-    const double fDenom[13] = {
+    static const double fDenom[13] = {
         0,
         39916800,
         120543840,


More information about the Libreoffice-commits mailing list