[gnumeric] .gnumeric: don't repeat error messages for missing shared expressions.



commit 3ef330b4cede67c0ac02b10c49bd8583583f3a77
Author: Morten Welinder <terra gnome org>
Date:   Tue Jan 13 17:37:40 2015 -0500

    .gnumeric: don't repeat error messages for missing shared expressions.
    
    Once per id is plenty.

 ChangeLog          |    6 ++++++
 NEWS               |    1 +
 src/xml-sax-read.c |    9 +++++----
 3 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ba4fd5a..63cca47 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-01-13  Morten Welinder  <terra gnome org>
+
+       * src/xml-sax-read.c (xml_sax_cell_content): When we discover a
+       missing shared expression, define a dummy version so we don't get
+       repeated errors.
+
 2015-01-09  Morten Welinder  <terra gnome org>
 
        * src/value.c (value_compare_real): Rewrite.  Handle errors and
diff --git a/NEWS b/NEWS
index c80fe32..8d5b75d 100644
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,7 @@ Morten:
        * Fix import of extended float formula results from wk4 files.
        * Fix ADDRESS problem.
        * Fix sheet-filter problem with errors.  [#742601]
+       * Improve error handling for .gnumeric a bit.
 
 Thomas Kluyver:
        * Fix import of extended floats from wk4 files.  [#739679]
diff --git a/src/xml-sax-read.c b/src/xml-sax-read.c
index e6e991d..d661a3a 100644
--- a/src/xml-sax-read.c
+++ b/src/xml-sax-read.c
@@ -2128,16 +2128,19 @@ xml_sax_cell_content (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
        } else if (expr_id > 0) {
                GnmExprTop const *texpr = g_hash_table_lookup (state->expr_map,
                        GINT_TO_POINTER (expr_id));
-               GnmExprTop const *dummy = NULL;
 
                if (!texpr) {
                        char *msg = g_strdup_printf
                                ("Looking up shared expression id %d",
                                 expr_id);
+                       char *s = g_strdup_printf ("<shared expression %d>", expr_id);
                        xml_sax_barf (G_STRFUNC, msg);
                        g_free (msg);
-                       texpr = dummy = gnm_expr_top_new_constant (value_new_int (0));
 
+                       texpr = gnm_expr_top_new_constant (value_new_string_nocopy (s));
+                       g_hash_table_insert (state->expr_map,
+                                            GINT_TO_POINTER (expr_id),
+                                            (gpointer)texpr);
                }
 
                if (cell)
@@ -2146,8 +2149,6 @@ xml_sax_cell_content (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
                        cc->texpr = texpr;
                        gnm_expr_top_ref (texpr);
                }
-               if (dummy)
-                       gnm_expr_top_unref (dummy);
        } else if (is_new_cell) {
                GnmValue *v;
 


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