Random whitespace and other minor fixes.
This commit is contained in:
parent
421bc3eba0
commit
0c5f2abc66
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -118,7 +118,7 @@
|
|||
* @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.
|
||||
|
@ -126,7 +126,7 @@
|
|||
* @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.
|
||||
|
@ -134,7 +134,7 @@
|
|||
* @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.
|
||||
|
@ -144,7 +144,7 @@
|
|||
#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.
|
||||
|
@ -154,7 +154,7 @@
|
|||
#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__
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue