From 50c25505f62786756519ef1e194883360eda82e0 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sun, 26 Jan 2003 07:48:16 +0000 Subject: 2003-01-26 Havoc Pennington 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 --- dbus/dbus-string.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'dbus/dbus-string.h') diff --git a/dbus/dbus-string.h b/dbus/dbus-string.h index b2335086..c5564e9c 100644 --- a/dbus/dbus-string.h +++ b/dbus/dbus-string.h @@ -48,6 +48,9 @@ dbus_bool_t _dbus_string_init (DBusString *str, int max_length); void _dbus_string_init_const (DBusString *str, const char *value); +void _dbus_string_init_const_len (DBusString *str, + const char *value, + int len); void _dbus_string_free (DBusString *str); void _dbus_string_lock (DBusString *str); @@ -63,6 +66,8 @@ void _dbus_string_get_const_data_len (const DBusString *str, const char **data_return, int start, int len); +char _dbus_string_get_byte (const DBusString *str, + int start); dbus_bool_t _dbus_string_steal_data (DBusString *str, char **data_return); dbus_bool_t _dbus_string_steal_data_len (DBusString *str, @@ -118,6 +123,12 @@ dbus_bool_t _dbus_string_copy_len (const DBusString *source, DBusString *dest, int insert_at); +dbus_bool_t _dbus_string_replace_len (const DBusString *source, + int start, + int len, + DBusString *dest, + int replace_at, + int replace_len); void _dbus_string_get_unichar (const DBusString *str, int start, -- cgit