[gimp/gimp-2-8] Bug 680432 - metadata.exe keeps dying
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-8] Bug 680432 - metadata.exe keeps dying
- Date: Tue, 31 Jul 2012 13:20:27 +0000 (UTC)
commit 977311dff84b9a17973e25a3f52b37a8b4863875
Author: Michael Natterer <mitch gimp org>
Date: Tue Jul 31 15:14:20 2012 +0200
Bug 680432 - metadata.exe keeps dying
Based on a patch by Hartmut Kuhse, run all strings through
gimp_any_to_utf8() which always returns something that's UTF-8, even
if it's only "(invalid UTF-8 String)". Better than crashing.
(cherry picked from commit c207e395fd522d870947e47261da6592c1e4c45c)
plug-ins/metadata/xmp-encode.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/plug-ins/metadata/xmp-encode.c b/plug-ins/metadata/xmp-encode.c
index bf6e375..184b2e7 100644
--- a/plug-ins/metadata/xmp-encode.c
+++ b/plug-ins/metadata/xmp-encode.c
@@ -63,6 +63,7 @@ gen_element (GString *buffer,
{
const gchar *attr_name;
const gchar *attr_value;
+ gchar *utf8 = NULL;
va_list args;
while (indent--)
@@ -82,8 +83,11 @@ gen_element (GString *buffer,
va_end (args);
if (value && *value)
+ utf8 = gimp_any_to_utf8 (value, -1, NULL);
+
+ if (utf8 && *utf8)
{
- gchar *escaped_value = g_markup_escape_text (value, -1);
+ gchar *escaped_value = g_markup_escape_text (utf8, -1);
g_string_append_printf (buffer, ">%s</%s:%s>\n",
escaped_value, prefix, name);
@@ -93,6 +97,8 @@ gen_element (GString *buffer,
{
g_string_append (buffer, " />\n");
}
+
+ g_free (utf8);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]