fpi-usb: Use unsigned length for USB async transfers

Properly follow function signature using a temporary gsize variable address
to make the function use the same pointer type and avoid troubles at
deferencing it, while use automatic-casting to switch to signed one if
transfer succeeded.
This commit is contained in:
Marco Trevisan (Treviño) 2019-12-03 19:34:58 +01:00
parent 98cd1c2680
commit a29586f398

View file

@ -454,6 +454,7 @@ fpi_usb_transfer_submit_sync (FpiUsbTransfer *transfer,
GError **error) GError **error)
{ {
gboolean res; gboolean res;
gsize actual_length;
g_return_val_if_fail (transfer, FALSE); g_return_val_if_fail (transfer, FALSE);
@ -469,7 +470,7 @@ fpi_usb_transfer_submit_sync (FpiUsbTransfer *transfer,
transfer->endpoint, transfer->endpoint,
transfer->buffer, transfer->buffer,
transfer->length, transfer->length,
&transfer->actual_length, &actual_length,
timeout_ms, timeout_ms,
NULL, NULL,
error); error);
@ -485,7 +486,7 @@ fpi_usb_transfer_submit_sync (FpiUsbTransfer *transfer,
transfer->idx, transfer->idx,
transfer->buffer, transfer->buffer,
transfer->length, transfer->length,
&transfer->actual_length, &actual_length,
timeout_ms, timeout_ms,
NULL, NULL,
error); error);
@ -496,7 +497,7 @@ fpi_usb_transfer_submit_sync (FpiUsbTransfer *transfer,
transfer->endpoint, transfer->endpoint,
transfer->buffer, transfer->buffer,
transfer->length, transfer->length,
&transfer->actual_length, &actual_length,
timeout_ms, timeout_ms,
NULL, NULL,
error); error);
@ -511,6 +512,8 @@ fpi_usb_transfer_submit_sync (FpiUsbTransfer *transfer,
if (!res) if (!res)
transfer->actual_length = -1; transfer->actual_length = -1;
else
transfer->actual_length = actual_length;
return res; return res;
} }