[gnumeric] xml: quiet and standardize various warnings a bit.



commit 67961ca3c10e08f665380cdcb88b7ebcc975ce0e
Author: Morten Welinder <terra gnome org>
Date:   Thu Aug 5 16:17:05 2010 -0400

    xml: quiet and standardize various warnings a bit.

 ChangeLog          |    2 ++
 src/value.c        |    3 +--
 src/xml-sax-read.c |   14 +++++++++++---
 3 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 40e7622..ed004bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2010-08-05  Morten Welinder  <terra gnome org>
 
+	* src/value.c (value_new_from_string): Quiet warning.
+
 	* src/xml-sax-read.c (xml_sax_must_have_sheet): New function.  Use
 	heavily throughout the parser.  Fixes #626043.
 	(xml_sax_colrow): Avoid near-infinite loop.
diff --git a/src/value.c b/src/value.c
index b537b80..0cc81cc 100644
--- a/src/value.c
+++ b/src/value.c
@@ -509,11 +509,10 @@ value_new_from_string (GnmValueType t, char const *str, GOFormat *sf,
 		res = value_new_string (str);
 		break;
 
-	/* Should not happen.  */
 	case VALUE_ARRAY:
 	case VALUE_CELLRANGE:
 	default:
-		g_warning ("value_new_from_string problem.");
+		/* This happen with corrupted files.  */
 		return NULL;
 	}
 
diff --git a/src/xml-sax-read.c b/src/xml-sax-read.c
index 7d0e9e5..2935948 100644
--- a/src/xml-sax-read.c
+++ b/src/xml-sax-read.c
@@ -1987,8 +1987,11 @@ xml_sax_cell_content (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
 			if (value_type > 0) {
 				GnmValue *v = value_new_from_string (value_type, content, value_fmt, FALSE);
 				if (v == NULL) {
-					g_warning ("Unable to parse \"%s\" as type %d.",
-						   content, value_type);
+					char *msg = g_strdup_printf
+						("Parsing \"%s\" as type 0x%x",
+						 content, value_type);
+					xml_sax_barf (G_STRFUNC, msg);
+					g_free (msg);
 					v = value_new_string (content);
 				}
 				if (cell)
@@ -2052,8 +2055,13 @@ xml_sax_cell_content (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
 		GnmExprTop const *dummy = NULL;
 
 		if (!texpr) {
+			char *msg = g_strdup_printf
+				("Looking up shared expression id %d",
+				 expr_id);
+			xml_sax_barf (G_STRFUNC, msg);
+			g_free (msg);
 			texpr = dummy = gnm_expr_top_new_constant (value_new_int (0));
-			g_warning ("XML-IO : Missing shared expression");
+
 		}
 
 		if (cell)



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