]> sigrok.org Git - libsigrok.git/commitdiff
fx2lafw: Minor cleanups.
authorUwe Hermann <redacted>
Sun, 29 Dec 2013 13:09:34 +0000 (14:09 +0100)
committerUwe Hermann <redacted>
Sun, 29 Dec 2013 13:18:51 +0000 (14:18 +0100)
hardware/fx2lafw/api.c
hardware/fx2lafw/protocol.c

index 0c591428cbb0963b93056af0da8474302e7d45e2..29c1887e9ac6c2ac307ba1f9e8509cd5aed96625 100644 (file)
@@ -230,7 +230,7 @@ static GSList *scan(GSList *options)
                                sr_err("Firmware upload failed for "
                                       "device %d.", devcnt);
                        sdi->inst_type = SR_INST_USB;
-                       sdi->conn = sr_usb_dev_inst_new (libusb_get_bus_number(devlist[i]),
+                       sdi->conn = sr_usb_dev_inst_new(libusb_get_bus_number(devlist[i]),
                                        0xff, NULL);
                }
        }
@@ -291,7 +291,7 @@ static int dev_open(struct sr_dev_inst *sdi)
 
        ret = libusb_claim_interface(usb->devhdl, USB_INTERFACE);
        if (ret != 0) {
-               switch(ret) {
+               switch (ret) {
                case LIBUSB_ERROR_BUSY:
                        sr_err("Unable to claim USB interface. Another "
                               "program or driver has already claimed it.");
index 303118d7e1fe44f732d20c6079fa282977fd6731..62be7f6d36e08ae2cf3f28bbee80a1f2e35baae3 100644 (file)
@@ -355,7 +355,7 @@ SR_PRIV struct dev_context *fx2lafw_dev_new(void)
        devc->fw_updated = 0;
        devc->cur_samplerate = 0;
        devc->limit_samples = 0;
-       devc->sample_wide = 0;
+       devc->sample_wide = FALSE;
 
        return devc;
 }
@@ -432,6 +432,7 @@ SR_PRIV void fx2lafw_receive_transfer(struct libusb_transfer *transfer)
        int trigger_offset, i, sample_width, cur_sample_count;
        int trigger_offset_bytes;
        uint8_t *cur_buf;
+       uint16_t cur_sample;
 
        devc = transfer->user_data;
 
@@ -486,9 +487,9 @@ SR_PRIV void fx2lafw_receive_transfer(struct libusb_transfer *transfer)
        if (devc->trigger_stage >= 0) {
                for (i = 0; i < cur_sample_count; i++) {
 
-                       const uint16_t cur_sample = devc->sample_wide ?
-                               *((const uint16_t*)cur_buf + i) :
-                               *((const uint8_t*)cur_buf + i);
+                       cur_sample = devc->sample_wide ?
+                               *((uint16_t *)cur_buf + i) :
+                               *((uint8_t *)cur_buf + i);
 
                        if ((cur_sample & devc->trigger_mask[devc->trigger_stage]) ==
                                devc->trigger_value[devc->trigger_stage]) {