[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - 2 commits - sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Dec 5 09:58:31 UTC 2018


 sc/source/core/opencl/formulagroupcl.cxx |    1 +
 sc/source/core/opencl/op_financial.cxx   |    3 +++
 sc/source/core/opencl/op_math.cxx        |    4 +++-
 3 files changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 1b0dc235543fc3f8185fc2f5f7bdf92c164a0826
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Fri Nov 16 17:46:43 2018 +0100
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Wed Dec 5 10:58:15 2018 +0100

    opencl SERIESSUM does not handle plain double arguments
    
    sc_subsequent_filters_test in ScFiltersTest::testFunctionsODS() also
    checks "SERIESSUM(2;3;2;3)", which the opencl code does not handle.
    At least bail out gracefully instead of returning 0.
    
    Change-Id: I154dca8cc437a6225b4eb98012232d80683f0114
    Reviewed-on: https://gerrit.libreoffice.org/64242
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
    (cherry picked from commit 6a2241e7db0c1db232b33dce619a203aadf21ec0)
    Reviewed-on: https://gerrit.libreoffice.org/64532

diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx
index 45306aee893e..341c3b04c333 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -3080,7 +3080,7 @@ void OpQuotient::GenSlidingWindowFunction(std::stringstream &ss,
 void OpSeriesSum::GenSlidingWindowFunction(std::stringstream &ss,
     const std::string &sSymName, SubArguments &vSubArguments)
 {
-    if( vSubArguments.size() != 4){return;}
+    CHECK_PARAMETER_COUNT(4,4);
     ss << "\ndouble " << sSymName;
     ss << "_"<< BinFuncName() <<"(";
     for (size_t i = 0; i < vSubArguments.size(); i++)
@@ -3184,6 +3184,8 @@ void OpSeriesSum::GenSlidingWindowFunction(std::stringstream &ss,
             ss << "))\n";
             ss << "        return 0;\n";
         }
+        else
+            throw Unhandled(__FILE__, __LINE__);
     }
     ss << "    return res;\n";
     ss << "}";
commit 7a8d6a23ea5b895f00f759017ad4a1d1eb7c94c9
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Fri Nov 16 17:22:42 2018 +0100
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Wed Dec 5 10:58:04 2018 +0100

    fix opencl YIELDDISC
    
    Otherwise the yielddisc unittest fails.
    
    Change-Id: I2ebb0fbf9d4aea6678c91d0289418991aa92dbb5
    Reviewed-on: https://gerrit.libreoffice.org/64241
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
    (cherry picked from commit de5dd98320533888973432797254bfc5c9b52680)
    Reviewed-on: https://gerrit.libreoffice.org/64531

diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 04c95a8de21f..25dd22da6a7a 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -40,6 +40,7 @@
 
 static const char* const publicFunc =
  "\n"
+ "#define IllegalArgument 502\n"
  "#define IllegalFPOperation 503 // #NUM!\n"
  "#define NoValue 519 // #VALUE!\n"
  "#define DivisionByZero 532 // #DIV/0!\n"
diff --git a/sc/source/core/opencl/op_financial.cxx b/sc/source/core/opencl/op_financial.cxx
index 6b108eeed2d3..6f728cbbbdd2 100644
--- a/sc/source/core/opencl/op_financial.cxx
+++ b/sc/source/core/opencl/op_financial.cxx
@@ -3913,6 +3913,7 @@ void OpReceived::GenSlidingWindowFunction(std::stringstream &ss,
 void OpYielddisc::GenSlidingWindowFunction(
     std::stringstream &ss, const std::string &sSymName, SubArguments &vSubArguments)
 {
+    CHECK_PARAMETER_COUNT(5,5);
     ss << "\ndouble " << sSymName;
     ss << "_"<< BinFuncName() <<"(";
     for (size_t i = 0; i < vSubArguments.size(); i++)
@@ -4010,6 +4011,8 @@ void OpYielddisc::GenSlidingWindowFunction(
     ss << vSubArguments[4]->GenSlidingWindowDeclRef();
     ss<<";\n\t";
 
+    ss<< "if(tmp002 <= 0 || tmp003 <= 0 || tmp000 >= tmp001 )\n";
+    ss<< "    return CreateDoubleError(IllegalArgument);\n";
     ss<< "tmp = (tmp003/tmp002)-1;\n\t";
     ss << "tmp /= GetYearFrac( GetNullDate(),tmp000,tmp001,tmp004);\n\t";
     ss << "return tmp;\n";


More information about the Libreoffice-commits mailing list