From 327fcfaf48c775b706da967d809c68d87e18dddf Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Mon, 20 Sep 2010 11:57:08 +0200 Subject: [PATCH] Do not squash underscores in error names Underscores are used and valid according to the specification. See https://bugs.freedesktop.org/show_bug.cgi?id=30274 --- dbus/dbus-gobject.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/dbus/dbus-gobject.c b/dbus/dbus-gobject.c index f340afa..d0d0c4d 100644 --- a/dbus/dbus-gobject.c +++ b/dbus/dbus-gobject.c @@ -53,7 +53,8 @@ static GData *error_metadata = NULL; static char* uscore_to_wincaps_full (const char *uscore, - gboolean uppercase_first) + gboolean uppercase_first, + gboolean strip_underscores) { const char *p; GString *str; @@ -65,7 +66,7 @@ uscore_to_wincaps_full (const char *uscore, p = uscore; while (p && *p) { - if (*p == '-' || *p == '_') + if (*p == '-' || (strip_underscores && *p == '_')) { last_was_uscore = TRUE; } @@ -105,7 +106,7 @@ compare_strings_ignoring_uscore_vs_dash (const char *a, const char *b) static char * uscore_to_wincaps (const char *uscore) { - return uscore_to_wincaps_full (uscore, TRUE); + return uscore_to_wincaps_full (uscore, TRUE, TRUE); } static const char * @@ -1362,7 +1363,7 @@ gerror_domaincode_to_dbus_error_name (const DBusGObjectInfo *object_info, * reasons; if someone had a lowercase enumeration value, * previously we'd just send it across unaltered. */ - code_str_wincaps = uscore_to_wincaps_full (code_str, FALSE); + code_str_wincaps = uscore_to_wincaps_full (code_str, FALSE, FALSE); g_string_append (dbus_error_name, code_str_wincaps); g_free (code_str_wincaps); } -- 1.7.2.3