]> sigrok.org Git - libsigrok.git/commitdiff
Random whitespace and other minor fixes.
authorUwe Hermann <redacted>
Wed, 11 Mar 2015 22:32:39 +0000 (23:32 +0100)
committerUwe Hermann <redacted>
Sun, 22 Mar 2015 01:15:30 +0000 (02:15 +0100)
16 files changed:
src/hardware/agilent-dmm/sched.c
src/hardware/brymen-dmm/protocol.c
src/hardware/cem-dt-885x/protocol.c
src/hardware/fluke-dmm/fluke.c
src/hardware/gmc-mh-1x-2x/protocol.c
src/hardware/hantek-dso/api.c
src/hardware/hantek-dso/dso.c
src/hardware/motech-lps-30x/api.c
src/hardware/motech-lps-30x/protocol.c
src/hardware/rigol-ds/api.c
src/hardware/rigol-ds/protocol.c
src/hardware/testo/protocol.c
src/input/csv.c
src/input/wav.c
src/libsigrok-internal.h
src/serial.c

index 46f4ade210d00f440a4227cf7e0e9753c9247da6..162b0b59894decc65f325277757c316e815ef5c4 100644 (file)
@@ -105,7 +105,7 @@ SR_PRIV int agdmm_receive_data(int fd, int revents, void *cb_data)
        serial = sdi->conn;
        if (revents == G_IO_IN) {
                /* Serial data arrived. */
-               while(AGDMM_BUFSIZE - devc->buflen - 1 > 0) {
+               while (AGDMM_BUFSIZE - devc->buflen - 1 > 0) {
                        len = serial_read_nonblocking(serial, devc->buf + devc->buflen, 1);
                        if (len < 1)
                                break;
@@ -330,7 +330,7 @@ static int recv_conf_u123x(const struct sr_dev_inst *sdi, GMatchInfo *match)
                devc->cur_unit = SR_UNIT_VOLT;
                devc->cur_mqflags = 0;
                devc->cur_divider = 0;
-       } else if(!strcmp(mstr, "MV")) {
+       } else if (!strcmp(mstr, "MV")) {
                if (devc->mode_tempaux) {
                        devc->cur_mq = SR_MQ_TEMPERATURE;
                        /* No way to detect whether Fahrenheit or Celcius
@@ -344,22 +344,22 @@ static int recv_conf_u123x(const struct sr_dev_inst *sdi, GMatchInfo *match)
                        devc->cur_mqflags = 0;
                        devc->cur_divider = 1000;
                }
-       } else if(!strcmp(mstr, "A")) {
+       } else if (!strcmp(mstr, "A")) {
                devc->cur_mq = SR_MQ_CURRENT;
                devc->cur_unit = SR_UNIT_AMPERE;
                devc->cur_mqflags = 0;
                devc->cur_divider = 0;
-       } else if(!strcmp(mstr, "UA")) {
+       } else if (!strcmp(mstr, "UA")) {
                devc->cur_mq = SR_MQ_CURRENT;
                devc->cur_unit = SR_UNIT_AMPERE;
                devc->cur_mqflags = 0;
                devc->cur_divider = 1000000;
-       } else if(!strcmp(mstr, "FREQ")) {
+       } else if (!strcmp(mstr, "FREQ")) {
                devc->cur_mq = SR_MQ_FREQUENCY;
                devc->cur_unit = SR_UNIT_HERTZ;
                devc->cur_mqflags = 0;
                devc->cur_divider = 0;
-       } else if(!strcmp(mstr, "RES")) {
+       } else if (!strcmp(mstr, "RES")) {
                if (devc->mode_continuity) {
                        devc->cur_mq = SR_MQ_CONTINUITY;
                        devc->cur_unit = SR_UNIT_BOOLEAN;
@@ -369,7 +369,7 @@ static int recv_conf_u123x(const struct sr_dev_inst *sdi, GMatchInfo *match)
                }
                devc->cur_mqflags = 0;
                devc->cur_divider = 0;
-       } else if(!strcmp(mstr, "CAP")) {
+       } else if (!strcmp(mstr, "CAP")) {
                devc->cur_mq = SR_MQ_CAPACITANCE;
                devc->cur_unit = SR_UNIT_FARAD;
                devc->cur_mqflags = 0;
@@ -423,32 +423,32 @@ static int recv_conf_u124x_5x(const struct sr_dev_inst *sdi, GMatchInfo *match)
                        }
                } else
                        devc->cur_mqflags &= ~(SR_MQFLAG_AC | SR_MQFLAG_DC);
-       } else if(!strcmp(mstr, "CURR")) {
+       } else if (!strcmp(mstr, "CURR")) {
                devc->cur_mq = SR_MQ_CURRENT;
                devc->cur_unit = SR_UNIT_AMPERE;
                devc->cur_mqflags = 0;
                devc->cur_divider = 0;
-       } else if(!strcmp(mstr, "RES")) {
+       } else if (!strcmp(mstr, "RES")) {
                devc->cur_mq = SR_MQ_RESISTANCE;
                devc->cur_unit = SR_UNIT_OHM;
                devc->cur_mqflags = 0;
                devc->cur_divider = 0;
-       } else if(!strcmp(mstr, "CAP")) {
+       } else if (!strcmp(mstr, "CAP")) {
                devc->cur_mq = SR_MQ_CAPACITANCE;
                devc->cur_unit = SR_UNIT_FARAD;
                devc->cur_mqflags = 0;
                devc->cur_divider = 0;
-       } else if(!strcmp(mstr, "FREQ")) {
+       } else if (!strcmp(mstr, "FREQ")) {
                devc->cur_mq = SR_MQ_FREQUENCY;
                devc->cur_unit = SR_UNIT_HERTZ;
                devc->cur_mqflags = 0;
                devc->cur_divider = 0;
-       } else if(!strcmp(mstr, "CONT")) {
+       } else if (!strcmp(mstr, "CONT")) {
                devc->cur_mq = SR_MQ_CONTINUITY;
                devc->cur_unit = SR_UNIT_BOOLEAN;
                devc->cur_mqflags = 0;
                devc->cur_divider = 0;
-       } else if(!strncmp(mstr, "T1", 2) || !strncmp(mstr, "T2", 2)) {
+       } else if (!strncmp(mstr, "T1", 2) || !strncmp(mstr, "T2", 2)) {
                devc->cur_mq = SR_MQ_TEMPERATURE;
                m2 = g_match_info_fetch(match, 2);
                if (!strcmp(m2, "FAR"))
@@ -458,13 +458,13 @@ static int recv_conf_u124x_5x(const struct sr_dev_inst *sdi, GMatchInfo *match)
                g_free(m2);
                devc->cur_mqflags = 0;
                devc->cur_divider = 0;
-       } else if(!strcmp(mstr, "SCOU")) {
+       } else if (!strcmp(mstr, "SCOU")) {
                /*
                 * Switch counter, not supported. Not sure what values
                 * come from FETC in this mode, or how they would map
                 * into libsigrok.
                 */
-       } else if(!strncmp(mstr, "CPER:", 5)) {
+       } else if (!strncmp(mstr, "CPER:", 5)) {
                devc->cur_mq = SR_MQ_CURRENT;
                devc->cur_unit = SR_UNIT_PERCENTAGE;
                devc->cur_mqflags = 0;
@@ -485,7 +485,7 @@ static int recv_conf(const struct sr_dev_inst *sdi, GMatchInfo *match)
        sr_spew("CONF? response '%s'.", g_match_info_get_string(match));
        devc = sdi->priv;
        mstr = g_match_info_fetch(match, 1);
-       if(!strcmp(mstr, "DIOD")) {
+       if (!strcmp(mstr, "DIOD")) {
                devc->cur_mq = SR_MQ_VOLTAGE;
                devc->cur_unit = SR_UNIT_VOLT;
                devc->cur_mqflags = SR_MQFLAG_DIODE;
index 881881cf026a1366b2993157e464c52c2e550265..07ac19394a674579dbe7d7993d3aba7c20bf4cea 100644 (file)
@@ -206,7 +206,7 @@ SR_PRIV int brymen_stream_detect(struct sr_serial_dev_inst *serial,
                        /* How large of a packet are we expecting? */
                        packet_len = stream_len;
                        status = get_packet_size(&buf[i], &packet_len);
-                       switch(status) {
+                       switch (status) {
                        case PACKET_HEADER_OK:
                                /* We know how much data we need to wait for. */
                                break;
index 00dbd0c447f2bc595e7de4f672250aa1de046594..8f6724d50b79c53d94ca53ebfbf4a4766f9c7469 100644 (file)
@@ -84,7 +84,7 @@ static void process_mset(const struct sr_dev_inst *sdi)
                g_string_free(dbg, TRUE);
        }
 
-       switch(devc->token) {
+       switch (devc->token) {
        case TOKEN_WEIGHT_TIME_FAST:
                devc->cur_mqflags |= SR_MQFLAG_SPL_TIME_WEIGHT_F;
                devc->cur_mqflags &= ~SR_MQFLAG_SPL_TIME_WEIGHT_S;
index df0f2461c251cffbecd8c8dd154ccb87968cad86..c098ced465a351f384db2fbb8eb1da5b60165325 100644 (file)
@@ -40,14 +40,14 @@ static struct sr_datafeed_analog *handle_qm_18x(const struct sr_dev_inst *sdi,
        if ((e = strstr(tokens[1], "Out of range"))) {
                is_oor = TRUE;
                fvalue = -1;
-               while(*e && *e != '.')
+               while (*e && *e != '.')
                        e++;
        } else {
                is_oor = FALSE;
                /* Delimit the float, since sr_atof_ascii() wants only
                 * a valid float here. */
                e = tokens[1];
-               while(*e && *e != ' ')
+               while (*e && *e != ' ')
                        e++;
                *e++ = '\0';
                if (sr_atof_ascii(tokens[1], &fvalue) != SR_OK || fvalue == 0.0) {
@@ -56,7 +56,7 @@ static struct sr_datafeed_analog *handle_qm_18x(const struct sr_dev_inst *sdi,
                        return NULL;
                }
        }
-       while(*e && *e == ' ')
+       while (*e && *e == ' ')
                e++;
 
        if (!(analog = g_try_malloc0(sizeof(struct sr_datafeed_analog))))
@@ -498,7 +498,7 @@ SR_PRIV int fluke_receive_data(int fd, int revents, void *cb_data)
        serial = sdi->conn;
        if (revents == G_IO_IN) {
                /* Serial data arrived. */
-               while(FLUKEDMM_BUFSIZE - devc->buflen - 1 > 0) {
+               while (FLUKEDMM_BUFSIZE - devc->buflen - 1 > 0) {
                        len = serial_read_nonblocking(serial, devc->buf + devc->buflen, 1);
                        if (len < 1)
                                break;
index 4f6c1e562f853c1d47edbc38795bc7ba0897ffd9..ffa3a2d87bde02d61b28b3dd065a252052ad6269 100644 (file)
@@ -567,7 +567,7 @@ static void decode_rs_2x_TR2(uint8_t rs, struct dev_context *devc)
        switch (devc->mq) {
        case SR_MQ_CURRENT:
                if (devc->scale1000 == -1) /* mA */
-                       switch(range) {
+                       switch (range) {
                        case 0: case 1: /* 100, 300 µA */
                                devc->scale *= pow(10.0, -6);
                                break;
@@ -582,7 +582,7 @@ static void decode_rs_2x_TR2(uint8_t rs, struct dev_context *devc)
                                break;
                        }
                else /* A */
-                       switch(range) {
+                       switch (range) {
                        case 0: case 1: /* 1, 3 A */
                                devc->scale *= pow(10.0, -5);
                                break;
@@ -1370,7 +1370,7 @@ SR_PRIV int gmc_decode_model_sm(uint8_t mcode)
                return METRAHIT_NONE;
        }
 
-       switch(mcode) {
+       switch (mcode) {
        case 0x04: /* 0100b */
                return METRAHIT_12S;
        case 0x08: /* 1000b */
index d2eebfbe55754c74571d7f46313ee41d4846d9cd..7f90b834e2eeca3115646eafad33618572b14982 100644 (file)
@@ -490,7 +490,7 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
                        ch_idx = 1;
                else
                        return SR_ERR_ARG;
-               switch(key) {
+               switch (key) {
                case SR_CONF_FILTER:
                        *data = g_variant_new_boolean(devc->filter[ch_idx]);
                        break;
index d46ddd6e0987550baa707e39fe77eb973cea8a36..814db59839785139211b9347dc5d155a94aec00e 100644 (file)
@@ -703,7 +703,7 @@ SR_PRIV int dso_get_capturestate(const struct sr_dev_inst *sdi,
        bitvalue = 1;
        for (i = 0; i < 24; i++) {
                /* Each set bit inverts all bits with a lower value. */
-               if(toff & bitvalue)
+               if (toff & bitvalue)
                        toff ^= bitvalue - 1;
                bitvalue <<= 1;
        }
index 5c979edefcd8b6049505f010f702dc0d42c90fae..203446f57d05db95353d37007699bead5a9a8fd2 100644 (file)
@@ -738,7 +738,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
        }
 
        /* Device options, independent from channel groups. */
-       if (cg == NULL) {
+       if (!cg) {
                switch (key) {
                case SR_CONF_DEVICE_OPTIONS:
                        *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
index b97ce3b66e26403ccd3e4b6aaaef88517eda5b81..86959ba5c3a71c1ac08241665130d7d080423bd4 100644 (file)
@@ -196,8 +196,7 @@ SR_PRIV int motech_lps_30x_receive_data(int fd, int revents, void *cb_data)
                        }
                }
                if (devc->acq_req_pending == 0) {
-                       switch(devc->acq_req)
-                       {
+                       switch (devc->acq_req) {
                        case AQ_NONE: /* Fall through */
                        case AQ_STATUS:
                                devc->acq_req = AQ_U1;
index 27705f7ccdc86995e8102e212d38491213c1356d..111eff067d6734a73883ca957fd26bc18761a7c7 100644 (file)
@@ -343,7 +343,7 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
                                break;
                        sr_dbg("Found DS1000 firmware < 0.2.4, using raw data format.");
                        devc->format = FORMAT_RAW;
-               } while(0);
+               } while (0);
                g_strfreev(version);
        }
 
@@ -815,7 +815,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
                *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
                                scanopts, ARRAY_SIZE(scanopts), sizeof(uint32_t));
                return SR_OK;
-       } else if (key == SR_CONF_DEVICE_OPTIONS && cg == NULL) {
+       } else if (key == SR_CONF_DEVICE_OPTIONS && !cg) {
                *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
                                devopts, ARRAY_SIZE(devopts), sizeof(uint32_t));
                return SR_OK;
index 8a144f1bad24d688eab6491e3aa855fdced1a00a..f328d9a642c241c7a18817cdd5d91f9a0e028886 100644 (file)
@@ -556,7 +556,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
        scpi = sdi->conn;
 
        if (revents == G_IO_IN || revents == 0) {
-               switch(devc->wait_event) {
+               switch (devc->wait_event) {
                case WAIT_NONE:
                        break;
                case WAIT_TRIGGER:
index 46e9ae62baf6071233c1df660853e14081b8eefd..d2e7c7ed5760e3156d9f7ba43c705150f9d1ecaf 100644 (file)
@@ -81,7 +81,7 @@ SR_PRIV int testo_probe_channels(struct sr_dev_inst *sdi)
                return SR_ERR;
 
        packet_len = 0;
-       while(TRUE) {
+       while (TRUE) {
                if (libusb_bulk_transfer(usb->devhdl, EP_IN, buf, MAX_REPLY_SIZE,
                                &len, 250) < 0)
                        return SR_ERR;
index 0e68e39156f884eb20d2dd14bbead33c1f724b84..73e911dff5c62aa3770bcbdba0a17c5ab1cd9aac 100644 (file)
@@ -351,7 +351,7 @@ static int parse_single_column(const char *column, struct context *inc)
 
        res = SR_ERR;
 
-       switch(inc->format) {
+       switch (inc->format) {
        case FORMAT_BIN:
                res = parse_binstr(column, inc);
                break;
index 88ddd7a814dd07b5f4ab18477871ff1b82fbe531..611878e850495f79342cb0b4091c61d2dc9b50d4 100644 (file)
@@ -160,7 +160,7 @@ static int find_data_chunk(GString *buf, int initial_offset)
        unsigned int offset, i;
 
        offset = initial_offset;
-       while(offset < MIN(MAX_DATA_CHUNK_OFFSET, buf->len)) {
+       while (offset < MIN(MAX_DATA_CHUNK_OFFSET, buf->len)) {
                if (!memcmp(buf->str + offset, "data", 4))
                        /* Skip into the samples. */
                        return offset + 8;
index 6617e7ae6fb167b63e99cc01702c385149980045..71fc79a9a6c69e9a710775f8854e57b7d3e54141 100644 (file)
  * @param p a pointer to the output memory
  * @param x the input unsigned integer
  */
-#define W8(p, x)    do { ((uint8_t*)(p))[0] = (uint8_t) (x);      } while(0)
+#define W8(p, x)    do { ((uint8_t*)(p))[0] = (uint8_t) (x);      } while (0)
 
 /**
  * Write a 16 bits unsigned integer to memory stored as big endian.
  * @param x the input unsigned integer
  */
 #define WB16(p, x)  do { ((uint8_t*)(p))[1] = (uint8_t) (x);      \
-                         ((uint8_t*)(p))[0] = (uint8_t)((x)>>8);  } while(0)
+                         ((uint8_t*)(p))[0] = (uint8_t)((x)>>8);  } while (0)
 
 /**
  * Write a 16 bits unsigned integer to memory stored as little endian.
  * @param x the input unsigned integer
  */
 #define WL16(p, x)  do { ((uint8_t*)(p))[0] = (uint8_t) (x);      \
-                         ((uint8_t*)(p))[1] = (uint8_t)((x)>>8);  } while(0)
+                         ((uint8_t*)(p))[1] = (uint8_t)((x)>>8);  } while (0)
 
 /**
  * Write a 32 bits unsigned integer to memory stored as big endian.
 #define WB32(p, x)  do { ((uint8_t*)(p))[3] = (uint8_t) (x);      \
                          ((uint8_t*)(p))[2] = (uint8_t)((x)>>8);  \
                          ((uint8_t*)(p))[1] = (uint8_t)((x)>>16); \
-                         ((uint8_t*)(p))[0] = (uint8_t)((x)>>24); } while(0)
+                         ((uint8_t*)(p))[0] = (uint8_t)((x)>>24); } while (0)
 
 /**
  * Write a 32 bits unsigned integer to memory stored as little endian.
 #define WL32(p, x)  do { ((uint8_t*)(p))[0] = (uint8_t) (x);      \
                          ((uint8_t*)(p))[1] = (uint8_t)((x)>>8);  \
                          ((uint8_t*)(p))[2] = (uint8_t)((x)>>16); \
-                         ((uint8_t*)(p))[3] = (uint8_t)((x)>>24); } while(0)
+                         ((uint8_t*)(p))[3] = (uint8_t)((x)>>24); } while (0)
 
 /* Portability fixes for FreeBSD. */
 #ifdef __FreeBSD__
index 0a60d3f14a496761516a4d627baaa97ad52c44db..e42b96a0ebce3d9d2988c56fd28cbd52ed68997e 100644 (file)
@@ -624,7 +624,7 @@ SR_PRIV int serial_readline(struct sr_serial_dev_inst *serial, char **buf,
 
        maxlen = *buflen;
        *buflen = len = 0;
-       while(1) {
+       while (1) {
                len = maxlen - *buflen - 1;
                if (len < 1)
                        break;