summaryrefslogtreecommitdiff
path: root/sc/inc/scmatrix.hxx
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2011-05-13 08:35:27 +0300
committerTor Lillqvist <tlillqvist@novell.com>2011-05-13 08:36:01 +0300
commit92a2c3477494c3fe623e0a762e5de4bbbaaeb34f (patch)
tree54f739c70f29ad213e290974bf366d610ddc4197 /sc/inc/scmatrix.hxx
parentf3aadd56c1e1723886f1868c84608467bd728549 (diff)
Properly initialize and copy fVal
This fixes the empty value check during unit test for the debug build on (32-bit) Windows. Signed-off-by: Tor Lillqvist <tlillqvist@novell.com>
Diffstat (limited to 'sc/inc/scmatrix.hxx')
-rw-r--r--sc/inc/scmatrix.hxx31
1 files changed, 11 insertions, 20 deletions
diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx
index 3979ce3729d6..8e14c4694d8a 100644
--- a/sc/inc/scmatrix.hxx
+++ b/sc/inc/scmatrix.hxx
@@ -67,19 +67,13 @@ struct ScMatrixValue
/// Only valid if ScMatrix methods indicate that this is a boolean
bool GetBoolean() const { return fVal != 0.0; }
- ScMatrixValue() : pS(NULL), nType(SC_MATVAL_EMPTY) {}
+ ScMatrixValue() : fVal(0.0), nType(SC_MATVAL_EMPTY) {}
- ScMatrixValue(const ScMatrixValue& r) : nType(r.nType)
+ ScMatrixValue(const ScMatrixValue& r) : fVal(r.fVal), nType(r.nType)
{
- switch (nType)
- {
- case SC_MATVAL_VALUE:
- case SC_MATVAL_BOOLEAN:
- fVal = r.fVal;
- break;
- default:
- pS = r.pS;
- }
+ if (nType == SC_MATVAL_STRING)
+ // This is probably not necessary but just in case...
+ pS = r.pS;
}
bool operator== (const ScMatrixValue& r) const
@@ -110,15 +104,12 @@ struct ScMatrixValue
ScMatrixValue& operator= (const ScMatrixValue& r)
{
nType = r.nType;
- switch (nType)
- {
- case SC_MATVAL_VALUE:
- case SC_MATVAL_BOOLEAN:
- fVal = r.fVal;
- break;
- default:
- pS = r.pS;
- }
+ fVal = r.fVal;
+
+ if (nType == SC_MATVAL_STRING)
+ // This is probably not necessary but just in case...
+ pS = r.pS;
+
return *this;
}
};