diff options
author | Pierre Ossman <ossman@cendio.se> | 2017-11-08 15:59:42 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2017-11-08 15:59:42 +0100 |
commit | e5cdadd6deca3c0d2af6bc0ab2b60a11f5c6ad4a (patch) | |
tree | 26302e9692c768afe820f1024583fbe681087432 /common/rdr | |
parent | bf003e5b1edf2877e1f47db41938bfe4ae7816b0 (diff) | |
download | tigervnc-e5cdadd6deca3c0d2af6bc0ab2b60a11f5c6ad4a.tar.gz tigervnc-e5cdadd6deca3c0d2af6bc0ab2b60a11f5c6ad4a.zip |
Fully standardise on send()/recv()
We already assume sockets here since we use select().
Diffstat (limited to 'common/rdr')
-rw-r--r-- | common/rdr/FdInStream.cxx | 8 | ||||
-rw-r--r-- | common/rdr/FdOutStream.cxx | 5 |
2 files changed, 6 insertions, 7 deletions
diff --git a/common/rdr/FdInStream.cxx b/common/rdr/FdInStream.cxx index a8b30857..011ebf41 100644 --- a/common/rdr/FdInStream.cxx +++ b/common/rdr/FdInStream.cxx @@ -26,13 +26,13 @@ #include <sys/time.h> #ifdef _WIN32 #include <winsock2.h> -#define read(s,b,l) recv(s,(char*)b,l,0) #define close closesocket #undef errno #define errno WSAGetLastError() #include <os/winerrno.h> #else #include <sys/types.h> +#include <sys/socket.h> #include <unistd.h> #endif @@ -165,9 +165,9 @@ int FdInStream::overrun(int itemSize, int nItems, bool wait) // blockCallback is set, it will be called (repeatedly) instead of blocking. // If alternatively there is a timeout set and that timeout expires, it throws // a TimedOut exception. Otherwise it returns the number of bytes read. It -// never attempts to read() unless select() indicates that the fd is readable - +// never attempts to recv() unless select() indicates that the fd is readable - // this means it can be used on an fd which has been set non-blocking. It also -// has to cope with the annoying possibility of both select() and read() +// has to cope with the annoying possibility of both select() and recv() // returning EINTR. // @@ -207,7 +207,7 @@ int FdInStream::readWithTimeoutOrCallback(void* buf, int len, bool wait) } do { - n = ::read(fd, buf, len); + n = ::recv(fd, (char*)buf, len, 0); } while (n < 0 && errno == EINTR); if (n < 0) throw SystemException("read",errno); diff --git a/common/rdr/FdOutStream.cxx b/common/rdr/FdOutStream.cxx index 8fe9df94..cf857f85 100644 --- a/common/rdr/FdOutStream.cxx +++ b/common/rdr/FdOutStream.cxx @@ -27,7 +27,6 @@ #include <errno.h> #ifdef _WIN32 #include <winsock2.h> -#define write(s,b,l) send(s,(const char*)b,l,0) #undef errno #define errno WSAGetLastError() #include <os/winerrno.h> @@ -161,10 +160,10 @@ int FdOutStream::overrun(int itemSize, int nItems) // writeWithTimeout() writes up to the given length in bytes from the given // buffer to the file descriptor. If there is a timeout set and that timeout // expires, it throws a TimedOut exception. Otherwise it returns the number of -// bytes written. It never attempts to write() unless select() indicates that +// bytes written. It never attempts to send() unless select() indicates that // the fd is writable - this means it can be used on an fd which has been set // non-blocking. It also has to cope with the annoying possibility of both -// select() and write() returning EINTR. +// select() and send() returning EINTR. // int FdOutStream::writeWithTimeout(const void* data, int length, int timeoutms) |