mirror of
https://github.com/wjwwood/serial.git
synced 2026-01-22 19:54:57 +08:00
style fixup
This commit is contained in:
parent
04d4763926
commit
051824894b
@ -437,12 +437,11 @@ Serial::SerialImpl::close ()
|
|||||||
{
|
{
|
||||||
if (is_open_ == true) {
|
if (is_open_ == true) {
|
||||||
if (fd_ != -1) {
|
if (fd_ != -1) {
|
||||||
int retVal;
|
int ret;
|
||||||
retVal=::close (fd_);
|
ret = ::close (fd_);
|
||||||
if (retVal==0)
|
if (ret == 0) {
|
||||||
fd_ = -1;
|
fd_ = -1;
|
||||||
else
|
} else {
|
||||||
{
|
|
||||||
THROW (IOException, errno);
|
THROW (IOException, errno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
/* Copyright 2012 William Woodall and John Harrison */
|
/* Copyright 2012 William Woodall and John Harrison */
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
#include "serial/impl/win.h"
|
#include "serial/impl/win.h"
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
@ -260,17 +262,16 @@ Serial::SerialImpl::close ()
|
|||||||
{
|
{
|
||||||
if (is_open_ == true) {
|
if (is_open_ == true) {
|
||||||
if (fd_ != INVALID_HANDLE_VALUE) {
|
if (fd_ != INVALID_HANDLE_VALUE) {
|
||||||
int retVal;
|
int ret;
|
||||||
retVal=CloseHandle(fd_);
|
ret = CloseHandle(fd_);
|
||||||
if (retVal==0)
|
if (ret == 0) {
|
||||||
{
|
|
||||||
stringstream ss;
|
stringstream ss;
|
||||||
ss << "Error while closing serial port: " << GetLastError();
|
ss << "Error while closing serial port: " << GetLastError();
|
||||||
THROW (IOException, ss.str().c_str());
|
THROW (IOException, ss.str().c_str());
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
fd_ = INVALID_HANDLE_VALUE;
|
fd_ = INVALID_HANDLE_VALUE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
is_open_ = false;
|
is_open_ = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user