[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sc/source
Eike Rathke
erack at redhat.com
Fri Nov 22 16:19:53 PST 2013
sc/source/filter/inc/formulaparser.hxx | 2 +-
sc/source/filter/oox/formulaparser.cxx | 15 ++++++++-------
2 files changed, 9 insertions(+), 8 deletions(-)
New commits:
commit 1f38670b11f7d49505603852f6e259cfc2b7710e
Author: Eike Rathke <erack at redhat.com>
Date: Fri Nov 22 23:25:00 2013 +0100
resolved fdo#38592 do not insert extraneous parameter in import
Importing already a Calc-only number of parameters do not insert
extraneous parameters.
(cherry picked from commit 4b9304ecdd067307e24e4388fe1addcab9e85bd0)
Change-Id: I011e3df24573fce9f2788c9311089af984650220
Reviewed-on: https://gerrit.libreoffice.org/6764
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/source/filter/inc/formulaparser.hxx b/sc/source/filter/inc/formulaparser.hxx
index 33135ab..cc61018 100644
--- a/sc/source/filter/inc/formulaparser.hxx
+++ b/sc/source/filter/inc/formulaparser.hxx
@@ -80,7 +80,7 @@ private:
const ApiToken* skipParentheses( const ApiToken* pToken, const ApiToken* pTokenEnd ) const;
const ApiToken* findParameters( ParameterPosVector& rParams, const ApiToken* pToken, const ApiToken* pTokenEnd ) const;
void appendEmptyParameter( const FunctionInfo& rFuncInfo, size_t nParam );
- void appendCalcOnlyParameter( const FunctionInfo& rFuncInfo, size_t nParam );
+ void appendCalcOnlyParameter( const FunctionInfo& rFuncInfo, size_t nParam, size_t nParamCount );
void appendRequiredParameters( const FunctionInfo& rFuncInfo, size_t nParamCount );
bool appendFinalToken( const ApiToken& rToken );
diff --git a/sc/source/filter/oox/formulaparser.cxx b/sc/source/filter/oox/formulaparser.cxx
index cf79c71..f6f2948 100644
--- a/sc/source/filter/oox/formulaparser.cxx
+++ b/sc/source/filter/oox/formulaparser.cxx
@@ -223,7 +223,7 @@ const ApiToken* FormulaFinalizer::processParameters(
// add embedded Calc-only parameters
if( aParamInfoIt.isCalcOnlyParam() )
{
- appendCalcOnlyParameter( *pRealFuncInfo, nParam );
+ appendCalcOnlyParameter( *pRealFuncInfo, nParam, nParamCount );
while( aParamInfoIt.isCalcOnlyParam() ) ++aParamInfoIt;
}
@@ -274,7 +274,7 @@ const ApiToken* FormulaFinalizer::processParameters(
// add trailing Calc-only parameters
if( aParamInfoIt.isCalcOnlyParam() )
- appendCalcOnlyParameter( *pRealFuncInfo, nLastValidCount );
+ appendCalcOnlyParameter( *pRealFuncInfo, nLastValidCount, nParamCount );
// add optional parameters that are required in Calc
appendRequiredParameters( *pRealFuncInfo, nLastValidCount );
@@ -381,16 +381,17 @@ void FormulaFinalizer::appendEmptyParameter( const FunctionInfo& rFuncInfo, size
maTokens.append( OPCODE_MISSING );
}
-void FormulaFinalizer::appendCalcOnlyParameter( const FunctionInfo& rFuncInfo, size_t nParam )
+void FormulaFinalizer::appendCalcOnlyParameter( const FunctionInfo& rFuncInfo, size_t nParam, size_t nParamCount )
{
- (void)nParam; // prevent 'unused' warning
switch( rFuncInfo.mnBiff12FuncId )
{
case BIFF_FUNC_FLOOR:
case BIFF_FUNC_CEILING:
- OSL_ENSURE( nParam == 2, "FormulaFinalizer::appendCalcOnlyParameter - unexpected parameter index" );
- maTokens.append< double >( OPCODE_PUSH, 1.0 );
- maTokens.append( OPCODE_SEP );
+ if (nParam == 2 && nParamCount < 3)
+ {
+ maTokens.append< double >( OPCODE_PUSH, 1.0 );
+ maTokens.append( OPCODE_SEP );
+ }
break;
}
}
More information about the Libreoffice-commits
mailing list