OSDN Git Service

unit: Fix 128-bit UUID format
authorClaudio Takahasi <claudio.takahasi@openbossa.org>
Mon, 24 Mar 2014 19:25:31 +0000 (16:25 -0300)
committerJohan Hedberg <johan.hedberg@intel.com>
Mon, 24 Mar 2014 20:06:42 +0000 (22:06 +0200)
No matter the system, 128-bit UUID must use big endian byte order format
(similar to human-readable format).

unit/test-uuid.c

index 225a7b5..6c7e9d0 100644 (file)
@@ -97,7 +97,6 @@ static void test_uuid(gconstpointer data)
 {
        const struct uuid_test_data *test_data = data;
        bt_uuid_t uuid;
-       uint128_t n128, u128;
 
        g_assert(bt_string_to_uuid(&uuid, test_data->str) == 0);
        g_assert(uuid.type == test_data->type);
@@ -110,9 +109,11 @@ static void test_uuid(gconstpointer data)
                g_assert(uuid.value.u32 == test_data->val32);
                break;
        case BT_UUID128:
-               memcpy(&n128, test_data->binary, 16);
-               ntoh128(&n128, &u128);
-               g_assert(memcmp(&uuid.value.u128, &u128, 16) == 0);
+               /*
+                * No matter the system type: 128-bit UUID should use
+                * big-endian (human readable format).
+                */
+               g_assert(memcmp(&uuid.value.u128, test_data->binary, 16) == 0);
                break;
        default:
                return;