diff options
author | Stefan Kost <ensonic@users.sf.net> | 2010-06-25 21:23:22 +0300 |
---|---|---|
committer | Stefan Kost <ensonic@users.sf.net> | 2010-06-25 21:25:10 +0300 |
commit | 8fffa2d790aa591294195457a69b3e265d266613 (patch) | |
tree | 01c399b0fa48862a351dcb8c915cd088d77d98ca | |
parent | 27b48681573a05f3502cf2bb122e9f87ad8e7905 (diff) |
dot-dump: terminate truncated strings and escape special chars
Fixes syntax errors in generated dot files for caps with strings.
-rw-r--r-- | gst/gstdebugutils.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gst/gstdebugutils.c b/gst/gstdebugutils.c index 58a3cb12a..3bca9f75f 100644 --- a/gst/gstdebugutils.c +++ b/gst/gstdebugutils.c @@ -234,6 +234,7 @@ string_append_field (GQuark field, const GValue * value, gpointer ptr) { GString *str = (GString *) ptr; gchar *value_str = gst_value_serialize (value); + gchar *esc_value_str; /* some enums can become really long */ if (strlen (value_str) > 25) { @@ -242,7 +243,7 @@ string_append_field (GQuark field, const GValue * value, gpointer ptr) /* truncate */ value_str[25] = '\0'; - /* mirror any brackets */ + /* mirror any brackets and quotes */ if (value_str[0] == '<') value_str[pos--] = '>'; if (value_str[0] == '[') @@ -251,6 +252,8 @@ string_append_field (GQuark field, const GValue * value, gpointer ptr) value_str[pos--] = ')'; if (value_str[0] == '{') value_str[pos--] = '}'; + if (value_str[0] == '"') + value_str[pos--] = '"'; if (pos != 24) value_str[pos--] = ' '; /* elippsize */ @@ -258,10 +261,13 @@ string_append_field (GQuark field, const GValue * value, gpointer ptr) value_str[pos--] = '.'; value_str[pos--] = '.'; } + esc_value_str = g_strescape (value_str, NULL); + g_string_append_printf (str, " %18s: %s\\l", g_quark_to_string (field), - value_str); + esc_value_str); g_free (value_str); + g_free (esc_value_str); return TRUE; } |