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

[style] always use curly braces with if statements

This commit is contained in:
William Woodall 2013-07-30 14:04:30 -07:00
parent 329545b282
commit a0a586cf5b

View File

@ -333,9 +333,10 @@ void
Serial::SerialImpl::setBaudrate (unsigned long baudrate) Serial::SerialImpl::setBaudrate (unsigned long baudrate)
{ {
baudrate_ = baudrate; baudrate_ = baudrate;
if (is_open_) if (is_open_) {
reconfigurePort (); reconfigurePort ();
} }
}
unsigned long unsigned long
Serial::SerialImpl::getBaudrate () const Serial::SerialImpl::getBaudrate () const
@ -347,9 +348,10 @@ void
Serial::SerialImpl::setBytesize (serial::bytesize_t bytesize) Serial::SerialImpl::setBytesize (serial::bytesize_t bytesize)
{ {
bytesize_ = bytesize; bytesize_ = bytesize;
if (is_open_) if (is_open_) {
reconfigurePort (); reconfigurePort ();
} }
}
serial::bytesize_t serial::bytesize_t
Serial::SerialImpl::getBytesize () const Serial::SerialImpl::getBytesize () const
@ -361,9 +363,10 @@ void
Serial::SerialImpl::setParity (serial::parity_t parity) Serial::SerialImpl::setParity (serial::parity_t parity)
{ {
parity_ = parity; parity_ = parity;
if (is_open_) if (is_open_) {
reconfigurePort (); reconfigurePort ();
} }
}
serial::parity_t serial::parity_t
Serial::SerialImpl::getParity () const Serial::SerialImpl::getParity () const
@ -375,9 +378,10 @@ void
Serial::SerialImpl::setStopbits (serial::stopbits_t stopbits) Serial::SerialImpl::setStopbits (serial::stopbits_t stopbits)
{ {
stopbits_ = stopbits; stopbits_ = stopbits;
if (is_open_) if (is_open_) {
reconfigurePort (); reconfigurePort ();
} }
}
serial::stopbits_t serial::stopbits_t
Serial::SerialImpl::getStopbits () const Serial::SerialImpl::getStopbits () const
@ -389,9 +393,10 @@ void
Serial::SerialImpl::setFlowcontrol (serial::flowcontrol_t flowcontrol) Serial::SerialImpl::setFlowcontrol (serial::flowcontrol_t flowcontrol)
{ {
flowcontrol_ = flowcontrol; flowcontrol_ = flowcontrol;
if (is_open_) if (is_open_) {
reconfigurePort (); reconfigurePort ();
} }
}
serial::flowcontrol_t serial::flowcontrol_t
Serial::SerialImpl::getFlowcontrol () const Serial::SerialImpl::getFlowcontrol () const
@ -494,9 +499,9 @@ Serial::SerialImpl::getCTS ()
throw PortNotOpenedException ("Serial::getCTS"); throw PortNotOpenedException ("Serial::getCTS");
} }
DWORD dwModemStatus; DWORD dwModemStatus;
if (!GetCommModemStatus(fd_, &dwModemStatus)) if (!GetCommModemStatus(fd_, &dwModemStatus)) {
// Error in GetCommModemStatus;
THROW (IOException, "Error getting the status of the CTS line."); THROW (IOException, "Error getting the status of the CTS line.");
}
return (bool) (MS_CTS_ON & dwModemStatus); return (bool) (MS_CTS_ON & dwModemStatus);
} }
@ -508,9 +513,9 @@ Serial::SerialImpl::getDSR ()
throw PortNotOpenedException ("Serial::getDSR"); throw PortNotOpenedException ("Serial::getDSR");
} }
DWORD dwModemStatus; DWORD dwModemStatus;
if (!GetCommModemStatus(fd_, &dwModemStatus)) if (!GetCommModemStatus(fd_, &dwModemStatus)) {
// Error in GetCommModemStatus;
THROW (IOException, "Error getting the status of the DSR line."); THROW (IOException, "Error getting the status of the DSR line.");
}
return (bool) (MS_DSR_ON & dwModemStatus); return (bool) (MS_DSR_ON & dwModemStatus);
} }
@ -522,9 +527,9 @@ Serial::SerialImpl::getRI()
throw PortNotOpenedException ("Serial::getRI"); throw PortNotOpenedException ("Serial::getRI");
} }
DWORD dwModemStatus; DWORD dwModemStatus;
if (!GetCommModemStatus(fd_, &dwModemStatus)) if (!GetCommModemStatus(fd_, &dwModemStatus)) {
// Error in GetCommModemStatus; THROW (IOException, "Error getting the status of the RI line.");
THROW (IOException, "Error getting the status of the DSR line."); }
return (bool) (MS_RING_ON & dwModemStatus); return (bool) (MS_RING_ON & dwModemStatus);
} }
@ -536,9 +541,10 @@ Serial::SerialImpl::getCD()
throw PortNotOpenedException ("Serial::getCD"); throw PortNotOpenedException ("Serial::getCD");
} }
DWORD dwModemStatus; DWORD dwModemStatus;
if (!GetCommModemStatus(fd_, &dwModemStatus)) if (!GetCommModemStatus(fd_, &dwModemStatus)) {
// Error in GetCommModemStatus; // Error in GetCommModemStatus;
THROW (IOException, "Error getting the status of the DSR line."); THROW (IOException, "Error getting the status of the CD line.");
}
return (bool) (MS_RLSD_ON & dwModemStatus); return (bool) (MS_RLSD_ON & dwModemStatus);
} }