[gnumeric] Analysis tools: ignore invalid formats.



commit 251b8f1895f2ffbfb4b594e84e025b7dc62635e1
Author: Morten Welinder <terra gnome org>
Date:   Wed Jul 3 13:54:40 2013 -0400

    Analysis tools: ignore invalid formats.
    
    These can occur with translations.  Print a warning and otherwise ignore
    them.

 NEWS                |    1 +
 src/tools/ChangeLog |    5 +++++
 src/tools/dao.c     |   16 +++++++++++-----
 3 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/NEWS b/NEWS
index 12a0e42..c586ad5 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,7 @@ Morten:
        * Fix --with-long-double tests.  [#703397]
        * Fix problems saving auto filters to xls.  [#703308]
        * Improve handling of large graph ranges.  [#703546]
+       * Fix analysis issue with translations.  [#703355]
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.3
diff --git a/src/tools/ChangeLog b/src/tools/ChangeLog
index 4b641de..4158935 100644
--- a/src/tools/ChangeLog
+++ b/src/tools/ChangeLog
@@ -1,3 +1,8 @@
+2013-07-03  Morten Welinder  <terra gnome org>
+
+       * dao.c (dao_set_format): Ignore invalid format, likely due to
+       translation errors.  Fixes #703355.
+
 2013-06-25  Morten Welinder <terra gnome org>
 
        * Release 1.12.3
diff --git a/src/tools/dao.c b/src/tools/dao.c
index e258b10..7a096de 100644
--- a/src/tools/dao.c
+++ b/src/tools/dao.c
@@ -818,14 +818,20 @@ dao_set_format (data_analysis_output_t *dao, int col1, int row1,
                int col2, int row2,
                char const * format)
 {
-       GnmStyle *mstyle;
+       GOFormat *fmt;
 
-       mstyle = gnm_style_new ();
-       gnm_style_set_format_text (mstyle, format);
-       dao_set_style (dao, col1, row1,
-                      col2, row2, mstyle);
+       fmt = go_format_new_from_XL (format);
+       if (go_format_is_invalid (fmt)) {
+               g_warning ("Ignoring invalid format [%s]", format);
+       } else {
+               GnmStyle *mstyle = gnm_style_new ();
+               gnm_style_set_format (mstyle, fmt);
+               dao_set_style (dao, col1, row1, col2, row2, mstyle);
+       }
+       go_format_unref (fmt);
 }
 
+
 /**
  * dao_set_colors:
  * @dao:


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