[Spice-devel] [spice-gtk Win32 v4 03/17] Make SpiceUsbDevice a box for SpiceUsbDeviceInfo, instead of a box for libusb_device

Uri Lublin uril at redhat.com
Sun Jul 8 13:33:56 PDT 2012


On 07/06/2012 09:40 AM, Hans de Goede wrote:
>
>> -    if (guest_filter_rules &&
>> -            usbredirhost_check_device_filter(
>> +    if (guest_filter_rules) {
>> +        gboolean filter_ok;
>> +        libusb_device *ldev;
>> +        ldev = spice_usb_device_manager_device_to_libdev(self, device);
>> +        g_return_val_if_fail(ldev != NULL, FALSE);
>> +        filter_ok = (usbredirhost_check_device_filter(
>>                               guest_filter_rules, 
>> guest_filter_rules_count,
>> -                            (libusb_device *)device, 0) != 0) {
>> -        g_set_error_literal(err, SPICE_CLIENT_ERROR, 
>> SPICE_CLIENT_ERROR_FAILED,
>> -                            _("Some USB devices are blocked by host 
>> policy"));
>> -        return FALSE;
>> +                            ldev, 0) == 0);
>> +        libusb_unref_device(ldev);
>> +        if (!filter_ok) {
>> +            g_set_error_literal(err, SPICE_CLIENT_ERROR, 
>> SPICE_CLIENT_ERROR_FAILED,
>> +                                _("Some USB devices are blocked by 
>> host policy"));
>> +            return FALSE;
>> +        }
>>       }
>>
>>       /* Check if there are free channels */
>
> You're using libdev for the actual libusb_device everywhere and now 
> here you are using ldev, please
> make it libdev for consistency.
>

Fixed both,

Thanks,
     Uri.


More information about the Spice-devel mailing list