[Spice-devel] Failure to compile spice-gtk (git clone git://git.engineering.redhat.com/users/rvaknin/preint_scripts/.git)
Christophe Fergeau
cfergeau at redhat.com
Thu Jan 5 05:25:11 PST 2012
On Thu, Jan 05, 2012 at 07:42:56AM -0500, Marc-André Lureau wrote:
>
> Attached is a patch that fixes the build with --disable-usbredir here.
> From f05cdc3adc88a6dd6cece068d885ec46bbcb2eae Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau at gmail.com>
> Date: Thu, 5 Jan 2012 13:41:20 +0100
> Subject: [PATCH] build: fix compilation with --disable-usbredir
>
> ---
> gtk/usb-device-manager-priv.h | 2 ++
> gtk/usb-device-manager.c | 22 ++++++++++++++--------
> 2 files changed, 16 insertions(+), 8 deletions(-)
>
> diff --git a/gtk/usb-device-manager-priv.h b/gtk/usb-device-manager-priv.h
> index e6e116c..7e1aea3 100644
> --- a/gtk/usb-device-manager-priv.h
> +++ b/gtk/usb-device-manager-priv.h
> @@ -25,7 +25,9 @@
>
> G_BEGIN_DECLS
>
> +#ifdef USE_USBREDIR
> const char *spice_usb_device_manager_libusb_strerror(enum libusb_error error_code);
> +#endif
>
> gboolean spice_usb_device_manager_start_event_listening(
> SpiceUsbDeviceManager *manager, GError **err);
> diff --git a/gtk/usb-device-manager.c b/gtk/usb-device-manager.c
> index e55caae..1facdd6 100644
> --- a/gtk/usb-device-manager.c
> +++ b/gtk/usb-device-manager.c
> @@ -112,6 +112,13 @@ static void spice_usb_device_manager_uevent_cb(GUdevClient *client,
> gpointer user_data);
> static void spice_usb_device_manager_add_dev(SpiceUsbDeviceManager *self,
> GUdevDevice *udev);
> +
> +G_DEFINE_BOXED_TYPE(SpiceUsbDevice, spice_usb_device,
> + (GBoxedCopyFunc)libusb_ref_device,
> + (GBoxedFreeFunc)libusb_unref_device)
> +
> +#else
> +G_DEFINE_BOXED_TYPE(SpiceUsbDevice, spice_usb_device, g_object_ref, g_object_unref)
> #endif
> static void spice_usb_device_manager_initable_iface_init(GInitableIface *iface);
>
> @@ -120,10 +127,6 @@ static guint signals[LAST_SIGNAL] = { 0, };
> G_DEFINE_TYPE_WITH_CODE(SpiceUsbDeviceManager, spice_usb_device_manager, G_TYPE_OBJECT,
> G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, spice_usb_device_manager_initable_iface_init));
>
> -G_DEFINE_BOXED_TYPE(SpiceUsbDevice, spice_usb_device,
> - (GBoxedCopyFunc)libusb_ref_device,
> - (GBoxedFreeFunc)libusb_unref_device)
> -
> static void spice_usb_device_manager_init(SpiceUsbDeviceManager *self)
> {
> SpiceUsbDeviceManagerPrivate *priv;
> @@ -132,8 +135,10 @@ static void spice_usb_device_manager_init(SpiceUsbDeviceManager *self)
> self->priv = priv;
>
> priv->channels = g_ptr_array_new();
> +#ifdef USE_USBREDIR
> priv->devices = g_ptr_array_new_with_free_func((GDestroyNotify)
> libusb_unref_device);
> +#endif
> }
>
> static gboolean spice_usb_device_manager_initable_init(GInitable *initable,
> @@ -735,19 +740,20 @@ SpiceUsbDeviceManager *spice_usb_device_manager_get(SpiceSession *session,
> */
> GPtrArray* spice_usb_device_manager_get_devices(SpiceUsbDeviceManager *self)
> {
> - SpiceUsbDeviceManagerPrivate *priv;
> - GPtrArray *devices_copy;
> - guint i;
guint i declaration got lost and is used in the #ifdef USE_USBREDIR block
> + GPtrArray *devices_copy = NULL;
>
> g_return_val_if_fail(SPICE_IS_USB_DEVICE_MANAGER(self), NULL);
>
> - priv = self->priv;
> +#ifdef USE_USBREDIR
> + SpiceUsbDeviceManagerPrivate *priv = self->priv;
I forgot if we are fine with mixing declarations and codes
> +
> devices_copy = g_ptr_array_new_with_free_func((GDestroyNotify)
> libusb_unref_device);
> for (i = 0; i < priv->devices->len; i++) {
> libusb_device *device = g_ptr_array_index(priv->devices, i);
> g_ptr_array_add(devices_copy, libusb_ref_device(device));
> }
> +#endif
>
> return devices_copy;
> }
Patch looks good otherwise.
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20120105/7f3a801d/attachment.pgp>
More information about the Spice-devel
mailing list