gnumeric r16466 - in trunk: . plugins/excel src
- From: mortenw svn gnome org
- To: svn-commits-list gnome org
- Subject: gnumeric r16466 - in trunk: . plugins/excel src
- Date: Thu, 13 Mar 2008 02:25:36 +0000 (GMT)
Author: mortenw
Date: Thu Mar 13 02:25:36 2008
New Revision: 16466
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16466&view=rev
Log:
2008-03-12 Morten Welinder <terra gnome org>
* src/xml-sax-read.c (make_format): New function to handle invalid
formats.
(xml_sax_style_start, xml_sax_cell): Use make_format.
2008-03-12 Morten Welinder <terra gnome org>
* ms-excel-read.c (excel_wb_get_fmt): Replace invalid formats by
General.
Modified:
trunk/ChangeLog
trunk/NEWS
trunk/configure.in
trunk/plugins/excel/ChangeLog
trunk/plugins/excel/ms-excel-read.c
trunk/src/xml-sax-read.c
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Thu Mar 13 02:25:36 2008
@@ -54,6 +54,7 @@
* Fix insert-time problem.
* Fix inc/dec buttons for General. [#510252]
* Don't allocate memory for boolean values. [#518527]
+ * Ignore invalid formats read from .gnumeric and .xls. [#521849]
Nick Lamb:
* Honour detachable-toolbar preference. [#321867]
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Thu Mar 13 02:25:36 2008
@@ -171,7 +171,7 @@
dnl *****************************
libspreadsheet_reqs="
- $libgoffice >= 0.5.5
+ $libgoffice >= 0.6.3
libgsf-1 >= 1.14.6
libxml-2.0 >= 2.4.12
"
Modified: trunk/plugins/excel/ms-excel-read.c
==============================================================================
--- trunk/plugins/excel/ms-excel-read.c (original)
+++ trunk/plugins/excel/ms-excel-read.c Thu Mar 13 02:25:36 2008
@@ -260,9 +260,19 @@
} else
g_printerr ("Unknown format: 0x%x\n", idx);
- if (ans)
- return go_format_new_from_XL (ans);
- else
+ if (ans) {
+ GOFormat *fmt = go_format_new_from_XL (ans);
+
+ if (go_format_is_invalid (fmt)) {
+ g_warning ("Ignoring invalid format [%s]",
+ go_format_as_XL (fmt));
+ go_format_unref (fmt);
+ fmt = go_format_general ();
+ go_format_ref (fmt);
+ }
+
+ return fmt;
+ } else
return NULL;
}
Modified: trunk/src/xml-sax-read.c
==============================================================================
--- trunk/src/xml-sax-read.c (original)
+++ trunk/src/xml-sax-read.c Thu Mar 13 02:25:36 2008
@@ -86,6 +86,21 @@
return !strcmp (CXML2C (a), s);
}
+static GOFormat *
+make_format (const char *str)
+{
+ GOFormat *res = go_format_new_from_XL (str);
+
+ if (go_format_is_invalid (res)) {
+ g_warning ("Ignoring invalid format [%s]",
+ go_format_as_XL (res));
+ go_format_unref (res);
+ return NULL;
+ }
+
+ return res;
+}
+
/*****************************************************************************/
gboolean
@@ -1275,8 +1290,13 @@
gnm_style_set_back_color (state->style, colour);
else if (xml_sax_attr_color (attrs, "PatternColor", &colour))
gnm_style_set_pattern_color (state->style, colour);
- else if (attr_eq (attrs[0], "Format"))
- gnm_style_set_format_text (state->style, CXML2C (attrs[1]));
+ else if (attr_eq (attrs[0], "Format")) {
+ GOFormat *fmt = make_format (CXML2C (attrs[1]));
+ if (fmt) {
+ gnm_style_set_format (state->style, fmt);
+ go_format_unref (fmt);
+ }
+ }
else if (gnm_xml_attr_int (attrs, "Hidden", &val))
gnm_style_set_contents_hidden (state->style, val);
else if (gnm_xml_attr_int (attrs, "Locked", &val))
@@ -1647,7 +1667,7 @@
else if (gnm_xml_attr_int (attrs, "ExprID", &expr_id)) ;
else if (gnm_xml_attr_int (attrs, "ValueType", &value_type)) ;
else if (attr_eq (attrs[0], "ValueFormat"))
- value_fmt = go_format_new_from_XL (CXML2C (attrs[1]));
+ value_fmt = make_format (CXML2C (attrs[1]));
else
unknown_attr (xin, attrs);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]