diff --git a/serialport.c b/serialport.c index 1b71cdb..f9b78bf 100644 --- a/serialport.c +++ b/serialport.c @@ -323,7 +323,8 @@ SP_PRIV struct sp_port **list_append(struct sp_port **list, void *tmp; 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)))) goto fail; list = tmp; @@ -1031,7 +1032,7 @@ SP_API enum sp_return sp_blocking_read(struct sp_port *port, void *buf, #else 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}; int started = 0; fd_set fds; @@ -1454,7 +1455,8 @@ SP_API enum sp_return sp_wait(struct sp_event_set *event_set, #else struct timeval start, delta, now, end = {0, 0}; 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 result, timeout_remaining_ms; 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"); 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].revents = 0; if (event_set->masks[i] & SP_EVENT_RX_READY) diff --git a/windows.c b/windows.c index 72ce307..ee15a11 100644 --- a/windows.c +++ b/windows.c @@ -220,7 +220,7 @@ static void enumerate_hub_ports(struct sp_port *port, HANDLE hub_device, port->usb_pid = connection_info_ex->DeviceDescriptor.idProduct; 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); if (connection_info_ex->DeviceDescriptor.iProduct) 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; } RegCloseKey(device_key); - value[sizeof(value)-1] = 0; + value[sizeof(value) - 1] = 0; if (strcmp(value, port->name)) continue;