summaryrefslogtreecommitdiffstats
path: root/common/glib-helper.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2008-11-06 16:12:16 -0300
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2008-11-06 16:12:16 -0300
commit054f044588ee84c300b11ef4d94ddc55fe170539 (patch)
tree59ea0fd443b353101454fbebc375115c69000bac /common/glib-helper.c
parent0cd6d963d0fed972434f6d0cec0448c99bee87cb (diff)
Rename bt_string2class to bt_name2class and introduce bt_name2string.
Since bt_string2class didn't work for UUID128 in string format the name got changed to be more suggestive. bt_name2string was introduced to prevent potential use of bt_string2uuid followed with bt_uuid2string which turns to do the same conversion twice.
Diffstat (limited to 'common/glib-helper.c')
-rw-r--r--common/glib-helper.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/common/glib-helper.c b/common/glib-helper.c
index 1812cc6d..17a8cb45 100644
--- a/common/glib-helper.c
+++ b/common/glib-helper.c
@@ -486,7 +486,7 @@ static struct {
{ }
};
-uint16_t bt_string2class(const char *pattern)
+uint16_t bt_name2class(const char *pattern)
{
int i;
@@ -498,6 +498,20 @@ uint16_t bt_string2class(const char *pattern)
return 0;
}
+char *bt_name2string(const char *pattern)
+{
+ uuid_t uuid;
+ uint16_t uuid16;
+
+ uuid16 = bt_name2class(pattern);
+ if (!uuid16)
+ return NULL;
+
+ sdp_uuid16_create(&uuid, uuid16);
+
+ return bt_uuid2string(&uuid);
+}
+
int bt_string2uuid(uuid_t *uuid, const char *string)
{
uint32_t data0, data4;
@@ -530,7 +544,7 @@ int bt_string2uuid(uuid_t *uuid, const char *string)
return 0;
} else {
- uint16_t class = bt_string2class(string);
+ uint16_t class = bt_name2class(string);
if (class) {
sdp_uuid16_create(uuid, class);
return 0;