[Spice-devel] [spice-gtk PATCH 3/9] usb-device-manager: constify spice_usb_device_get_ functions

Uri Lublin uril at redhat.com
Mon Mar 25 03:01:24 PDT 2013


---
 gtk/usb-device-manager-priv.h |  8 ++++----
 gtk/usb-device-manager.c      | 16 ++++++++--------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/gtk/usb-device-manager-priv.h b/gtk/usb-device-manager-priv.h
index 51a38df..b6fa9c9 100644
--- a/gtk/usb-device-manager-priv.h
+++ b/gtk/usb-device-manager-priv.h
@@ -36,10 +36,10 @@ void spice_usb_device_manager_stop_event_listening(
 void spice_usb_device_manager_device_error(
     SpiceUsbDeviceManager *manager, SpiceUsbDevice *device, GError *err);

-guint8 spice_usb_device_get_busnum(SpiceUsbDevice *device);
-guint8 spice_usb_device_get_devaddr(SpiceUsbDevice *device);
-guint16 spice_usb_device_get_vid(SpiceUsbDevice *device);
-guint16 spice_usb_device_get_pid(SpiceUsbDevice *device);
+guint8 spice_usb_device_get_busnum(const SpiceUsbDevice *device);
+guint8 spice_usb_device_get_devaddr(const SpiceUsbDevice *device);
+guint16 spice_usb_device_get_vid(const SpiceUsbDevice *device);
+guint16 spice_usb_device_get_pid(const SpiceUsbDevice *device);

 #endif

diff --git a/gtk/usb-device-manager.c b/gtk/usb-device-manager.c
index eafed7c..4421c48 100644
--- a/gtk/usb-device-manager.c
+++ b/gtk/usb-device-manager.c
@@ -1477,36 +1477,36 @@ static SpiceUsbDeviceInfo *spice_usb_device_new(libusb_device *libdev)
     return info;
 }

-guint8 spice_usb_device_get_busnum(SpiceUsbDevice *device)
+guint8 spice_usb_device_get_busnum(const SpiceUsbDevice *device)
 {
-    SpiceUsbDeviceInfo *info = (SpiceUsbDeviceInfo *)device;
+    const SpiceUsbDeviceInfo *info = (const SpiceUsbDeviceInfo *)device;

     g_return_val_if_fail(info != NULL, 0);

     return info->busnum;
 }

-guint8 spice_usb_device_get_devaddr(SpiceUsbDevice *device)
+guint8 spice_usb_device_get_devaddr(const SpiceUsbDevice *device)
 {
-    SpiceUsbDeviceInfo *info = (SpiceUsbDeviceInfo *)device;
+    const SpiceUsbDeviceInfo *info = (const SpiceUsbDeviceInfo *)device;

     g_return_val_if_fail(info != NULL, 0);

     return info->devaddr;
 }

-guint16 spice_usb_device_get_vid(SpiceUsbDevice *device)
+guint16 spice_usb_device_get_vid(const SpiceUsbDevice *device)
 {
-    SpiceUsbDeviceInfo *info = (SpiceUsbDeviceInfo *)device;
+    const SpiceUsbDeviceInfo *info = (const SpiceUsbDeviceInfo *)device;

     g_return_val_if_fail(info != NULL, 0);

     return info->vid;
 }

-guint16 spice_usb_device_get_pid(SpiceUsbDevice *device)
+guint16 spice_usb_device_get_pid(const SpiceUsbDevice *device)
 {
-    SpiceUsbDeviceInfo *info = (SpiceUsbDeviceInfo *)device;
+    const SpiceUsbDeviceInfo *info = (const SpiceUsbDeviceInfo *)device;

     g_return_val_if_fail(info != NULL, 0);

-- 
1.8.1.4



More information about the Spice-devel mailing list