1
0
mirror of https://github.com/wjwwood/serial.git synced 2026-01-23 04:04:54 +08:00

fix up style

This commit is contained in:
William Woodall 2017-01-20 16:25:30 -08:00 committed by GitHub
parent 64395f314f
commit 61e196c9d9

View File

@ -617,18 +617,17 @@ Serial::SerialImpl::write (const uint8_t *data, size_t length)
total_timeout_ms += timeout_.write_timeout_multiplier * static_cast<long> (length); total_timeout_ms += timeout_.write_timeout_multiplier * static_cast<long> (length);
MillisecondTimer total_timeout(total_timeout_ms); MillisecondTimer total_timeout(total_timeout_ms);
bool first = true; bool first_iteration = true;
while (bytes_written < length) { while (bytes_written < length) {
int64_t timeout_remaining_ms = total_timeout.remaining(); int64_t timeout_remaining_ms = total_timeout.remaining();
// Only consider the timeout if it's not the first iteration of the loop // Only consider the timeout if it's not the first iteration of the loop
// otherwise a timeout of 0 won't be allowed through // otherwise a timeout of 0 won't be allowed through
if (!first && (timeout_remaining_ms <= 0)) { if (!first_iteration && (timeout_remaining_ms <= 0)) {
// Timed out // Timed out
break; break;
} }
if( first ) { first_iteration = false;
first = false;
}
timespec timeout(timespec_from_ms(timeout_remaining_ms)); timespec timeout(timespec_from_ms(timeout_remaining_ms));
FD_ZERO (&writefds); FD_ZERO (&writefds);