diff options
Diffstat (limited to 'src/stdiodevice.cc')
-rw-r--r-- | src/stdiodevice.cc | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/src/stdiodevice.cc b/src/stdiodevice.cc index a9cce91..b078c7a 100644 --- a/src/stdiodevice.cc +++ b/src/stdiodevice.cc @@ -1,9 +1,10 @@ -/** -------------------------------------------------------------------- +/** * @file stdiodevice.cc * @brief Implementation of the StdIODevice class * @author Andreas Aardal Hanssen * @date 2003/2023 - * ---------------------------------------------------------------- **/ + */ + #include "stdiodevice.h" #include <string> @@ -16,29 +17,23 @@ #include <sys/types.h> #include <unistd.h> -using namespace ::std; -using namespace ::Binc; +using namespace Binc; -//------------------------------------------------------------------------ StdIODevice::StdIODevice(int f) : IODevice(f) {} -//------------------------------------------------------------------------ StdIODevice::~StdIODevice(void) {} -//------------------------------------------------------------------------ -string StdIODevice::service(void) const +std::string StdIODevice::service(void) const { return "client"; } -//------------------------------------------------------------------------ bool StdIODevice::canRead(void) const { size_t bytes; return ioctl(fileno(stdin), FIONREAD, (char *)&bytes) > 0; } -//------------------------------------------------------------------------ bool StdIODevice::waitForWrite(void) const { fd_set writeMask; @@ -49,12 +44,11 @@ bool StdIODevice::waitForWrite(void) const tv.tv_sec = timeout; tv.tv_usec = 0; - int result = select(fileno(stdout) + 1, 0, &writeMask, 0, timeout ? &tv : 0); + int result = select(fileno(stdout) + 1, nullptr, &writeMask, nullptr, timeout ? &tv : nullptr); if (result == 0) error = Timeout; return result > 0; } -//------------------------------------------------------------------------ bool StdIODevice::waitForRead(void) const { fd_set readMask; @@ -65,12 +59,11 @@ bool StdIODevice::waitForRead(void) const tv.tv_sec = timeout; tv.tv_usec = 0; - int result = select(fileno(stdin) + 1, &readMask, 0, 0, timeout ? &tv : 0); + int result = select(fileno(stdin) + 1, &readMask, nullptr, nullptr, timeout ? &tv : nullptr); if (result == 0) error = Timeout; return result > 0; } -//------------------------------------------------------------------------ IODevice::WriteResult StdIODevice::write(void) { for (;;) { @@ -90,7 +83,6 @@ IODevice::WriteResult StdIODevice::write(void) } } -//------------------------------------------------------------------------ bool StdIODevice::fillInputBuffer(void) { if (!waitForRead()) return false; |