Source: goffice-0.8
Followup-For: Bug #812013

For the go_format_odf_style_map() issue, the fix is simply to make the format 
string
itself constant. Patch attached.

I can't see a way to make g_object_set_property()'s error_template parameter 
safe, except
by sanity-checking in the function itself. One would probably have to turn the 
warning
off for this file...
diff -ru goffice-0.8-0.8.17/goffice/utils/go-format.c goffice-0.8-0.8.17+/goffice/utils/go-format.c
--- goffice-0.8-0.8.17/goffice/utils/go-format.c	2011-06-17 00:46:51.000000000 +0200
+++ goffice-0.8-0.8.17+/goffice/utils/go-format.c	2016-07-01 10:50:12.072984065 +0200
@@ -5537,7 +5537,7 @@
 char *
 go_format_odf_style_map (GOFormat const *fmt, int cond_part)
 {
-	char const *format_string = NULL;
+	char const *op = NULL;
 
 	g_return_val_if_fail (fmt != NULL, NULL);
 	g_return_val_if_fail (fmt->typ == GO_FMT_COND, NULL);
@@ -5547,29 +5547,29 @@
 
 	switch (fmt->u.cond.conditions[cond_part].op) {
 	case GO_FMT_COND_EQ:
-		format_string = "value()=%g";
+		op = "=";
 		break;
 	case GO_FMT_COND_NE:
-		format_string = "value()!=%g";
+		op = "!=";
 		break;
 	case GO_FMT_COND_NONTEXT: /* Under certain circumstances this */
                                   /*appears for second of two conditions */
 	case GO_FMT_COND_LT:
-		format_string = "value()<%g";
+		op = "<";
 		break;
 	case GO_FMT_COND_LE:
-		format_string = "value()<=%g";
+		op = "<=";
 		break;
 	case GO_FMT_COND_GT:
-		format_string = "value()>%g";
+		op = ">";
 		break;
 	case GO_FMT_COND_GE:
-		format_string = "value()>=%g";
+		op = ">=";
 		break;
 	default:
 		return NULL;
 	}
-	return g_strdup_printf (format_string,
+	return g_strdup_printf ("value()%s%g", op,
 				fmt->u.cond.conditions[cond_part].val);
 
 }

Reply via email to