summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-marshal.h
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-01-26 07:48:16 +0000
committerHavoc Pennington <hp@redhat.com>2003-01-26 07:48:16 +0000
commit50c25505f62786756519ef1e194883360eda82e0 (patch)
tree968d4b0b148a78a665ea7b023350047e070aafed /dbus/dbus-marshal.h
parentd5ad082fecbbd803fd89b3574ac137b3fa964bc7 (diff)
2003-01-26 Havoc Pennington <hp@pobox.com>
The unit tests pass, but otherwise untested. If it breaks, the tests should have been better. ;-) * bus/driver.c (bus_driver_handle_hello): return if we disconnect the connection. * dbus/dbus-message.c: redo everything so we maintain message->header as the only copy of the various fields. This avoids the possibility of out-of-memory in some cases, for example dbus_message_lock() can't run out of memory anymore, and avoids extra copying. Figured I may as well go ahead and do this since it was busted for dbus_message_lock to not return failure on OOM, and dbus_message_write_header was totally unchecked for OOM. Also fixed some random other bugs. * dbus/dbus-marshal.c (_dbus_marshal_get_field_end_pos): verify that strings are nul-terminated. Also, end_pos can be equal to string length just not greater than, I think. (_dbus_marshal_set_int32): new function (_dbus_marshal_set_uint32): new function (_dbus_marshal_set_string): new function * dbus/dbus-connection.c (_dbus_connection_new_for_transport): fix a warning, init timeout_list to NULL (dbus_connection_send_message): don't use uninitialized variable "serial" * dbus/dbus-string.c (_dbus_string_replace_len): new function
Diffstat (limited to 'dbus/dbus-marshal.h')
-rw-r--r--dbus/dbus-marshal.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/dbus/dbus-marshal.h b/dbus/dbus-marshal.h
index 5184318e..bdeeccb9 100644
--- a/dbus/dbus-marshal.h
+++ b/dbus/dbus-marshal.h
@@ -46,11 +46,12 @@
(((dbus_uint32_t) (val) & (dbus_uint32_t) 0xff000000U) >> 24)))
#define DBUS_UINT32_SWAP_LE_BE(val) (DBUS_UINT32_SWAP_LE_BE_CONSTANT (val))
+#define DBUS_INT32_SWAP_LE_BE(val) ((dbus_int32_t)DBUS_UINT32_SWAP_LE_BE_CONSTANT (val))
#ifdef WORDS_BIGENDIAN
#define DBUS_INT32_TO_BE(val) ((dbus_int32_t) (val))
#define DBUS_UINT32_TO_BE(val) ((dbus_uint32_t) (val))
-#define DBUS_INT32_TO_LE(val) ((dbus_int32_t) DBUS_UINT32_SWAP_LE_BE (val))
+#define DBUS_INT32_TO_LE(val) (DBUS_INT32_SWAP_LE_BE (val))
#define DBUS_UINT32_TO_LE(val) (DBUS_UINT32_SWAP_LE_BE (val))
#else
#define DBUS_INT32_TO_LE(val) ((dbus_int32_t) (val))
@@ -76,6 +77,19 @@ void _dbus_pack_uint32 (dbus_uint32_t value,
dbus_uint32_t _dbus_unpack_uint32 (int byte_order,
const unsigned char *data);
+void _dbus_marshal_set_int32 (DBusString *str,
+ int byte_order,
+ int offset,
+ dbus_int32_t value);
+void _dbus_marshal_set_uint32 (DBusString *str,
+ int byte_order,
+ int offset,
+ dbus_uint32_t value);
+dbus_bool_t _dbus_marshal_set_string (DBusString *str,
+ int byte_order,
+ int offset,
+ const DBusString *value);
+
dbus_bool_t _dbus_marshal_int32 (DBusString *str,
int byte_order,