[libgsf] Remove embedded macros in translatable strings [#595622]



commit d6dc7f4dd978de2ce99233a79f388f16d105ed09
Author: Claude Paroz <claude 2xlibre net>
Date:   Mon Sep 21 21:24:55 2009 +0200

    Remove embedded macros in translatable strings [#595622]

 gsf/gsf-blob.c        |    8 ++++++--
 gsf/gsf-clip-data.c   |    8 ++++++--
 gsf/gsf-msole-utils.c |   22 ++++++++++++++++------
 3 files changed, 28 insertions(+), 10 deletions(-)
---
diff --git a/gsf/gsf-blob.c b/gsf/gsf-blob.c
index 7695e42..66b88ab 100644
--- a/gsf/gsf-blob.c
+++ b/gsf/gsf-blob.c
@@ -102,11 +102,15 @@ gsf_blob_new (gsize size, gconstpointer data_to_copy, GError **error)
 	if (data_to_copy) {
 		data = g_try_malloc (size);
 		if (!data) {
+			gchar *size_str;
+
+			size_str = g_strdup_printf ("%" G_GSIZE_FORMAT, size);
 			g_set_error (error,
 				     GSF_ERROR,
 				     GSF_ERROR_OUT_OF_MEMORY,
-				     _("Not enough memory to copy %" G_GSIZE_FORMAT " bytes of data"),
-				     size);
+				     _("Not enough memory to copy %s bytes of data"),
+				     size_str);
+			g_free (size_str);
 			return NULL;
 		}
 
diff --git a/gsf/gsf-clip-data.c b/gsf/gsf-clip-data.c
index d4649c9..bd7f8ad 100644
--- a/gsf/gsf-clip-data.c
+++ b/gsf/gsf-clip-data.c
@@ -144,13 +144,17 @@ gsf_clip_data_get_data_blob (GsfClipData *clip_data)
 static void
 set_error_missing_clipboard_data (GError **error, const char *format_name, gsize at_least_size)
 {
+	gchar *size_str;
+
+	size_str = g_strdup_printf ("%" G_GSIZE_FORMAT, at_least_size);
 	g_set_error (error,
 		     GSF_ERROR,
 		     GSF_ERROR_INVALID_DATA,
 		     _("The clip_data is in %s, but it is smaller than "
-		       "at least %" G_GSIZE_FORMAT " bytes"),
+		       "at least %s bytes"),
 		     format_name,
-		     at_least_size);
+		     size_str);
+	g_free (size_str);
 }
 
 static gsize
diff --git a/gsf/gsf-msole-utils.c b/gsf/gsf-msole-utils.c
index 21f9aef..965b31c 100644
--- a/gsf/gsf-msole-utils.c
+++ b/gsf/gsf-msole-utils.c
@@ -305,14 +305,20 @@ msole_gsf_name_to_prop (char const *name)
 static void
 set_error_missing_data (GError **error, const char *property_name, gsize size_needed, gsize size_gotten)
 {
+	gchar *size_needed_str, *size_gotten_str;
+
+	size_needed_str = g_strdup_printf ("%" G_GSIZE_FORMAT, size_needed);
+	size_gotten_str = g_strdup_printf ("%" G_GSIZE_FORMAT, size_gotten);
 	g_set_error (error,
 		     GSF_ERROR,
 		     GSF_ERROR_INVALID_DATA,
-		     _("Missing data when reading the %s property; got %" G_GSIZE_FORMAT "bytes, "
-		       "but %" G_GSIZE_FORMAT " bytes at least are needed."),
+		     _("Missing data when reading the %s property; got %s bytes, "
+		       "but %s bytes at least are needed."),
 		     property_name,
-		     size_needed,
-		     size_gotten);
+		     size_needed_str,
+		     size_gotten_str);
+	g_free (size_needed_str);
+	g_free (size_gotten_str);
 }
 
 /* Can return errors from gsf_blob_new() and GSF_ERROR_INVALID_DATA */
@@ -351,12 +357,16 @@ parse_vt_cf (GValue *res, guint8 const **data, guint8 const *data_end, GError **
 	clip_size = GSF_LE_GET_GUINT32 (*data);
 
 	if (clip_size < 4) {	/* must emcompass int32 format plus data size */
+		gchar *size_str;
+
+		size_str = g_strdup_printf ("%" G_GSIZE_FORMAT, (gsize) clip_size);
 		g_set_error (error,
 			     GSF_ERROR,
 			     GSF_ERROR_INVALID_DATA,
 			     _("Corrupt data in the VT_CF property; clipboard data length must be at least 4 bytes, "
-			       "but the data says it only has %" G_GSIZE_FORMAT " bytes available."),
-			     (gsize) clip_size);
+			       "but the data says it only has %s bytes available."),
+			     size_str);
+		g_free (size_str);
 		return FALSE;
 	}
 



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