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

windows: Restructure if/else blocks with unnecessary indentation.

This commit is contained in:
Martin Ling 2015-05-07 00:09:49 +01:00 committed by Uwe Hermann
parent 8ebfaf8966
commit bbe566fe1c

View File

@ -758,8 +758,10 @@ SP_API enum sp_return sp_blocking_write(struct sp_port *port, const void *buf,
} }
/* Start write. */ /* Start write. */
if (WriteFile(port->hdl, buf, count, NULL, &port->write_ovl) == 0) { if (WriteFile(port->hdl, buf, count, NULL, &port->write_ovl)) {
if (GetLastError() == ERROR_IO_PENDING) { DEBUG("Write completed immediately");
RETURN_INT(count);
} else if (GetLastError() == ERROR_IO_PENDING) {
DEBUG("Waiting for write to complete"); DEBUG("Waiting for write to complete");
GetOverlappedResult(port->hdl, &port->write_ovl, &bytes_written, TRUE); GetOverlappedResult(port->hdl, &port->write_ovl, &bytes_written, TRUE);
DEBUG_FMT("Write completed, %d/%d bytes written", bytes_written, count); DEBUG_FMT("Write completed, %d/%d bytes written", bytes_written, count);
@ -767,10 +769,6 @@ SP_API enum sp_return sp_blocking_write(struct sp_port *port, const void *buf,
} else { } else {
RETURN_FAIL("WriteFile() failed"); RETURN_FAIL("WriteFile() failed");
} }
} else {
DEBUG("Write completed immediately");
RETURN_INT(count);
}
#else #else
size_t bytes_written = 0; size_t bytes_written = 0;
unsigned char *ptr = (unsigned char *) buf; unsigned char *ptr = (unsigned char *) buf;
@ -970,18 +968,16 @@ SP_API enum sp_return sp_blocking_read(struct sp_port *port, void *buf,
} }
/* Start read. */ /* Start read. */
if (ReadFile(port->hdl, buf, count, NULL, &port->read_ovl) == 0) { if (ReadFile(port->hdl, buf, count, NULL, &port->read_ovl)) {
if (GetLastError() == ERROR_IO_PENDING) { DEBUG("Read completed immediately");
bytes_read = count;
} else if (GetLastError() == ERROR_IO_PENDING) {
DEBUG("Waiting for read to complete"); DEBUG("Waiting for read to complete");
GetOverlappedResult(port->hdl, &port->read_ovl, &bytes_read, TRUE); GetOverlappedResult(port->hdl, &port->read_ovl, &bytes_read, TRUE);
DEBUG_FMT("Read completed, %d/%d bytes read", bytes_read, count); DEBUG_FMT("Read completed, %d/%d bytes read", bytes_read, count);
} else { } else {
RETURN_FAIL("ReadFile() failed"); RETURN_FAIL("ReadFile() failed");
} }
} else {
DEBUG("Read completed immediately");
bytes_read = count;
}
TRY(restart_wait_if_needed(port, bytes_read)); TRY(restart_wait_if_needed(port, bytes_read));