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

Eike Rathke erack at redhat.com
Tue Jul 12 23:11:42 UTC 2016


 sc/source/core/tool/compiler.cxx |   22 ++++++++++++----------
 sc/source/core/tool/interpr2.cxx |    2 ++
 2 files changed, 14 insertions(+), 10 deletions(-)

New commits:
commit 633413a37ee7442cd899db1269fd3ef404efe58a
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Jul 13 01:11:00 2016 +0200

    Resolves: tdf#100768 accept empty missing argument also for first parameter
    
    ... and let the interpreter decide about validity. Only if at least two
    parameters are given, empty/omitted or not.
    
    Change-Id: I2d7070e56f616b1940ff577c43e257eabb81b412

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 2ed3d59..8cb9534 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4408,17 +4408,19 @@ ScTokenArray* ScCompiler::CompileString( const OUString& rFormula )
             default:
             break;
         }
-        if( (eLastOp == ocSep ||
-             eLastOp == ocArrayRowSep ||
-             eLastOp == ocArrayColSep ||
-             eLastOp == ocArrayOpen) &&
-            (eOp == ocSep ||
-             eOp == ocClose ||
-             eOp == ocArrayRowSep ||
-             eOp == ocArrayColSep ||
-             eOp == ocArrayClose) )
+        if (!(eLastOp == ocOpen && eOp == ocClose) &&
+                (eLastOp == ocOpen ||
+                 eLastOp == ocSep ||
+                 eLastOp == ocArrayRowSep ||
+                 eLastOp == ocArrayColSep ||
+                 eLastOp == ocArrayOpen) &&
+                (eOp == ocSep ||
+                 eOp == ocClose ||
+                 eOp == ocArrayRowSep ||
+                 eOp == ocArrayColSep ||
+                 eOp == ocArrayClose))
         {
-            // FIXME: should we check for known functions with optional empty
+            // TODO: should we check for known functions with optional empty
             // args so the correction dialog can do better?
             if ( !static_cast<ScTokenArray*>(pArr)->Add( new FormulaMissingToken ) )
             {
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 458236e..9c8f5e3 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -646,6 +646,8 @@ void ScInterpreter::ScGetDate()
     {
         sal_Int16 nDay   = GetInt16();
         sal_Int16 nMonth = GetInt16();
+        if (IsMissing())
+            SetError( errParameterExpected);    // Year must be given.
         sal_Int16 nYear  = GetInt16();
         if (nGlobalError || nYear < 0)
             PushIllegalArgument();


More information about the Libreoffice-commits mailing list