X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fsaleae-logic16%2Fprotocol.c;h=3db8a82f0b8577b9bf580324b9f2a96598dcb013;hb=55462b8ba9f48931de9b9a7bfbc182a1d113b3b5;hp=9e5806e0ae4c89c620121e158b345753d38022dd;hpb=974fb0fffaffb0b2d1437ee280e4308a252741a0;p=libsigrok.git diff --git a/src/hardware/saleae-logic16/protocol.c b/src/hardware/saleae-logic16/protocol.c index 9e5806e0..3db8a82f 100644 --- a/src/hardware/saleae-logic16/protocol.c +++ b/src/hardware/saleae-logic16/protocol.c @@ -19,8 +19,6 @@ * along with this program. If not, see . */ -#include "protocol.h" - #include #include #include @@ -30,6 +28,7 @@ #include #include "libsigrok.h" #include "libsigrok-internal.h" +#include "protocol.h" #define FPGA_FIRMWARE_18 FIRMWARE_DIR"/saleae-logic16-fpga-18.bitstream" #define FPGA_FIRMWARE_33 FIRMWARE_DIR"/saleae-logic16-fpga-33.bitstream" @@ -107,7 +106,7 @@ static int do_ep1_command(const struct sr_dev_inst *sdi, usb = sdi->conn; if (cmd_len < 1 || cmd_len > 64 || reply_len > 64 || - command == NULL || (reply_len > 0 && reply == NULL)) + !command || (reply_len > 0 && !reply)) return SR_ERR_ARG; encrypt(buf, command, cmd_len); @@ -165,7 +164,7 @@ static int upload_led_table(const struct sr_dev_inst *sdi, uint8_t chunk, command[64]; int ret; - if (cnt < 1 || cnt + offset > 64 || table == NULL) + if (cnt < 1 || cnt + offset > 64 || !table) return SR_ERR_ARG; while (cnt > 0) { @@ -351,7 +350,7 @@ static int upload_fpga_bitstream(const struct sr_dev_inst *sdi, } sr_info("Uploading FPGA bitstream at %s.", filename); - if ((fw = g_fopen(filename, "rb")) == NULL) { + if (!(fw = g_fopen(filename, "rb"))) { sr_err("Unable to open bitstream file %s for reading: %s.", filename, strerror(errno)); return SR_ERR; @@ -703,7 +702,7 @@ static size_t convert_sample_data(struct dev_context *devc, return ret; } -SR_PRIV void logic16_receive_transfer(struct libusb_transfer *transfer) +SR_PRIV void LIBUSB_CALL logic16_receive_transfer(struct libusb_transfer *transfer) { gboolean packet_has_error = FALSE; struct sr_datafeed_packet packet;