[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sc/source
Eike Rathke
erack at redhat.com
Fri Jan 6 00:47:38 UTC 2017
sc/source/core/data/cellvalue.cxx | 3 +++
sc/source/core/data/formulacell.cxx | 13 +++++++++++++
2 files changed, 16 insertions(+)
New commits:
commit a34de7f0e4165db1a64be42044f9d5900d0d3da9
Author: Eike Rathke <erack at redhat.com>
Date: Thu Jan 5 16:37:07 2017 +0100
check token array code errors when testing for equality, tdf#105024 related
To not end up with a series of equal errors when importing individual error
cells and attempting to group them.
Change-Id: Idfcbb2e7077fc8799ef925c2c2e17188ac5e3b14
(cherry picked from commit 44021bd4018f4f97d9f0f6b6e1f0a256e8853537)
Reviewed-on: https://gerrit.libreoffice.org/32762
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Eike Rathke <erack at redhat.com>
diff --git a/sc/source/core/data/cellvalue.cxx b/sc/source/core/data/cellvalue.cxx
index 147ad51..efe66f7 100644
--- a/sc/source/core/data/cellvalue.cxx
+++ b/sc/source/core/data/cellvalue.cxx
@@ -63,6 +63,9 @@ bool equalsFormulaCells( const ScFormulaCell* p1, const ScFormulaCell* p2 )
if (pCode1->GetLen() != pCode2->GetLen())
return false;
+ if (pCode1->GetCodeError() != pCode2->GetCodeError())
+ return false;
+
sal_uInt16 n = pCode1->GetLen();
formula::FormulaToken** ppToken1 = pCode1->GetArray();
formula::FormulaToken** ppToken2 = pCode2->GetArray();
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 6616439..465f0b8 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -3844,6 +3844,13 @@ ScFormulaCell::CompareState ScFormulaCell::CompareByTokenArray( ScFormulaCell& r
if ( nThisLen != nOtherLen )
return NotEqual;
+ // No tokens can be an error cell so check error code, otherwise we could
+ // end up with a series of equal error values instead of individual error
+ // values. Also if for any reason different errors are set even if all
+ // tokens are equal, the cells are not equal.
+ if (pCode->GetCodeError() != rOther.pCode->GetCodeError())
+ return NotEqual;
+
bool bInvariant = true;
// check we are basically the same function
@@ -3930,6 +3937,12 @@ ScFormulaCell::CompareState ScFormulaCell::CompareByTokenArray( ScFormulaCell& r
return NotEqual;
}
break;
+ case formula::svError:
+ {
+ if (pThisTok->GetError() != pOtherTok->GetError())
+ return NotEqual;
+ }
+ break;
default:
;
}
More information about the Libreoffice-commits
mailing list