1
0
mirror of git://sigrok.org/libserialport synced 2023-08-10 21:13:24 +03:00

Random minor whitespace fixes.

This commit is contained in:
Uwe Hermann 2019-12-28 19:23:30 +01:00
parent 2e0437c28e
commit 81243567bc
2 changed files with 8 additions and 6 deletions

View File

@ -323,7 +323,8 @@ SP_PRIV struct sp_port **list_append(struct sp_port **list,
void *tmp; void *tmp;
unsigned int count; unsigned int count;
for (count = 0; list[count]; count++); for (count = 0; list[count]; count++)
;
if (!(tmp = realloc(list, sizeof(struct sp_port *) * (count + 2)))) if (!(tmp = realloc(list, sizeof(struct sp_port *) * (count + 2))))
goto fail; goto fail;
list = tmp; list = tmp;
@ -1031,7 +1032,7 @@ SP_API enum sp_return sp_blocking_read(struct sp_port *port, void *buf,
#else #else
size_t bytes_read = 0; size_t bytes_read = 0;
unsigned char *ptr = (unsigned char *) buf; unsigned char *ptr = (unsigned char *)buf;
struct timeval start, delta, now, end = {0, 0}; struct timeval start, delta, now, end = {0, 0};
int started = 0; int started = 0;
fd_set fds; fd_set fds;
@ -1454,7 +1455,8 @@ SP_API enum sp_return sp_wait(struct sp_event_set *event_set,
#else #else
struct timeval start, delta, now, end = {0, 0}; struct timeval start, delta, now, end = {0, 0};
const struct timeval max_delta = { const struct timeval max_delta = {
(INT_MAX / 1000), (INT_MAX % 1000) * 1000}; (INT_MAX / 1000), (INT_MAX % 1000) * 1000
};
int started = 0, timeout_overflow = 0; int started = 0, timeout_overflow = 0;
int result, timeout_remaining_ms; int result, timeout_remaining_ms;
struct pollfd *pollfds; struct pollfd *pollfds;
@ -1464,7 +1466,7 @@ SP_API enum sp_return sp_wait(struct sp_event_set *event_set,
RETURN_ERROR(SP_ERR_MEM, "pollfds malloc() failed"); RETURN_ERROR(SP_ERR_MEM, "pollfds malloc() failed");
for (i = 0; i < event_set->count; i++) { for (i = 0; i < event_set->count; i++) {
pollfds[i].fd = ((int *) event_set->handles)[i]; pollfds[i].fd = ((int *)event_set->handles)[i];
pollfds[i].events = 0; pollfds[i].events = 0;
pollfds[i].revents = 0; pollfds[i].revents = 0;
if (event_set->masks[i] & SP_EVENT_RX_READY) if (event_set->masks[i] & SP_EVENT_RX_READY)

View File

@ -220,7 +220,7 @@ static void enumerate_hub_ports(struct sp_port *port, HANDLE hub_device,
port->usb_pid = connection_info_ex->DeviceDescriptor.idProduct; port->usb_pid = connection_info_ex->DeviceDescriptor.idProduct;
if (connection_info_ex->DeviceDescriptor.iManufacturer) if (connection_info_ex->DeviceDescriptor.iManufacturer)
port->usb_manufacturer = get_string_descriptor(hub_device,index, port->usb_manufacturer = get_string_descriptor(hub_device, index,
connection_info_ex->DeviceDescriptor.iManufacturer); connection_info_ex->DeviceDescriptor.iManufacturer);
if (connection_info_ex->DeviceDescriptor.iProduct) if (connection_info_ex->DeviceDescriptor.iProduct)
port->usb_product = get_string_descriptor(hub_device, index, port->usb_product = get_string_descriptor(hub_device, index,
@ -381,7 +381,7 @@ SP_PRIV enum sp_return get_port_details(struct sp_port *port)
continue; continue;
} }
RegCloseKey(device_key); RegCloseKey(device_key);
value[sizeof(value)-1] = 0; value[sizeof(value) - 1] = 0;
if (strcmp(value, port->name)) if (strcmp(value, port->name))
continue; continue;