voc Pennington <hp@redhat.com>

* dbus/dbus-sysdeps.h: add _DBUS_DOUBLES_BITWISE_EQUAL macro,
	for a variety of reasons '==' doesn't do this.
This commit is contained in:
Havoc Pennington 2005-01-01 20:53:42 +00:00
parent 60a9694974
commit e07789e511
3 changed files with 24 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2005-01-01 Havoc Pennington <hp@redhat.com>
* dbus/dbus-sysdeps.h: add _DBUS_DOUBLES_BITWISE_EQUAL macro,
for a variety of reasons '==' doesn't do this.
2004-12-31 Havoc Pennington <hp@redhat.com>
* dbus/dbus-string.c (_dbus_string_equal_substrings): new function

View file

@ -329,6 +329,21 @@ dbus_bool_t _dbus_user_at_console (const char *username,
# endif /* va_list is a pointer */
#endif /* !DBUS_VA_COPY */
/* On x86 there is an 80-bit FPU, and if you do "a == b" it may have a
* or b in an 80-bit register, thus failing to compare the two 64-bit
* doubles for bitwise equality.
*/
#define _DBUS_BYTE_OF_PRIMITIVE(p, i) \
(((const char*)&(p))[(i)])
#define _DBUS_DOUBLES_BITWISE_EQUAL(a, b) \
(_DBUS_BYTE_OF_PRIMITIVE (a, 0) == _DBUS_BYTE_OF_PRIMITIVE (b, 0) && \
_DBUS_BYTE_OF_PRIMITIVE (a, 1) == _DBUS_BYTE_OF_PRIMITIVE (b, 1) && \
_DBUS_BYTE_OF_PRIMITIVE (a, 2) == _DBUS_BYTE_OF_PRIMITIVE (b, 2) && \
_DBUS_BYTE_OF_PRIMITIVE (a, 3) == _DBUS_BYTE_OF_PRIMITIVE (b, 3) && \
_DBUS_BYTE_OF_PRIMITIVE (a, 4) == _DBUS_BYTE_OF_PRIMITIVE (b, 4) && \
_DBUS_BYTE_OF_PRIMITIVE (a, 5) == _DBUS_BYTE_OF_PRIMITIVE (b, 5) && \
_DBUS_BYTE_OF_PRIMITIVE (a, 6) == _DBUS_BYTE_OF_PRIMITIVE (b, 6) && \
_DBUS_BYTE_OF_PRIMITIVE (a, 7) == _DBUS_BYTE_OF_PRIMITIVE (b, 7))
DBUS_END_DECLS

View file

@ -58,6 +58,10 @@ Important for 1.0
(though they are kind of a pita to pass in as size_t with the
varargs, so maybe not - what does glib do with g_object_get()?)
- it's probably obnoxious that reading/writing bools doesn't return dbus_bool_t;
the only possible solution I think is to change dbus_bool_t to unsigned char,
but that may cause wackiness elsewhere.
- rename the service thing. unique service names (":1") and well-known
("org.foo.bar") should have different names probably; something like
"address" for the unique and "alias" for the well-known, or