[libgsf] Compilation: G_TYPE_CHAR is always signed.



commit cd920a8949811cb3ff5659e7c163fd3ea8226569
Author: Morten Welinder <terra gnome org>
Date:   Sat Jan 5 11:41:53 2013 -0500

    Compilation: G_TYPE_CHAR is always signed.
    
    Correctly work around glib's mess.

 ChangeLog             |    7 +++++++
 NEWS                  |    3 +++
 gsf/gsf-libxml.c      |    4 ++--
 gsf/gsf-msole-utils.c |    4 ++--
 4 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b7503cf..e97c509 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-01-05  Morten Welinder  <terra gnome org>
+
+	* gsf/gsf-libxml.c (gsf_xml_out_add_gvalue): Deal with G_TYPE_CHAR
+	always being signed char.
+	(gsf_xml_gvalue_from_str): Ditto.
+	* gsf/gsf-msole-utils.c (msole_prop_parse): Ditto.
+
 2013-01-05  Valek Filippov  <frob df ru>
 
 	* gsf/gsf-infile-msvba.c,.h (gsf_vba_inflate): Fix based on
diff --git a/NEWS b/NEWS
index f52c5f4..e53e5b1 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
 libgsf 1.14.26
 
+Morten:
+	* Deal with G_TYPE_CHAR signedness.
+
 Paolo Bonzini:
 	* Fix gsf_input_dep for msole streams.  [#689706]
 
diff --git a/gsf/gsf-libxml.c b/gsf/gsf-libxml.c
index b8df513..b36b823 100644
--- a/gsf/gsf-libxml.c
+++ b/gsf/gsf-libxml.c
@@ -218,7 +218,7 @@ gsf_xml_gvalue_from_str (GValue *res, GType t, char const *str)
 
 	switch (t) {
 	case G_TYPE_CHAR:
-		g_value_set_char (res, str[0]);
+		g_value_set_schar (res, (signed char)(str[0]));
 		break;
 	case G_TYPE_UCHAR:
 		g_value_set_uchar (res, (guchar)str[0]);
@@ -1953,7 +1953,7 @@ gsf_xml_out_add_gvalue (GsfXMLOut *xout, char const *id, GValue const *val)
 	switch (t) {
 	case G_TYPE_CHAR: {
 		char c[2] = { 0, 0 };
-		c[0] = g_value_get_char (val);
+		c[0] = (char)g_value_get_schar (val);
 		/* FIXME: What if we are in 0x80-0xff? */
 		gsf_xml_out_add_cstr (xout, id, c);
 		break;
diff --git a/gsf/gsf-msole-utils.c b/gsf/gsf-msole-utils.c
index 35a8ad9..80b7631 100644
--- a/gsf/gsf-msole-utils.c
+++ b/gsf/gsf-msole-utils.c
@@ -682,10 +682,10 @@ msole_prop_parse (GsfMSOleMetaDataSection *section,
 		break;
 
 	case VT_I1 :
-		/* 1-byte unsigned integer */
+		/* 1-byte signed integer */
 		NEED_BYTES (1);
 		g_value_init (res, G_TYPE_CHAR);
-		g_value_set_char (res, GSF_LE_GET_GINT8 (*data));
+		g_value_set_schar (res, GSF_LE_GET_GINT8 (*data));
 		ADVANCE;
 		break;
 



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