diff options
Diffstat (limited to 'dbus')
-rw-r--r-- | dbus/dbus-connection.c | 5 | ||||
-rw-r--r-- | dbus/dbus-internals.c | 11 | ||||
-rw-r--r-- | dbus/dbus-internals.h | 5 |
3 files changed, 10 insertions, 11 deletions
diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c index 552ecfd8..268a97d6 100644 --- a/dbus/dbus-connection.c +++ b/dbus/dbus-connection.c @@ -5511,7 +5511,10 @@ dbus_connection_get_outgoing_size (DBusConnection *connection) * If the remote application has the same machine ID as the one * returned by this function, then the remote application is on the * same machine as your application. - * + * + * The UUID is not a UUID in the sense of RFC4122; the details + * are explained in the D-Bus specification. + * * @returns a 32-byte-long hex-encoded UUID string, or #NULL if insufficient memory */ char* 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 <stdio.h> #include <stdarg.h> @@ -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); } /** diff --git a/dbus/dbus-internals.h b/dbus/dbus-internals.h index 4d839241..750882b9 100644 --- a/dbus/dbus-internals.h +++ b/dbus/dbus-internals.h @@ -318,7 +318,8 @@ void _dbus_set_bad_address (DBusError *error, const char *address_problem_other); #define DBUS_UUID_LENGTH_BYTES 16 -#define DBUS_UUID_LENGTH_HEX (DBUS_UUID_LENGTH_BYTES * 2) +#define DBUS_UUID_LENGTH_WORDS (DBUS_UUID_LENGTH_BYTES / 4) +#define DBUS_UUID_LENGTH_HEX (DBUS_UUID_LENGTH_BYTES * 2) /** * A globally unique ID ; we have one for each DBusServer, and also one for each @@ -326,7 +327,7 @@ void _dbus_set_bad_address (DBusError *error, */ union DBusGUID { - dbus_uint32_t as_uint32s[DBUS_UUID_LENGTH_BYTES / 4]; /**< guid as four uint32 values */ + dbus_uint32_t as_uint32s[DBUS_UUID_LENGTH_WORDS]; /**< guid as four uint32 values */ char as_bytes[DBUS_UUID_LENGTH_BYTES]; /**< guid as 16 single-byte values */ }; |