From 566dd25530779388859f8a21191e60c62a21cd5f Mon Sep 17 00:00:00 2001 From: David Date: Fri, 24 Oct 2008 19:12:49 +0000 Subject: david - ok, fixed the compiler warnings in socket class. got serversocket compliling without warnings. added win32_compatibility.h along the same lines as osx_copatibility.h --- src/socket.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'src/socket.cpp') diff --git a/src/socket.cpp b/src/socket.cpp index 1e9a2f9..aea66f8 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -16,6 +16,7 @@ #include #include "socket.h" #include "osx_compatibility.h" +#include "win32_compatibility.h" #ifndef WIN32 #include @@ -194,11 +195,7 @@ void Bu::Socket::read() size_t Bu::Socket::read( void *pBuf, size_t nBytes ) { -#ifndef WIN32 int nRead = TEMP_FAILURE_RETRY( ::read( nSocket, pBuf, nBytes ) ); -#else - int nRead = ::read( nSocket, pBuf, nBytes ); -#endif if( nRead < 0 ) { throw SocketException( SocketException::cRead, strerror(errno) ); @@ -209,7 +206,7 @@ size_t Bu::Socket::read( void *pBuf, size_t nBytes ) size_t Bu::Socket::read( void *pBuf, size_t nBytes, uint32_t nSec, uint32_t nUSec ) { - struct timeval tv, nt, ct; + struct timeval tv; size_t nRead = 0; fd_set rfds; @@ -217,6 +214,7 @@ size_t Bu::Socket::read( void *pBuf, size_t nBytes, FD_SET(nSocket, &rfds); #ifndef WIN32 + struct timeval nt, ct; gettimeofday( &nt, NULL ); nt.tv_sec += nSec; nt.tv_usec += nUSec; @@ -251,11 +249,7 @@ size_t Bu::Socket::read( void *pBuf, size_t nBytes, size_t Bu::Socket::write( const void *pBuf, size_t nBytes ) { -#ifndef WIN32 int nWrote = TEMP_FAILURE_RETRY( ::write( nSocket, pBuf, nBytes ) ); -#else - int nWrote = ::write( nSocket, pBuf, nBytes ); -#endif if( nWrote < 0 ) { if( errno == EAGAIN ) return 0; @@ -266,7 +260,7 @@ size_t Bu::Socket::write( const void *pBuf, size_t nBytes ) size_t Bu::Socket::write( const void *pBuf, size_t nBytes, uint32_t nSec, uint32_t nUSec ) { - struct timeval tv, nt, ct; + struct timeval tv; size_t nWrote = 0; fd_set wfds; @@ -274,6 +268,7 @@ size_t Bu::Socket::write( const void *pBuf, size_t nBytes, uint32_t nSec, uint32 FD_SET(nSocket, &wfds); #ifndef WIN32 + struct timeval nt, ct; gettimeofday( &nt, NULL ); nt.tv_sec += nSec; nt.tv_usec += nUSec; @@ -421,9 +416,9 @@ bool Bu::Socket::isOpen() return bActive; } -#ifdef WIN32 - typedef int socklen_t; -#endif +//#ifdef WIN32 +// typedef int socklen_t; +//#endif void Bu::Socket::setAddress() { -- cgit v1.2.3