[PATCH spice-gtk 06/14] win-usb: get rid of status code return in async ops

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

 



---
 gtk/usb-device-manager.c     | 17 ++---------------
 gtk/win-usb-driver-install.c | 10 +++++-----
 gtk/win-usb-driver-install.h |  8 ++++----
 3 files changed, 11 insertions(+), 24 deletions(-)

diff --git a/gtk/usb-device-manager.c b/gtk/usb-device-manager.c
index 147026c..a505c19 100644
--- a/gtk/usb-device-manager.c
+++ b/gtk/usb-device-manager.c
@@ -1065,7 +1065,6 @@ static void spice_usb_device_manager_drv_install_cb(GObject *gobject,
 {
     SpiceUsbDeviceManager *self;
     SpiceWinUsbDriver *installer;
-    gint status;
     GError *err = NULL;
     SpiceUsbDevice *device;
     UsbInstallCbInfo *cbinfo;
@@ -1090,17 +1089,11 @@ static void spice_usb_device_manager_drv_install_cb(GObject *gobject,
 
     SPICE_DEBUG("Win USB driver install finished");
 
-    status = spice_win_usb_driver_install_finish(installer, res, &err);
-
-    if (err) {
+    if (!spice_win_usb_driver_install_finish(installer, res, &err)) {
         g_warning("win usb driver install failed -- %s", err->message);
         g_error_free(err);
     }
 
-    if (!status) {
-        g_warning("failed to install win usb driver (status=0)");
-    }
-
     spice_usb_device_unref(device);
     spice_usb_device_set_state(device, SPICE_USB_DEVICE_STATE_INSTALLED);
 
@@ -1120,21 +1113,15 @@ static void spice_usb_device_manager_drv_uninstall_cb(GObject *gobject,
     UsbInstallCbInfo *cbinfo = user_data;
     SpiceUsbDeviceManager *self = cbinfo->manager;
     GError *err = NULL;
-    gint status;
 
     SPICE_DEBUG("Win USB driver uninstall finished");
     g_return_if_fail(SPICE_IS_USB_DEVICE_MANAGER(self));
 
-    status = spice_win_usb_driver_uninstall_finish(cbinfo->installer, res, &err);
-    if (err) {
+    if (!spice_win_usb_driver_uninstall_finish(cbinfo->installer, res, &err)) {
         g_warning("win usb driver uninstall failed -- %s", err->message);
         g_clear_error(&err);
     }
 
-    if (!status) {
-        g_warning("failed to uninstall win usb driver (status=0)");
-    }
-
     spice_usb_device_unref(cbinfo->device);
     spice_usb_device_set_state(cbinfo->device, SPICE_USB_DEVICE_STATE_NONE);
 
diff --git a/gtk/win-usb-driver-install.c b/gtk/win-usb-driver-install.c
index 865f795..5eb7dcc 100644
--- a/gtk/win-usb-driver-install.c
+++ b/gtk/win-usb-driver-install.c
@@ -337,7 +337,7 @@ void spice_win_usb_driver_op(SpiceWinUsbDriver *self,
  * Returns: currently returns 0 (failure) and 1 (success)
  * possibly later we'll add error-codes
  */
-static gint
+static gboolean
 spice_win_usb_driver_op_finish(SpiceWinUsbDriver *self,
                                GAsyncResult *res, GError **err)
 {
@@ -348,9 +348,9 @@ spice_win_usb_driver_op_finish(SpiceWinUsbDriver *self,
                                                         spice_win_usb_driver_op),
                          FALSE);
     if (g_simple_async_result_propagate_error(result, err))
-        return 0;
+        return FALSE;
 
-    return self->priv->reply.status;
+    return TRUE;
 }
 
 /**
@@ -389,14 +389,14 @@ void spice_win_usb_driver_uninstall_async(SpiceWinUsbDriver *self,
 }
 
 G_GNUC_INTERNAL
-gint spice_win_usb_driver_install_finish(SpiceWinUsbDriver *self,
+gboolean spice_win_usb_driver_install_finish(SpiceWinUsbDriver *self,
                                           GAsyncResult *res, GError **err)
 {
     return spice_win_usb_driver_op_finish(self, res, err);
 }
 
 G_GNUC_INTERNAL
-gint spice_win_usb_driver_uninstall_finish(SpiceWinUsbDriver *self,
+gboolean spice_win_usb_driver_uninstall_finish(SpiceWinUsbDriver *self,
                                            GAsyncResult *res, GError **err)
 {
     return spice_win_usb_driver_op_finish(self, res, err);
diff --git a/gtk/win-usb-driver-install.h b/gtk/win-usb-driver-install.h
index bac41f1..b9eadcd 100644
--- a/gtk/win-usb-driver-install.h
+++ b/gtk/win-usb-driver-install.h
@@ -69,16 +69,16 @@ void spice_win_usb_driver_install_async(SpiceWinUsbDriver *self,
                                         GCancellable *cancellable,
                                         GAsyncReadyCallback callback,
                                         gpointer user_data);
-gint spice_win_usb_driver_install_finish(SpiceWinUsbDriver *self,
-                                         GAsyncResult *res, GError **err);
+gboolean spice_win_usb_driver_install_finish(SpiceWinUsbDriver *self,
+                                             GAsyncResult *res, GError **err);
 
 void spice_win_usb_driver_uninstall_async(SpiceWinUsbDriver *self,
                                           SpiceUsbDevice *device,
                                           GCancellable *cancellable,
                                           GAsyncReadyCallback callback,
                                           gpointer user_data);
-gint spice_win_usb_driver_uninstall_finish(SpiceWinUsbDriver *self,
-                                           GAsyncResult *res, GError **err);
+gboolean spice_win_usb_driver_uninstall_finish(SpiceWinUsbDriver *self,
+                                               GAsyncResult *res, GError **err);
 
 
 
-- 
1.8.5.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]