[Spice-devel] [PATCH spice-gtk 25/44] fixup! usb-redir: add files for SCSI and USB MSC implementation

Frediano Ziglio fziglio at redhat.com
Tue Jul 30 12:03:13 UTC 2019


Reuse MIN macro from GLib.
---
 src/cd-usb-bulk-msd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cd-usb-bulk-msd.c b/src/cd-usb-bulk-msd.c
index bb49e0d4..843f4f2e 100644
--- a/src/cd-usb-bulk-msd.c
+++ b/src/cd-usb-bulk-msd.c
@@ -354,7 +354,7 @@ static void usb_cd_send_data_in(UsbCdBulkMsdDevice *cd, uint32_t max_len)
     CdScsiRequest *scsi_req = &usb_req->scsi_req;
     uint8_t *buf = ((uint8_t *)scsi_req->buf) + usb_req->xfer_len;
     uint32_t avail_len = usb_req->scsi_in_len - usb_req->xfer_len;
-    uint32_t send_len = (avail_len <= max_len) ? avail_len : max_len;
+    uint32_t send_len = MIN(avail_len, max_len);
 
     SPICE_DEBUG("Data-in cmd tag 0x%x, remains %" G_GUINT32_FORMAT
                 ", requested %" G_GUINT32_FORMAT ", send %" G_GUINT32_FORMAT,
-- 
2.20.1



More information about the Spice-devel mailing list