[gnumeric] Lotus: fix import of formula results.



commit 6cfd8b189f107aacf0c83715806f161b34574add
Author: Morten Welinder <terra gnome org>
Date:   Wed Dec 31 19:47:45 2014 -0500

    Lotus: fix import of formula results.
    
    Previous patch laid all the ground work.

 NEWS                        |    1 +
 plugins/lotus-123/ChangeLog |    5 +++++
 plugins/lotus-123/lotus.c   |   14 ++++----------
 3 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/NEWS b/NEWS
index 1b0879d..af2bc45 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,7 @@ Morten:
        * Allow removing a specific item from the history.  [#735305]
        * Fix GNM_HALIGN_DISTRIBUTED rendering.  [#726155]
        * Restore translations of function help texts.
+       * Fix import of extended float formula results from wk4 files.
 
 Thomas Kluyver:
        * Fix import of extended floats from wk4 files.  [#739679]
diff --git a/plugins/lotus-123/ChangeLog b/plugins/lotus-123/ChangeLog
index 965dcb8..8b087d8 100644
--- a/plugins/lotus-123/ChangeLog
+++ b/plugins/lotus-123/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-31  Morten Welinder  <terra gnome org>
+
+       * lotus.c (lotus_treal): Base this on lotus_extfloat thus giving
+       it a chance of working.
+
 2014-11-06  Morten Welinder  <terra gnome org>
 
        * lotus.c (lotus_read_new): Handle extended floats.  Patch from
diff --git a/plugins/lotus-123/lotus.c b/plugins/lotus-123/lotus.c
index e3f74f9..6cb6b77 100644
--- a/plugins/lotus-123/lotus.c
+++ b/plugins/lotus-123/lotus.c
@@ -30,7 +30,7 @@
 #include <gsf/gsf-msole-utils.h>
 #include <string.h>
 
-#define LOTUS_DEBUG 0
+#define LOTUS_DEBUG 1
 #undef DEBUG_RLDB
 #undef DEBUG_STYLE
 #undef DEBUG_FORMAT
@@ -925,15 +925,10 @@ lotus_extfloat (guint64 mant, guint16 signexp)
 static GnmValue *
 lotus_treal (const record_t *r, int ofs)
 {
-       const guint8 *p;
-       gnm_float v;
        g_return_val_if_fail (ofs + 10 <= r->len, NULL);
 
-       p = r->data + ofs;
-
-       /* This this ignores two bytes of mantissa.  */
-       v = GSF_LE_GET_DOUBLE (p + 2);
-       return lotus_value (v);
+       return lotus_extfloat (GSF_LE_GET_GUINT64 (r->data + ofs),
+                              GSF_LE_GET_GUINT16 (r->data + ofs + 8));
 }
 
 /* ------------------------------------------------------------------------- */
@@ -1982,8 +1977,7 @@ lotus_read_new (LotusState *state, record_t *r)
                        int row = GSF_LE_GET_GUINT16 (r->data);
                        Sheet *sheet = lotus_get_sheet (state->wb, r->data[2]);
                        int col = r->data[3];
-                       GnmValue *v = lotus_extfloat (GSF_LE_GET_GUINT64 (r->data + 4),
-                                                     GSF_LE_GET_GUINT16 (r->data + 12));
+                       GnmValue *v = lotus_treal (r, 4);
                        (void)insert_value (state, sheet, col, row, v);
                        break;
                }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]