From 44f7ae6453822aa5817342e2bad134efe28008ee Mon Sep 17 00:00:00 2001 From: Vasiliy Balyasnyy Date: Tue, 8 Oct 2013 13:36:38 +0400 Subject: [PATCH] dbus-message.c: unused variable bytes_read in _dbus_message_loader_get_buffer --- dbus/dbus-message-internal.h | 3 +-- dbus/dbus-message-util.c | 10 +++++----- dbus/dbus-message.c | 6 ++---- dbus/dbus-transport-socket.c | 15 ++++----------- dbus/dbus-transport.c | 8 ++------ 5 files changed, 14 insertions(+), 28 deletions(-) diff --git a/dbus/dbus-message-internal.h b/dbus/dbus-message-internal.h index c194873..5d6594e 100644 --- a/dbus/dbus-message-internal.h +++ b/dbus/dbus-message-internal.h @@ -70,8 +70,7 @@ void _dbus_message_loader_unref (DBusMessageLoader void _dbus_message_loader_get_buffer (DBusMessageLoader *loader, DBusString **buffer); void _dbus_message_loader_return_buffer (DBusMessageLoader *loader, - DBusString *buffer, - int bytes_read); + DBusString *buffer); dbus_bool_t _dbus_message_loader_get_unix_fds (DBusMessageLoader *loader, int **fds, diff --git a/dbus/dbus-message-util.c b/dbus/dbus-message-util.c index fb7e260..8f36dc0 100644 --- a/dbus/dbus-message-util.c +++ b/dbus/dbus-message-util.c @@ -493,7 +493,7 @@ dbus_internal_do_not_use_try_message_data (const DBusString *data, _dbus_message_loader_get_buffer (loader, &buffer); _dbus_string_append_byte (buffer, _dbus_string_get_byte (data, i)); - _dbus_message_loader_return_buffer (loader, buffer, 1); + _dbus_message_loader_return_buffer (loader, buffer); } if (!check_loader_results (loader, expected_validity)) @@ -512,7 +512,7 @@ dbus_internal_do_not_use_try_message_data (const DBusString *data, _dbus_message_loader_get_buffer (loader, &buffer); _dbus_string_copy (data, 0, buffer, _dbus_string_get_length (buffer)); - _dbus_message_loader_return_buffer (loader, buffer, 1); + _dbus_message_loader_return_buffer (loader, buffer); } if (!check_loader_results (loader, expected_validity)) @@ -536,7 +536,7 @@ dbus_internal_do_not_use_try_message_data (const DBusString *data, if ((i+1) < len) _dbus_string_append_byte (buffer, _dbus_string_get_byte (data, i+1)); - _dbus_message_loader_return_buffer (loader, buffer, 1); + _dbus_message_loader_return_buffer (loader, buffer); } if (!check_loader_results (loader, expected_validity)) @@ -1327,7 +1327,7 @@ _dbus_message_test (const char *test_data_dir) _dbus_message_loader_get_buffer (loader, &buffer); _dbus_string_append_byte (buffer, data[i]); - _dbus_message_loader_return_buffer (loader, buffer, 1); + _dbus_message_loader_return_buffer (loader, buffer); } /* Write the body data one byte at a time */ @@ -1338,7 +1338,7 @@ _dbus_message_test (const char *test_data_dir) _dbus_message_loader_get_buffer (loader, &buffer); _dbus_string_append_byte (buffer, data[i]); - _dbus_message_loader_return_buffer (loader, buffer, 1); + _dbus_message_loader_return_buffer (loader, buffer); } #ifdef HAVE_UNIX_FD_PASSING diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index 20c8be3..13edeb7 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -3912,12 +3912,10 @@ _dbus_message_loader_get_buffer (DBusMessageLoader *loader, * * @param loader the loader. * @param buffer the buffer. - * @param bytes_read number of bytes that were read into the buffer. */ void _dbus_message_loader_return_buffer (DBusMessageLoader *loader, - DBusString *buffer, - int bytes_read) + DBusString *buffer) { _dbus_assert (loader->buffer_outstanding); _dbus_assert (buffer == &loader->data); @@ -4694,7 +4692,7 @@ dbus_message_demarshal (const char *str, _dbus_message_loader_get_buffer (loader, &buffer); _dbus_string_append_len (buffer, str, len); - _dbus_message_loader_return_buffer (loader, buffer, len); + _dbus_message_loader_return_buffer (loader, buffer); if (!_dbus_message_loader_queue_messages (loader)) goto fail_oom; diff --git a/dbus/dbus-transport-socket.c b/dbus/dbus-transport-socket.c index c7c6291..44c7af7 100644 --- a/dbus/dbus-transport-socket.c +++ b/dbus/dbus-transport-socket.c @@ -748,29 +748,23 @@ do_reading (DBusTransport *transport) if (bytes_read > 0) { - int orig_len; - _dbus_message_loader_get_buffer (transport->loader, &buffer); - orig_len = _dbus_string_get_length (buffer); - if (!_dbus_auth_decode_data (transport->auth, &socket_transport->encoded_incoming, buffer)) { _dbus_verbose ("Out of memory decoding incoming data\n"); _dbus_message_loader_return_buffer (transport->loader, - buffer, - _dbus_string_get_length (buffer) - orig_len); + buffer); oom = TRUE; goto out; } _dbus_message_loader_return_buffer (transport->loader, - buffer, - _dbus_string_get_length (buffer) - orig_len); + buffer); _dbus_string_set_length (&socket_transport->encoded_incoming, 0); _dbus_string_compact (&socket_transport->encoded_incoming, 2048); @@ -789,7 +783,7 @@ do_reading (DBusTransport *transport) if (!_dbus_message_loader_get_unix_fds(transport->loader, &fds, &n_fds)) { _dbus_verbose ("Out of memory reading file descriptors\n"); - _dbus_message_loader_return_buffer (transport->loader, buffer, 0); + _dbus_message_loader_return_buffer (transport->loader, buffer); oom = TRUE; goto out; } @@ -812,8 +806,7 @@ do_reading (DBusTransport *transport) } _dbus_message_loader_return_buffer (transport->loader, - buffer, - bytes_read < 0 ? 0 : bytes_read); + buffer); } if (bytes_read < 0) diff --git a/dbus/dbus-transport.c b/dbus/dbus-transport.c index e68a9f0..ecc3182 100644 --- a/dbus/dbus-transport.c +++ b/dbus/dbus-transport.c @@ -1045,9 +1045,7 @@ recover_unused_bytes (DBusTransport *transport) orig_len); _dbus_message_loader_return_buffer (transport->loader, - buffer, - _dbus_string_get_length (buffer) - - orig_len); + buffer); _dbus_auth_delete_unused_bytes (transport->auth); @@ -1077,9 +1075,7 @@ recover_unused_bytes (DBusTransport *transport) orig_len); _dbus_message_loader_return_buffer (transport->loader, - buffer, - _dbus_string_get_length (buffer) - - orig_len); + buffer); if (succeeded) _dbus_auth_delete_unused_bytes (transport->auth); -- 1.7.5.4