From dbc061b8123799e9352ab069b4dc1b5ea394587d Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Wed, 15 Nov 2006 01:52:01 +0000 Subject: 2006-11-14 Havoc Pennington * dbus/dbus-internals.c (_dbus_generate_uuid): The spec said the UUID had the timestamp last, but the implementation had it first; move it to last since I think it's a tiny bit nicer (easier to compare at a glance, faster to sort, less code), and will not cause any practical compatibility problems. Also, always convert the timestamp to big endian. * doc/dbus-specification.xml: Clean up the docs on the UUID. * tools/dbus-uuidgen.1: more prominently say it is not suitable as a replacement for regular uuidgen/RFC4122. --- dbus/dbus-internals.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'dbus/dbus-internals.c') diff --git a/dbus/dbus-internals.c b/dbus/dbus-internals.c index 961e7269..788b3529 100644 --- a/dbus/dbus-internals.c +++ b/dbus/dbus-internals.c @@ -22,6 +22,7 @@ */ #include "dbus-internals.h" #include "dbus-protocol.h" +#include "dbus-marshal-basic.h" #include "dbus-test.h" #include #include @@ -505,18 +506,12 @@ void _dbus_generate_uuid (DBusGUID *uuid) { long now; - char *p; - int ts_size; _dbus_get_current_time (&now, NULL); - uuid->as_uint32s[0] = now; - - ts_size = sizeof (uuid->as_uint32s[0]); - p = ((char*)uuid->as_bytes) + ts_size; + uuid->as_uint32s[DBUS_UUID_LENGTH_WORDS - 1] = DBUS_UINT32_TO_BE (now); - _dbus_generate_random_bytes_buffer (p, - sizeof (uuid->as_bytes) - ts_size); + _dbus_generate_random_bytes_buffer (uuid->as_bytes, DBUS_UUID_LENGTH_BYTES - 4); } /** -- cgit