diff options
Diffstat (limited to 'src/network/tqsocketdevice_unix.cpp')
| -rw-r--r-- | src/network/tqsocketdevice_unix.cpp | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/src/network/tqsocketdevice_unix.cpp b/src/network/tqsocketdevice_unix.cpp index 39a9560dd..eaf9e1bf3 100644 --- a/src/network/tqsocketdevice_unix.cpp +++ b/src/network/tqsocketdevice_unix.cpp @@ -232,12 +232,12 @@ void TQSocketDevice::close() /*! - Returns TRUE if the socket is valid and in blocking mode; - otherwise returns FALSE. + Returns true if the socket is valid and in blocking mode; + otherwise returns false. Note that this function does not set error(). - \warning On Windows, this function always returns TRUE since the + \warning On Windows, this function always returns true since the ioctlsocket() function is broken. \sa setBlocking(), isValid() @@ -245,15 +245,15 @@ void TQSocketDevice::close() bool TQSocketDevice::blocking() const { if ( !isValid() ) - return TRUE; + return true; int s = fcntl(fd, F_GETFL, 0); return !(s >= 0 && ((s & O_NDELAY) != 0)); } /*! - Makes the socket blocking if \a enable is TRUE or nonblocking if - \a enable is FALSE. + Makes the socket blocking if \a enable is true or nonblocking if + \a enable is false. Sockets are blocking by default, but we recommend using nonblocking socket operations, especially for GUI programs that @@ -395,8 +395,8 @@ void TQSocketDevice::setOption( Option opt, int v ) /*! Connects to the IP address and port specified by \a addr and \a - port. Returns TRUE if it establishes a connection; otherwise returns FALSE. - If it returns FALSE, error() explains why. + port. Returns true if it establishes a connection; otherwise returns false. + If it returns false, error() explains why. Note that error() commonly returns NoError for non-blocking sockets; this just means that you can call connect() again in a @@ -405,7 +405,7 @@ void TQSocketDevice::setOption( Option opt, int v ) bool TQSocketDevice::connect( const TQHostAddress &addr, TQ_UINT16 port ) { if ( !isValid() ) - return FALSE; + return false; pa = addr; pp = port; @@ -438,20 +438,20 @@ bool TQSocketDevice::connect( const TQHostAddress &addr, TQ_UINT16 port ) aa = (struct sockaddr *)&a4; } else { e = Impossible; - return FALSE; + return false; } int r = qt_socket_connect( fd, aa, aalen ); if ( r == 0 ) { fetchConnectionParameters(); - return TRUE; + return true; } if ( errno == EISCONN || errno == EALREADY || errno == EINPROGRESS ) { fetchConnectionParameters(); - return TRUE; + return true; } if ( e != NoError || errno == EAGAIN || errno == EWOULDBLOCK ) { - return FALSE; + return false; } switch( errno ) { case EBADF: @@ -480,14 +480,14 @@ bool TQSocketDevice::connect( const TQHostAddress &addr, TQ_UINT16 port ) e = UnknownError; break; } - return FALSE; + return false; } /*! Assigns a name to an unnamed socket. The name is the host address \a address and the port number \a port. If the operation succeeds, - bind() returns TRUE; otherwise it returns FALSE without changing + bind() returns true; otherwise it returns false without changing what port() and address() return. bind() is used by servers for setting up incoming connections. @@ -496,7 +496,7 @@ bool TQSocketDevice::connect( const TQHostAddress &addr, TQ_UINT16 port ) bool TQSocketDevice::bind( const TQHostAddress &address, TQ_UINT16 port ) { if ( !isValid() ) - return FALSE; + return false; int r; struct sockaddr_in a4; #if !defined(TQT_NO_IPV6) @@ -521,7 +521,7 @@ bool TQSocketDevice::bind( const TQHostAddress &address, TQ_UINT16 port ) r = qt_socket_bind( fd, (struct sockaddr*)&a4, sizeof(a4) ); } else { e = Impossible; - return FALSE; + return false; } if ( r < 0 ) { @@ -551,17 +551,17 @@ bool TQSocketDevice::bind( const TQHostAddress &address, TQ_UINT16 port ) e = UnknownError; break; } - return FALSE; + return false; } fetchConnectionParameters(); - return TRUE; + return true; } /*! Specifies how many pending connections a server socket can have. - Returns TRUE if the operation was successful; otherwise returns - FALSE. A \a backlog value of 50 is quite common. + Returns true if the operation was successful; otherwise returns + false. A \a backlog value of 50 is quite common. The listen() call only applies to sockets where type() is \c Stream, i.e. not to \c Datagram sockets. listen() must not be @@ -572,12 +572,12 @@ bool TQSocketDevice::bind( const TQHostAddress &address, TQ_UINT16 port ) bool TQSocketDevice::listen( int backlog ) { if ( !isValid() ) - return FALSE; + return false; if ( qt_socket_listen( fd, backlog ) >= 0 ) - return TRUE; + return true; if ( !e ) e = Impossible; - return FALSE; + return false; } @@ -604,11 +604,11 @@ int TQSocketDevice::accept() do { s = qt_socket_accept( fd, (struct sockaddr*)&aa, &l ); // we'll blithely throw away the stuff accept() wrote to aa - done = TRUE; + done = true; if ( s < 0 && e == NoError ) { switch( errno ) { case EINTR: - done = FALSE; + done = false; break; #if defined(EPROTO) case EPROTO: @@ -707,9 +707,9 @@ TQ_LONG TQSocketDevice::bytesAvailable() const error occurred. If \a timeout is non-null and no error occurred (i.e. it does not - return -1): this function sets \a *timeout to TRUE, if the reason + return -1): this function sets \a *timeout to true, if the reason for returning was that the timeout was reached; otherwise it sets - \a *timeout to FALSE. This is useful to find out if the peer + \a *timeout to false. This is useful to find out if the peer closed the connection. \warning This is a blocking call and should be avoided in event @@ -740,9 +740,9 @@ TQ_LONG TQSocketDevice::waitForMore( int msecs, bool *timeout ) const if ( timeout ) { if ( rv == 0 ) - *timeout = TRUE; + *timeout = true; else - *timeout = FALSE; + *timeout = false; } return bytesAvailable(); @@ -777,9 +777,9 @@ TQ_LONG TQSocketDevice::readBlock( char *data, TQ_ULONG maxlen ) return -1; } #endif - bool done = FALSE; + bool done = false; int r = 0; - while ( done == FALSE ) { + while ( !done ) { if ( t == Datagram ) { #if !defined(TQT_NO_IPV6) struct sockaddr_storage aa; @@ -797,14 +797,14 @@ TQ_LONG TQSocketDevice::readBlock( char *data, TQ_ULONG maxlen ) } else { r = ::read( fd, data, maxlen ); } - done = TRUE; + done = true; if ( r == 0 && t == Stream && maxlen > 0 ) { // connection closed close(); } else if ( r >= 0 || errno == EAGAIN || errno == EWOULDBLOCK ) { // nothing } else if ( errno == EINTR ) { - done = FALSE; + done = false; } else if ( e == NoError ) { switch( errno ) { case EIO: @@ -873,17 +873,17 @@ TQ_LONG TQSocketDevice::writeBlock( const char *data, TQ_ULONG len ) #endif return -1; } - bool done = FALSE; + bool done = false; int r = 0; bool timeout; while ( !done ) { r = ::write( fd, data, len ); - done = TRUE; + done = true; if ( r < 0 && e == NoError && errno != EAGAIN && errno != EWOULDBLOCK ) { switch( errno ) { case EINTR: // signal - call read() or whatever again - done = FALSE; + done = false; break; case EPIPE: case ECONNRESET: @@ -998,16 +998,16 @@ TQ_LONG TQSocketDevice::writeBlock( const char * data, TQ_ULONG len, // we'd use MSG_DONTWAIT + MSG_NOSIGNAL if Stevens were right. // but apparently Stevens and most implementors disagree - bool done = FALSE; + bool done = false; int r = 0; while ( !done ) { r = ::sendto( fd, data, len, 0, aa, slen); - done = TRUE; + done = true; if ( r < 0 && e == NoError && errno != EAGAIN && errno != EWOULDBLOCK ) { switch( errno ) { case EINTR: // signal - call read() or whatever again - done = FALSE; + done = false; break; case ENOSPC: case EPIPE: |
