diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ChangeLog.pre-1-10 | 6 | ||||
-rw-r--r-- | ChangeLog.pre-1-2 | 6 | ||||
-rw-r--r-- | ChangeLog.pre-1-4 | 6 | ||||
-rw-r--r-- | ChangeLog.pre-1-6 | 6 | ||||
-rw-r--r-- | ChangeLog.pre-1-8 | 6 | ||||
-rw-r--r-- | pango/querymodules.c | 46 |
7 files changed, 80 insertions, 2 deletions
@@ -1,3 +1,9 @@ +Wed Jul 31 12:38:36 2002 Owen Taylor <otaylor@redhat.com> + + * pango/querymodules.c (string_needs_escape): Avoid + using g_strescape(), since it mangles UTF-8. + (#89479, Yao Zhang) + Tue Jul 30 23:10:14 2002 Owen Taylor <otaylor@redhat.com> * pango/shape.c (pango_shape): Set is_cluster_start diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10 index 13d4e345..b92ffa7c 100644 --- a/ChangeLog.pre-1-10 +++ b/ChangeLog.pre-1-10 @@ -1,3 +1,9 @@ +Wed Jul 31 12:38:36 2002 Owen Taylor <otaylor@redhat.com> + + * pango/querymodules.c (string_needs_escape): Avoid + using g_strescape(), since it mangles UTF-8. + (#89479, Yao Zhang) + Tue Jul 30 23:10:14 2002 Owen Taylor <otaylor@redhat.com> * pango/shape.c (pango_shape): Set is_cluster_start diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2 index 13d4e345..b92ffa7c 100644 --- a/ChangeLog.pre-1-2 +++ b/ChangeLog.pre-1-2 @@ -1,3 +1,9 @@ +Wed Jul 31 12:38:36 2002 Owen Taylor <otaylor@redhat.com> + + * pango/querymodules.c (string_needs_escape): Avoid + using g_strescape(), since it mangles UTF-8. + (#89479, Yao Zhang) + Tue Jul 30 23:10:14 2002 Owen Taylor <otaylor@redhat.com> * pango/shape.c (pango_shape): Set is_cluster_start diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4 index 13d4e345..b92ffa7c 100644 --- a/ChangeLog.pre-1-4 +++ b/ChangeLog.pre-1-4 @@ -1,3 +1,9 @@ +Wed Jul 31 12:38:36 2002 Owen Taylor <otaylor@redhat.com> + + * pango/querymodules.c (string_needs_escape): Avoid + using g_strescape(), since it mangles UTF-8. + (#89479, Yao Zhang) + Tue Jul 30 23:10:14 2002 Owen Taylor <otaylor@redhat.com> * pango/shape.c (pango_shape): Set is_cluster_start diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6 index 13d4e345..b92ffa7c 100644 --- a/ChangeLog.pre-1-6 +++ b/ChangeLog.pre-1-6 @@ -1,3 +1,9 @@ +Wed Jul 31 12:38:36 2002 Owen Taylor <otaylor@redhat.com> + + * pango/querymodules.c (string_needs_escape): Avoid + using g_strescape(), since it mangles UTF-8. + (#89479, Yao Zhang) + Tue Jul 30 23:10:14 2002 Owen Taylor <otaylor@redhat.com> * pango/shape.c (pango_shape): Set is_cluster_start diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8 index 13d4e345..b92ffa7c 100644 --- a/ChangeLog.pre-1-8 +++ b/ChangeLog.pre-1-8 @@ -1,3 +1,9 @@ +Wed Jul 31 12:38:36 2002 Owen Taylor <otaylor@redhat.com> + + * pango/querymodules.c (string_needs_escape): Avoid + using g_strescape(), since it mangles UTF-8. + (#89479, Yao Zhang) + Tue Jul 30 23:10:14 2002 Owen Taylor <otaylor@redhat.com> * pango/shape.c (pango_shape): Set is_cluster_start diff --git a/pango/querymodules.c b/pango/querymodules.c index 5ae7789a..95c67d89 100644 --- a/pango/querymodules.c +++ b/pango/querymodules.c @@ -42,6 +42,48 @@ #endif #define SOEXT_LEN (strlen (SOEXT)) +static gboolean +string_needs_escape (const char *str) +{ + while (TRUE) + { + char c = *str++; + + if (!c) + return FALSE; + else if (c == '\"' || g_ascii_isspace (c)) + return TRUE; + } +} + +static char * +escape_string (const char *str) +{ + GString *result = g_string_new (""); + + while (TRUE) + { + char c = *str++; + + switch (c) + { + case '\0': + goto done; + case '\n': + g_string_append (result, "\\n"); + break; + case '\"': + g_string_append (result, "\\\""); + break; + default: + g_string_append_c (result, c); + } + } + + done: + return g_string_free (result, FALSE); +} + void query_module (const char *dir, const char *name) { @@ -78,10 +120,10 @@ query_module (const char *dir, const char *name) const gchar *quote; gchar *quoted_path; - if (strchr (path, ' ') != NULL) + if (string_needs_escape (path)) { quote = "\""; - quoted_path = g_strescape (path, NULL); + quoted_path = escape_string (path); } else { |