[tracker/extractor-dbus-fd: 9/11] libtracker-common: Check more parameters and make g_return* asserts clearer



commit 142701db0a1abe853dbebd9c00bf21d8ccc68f2e
Author: Martyn Russell <martyn lanedo com>
Date:   Wed Jul 7 14:52:25 2010 +0100

    libtracker-common: Check more parameters and make g_return* asserts clearer

 src/libtracker-common/tracker-dbus.c |   22 +++++++++++++---------
 src/libtracker-common/tracker-dbus.h |    2 +-
 2 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/src/libtracker-common/tracker-dbus.c b/src/libtracker-common/tracker-dbus.c
index f7a907e..6cbb020 100644
--- a/src/libtracker-common/tracker-dbus.c
+++ b/src/libtracker-common/tracker-dbus.c
@@ -728,9 +728,10 @@ tracker_dbus_send_and_splice (DBusConnection  *connection,
 	GError *inner_error = NULL;
 	gboolean ret_value = FALSE;
 
-	g_return_val_if_fail (connection, FALSE);
-	g_return_val_if_fail (message, FALSE);
-	g_return_val_if_fail (dest_buffer, FALSE);
+	g_return_val_if_fail (connection != NULL, FALSE);
+	g_return_val_if_fail (message != NULL, FALSE);
+	g_return_val_if_fail (fd > 0, FALSE);
+	g_return_val_if_fail (dest_buffer != NULL, FALSE);
 
 	dbus_connection_send_with_reply (connection,
 	                                 message,
@@ -802,7 +803,7 @@ tracker_dbus_send_and_splice (DBusConnection  *connection,
 	return ret_value;
 }
 
-static SendAndSpliceData*
+static SendAndSpliceData *
 send_and_splice_data_new (GInputStream                     *unix_input_stream,
                           GInputStream                     *buffered_input_stream,
                           GOutputStream                    *output_stream,
@@ -880,7 +881,7 @@ send_and_splice_async_callback (GObject      *source,
 	send_and_splice_data_free (data);
 }
 
-void
+gboolean
 tracker_dbus_send_and_splice_async (DBusConnection                   *connection,
                                     DBusMessage                      *message,
                                     int                               fd,
@@ -894,9 +895,10 @@ tracker_dbus_send_and_splice_async (DBusConnection                   *connection
 	GOutputStream *output_stream;
 	SendAndSpliceData *data;
 
-	g_return_if_fail (connection);
-	g_return_if_fail (message);
-
+	g_return_val_if_fail (connection != NULL, FALSE);
+	g_return_val_if_fail (message != NULL, FALSE);
+	g_return_val_if_fail (fd > 0, FALSE);
+	g_return_val_if_fail (callback != NULL, FALSE);
 
 	dbus_connection_send_with_reply (connection,
 	                                 message,
@@ -906,7 +908,7 @@ tracker_dbus_send_and_splice_async (DBusConnection                   *connection
 
 	if (!call) {
 		g_critical ("FD passing unsupported or connection disconnected");
-		return;
+		return FALSE;
 	}
 
 	unix_input_stream = g_unix_input_stream_new (fd, TRUE);
@@ -929,4 +931,6 @@ tracker_dbus_send_and_splice_async (DBusConnection                   *connection
 	                              cancellable,
 	                              send_and_splice_async_callback,
 	                              data);
+
+	return TRUE;
 }
diff --git a/src/libtracker-common/tracker-dbus.h b/src/libtracker-common/tracker-dbus.h
index b4ab087..35eb699 100644
--- a/src/libtracker-common/tracker-dbus.h
+++ b/src/libtracker-common/tracker-dbus.h
@@ -176,7 +176,7 @@ gboolean         tracker_dbus_send_and_splice        (DBusConnection
                                                       gssize                     *dest_buffer_size,
                                                       GError                    **error);
 
-void             tracker_dbus_send_and_splice_async  (DBusConnection             *connection,
+gboolean         tracker_dbus_send_and_splice_async  (DBusConnection             *connection,
                                                       DBusMessage                *message,
                                                       int                         fd,
                                                       GCancellable               *cancellable,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]