Sophie

Sophie

distrib > Mandriva > 10.2 > x86_64 > by-pkgid > 1aebb1378a2b7112488d2aaddd022e5a > files > 4

bluez-utils-2.14-1.1.102mdk.src.rpm

===================================================================
RCS file: /cvsroot/bluez/utils/acinclude.m4,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- bluez/utils/acinclude.m4	2005/05/03 23:19:22	1.42
+++ bluez/utils/acinclude.m4	2005/05/14 10:43:22	1.43
@@ -244,6 +244,9 @@
 
 	LDFLAGS="$LDFLAGS $DBUS_LIBS"
 	AC_CHECK_LIB(dbus-1, dbus_error_init, DBUS_LIBS="$DBUS_LIBS -ldbus-1", dbus_found=no)
+	AC_CHECK_LIB(dbus-1, dbus_pending_call_steal_reply, AC_DEFINE(HAVE_DBUS_PENDING_CALL_STEAL_REPLY, 1, [Define to 1 if you have the dbus_pending_call_steal_reply() function.]))
+	AC_CHECK_LIB(dbus-1, dbus_message_iter_get_basic, AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_GET_BASIC, 1, [Define to 1 if you have the dbus_message_iter_get_basic() function.]))
+	AC_CHECK_LIB(dbus-1, dbus_message_append_args, AC_DEFINE(HAVE_DBUS_MESSAGE_APPEND_ARGS, 1, [Define to 1 if you have the dbus_message_append_args() function.]))
 
 	CPPFLAGS=$ac_save_CPPFLAGS
 	LDFLAGS=$ac_save_LDFLAGS
===================================================================
RCS file: /cvsroot/bluez/utils/hcid/dbus.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- bluez/utils/hcid/dbus.c	2005/01/26 02:08:01	1.6
+++ bluez/utils/hcid/dbus.c	2005/05/14 10:43:23	1.7
@@ -72,7 +72,11 @@
 	size_t len;
 	char *pin;
 
+#ifdef HAVE_DBUS_PENDING_CALL_STEAL_REPLY
+	message = dbus_pending_call_steal_reply(call);
+#else
 	message = dbus_pending_call_get_reply(call);
+#endif
 
 	if (dbus_message_is_error(message, WRONG_ARGS_ERROR))
 		goto error;
@@ -83,7 +87,12 @@
 	if (type != DBUS_TYPE_STRING)
 		goto error;
 
+#ifdef HAVE_DBUS_MESSAGE_ITER_GET_BASIC
+	dbus_message_iter_get_basic(&iter, &pin);
+#else
 	pin = dbus_message_iter_get_string(&iter);
+#endif
+
 	len = strlen(pin);
 
 	memset(&pr, 0, sizeof(pr));
@@ -93,11 +102,13 @@
 	hci_send_cmd(req->dev, OGF_LINK_CTL, OCF_PIN_CODE_REPLY,
 						PIN_CODE_REPLY_CP_SIZE, &pr);
 
+	dbus_message_unref(message);
+
 	return;
 
 error:
-	hci_send_cmd(req->dev, OGF_LINK_CTL, OCF_PIN_CODE_NEG_REPLY,
-							6, &req->bda);
+	hci_send_cmd(req->dev, OGF_LINK_CTL,
+				OCF_PIN_CODE_NEG_REPLY, 6, &req->bda);
 }
 
 
@@ -109,7 +120,9 @@
 void hcid_dbus_request_pin(int dev, struct hci_conn_info *ci)
 {
 	DBusMessage *message;
+#ifndef HAVE_DBUS_MESSAGE_APPEND_ARGS
 	DBusMessageIter iter;
+#endif
 	DBusPendingCall *pending = NULL;
 	struct pin_request *req;
 
@@ -124,14 +137,20 @@
 	req->dev = dev;
 	bacpy(&req->bda, &ci->bdaddr);
 
+#ifdef HAVE_DBUS_MESSAGE_APPEND_ARGS
+	dbus_message_append_args(message, DBUS_TYPE_BOOLEAN, &ci->out,
+			DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
+			&ci->bdaddr, sizeof(bdaddr_t), DBUS_TYPE_INVALID);
+#else
 	dbus_message_append_iter_init(message, &iter);
 
 	dbus_message_iter_append_boolean(&iter, ci->out);
 	dbus_message_iter_append_byte_array(&iter,
 			(unsigned char *) &ci->bdaddr, sizeof(ci->bdaddr));
+#endif
 
 	if (dbus_connection_send_with_reply(connection, message,
-						&pending, TIMEOUT) == FALSE) {
+					&pending, TIMEOUT) == FALSE) {
 		syslog(LOG_ERR, "D-BUS send failed");
 		goto failed;
 	}
@@ -139,16 +158,16 @@
 	dbus_pending_call_set_notify(pending, reply_handler_function,
 							req, free_pin_req);
 
-	dbus_connection_flush (connection);
+	dbus_connection_flush(connection);
 
-	dbus_message_unref (message);
+	dbus_message_unref(message);
 
 	return;
 
 failed:
-	dbus_message_unref (message);
-	hci_send_cmd(dev, OGF_LINK_CTL, OCF_PIN_CODE_NEG_REPLY,
-							6, &ci->bdaddr);
+	dbus_message_unref(message);
+	hci_send_cmd(dev, OGF_LINK_CTL,
+				OCF_PIN_CODE_NEG_REPLY, 6, &ci->bdaddr);
 }
 
 gboolean watch_func(GIOChannel *chan, GIOCondition cond, gpointer data)