[Libreoffice-commits] .: Branch 'libreoffice-3-4' - sc/inc

Tor Lillqvist tml at kemper.freedesktop.org
Thu May 12 22:39:20 PDT 2011


 sc/inc/scmatrix.hxx |   31 +++++++++++--------------------
 1 file changed, 11 insertions(+), 20 deletions(-)

New commits:
commit d8787c0212b6abde83e8ee4557e492172e20ae74
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Fri May 13 08:35:27 2011 +0300

    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 at novell.com>

diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx
index 1568f2a..bf69522 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;
     }
 };


More information about the Libreoffice-commits mailing list