summaryrefslogtreecommitdiffstats
path: root/src/network/tqsocket.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/tqsocket.cpp')
-rw-r--r--src/network/tqsocket.cpp98
1 files changed, 49 insertions, 49 deletions
diff --git a/src/network/tqsocket.cpp b/src/network/tqsocket.cpp
index 9314318d1..91d48cec2 100644
--- a/src/network/tqsocket.cpp
+++ b/src/network/tqsocket.cpp
@@ -152,7 +152,7 @@ TQSocketPrivate::TQSocketPrivate()
dns4 = 0;
dns6 = 0;
#endif
- wba.setAutoDelete( TRUE );
+ wba.setAutoDelete( true );
}
TQSocketPrivate::~TQSocketPrivate()
@@ -208,8 +208,8 @@ void TQSocketPrivate::setSocketDevice( TQSocket *q, TQSocketDevice *device )
( addr.isIPv4Address() ?
TQSocketDevice::IPv4 :
TQSocketDevice::IPv6 ), 0 );
- socket->setBlocking( FALSE );
- socket->setAddressReusable( TRUE );
+ socket->setBlocking( false );
+ socket->setAddressReusable( true );
}
rsn = new TQSocketNotifier( socket->socket(),
@@ -218,9 +218,9 @@ void TQSocketPrivate::setSocketDevice( TQSocket *q, TQSocketDevice *device )
TQSocketNotifier::Write, q, "write" );
TQObject::connect( rsn, TQ_SIGNAL(activated(int)), q, TQ_SLOT(sn_read()) );
- rsn->setEnabled( FALSE );
+ rsn->setEnabled( false );
TQObject::connect( wsn, TQ_SIGNAL(activated(int)), q, TQ_SLOT(sn_write()) );
- wsn->setEnabled( FALSE );
+ wsn->setEnabled( false );
}
/*!
@@ -504,14 +504,14 @@ void TQSocket::tryConnecting()
// or do multiple TCP-level connects at a time, with staggered
// starts to avoid bandwidth waste and cause fewer
// "connect-and-abort" errors. but that later.)
- bool stuck = TRUE;
+ bool stuck = true;
while( stuck ) {
- stuck = FALSE;
+ stuck = false;
if ( d->socket &&
- d->socket->connect( d->addr, d->port ) == FALSE ) {
+ !d->socket->connect( d->addr, d->port ) ) {
if ( d->socket->error() == TQSocketDevice::NoError ) {
if ( d->wsn )
- d->wsn->setEnabled( TRUE );
+ d->wsn->setEnabled( true );
return; // not serious, try again later
}
@@ -537,7 +537,7 @@ void TQSocket::tryConnecting()
d->addr = *d->addresses.begin();
d->addresses.remove( d->addresses.begin() );
d->setSocketDevice( this, 0 );
- stuck = TRUE;
+ stuck = true;
#if defined(TQSOCKET_DEBUG)
tqDebug( "TQSocket (%s)::tryConnecting: Trying IP address %s",
name(), d->addr.toString().ascii() );
@@ -547,7 +547,7 @@ void TQSocket::tryConnecting()
// The socket write notifier will fire when the connection succeeds
if ( d->wsn )
- d->wsn->setEnabled( TRUE );
+ d->wsn->setEnabled( true );
}
#endif
}
@@ -656,11 +656,11 @@ bool TQSocket::open( int m )
#if defined(QT_CHECK_STATE)
tqWarning( "TQSocket::open: Already open" );
#endif
- return FALSE;
+ return false;
}
TQIODevice::setMode( m & IO_ReadWrite );
setState( IO_Open );
- return TRUE;
+ return true;
}
@@ -697,9 +697,9 @@ void TQSocket::close()
if ( d->socket && d->wsize ) { // there's data to be written
d->state = Closing;
if ( d->rsn )
- d->rsn->setEnabled( FALSE );
+ d->rsn->setEnabled( false );
if ( d->wsn )
- d->wsn->setEnabled( TRUE );
+ d->wsn->setEnabled( true );
d->rba.clear(); // clear incoming data
return;
}
@@ -719,7 +719,7 @@ void TQSocket::close()
bool TQSocket::consumeWriteBuf( TQ_ULONG nbytes )
{
if ( nbytes <= 0 || nbytes > d->wsize )
- return FALSE;
+ return false;
#if defined(TQSOCKET_DEBUG)
tqDebug( "TQSocket (%s): skipWriteBuf %d bytes", name(), (int)nbytes );
#endif
@@ -737,7 +737,7 @@ bool TQSocket::consumeWriteBuf( TQ_ULONG nbytes )
break;
}
}
- return TRUE;
+ return true;
}
@@ -750,7 +750,7 @@ void TQSocket::flush()
{
if ( !d->socket )
return;
- bool osBufferFull = FALSE;
+ bool osBufferFull = false;
int consumed = 0;
while ( !osBufferFull && d->state >= Connecting && d->wsize > 0 ) {
#if defined(TQSOCKET_DEBUG)
@@ -781,20 +781,20 @@ void TQSocket::flush()
}
nwritten = d->socket->writeBlock( out.data(), i );
if ( d->wsn )
- d->wsn->setEnabled( FALSE ); // the TQSocketNotifier documentation says so
+ d->wsn->setEnabled( false ); // the TQSocketNotifier documentation says so
} else {
// Big block, write it immediately
i = a->size() - d->windex;
nwritten = d->socket->writeBlock( a->data() + d->windex, i );
if ( d->wsn )
- d->wsn->setEnabled( FALSE ); // the TQSocketNotifier documentation says so
+ d->wsn->setEnabled( false ); // the TQSocketNotifier documentation says so
}
if ( nwritten > 0 ) {
if ( consumeWriteBuf( nwritten ) )
consumed += nwritten;
}
if ( nwritten < i )
- osBufferFull = TRUE;
+ osBufferFull = true;
}
if ( consumed > 0 ) {
#if defined(TQSOCKET_DEBUG)
@@ -851,15 +851,15 @@ TQIODevice::Offset TQSocket::at() const
/*!
\overload
- Moves the read index forward to \a index and returns TRUE if the
- operation was successful; otherwise returns FALSE. Moving the
+ Moves the read index forward to \a index and returns true if the
+ operation was successful; otherwise returns false. Moving the
index forward means skipping incoming data.
*/
bool TQSocket::at( Offset index )
{
if ( index > d->rba.size() )
- return FALSE;
+ return false;
d->rba.consumeBytes( (TQ_ULONG)index, 0 ); // throw away data 0..index-1
// After we read data from our internal buffer, if we use the
// setReadBufferSize() to limit our buffer, we might now be able to
@@ -869,19 +869,19 @@ bool TQSocket::at( Offset index )
// We can test for this condition by looking at the
// sn_read_alreadyCalled flag.
if ( d->rsn && TQSocketPrivate::sn_read_alreadyCalled.findRef(this) == -1 )
- d->rsn->setEnabled( TRUE );
- return TRUE;
+ d->rsn->setEnabled( true );
+ return true;
}
/*!
- Returns TRUE if there is no more data to read; otherwise returns FALSE.
+ Returns true if there is no more data to read; otherwise returns false.
*/
bool TQSocket::atEnd() const
{
if ( d->socket == 0 )
- return TRUE;
+ return true;
TQSocket * that = (TQSocket *)this;
if ( that->d->socket->bytesAvailable() ) // a little slow, perhaps...
that->sn_read();
@@ -918,9 +918,9 @@ TQ_ULONG TQSocket::bytesAvailable() const
Returns the number of bytes available.
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
@@ -935,7 +935,7 @@ TQ_ULONG TQSocket::waitForMore( int msecs, bool *timeout ) const
return 0;
TQSocket * that = (TQSocket *)this;
if ( that->d->socket->waitForMore( msecs, timeout ) > 0 )
- (void)that->sn_read( TRUE );
+ (void)that->sn_read( true );
return that->d->rba.size();
}
@@ -1005,7 +1005,7 @@ TQ_LONG TQSocket::readBlock( char *data, TQ_ULONG maxlen )
// We can test for this condition by looking at the
// sn_read_alreadyCalled flag.
if ( d->rsn && TQSocketPrivate::sn_read_alreadyCalled.findRef(this) == -1 )
- d->rsn->setEnabled( TRUE );
+ d->rsn->setEnabled( true );
return maxlen;
}
@@ -1059,7 +1059,7 @@ TQ_LONG TQSocket::writeBlock( const char *data, TQ_ULONG len )
if ( writeNow )
flush();
else if ( d->wsn )
- d->wsn->setEnabled( TRUE );
+ d->wsn->setEnabled( true );
#if defined(TQSOCKET_DEBUG)
tqDebug( "TQSocket (%s): writeBlock %d bytes", name(), (int)len );
#endif
@@ -1088,7 +1088,7 @@ int TQSocket::getch()
// We can test for this condition by looking at the
// sn_read_alreadyCalled flag.
if ( d->rsn && TQSocketPrivate::sn_read_alreadyCalled.findRef(this) == -1 )
- d->rsn->setEnabled( TRUE );
+ d->rsn->setEnabled( true );
return c;
}
return -1;
@@ -1130,11 +1130,11 @@ int TQSocket::ungetch( int ch )
/*!
- Returns TRUE if it's possible to read an entire line of text from
- this socket at this time; otherwise returns FALSE.
+ Returns true if it's possible to read an entire line of text from
+ this socket at this time; otherwise returns false.
Note that if the peer closes the connection unexpectedly, this
- function returns FALSE. This means that loops such as this won't
+ function returns false. This means that loops such as this won't
work:
\code
@@ -1148,7 +1148,7 @@ int TQSocket::ungetch( int ch )
bool TQSocket::canReadLine() const
{
if ( ((TQSocket*)this)->d->rba.scanNewline( 0 ) )
- return TRUE;
+ return true;
return ( bytesAvailable() > 0 &&
((TQSocket*)this)->d->rba.scanNewline( 0 ) );
}
@@ -1165,7 +1165,7 @@ TQ_LONG TQSocket::readLine( char *data, TQ_ULONG maxlen )
/*!
Returns a line of text including a terminating newline character
- (\n). Returns "" if canReadLine() returns FALSE.
+ (\n). Returns "" if canReadLine() returns false.
\sa canReadLine()
*/
@@ -1187,7 +1187,7 @@ TQString TQSocket::readLine()
Internal slot for handling socket read notifications.
This function has can usually only be entered once (i.e. no
- recursive calls). If the argument \a force is TRUE, the function
+ recursive calls). If the argument \a force is true, the function
is executed, but no readyRead() signals are emitted. This
behaviour is useful for the waitForMore() function, so that it is
possible to call waitForMore() in a slot connected to the
@@ -1201,7 +1201,7 @@ void TQSocket::sn_read( bool force )
maxToRead = d->readBufferSize - d->rba.size();
if ( maxToRead <= 0 ) {
if ( d->rsn )
- d->rsn->setEnabled( FALSE );
+ d->rsn->setEnabled( false );
return;
}
}
@@ -1261,7 +1261,7 @@ void TQSocket::sn_read( bool force )
tqWarning( "TQSocket::sn_read (%s): Close error", name() );
#endif
if ( d->rsn )
- d->rsn->setEnabled( FALSE );
+ d->rsn->setEnabled( false );
emit error( ErrSocketRead );
TQSocketPrivate::sn_read_alreadyCalled.removeRef( this );
return;
@@ -1309,7 +1309,7 @@ void TQSocket::sn_read( bool force )
tqWarning( "TQSocket::sn_read: Read error" );
#endif
if ( d->rsn )
- d->rsn->setEnabled( FALSE );
+ d->rsn->setEnabled( false );
emit error( ErrSocketRead );
TQSocketPrivate::sn_read_alreadyCalled.removeRef( this );
return;
@@ -1324,10 +1324,10 @@ void TQSocket::sn_read( bool force )
d->rba.append( a );
if ( !force ) {
if ( d->rsn )
- d->rsn->setEnabled( FALSE );
+ d->rsn->setEnabled( false );
emit readyRead();
if ( d->rsn )
- d->rsn->setEnabled( TRUE );
+ d->rsn->setEnabled( true );
}
TQSocketPrivate::sn_read_alreadyCalled.removeRef( this );
@@ -1360,7 +1360,7 @@ void TQSocket::tryConnection()
name(), peerName().ascii() );
#endif
if ( d->rsn )
- d->rsn->setEnabled( TRUE );
+ d->rsn->setEnabled( true );
emit connected();
} else {
d->state = Idle;
@@ -1393,7 +1393,7 @@ void TQSocket::setSocket( int socket )
{
setSocketIntern( socket );
d->state = Connection;
- d->rsn->setEnabled( TRUE );
+ d->rsn->setEnabled( true );
}
@@ -1416,8 +1416,8 @@ void TQSocket::setSocketIntern( int socket )
d->readBufferSize = oldBufferSize;
if ( socket >= 0 ) {
TQSocketDevice *sd = new TQSocketDevice( socket, TQSocketDevice::Stream );
- sd->setBlocking( FALSE );
- sd->setAddressReusable( TRUE );
+ sd->setBlocking( false );
+ sd->setAddressReusable( true );
d->setSocketDevice( this, sd );
}
d->state = Idle;