Blob Blame History Raw
From 35b30ed4f5e7678ab75affad0ec2fb1869eec384 Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Mon, 1 Feb 2010 10:09:53 -0500
Subject: [PATCH] Squash underscores and dashes in errors when converting to DBus errors

We were just taking the enumeration nick and appending to the DBus
error name, but since these can contain '-' we need to squash.
---
 dbus/dbus-gobject.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/dbus/dbus-gobject.c b/dbus/dbus-gobject.c
index f75a3b1..9fca6a2 100644
--- a/dbus/dbus-gobject.c
+++ b/dbus/dbus-gobject.c
@@ -1093,9 +1093,18 @@ gerror_domaincode_to_dbus_error_name (const DBusGObjectInfo *object_info,
     }
   else
     {
-      dbus_error_name = g_string_new (domain_str);
+      char *domain_member, *code_member;
+      
+      /* TODO should further validate these */
+      domain_member = uscore_to_wincaps (domain_str);
+      code_member = uscore_to_wincaps (code_str);
+      
+      dbus_error_name = g_string_new (domain_member);
       g_string_append_c (dbus_error_name, '.');
-      g_string_append (dbus_error_name, code_str);
+      g_string_append (dbus_error_name, code_member);
+      
+      g_free (domain_member);
+      g_free (code_member);
     }
 
   return g_string_free (dbus_error_name, FALSE);
-- 
1.6.6