Commit fbae5baa authored by Havoc Pennington's avatar Havoc Pennington

2004-05-28 Havoc Pennington <hp@redhat.com>

	* test/glib/test-service-glib.c (main): remove unused variable

	* glib/dbus-gidl.c (base_info_ref): fix a silly compiler warning

	* dbus/dbus-auth.h (enum): remove AUTHENTICATED_WITH_UNUSED_BYTES
	from the enum, no longer in use.

	* dbus/dbus-sysdeps.h: include config.h so DBUS_VA_COPY actually
	works right.

	* dbus/dbus-message.c: add various _dbus_return_val_if_fail for
	whether error_name passed in is a valid error name.
parent 1041b44d
2004-05-28 Havoc Pennington <hp@redhat.com>
* test/glib/test-service-glib.c (main): remove unused variable
* glib/dbus-gidl.c (base_info_ref): fix a silly compiler warning
* dbus/dbus-auth.h (enum): remove AUTHENTICATED_WITH_UNUSED_BYTES
from the enum, no longer in use.
* dbus/dbus-sysdeps.h: include config.h so DBUS_VA_COPY actually
works right.
* dbus/dbus-message.c: add various _dbus_return_val_if_fail for
whether error_name passed in is a valid error name.
2004-05-28 John (J5) Palmieri <johnp@redhat.com>
* dbus/dbus-message.c (dbus_message_get_args): Added support for
......
......@@ -38,7 +38,6 @@ typedef enum
DBUS_AUTH_STATE_WAITING_FOR_MEMORY,
DBUS_AUTH_STATE_HAVE_BYTES_TO_SEND,
DBUS_AUTH_STATE_NEED_DISCONNECT,
DBUS_AUTH_STATE_AUTHENTICATED_WITH_UNUSED_BYTES,
DBUS_AUTH_STATE_AUTHENTICATED
} DBusAuthState;
......
......@@ -171,6 +171,23 @@ clear_header_padding (DBusMessage *message)
message->header_padding = 0;
}
#ifdef DBUS_DISABLE_CHECKS
#define is_valid_error_name(x) TRUE
#else
static dbus_bool_t
is_valid_error_name (const char *error_name)
{
DBusString the_error_name;
if (error_name == NULL)
return FALSE;
_dbus_string_init_const (&the_error_name, error_name);
return _dbus_string_validate_error_name (&the_error_name, 0,
_dbus_string_get_length (&the_error_name));
}
#endif
static dbus_bool_t
append_header_padding (DBusMessage *message)
{
......@@ -1022,6 +1039,7 @@ dbus_message_create_header (DBusMessage *message,
_dbus_assert ((interface && member) ||
(error_name) ||
!(interface || member || error_name));
_dbus_assert (error_name == NULL || is_valid_error_name (error_name));
if (!_dbus_string_append_byte (&message->header, message->byte_order))
return FALSE;
......@@ -1378,6 +1396,7 @@ dbus_message_new_error (DBusMessage *reply_to,
_dbus_return_val_if_fail (reply_to != NULL, NULL);
_dbus_return_val_if_fail (error_name != NULL, NULL);
_dbus_return_val_if_fail (is_valid_error_name (error_name), NULL);
sender = get_string_field (reply_to,
DBUS_HEADER_FIELD_SENDER,
......@@ -1441,6 +1460,10 @@ dbus_message_new_error_printf (DBusMessage *reply_to,
DBusString str;
DBusMessage *message;
_dbus_return_val_if_fail (reply_to != NULL, NULL);
_dbus_return_val_if_fail (error_name != NULL, NULL);
_dbus_return_val_if_fail (is_valid_error_name (error_name), NULL);
if (!_dbus_string_init (&str))
return NULL;
......@@ -1787,7 +1810,9 @@ dbus_message_set_error_name (DBusMessage *message,
{
_dbus_return_val_if_fail (message != NULL, FALSE);
_dbus_return_val_if_fail (!message->locked, FALSE);
_dbus_return_val_if_fail (error_name != NULL, FALSE);
_dbus_return_val_if_fail (is_valid_error_name (error_name), FALSE);
return set_string_field (message,
DBUS_HEADER_FIELD_ERROR_NAME,
DBUS_TYPE_STRING,
......@@ -3819,6 +3844,9 @@ dbus_message_append_args_valist (DBusMessage *message,
goto errorout;
break;
case DBUS_TYPE_BYTE:
/* FIXME if you pass an unsigned char to varargs it gets promoted to int,
* so probably we should read an int here.
*/
if (!dbus_message_iter_append_byte (&iter, va_arg (var_args, unsigned char)))
goto errorout;
break;
......@@ -3827,10 +3855,16 @@ dbus_message_append_args_valist (DBusMessage *message,
goto errorout;
break;
case DBUS_TYPE_INT32:
/* FIXME this is probably wrong, because an int passed in probably gets
* converted to plain "int" not necessarily 32-bit.
*/
if (!dbus_message_iter_append_int32 (&iter, va_arg (var_args, dbus_int32_t)))
goto errorout;
break;
case DBUS_TYPE_UINT32:
/* FIXME this is probably wrong, because an int passed in probably gets
* converted to plain "int" not necessarily 32-bit.
*/
if (!dbus_message_iter_append_uint32 (&iter, va_arg (var_args, dbus_uint32_t)))
goto errorout;
break;
......@@ -4367,13 +4401,14 @@ dbus_message_is_signal (DBusMessage *message,
*/
dbus_bool_t
dbus_message_is_error (DBusMessage *message,
const char *error_name)
const char *error_name)
{
const char *n;
_dbus_return_val_if_fail (message != NULL, FALSE);
_dbus_return_val_if_fail (error_name != NULL, FALSE);
_dbus_return_val_if_fail (is_valid_error_name (error_name), FALSE);
if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_ERROR)
return FALSE;
......
......@@ -25,6 +25,8 @@
#ifndef DBUS_SYSDEPS_H
#define DBUS_SYSDEPS_H
#include <config.h>
#include <dbus/dbus-errors.h>
/* this is perhaps bogus, but strcmp() etc. are faster if we use the
......
......@@ -70,8 +70,8 @@ struct ArgInfo
BaseInfo *
base_info_ref (BaseInfo *info)
{
g_return_if_fail (info != NULL);
g_return_if_fail (info->refcount > 0);
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (info->refcount > 0, NULL);
info->refcount += 1;
......
......@@ -11,7 +11,6 @@ main (int argc, char **argv)
{
DBusConnection *connection;
GError *error;
int i;
g_type_init ();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment