[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
serial.cpp, proper win32 checks for dev
From: |
Adib Taraben |
Subject: |
serial.cpp, proper win32 checks for dev |
Date: |
Mon, 08 Mar 2004 14:22:19 +0100 |
User-agent: |
Mozilla Thunderbird 0.5 (Windows/20040207) |
Attached there is a patch to make proper win32 checks
against the file-handle dev.
Also I don't know exactly whether an valid FILE in UNIX is:
dev > 0
or
dev >= 0
This patch is against the serial.cpp version that I
found in
commoncpp2-1.1.0.tar.gz
from sourceforge using following command:
diff -c serial_org.cpp serial.cpp > devcheck.patch
HTH,
Adib.
*** serial_org.cpp Sat Jan 17 11:51:02 2004
--- serial.cpp Mon Mar 8 13:05:56 2004
***************
*** 118,124 ****
--- 118,128 ----
open(fname);
+ #ifdef WIN32
+ if(INVALID_HANDLE_VALUE == dev)
+ #else
if(0 > dev)
+ #endif
{
error(errOpenFailed);
return;
***************
*** 254,260 ****
--- 258,268 ----
void Serial::endSerial(void)
{
+ #ifdef WIN32
+ if(INVALID_HANDLE_VALUE != dev)
+ #else
if(0 < dev)
+ #endif
#ifdef WIN32
{
SetCommState(dev, (DCB *)original);
***************
*** 390,396 ****
--- 398,408 ----
{
Serial::close();
+ #ifdef WIN32
+ if(INVALID_HANDLE_VALUE == ser.dev)
+ #else
if(ser.dev < 0)
+ #endif
return *this;
#ifdef WIN32
***************
*** 1060,1066 ****
--- 1072,1082 ----
void TTYStream::interactive(bool iflag)
{
+ #ifdef WIN32
+ if(INVALID_HANDLE_VALUE == dev)
+ #else
if(dev < 0)
+ #endif
return;
if(bufsize >= 1)
***************
*** 1305,1311 ****
--- 1321,1331 ----
Serial::open(pathname);
+ #ifdef WIN32
if(INVALID_HANDLE_VALUE == dev)
+ #else
+ if(dev < 0)
+ #endif
{
error(errOpenFailed);
return;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- serial.cpp, proper win32 checks for dev,
Adib Taraben <=