dbus/dbus dbus-connection.c, 1.152, 1.152.2.1 dbus-internals.c, 1.54, 1.54.2.1 dbus-internals.h, 1.64, 1.64.2.1

Havoc Pennington hp at kemper.freedesktop.org
Tue Nov 14 17:51:21 PST 2006


Update of /cvs/dbus/dbus/dbus
In directory kemper:/tmp/cvs-serv8172/dbus

Modified Files:
      Tag: DBUS_1_0
	dbus-connection.c dbus-internals.c dbus-internals.h 
Log Message:
2006-11-14  Havoc Pennington  <hp at redhat.com>

	* 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.



Index: dbus-connection.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-connection.c,v
retrieving revision 1.152
retrieving revision 1.152.2.1
diff -u -d -r1.152 -r1.152.2.1
--- dbus-connection.c	28 Oct 2006 01:50:08 -0000	1.152
+++ dbus-connection.c	15 Nov 2006 01:51:19 -0000	1.152.2.1
@@ -5511,7 +5511,10 @@
  * 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*

Index: dbus-internals.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-internals.c,v
retrieving revision 1.54
retrieving revision 1.54.2.1
diff -u -d -r1.54 -r1.54.2.1
--- dbus-internals.c	24 Oct 2006 20:25:01 -0000	1.54
+++ dbus-internals.c	15 Nov 2006 01:51:19 -0000	1.54.2.1
@@ -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 @@
 _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);
 }
 
 /**

Index: dbus-internals.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-internals.h,v
retrieving revision 1.64
retrieving revision 1.64.2.1
diff -u -d -r1.64 -r1.64.2.1
--- dbus-internals.h	28 Oct 2006 01:41:37 -0000	1.64
+++ dbus-internals.h	15 Nov 2006 01:51:19 -0000	1.64.2.1
@@ -318,7 +318,8 @@
                                             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 @@
  */
 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 */
 };
 



More information about the dbus-commit mailing list