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:
parent
329545b282
commit
a0a586cf5b
@ -333,8 +333,9 @@ 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
|
||||||
@ -347,8 +348,9 @@ 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
|
||||||
@ -361,8 +363,9 @@ 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
|
||||||
@ -375,8 +378,9 @@ 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
|
||||||
@ -389,8 +393,9 @@ 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
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user