diff options
Diffstat (limited to 'src/network')
| -rw-r--r-- | src/network/tqdns.cpp | 144 | ||||
| -rw-r--r-- | src/network/tqftp.cpp | 178 | ||||
| -rw-r--r-- | src/network/tqhostaddress.cpp | 68 | ||||
| -rw-r--r-- | src/network/tqhttp.cpp | 126 | ||||
| -rw-r--r-- | src/network/tqserversocket.cpp | 8 | ||||
| -rw-r--r-- | src/network/tqsocket.cpp | 98 | ||||
| -rw-r--r-- | src/network/tqsocket.h | 2 | ||||
| -rw-r--r-- | src/network/tqsocketdevice.cpp | 22 | ||||
| -rw-r--r-- | src/network/tqsocketdevice_unix.cpp | 80 |
9 files changed, 363 insertions, 363 deletions
diff --git a/src/network/tqdns.cpp b/src/network/tqdns.cpp index fa248533c..b44f43433 100644 --- a/src/network/tqdns.cpp +++ b/src/network/tqdns.cpp @@ -109,7 +109,7 @@ static TQ_UINT32 now() static TQPtrList<TQHostAddress> * ns = 0; static TQStrList * domains = 0; -static bool ipv6support = FALSE; +static bool ipv6support = false; #if defined(Q_MODERN_RES_API) #else @@ -135,13 +135,13 @@ static int tqdns_res_init() class TQDnsPrivate { public: - TQDnsPrivate() : queryTimer( 0 ), noNames(FALSE) + TQDnsPrivate() : queryTimer( 0 ), noNames(false) { #if defined(Q_DNS_SYNCHRONOUS) #if defined(Q_OS_UNIX) noEventLoop = tqApp==0 || tqApp->loopLevel()==0; #else - noEventLoop = FALSE; + noEventLoop = false; #endif #endif } @@ -267,7 +267,7 @@ private: TQString label; TQDnsRR * rr; - TQString readString(bool multipleLabels = TRUE); + TQString readString(bool multipleLabels = true); void parseA(); void parseAaaa(); void parseMx(); @@ -281,7 +281,7 @@ private: TQDnsRR::TQDnsRR( const TQString & label ) : domain( 0 ), t( TQDns::None ), - nxdomain( FALSE ), current( FALSE ), + nxdomain( false ), current( false ), expireTime( 0 ), deleteTime( 0 ), priority( 0 ), weight( 0 ), port( 0 ) { @@ -299,14 +299,14 @@ TQDnsRR::~TQDnsRR() // this one just sticks in a NXDomain TQDnsAnswer::TQDnsAnswer( TQDnsQuery * query_ ) { - ok = TRUE; + ok = true; answer = 0; size = 0; query = query_; pp = 0; rrs = new TQPtrList<TQDnsRR>; - rrs->setAutoDelete( FALSE ); + rrs->setAutoDelete( false ); next = size; ttl = 0; label = TQString::null; @@ -316,8 +316,8 @@ TQDnsAnswer::TQDnsAnswer( TQDnsQuery * query_ ) newrr->t = query->t; newrr->deleteTime = query->started + 10; newrr->expireTime = query->started + 10; - newrr->nxdomain = TRUE; - newrr->current = TRUE; + newrr->nxdomain = true; + newrr->current = true; rrs->append( newrr ); } @@ -325,14 +325,14 @@ TQDnsAnswer::TQDnsAnswer( TQDnsQuery * query_ ) TQDnsAnswer::TQDnsAnswer( const TQByteArray& answer_, TQDnsQuery * query_ ) { - ok = TRUE; + ok = true; answer = (TQ_UINT8 *)(answer_.data()); size = (int)answer_.size(); query = query_; pp = 0; rrs = new TQPtrList<TQDnsRR>; - rrs->setAutoDelete( FALSE ); + rrs->setAutoDelete( false ); next = size; ttl = 0; label = TQString::null; @@ -408,7 +408,7 @@ TQString TQDnsAnswer::readString(bool multipleLabels) } } not_ok: - ok = FALSE; + ok = false; return TQString::null; } @@ -577,7 +577,7 @@ void TQDnsAnswer::parsePtr() void TQDnsAnswer::parseTxt() { - TQString text = readString(FALSE); + TQString text = readString(false); if ( !ok ) { #if defined(TQDNS_DEBUG) tqDebug( "TQDns: saw bad TXT for for %s", label.ascii() ); @@ -602,7 +602,7 @@ void TQDnsAnswer::parse() #if defined(TQDNS_DEBUG) tqDebug( "DNS Manager: answer to wrong query type (%d)", answer[1] ); #endif - ok = FALSE; + ok = false; return; } @@ -631,8 +631,8 @@ void TQDnsAnswer::parse() rr->t = query->t; rr->deleteTime = query->started + 60; rr->expireTime = query->started + 60; - rr->nxdomain = TRUE; - rr->current = TRUE; + rr->nxdomain = true; + rr->current = true; rrs->append( rr ); return; } @@ -641,7 +641,7 @@ void TQDnsAnswer::parse() #if defined(TQDNS_DEBUG) tqDebug( "DNS Manager: error code %d", answer[3] & 0x0f ); #endif - ok = FALSE; + ok = false; return; } @@ -745,7 +745,7 @@ void TQDnsAnswer::parse() answers++; rr->deleteTime = rr->expireTime; } - rr->current = TRUE; + rr->current = true; rrs->append( rr ); } } @@ -766,7 +766,7 @@ void TQDnsAnswer::parse() // by something we care about. we want to cache such As. rrs->first(); TQDict<void> used( 17 ); - used.setAutoDelete( FALSE ); + used.setAutoDelete( false ); while( (rr=rrs->current()) != 0 ) { rrs->next(); if ( rr->target.length() && rr->deleteTime > 0 && rr->current ) @@ -822,7 +822,7 @@ void TQDnsAnswer::parse() class TQDnsUgleHack: public TQDns { public: - void ugle( bool emitAnyway=FALSE ); + void ugle( bool emitAnyway=false ); }; @@ -832,7 +832,7 @@ void TQDnsAnswer::notify() return; TQPtrDict<void> notified; - notified.setAutoDelete( FALSE ); + notified.setAutoDelete( false ); TQPtrDictIterator<void> it( *query->dns ); TQDns * dns; @@ -845,8 +845,8 @@ void TQDnsAnswer::notify() #if defined(TQDNS_DEBUG) tqDebug( "DNS Manager: found no answers!" ); #endif - dns->d->noNames = TRUE; - ((TQDnsUgleHack*)dns)->ugle( TRUE ); + dns->d->noNames = true; + ((TQDnsUgleHack*)dns)->ugle( true ); } else { TQStringList n = dns->qualifiedNames(); if ( query && n.contains(query->l) ) @@ -931,13 +931,13 @@ void TQDnsUgleHack::ugle( bool emitAnyway) TQDnsManager::TQDnsManager() : TQDnsSocket( tqApp, "Internal DNS manager" ), queries( TQPtrVector<TQDnsQuery>( 0 ) ), - cache( TQDict<TQDnsDomain>( 83, FALSE ) ), + cache( TQDict<TQDnsDomain>( 83, false ) ), ipv4Socket( new TQSocketDevice( TQSocketDevice::Datagram, TQSocketDevice::IPv4, 0 ) ) #if !defined (TQT_NO_IPV6) , ipv6Socket( new TQSocketDevice( TQSocketDevice::Datagram, TQSocketDevice::IPv6, 0 ) ) #endif { - cache.setAutoDelete( TRUE ); + cache.setAutoDelete( true ); globalManager = this; TQTimer * sweepTimer = new TQTimer( this ); @@ -948,8 +948,8 @@ TQDnsManager::TQDnsManager() TQSocketNotifier * rn4 = new TQSocketNotifier( ipv4Socket->socket(), TQSocketNotifier::Read, this, "dns IPv4 socket watcher" ); - ipv4Socket->setAddressReusable( FALSE ); - ipv4Socket->setBlocking( FALSE ); + ipv4Socket->setAddressReusable( false ); + ipv4Socket->setBlocking( false ); connect( rn4, TQ_SIGNAL(activated(int)), TQ_SLOT(answer()) ); #if !defined (TQT_NO_IPV6) @@ -960,9 +960,9 @@ TQDnsManager::TQDnsManager() TQSocketNotifier::Read, this, "dns IPv6 socket watcher" ); - ipv6support = TRUE; - ipv6Socket->setAddressReusable( FALSE ); - ipv6Socket->setBlocking( FALSE ); + ipv6support = true; + ipv6Socket->setAddressReusable( false ); + ipv6Socket->setBlocking( false ); connect( rn6, TQ_SIGNAL(activated(int)), TQ_SLOT(answer()) ); } #endif @@ -994,9 +994,9 @@ TQDnsManager::TQDnsManager() delete ::ns; ::ns = ns; - ::ns->setAutoDelete( TRUE ); + ::ns->setAutoDelete( true ); - TQStrList * domains = new TQStrList( TRUE ); + TQStrList * domains = new TQStrList( true ); ::domains->first(); const char * s; @@ -1017,7 +1017,7 @@ TQDnsManager::TQDnsManager() delete ::domains; ::domains = domains; - ::domains->setAutoDelete( TRUE ); + ::domains->setAutoDelete( true ); } @@ -1025,8 +1025,8 @@ TQDnsManager::~TQDnsManager() { if ( globalManager ) globalManager = 0; - queries.setAutoDelete( TRUE ); - cache.setAutoDelete( TRUE ); + queries.setAutoDelete( true ); + cache.setAutoDelete( true ); delete ipv4Socket; #if !defined (TQT_NO_IPV6) delete ipv6Socket; @@ -1037,7 +1037,7 @@ static TQ_UINT32 lastSweep = 0; void TQDnsManager::cleanCache() { - bool again = FALSE; + bool again = false; TQDictIterator<TQDnsDomain> it( cache ); TQDnsDomain * d; TQ_UINT32 thisSweep = now(); @@ -1305,7 +1305,7 @@ void TQDnsManager::transmitQuery( int i ) // seconds. the graph becomes steep around that point, and the // number of errors rises... so it seems good to retry at that // point. - q->start( q->step < ns->count() ? 800 : 1500, TRUE ); + q->start( q->step < ns->count() ? 800 : 1500, true ); } @@ -1350,7 +1350,7 @@ void TQDnsDomain::add( const TQString & label, TQDnsRR * rr ) TQDnsDomain * d = TQDnsManager::manager()->domain( label ); if ( !d->rrs ) { d->rrs = new TQPtrList<TQDnsRR>; - d->rrs->setAutoDelete( TRUE ); + d->rrs->setAutoDelete( true ); } d->rrs->append( rr ); rr->domain = d; @@ -1370,7 +1370,7 @@ TQPtrList<TQDnsRR> * TQDnsDomain::cached( const TQDns * r ) TQDnsRR *rrTmp = new TQDnsRR( r->label() ); rrTmp->t = TQDns::A; rrTmp->address = TQHostAddress( 0x7f000001 ); - rrTmp->current = TRUE; + rrTmp->current = true; l->append( rrTmp ); return l; } @@ -1380,10 +1380,10 @@ TQPtrList<TQDnsRR> * TQDnsDomain::cached( const TQDns * r ) if ( tmp.isIPv4Address() ) { rrTmp->t = TQDns::A; rrTmp->address = tmp; - rrTmp->current = TRUE; + rrTmp->current = true; l->append( rrTmp ); } else { - rrTmp->nxdomain = TRUE; + rrTmp->nxdomain = true; } return l; } @@ -1395,10 +1395,10 @@ TQPtrList<TQDnsRR> * TQDnsDomain::cached( const TQDns * r ) if ( tmp.isIPv6Address() ) { rrTmp->t = TQDns::Aaaa; rrTmp->address = tmp; - rrTmp->current = TRUE; + rrTmp->current = true; l->append( rrTmp ); } else { - rrTmp->nxdomain = TRUE; + rrTmp->nxdomain = true; } return l; } @@ -1413,7 +1413,7 @@ TQPtrList<TQDnsRR> * TQDnsDomain::cached( const TQDns * r ) int cnamecount = 0; while( it != end ) { TQString s = *it++; - nxdomain = FALSE; + nxdomain = false; #if defined(TQDNS_DEBUG) tqDebug( "looking at cache for %s (%s %d)", s.ascii(), r->label().ascii(), r->recordType() ); @@ -1425,7 +1425,7 @@ TQPtrList<TQDnsRR> * TQDnsDomain::cached( const TQDns * r ) if ( d->rrs ) d->rrs->first(); TQDnsRR * rr; - bool answer = FALSE; + bool answer = false; while( d->rrs && (rr=d->rrs->current()) != 0 ) { if ( rr->t == TQDns::Cname && r->recordType() != TQDns::Cname && !rr->nxdomain && cnamecount < 16 ) { @@ -1448,9 +1448,9 @@ TQPtrList<TQDnsRR> * TQDnsDomain::cached( const TQDns * r ) } else { if ( rr->t == r->recordType() ) { if ( rr->nxdomain ) - nxdomain = TRUE; + nxdomain = true; else - answer = TRUE; + answer = true; l->append( rr ); if ( rr->deleteTime <= lastSweep ) { // we're returning something that'll be @@ -1551,7 +1551,7 @@ void TQDnsDomain::sweep( TQ_UINT32 thisSweep ) rr->expireTime, rr->deleteTime, rr->target.latin1(), rr->address.toString().latin1()); #endif - if ( rr->current == FALSE || + if ( rr->current == false || rr->t == TQDns::None || rr->deleteTime <= thisSweep || rr->expireTime <= thisSweep ) @@ -1746,7 +1746,7 @@ TQDns::~TQDns() void TQDns::setLabel( const TQString & label ) { l = label; - d->noNames = FALSE; + d->noNames = false; // construct a list of qualified names n.clear(); @@ -1877,7 +1877,7 @@ void TQDns::setLabel( const TQHostAddress & address ) void TQDns::setRecordType( RecordType rr ) { t = rr; - d->noNames = FALSE; + d->noNames = false; setStartQueryTimer(); // start query the next time we enter event loop } @@ -1910,7 +1910,7 @@ void TQDns::setStartQueryTimer() d->queryTimer = new TQTimer( this ); connect( d->queryTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(startQuery()) ); - d->queryTimer->start( 0, TRUE ); + d->queryTimer->start( 0, true ); } } @@ -1962,11 +1962,11 @@ TQString TQDns::toInAddrArpaDomain( const TQHostAddress &address ) */ /*! - Returns TRUE if TQDns is doing a lookup for this object (i.e. if it + Returns true if TQDns is doing a lookup for this object (i.e. if it does not already have the necessary information); otherwise - returns FALSE. + returns false. - TQDns emits the resultsReady() signal when the status changes to FALSE. + TQDns emits the resultsReady() signal when the status changes to false. */ bool TQDns::isWorking() const @@ -1975,11 +1975,11 @@ bool TQDns::isWorking() const tqDebug( "TQDns::isWorking (%s, %d)", l.ascii(), t ); #endif if ( t == None ) - return FALSE; + return false; #if defined(Q_DNS_SYNCHRONOUS) if ( d->noEventLoop ) - return TRUE; + return true; #endif TQPtrList<TQDnsRR> * ll = TQDnsDomain::cached( this ); @@ -1989,17 +1989,17 @@ bool TQDns::isWorking() const queries--; } else { delete ll; - return FALSE; + return false; } ll->next(); } delete ll; if ( queries <= 0 ) - return FALSE; + return false; if ( d->noNames ) - return FALSE; - return TRUE; + return false; + return true; } @@ -2392,13 +2392,13 @@ void TQDns::doResInit() if ( ns ) delete ns; ns = new TQPtrList<TQHostAddress>; - ns->setAutoDelete( TRUE ); - domains = new TQStrList( TRUE ); - domains->setAutoDelete( TRUE ); + ns->setAutoDelete( true ); + domains = new TQStrList( true ); + domains->setAutoDelete( true ); TQString domainName, nameServer, searchList; - bool gotNetworkParams = FALSE; + bool gotNetworkParams = false; // try the API call GetNetworkParams() first and use registry lookup only // as a fallback #ifdef Q_OS_TEMP @@ -2431,7 +2431,7 @@ void TQDns::doResInit() } searchList = ""; separator = ' '; - gotNetworkParams = TRUE; + gotNetworkParams = true; } delete[] finfo; } @@ -2551,9 +2551,9 @@ void TQDns::doResInit() if ( ns ) return; ns = new TQPtrList<TQHostAddress>; - ns->setAutoDelete( TRUE ); - domains = new TQStrList( TRUE ); - domains->setAutoDelete( TRUE ); + ns->setAutoDelete( true ); + domains = new TQStrList( true ); + domains->setAutoDelete( true ); // read resolv.conf manually. TQFile resolvConf("/etc/resolv.conf"); @@ -2659,7 +2659,7 @@ void TQDns::doResInit() TQHostAddress a; a.setAddress( ip ); if ( ( a.isIPv4Address() || a.isIPv6Address() ) && !a.isNull() ) { - bool first = TRUE; + bool first = true; line = line.mid( n+1 ); n = 0; while( n < line.length() && !line[(int)n].isSpace() ) @@ -2675,15 +2675,15 @@ void TQDns::doResInit() rr->address = a; rr->deleteTime = UINT_MAX; rr->expireTime = UINT_MAX; - rr->current = TRUE; + rr->current = true; if ( first ) { - first = FALSE; + first = false; TQDnsRR * ptr = new TQDnsRR( TQDns::toInAddrArpaDomain( a ) ); ptr->t = TQDns::Ptr; ptr->target = hostname; ptr->deleteTime = UINT_MAX; ptr->expireTime = UINT_MAX; - ptr->current = TRUE; + ptr->current = true; } } } diff --git a/src/network/tqftp.cpp b/src/network/tqftp.cpp index 8c7dbb184..93bdfc6fb 100644 --- a/src/network/tqftp.cpp +++ b/src/network/tqftp.cpp @@ -136,7 +136,7 @@ private slots: private: void clearData() { - is_ba = FALSE; + is_ba = false; data.dev = 0; } @@ -147,7 +147,7 @@ private: int bytesTotal; bool callWriteData; - // If is_ba is TRUE, ba is used; ba is never 0. + // If is_ba is true, ba is used; ba is never 0. // Otherwise dev is used; dev can be 0 or not. union { TQByteArray *ba; @@ -244,7 +244,7 @@ public: TQFtp::Command command; TQStringList rawCmds; - // If is_ba is TRUE, ba is used; ba is never 0. + // If is_ba is true, ba is used; ba is never 0. // Otherwise dev is used; dev can be 0 or not. union { TQByteArray *ba; @@ -258,21 +258,21 @@ public: int TQFtpCommand::idCounter = 0; TQFtpCommand::TQFtpCommand( TQFtp::Command cmd, TQStringList raw ) - : command(cmd), rawCmds(raw), is_ba(FALSE) + : command(cmd), rawCmds(raw), is_ba(false) { id = ++idCounter; data.dev = 0; } TQFtpCommand::TQFtpCommand( TQFtp::Command cmd, TQStringList raw, const TQByteArray &ba ) - : command(cmd), rawCmds(raw), is_ba(TRUE) + : command(cmd), rawCmds(raw), is_ba(true) { id = ++idCounter; data.ba = new TQByteArray( ba ); } TQFtpCommand::TQFtpCommand( TQFtp::Command cmd, TQStringList raw, TQIODevice *dev ) - : command(cmd), rawCmds(raw), is_ba(FALSE) + : command(cmd), rawCmds(raw), is_ba(false) { id = ++idCounter; data.dev = dev; @@ -293,7 +293,7 @@ TQFtpDTP::TQFtpDTP( TQFtpPI *p, TQObject *parent, const char *name ) : TQObject( parent, name ), socket( 0, "TQFtpDTP_socket" ), pi( p ), - callWriteData( FALSE ) + callWriteData( false ) { clearData(); @@ -311,13 +311,13 @@ TQFtpDTP::TQFtpDTP( TQFtpPI *p, TQObject *parent, const char *name ) : void TQFtpDTP::setData( TQByteArray *ba ) { - is_ba = TRUE; + is_ba = true; data.ba = ba; } void TQFtpDTP::setDevice( TQIODevice *dev ) { - is_ba = FALSE; + is_ba = false; data.dev = dev; } @@ -334,7 +334,7 @@ void TQFtpDTP::writeData() socket.close(); clearData(); } else if ( data.dev ) { - callWriteData = FALSE; + callWriteData = false; const int blockSize = 16*1024; char buf[blockSize]; while ( !data.dev->atEnd() && socket.bytesToWrite()==0 ) { @@ -352,7 +352,7 @@ void TQFtpDTP::writeData() socket.close(); clearData(); } else { - callWriteData = TRUE; + callWriteData = true; } } } @@ -377,7 +377,7 @@ void TQFtpDTP::abortConnection() #if defined(TQFTPDTP_DEBUG) tqDebug( "TQFtpDTP::abortConnection" ); #endif - callWriteData = FALSE; + callWriteData = false; clearData(); socket.clearPendingData(); @@ -389,7 +389,7 @@ bool TQFtpDTP::parseDir( const TQString &buffer, const TQString &userName, TQUrl TQStringList lst = TQStringList::split( " ", buffer ); if ( lst.count() < 9 ) - return FALSE; + return false; TQString tmp; @@ -397,19 +397,19 @@ bool TQFtpDTP::parseDir( const TQString &buffer, const TQString &userName, TQUrl tmp = lst[ 0 ]; if ( tmp[ 0 ] == TQChar( 'd' ) ) { - info->setDir( TRUE ); - info->setFile( FALSE ); - info->setSymLink( FALSE ); + info->setDir( true ); + info->setFile( false ); + info->setSymLink( false ); } else if ( tmp[ 0 ] == TQChar( '-' ) ) { - info->setDir( FALSE ); - info->setFile( TRUE ); - info->setSymLink( FALSE ); + info->setDir( false ); + info->setFile( true ); + info->setSymLink( false ); } else if ( tmp[ 0 ] == TQChar( 'l' ) ) { - info->setDir( TRUE ); // #### todo - info->setFile( FALSE ); - info->setSymLink( TRUE ); + info->setDir( true ); // #### todo + info->setFile( false ); + info->setSymLink( true ); } else { - return FALSE; + return false; } static int user = 0; @@ -510,7 +510,7 @@ bool TQFtpDTP::parseDir( const TQString &buffer, const TQString &userName, TQUrl n = n.stripWhiteSpace(); info->setName( n ); } - return TRUE; + return true; } void TQFtpDTP::socketConnected() @@ -627,13 +627,13 @@ void TQFtpDTP::socketBytesWritten( int bytes ) *********************************************************************/ TQFtpPI::TQFtpPI( TQObject *parent ) : TQObject( parent ), - rawCommand(FALSE), + rawCommand(false), dtp( this ), commandSocket( 0, "TQFtpPI_socket" ), state( Begin ), abortState( None ), currentCmd( TQString::null ), - waitForDtpToConnect( FALSE ), - waitForDtpToClose( FALSE ) + waitForDtpToConnect( false ), + waitForDtpToClose( false ) { connect( &commandSocket, TQ_SIGNAL(hostFound()), TQ_SLOT(hostFound()) ); @@ -663,22 +663,22 @@ void TQFtpPI::connectToHost( const TQString &host, TQ_UINT16 port ) are all done the finished() signal is emitted. When an error occurs, the error() signal is emitted. - If there are pending commands in the queue this functions returns FALSE and - the \a cmds are not added to the queue; otherwise it returns TRUE. + If there are pending commands in the queue this functions returns false and + the \a cmds are not added to the queue; otherwise it returns true. */ bool TQFtpPI::sendCommands( const TQStringList &cmds ) { if ( !pendingCommands.isEmpty() ) - return FALSE; + return false; if ( commandSocket.state()!=TQSocket::Connected || state!=Idle ) { emit error( TQFtp::NotConnected, TQFtp::tr( "Not connected" ) ); - return TRUE; // there are no pending commands + return true; // there are no pending commands } pendingCommands = cmds; startNextCmd(); - return TRUE; + return true; } void TQFtpPI::clearPendingCommands() @@ -799,7 +799,7 @@ void TQFtpPI::readyRead() /* Process a reply from the FTP server. - Returns TRUE if the reply was processed or FALSE if the reply has to be + Returns true if the reply was processed or false if the reply has to be processed at a later point. */ bool TQFtpPI::processReply() @@ -816,8 +816,8 @@ bool TQFtpPI::processReply() // connection is really closed to avoid short reads of the DTP if ( 100*replyCode[0]+10*replyCode[1]+replyCode[2] == 226 ) { if ( dtp.socketState() != TQSocket::Idle ) { - waitForDtpToClose = TRUE; - return FALSE; + waitForDtpToClose = true; + return false; } } @@ -827,7 +827,7 @@ bool TQFtpPI::processReply() break; case WaitForAbortToFinish: abortState = None; - return TRUE; + return true; default: break; } @@ -840,14 +840,14 @@ bool TQFtpPI::processReply() switch ( state ) { case Begin: if ( replyCode[0] == 1 ) { - return TRUE; + return true; } else if ( replyCode[0] == 2 ) { state = Idle; emit finished( TQFtp::tr( "Connected to host %1" ).arg( commandSocket.peerName() ) ); break; } // ### error handling - return TRUE; + return true; case Waiting: if ( replyCode[0]<0 || replyCode[0]>5 ) state = Failure; @@ -856,7 +856,7 @@ bool TQFtpPI::processReply() break; default: // ### spontaneous message - return TRUE; + return true; } #if defined(TQFTPPI_DEBUG) // tqDebug( "TQFtpPI state: %d [processReply() intermediate]", state ); @@ -866,7 +866,7 @@ bool TQFtpPI::processReply() int replyCodeInt = 100*replyCode[0] + 10*replyCode[1] + replyCode[2]; emit rawFtpReply( replyCodeInt, replyText ); if ( rawCommand ) { - rawCommand = FALSE; + rawCommand = false; } else if ( replyCodeInt == 227 ) { // 227 Entering Passive Mode (h1,h2,h3,h4,p1,p2) // rfc959 does not define this response precisely, and gives @@ -883,7 +883,7 @@ bool TQFtpPI::processReply() TQStringList lst = addrPortPattern.capturedTexts(); TQString host = lst[1] + "." + lst[2] + "." + lst[3] + "." + lst[4]; TQ_UINT16 port = ( lst[5].toUInt() << 8 ) + lst[6].toUInt(); - waitForDtpToConnect = TRUE; + waitForDtpToConnect = true; dtp.connectToHost( host, port ); } } else if ( replyCodeInt == 230 ) { @@ -930,7 +930,7 @@ bool TQFtpPI::processReply() #if defined(TQFTPPI_DEBUG) // tqDebug( "TQFtpPI state: %d [processReply() end]", state ); #endif - return TRUE; + return true; } #ifndef TQT_NO_TEXTCODEC @@ -938,14 +938,14 @@ TQM_EXPORT_FTP TQTextCodec *tqt_ftp_filename_codec = 0; #endif /* - Starts next pending command. Returns FALSE if there are no pending commands, - otherwise it returns TRUE. + Starts next pending command. Returns false if there are no pending commands, + otherwise it returns true. */ bool TQFtpPI::startNextCmd() { if ( waitForDtpToConnect ) // don't process any new commands until we are connected - return TRUE; + return true; #if defined(TQFTPPI_DEBUG) if ( state != Idle ) @@ -954,7 +954,7 @@ bool TQFtpPI::startNextCmd() if ( pendingCommands.isEmpty() ) { currentCmd = TQString::null; emit finished( replyText ); - return FALSE; + return false; } currentCmd = pendingCommands.first(); pendingCommands.pop_front(); @@ -972,7 +972,7 @@ bool TQFtpPI::startNextCmd() { commandSocket.writeBlock( currentCmd.latin1(), currentCmd.length() ); } - return TRUE; + return true; } void TQFtpPI::dtpConnectState( int s ) @@ -986,11 +986,11 @@ void TQFtpPI::dtpConnectState( int s ) else return; } - waitForDtpToClose = FALSE; + waitForDtpToClose = false; readyRead(); return; case TQFtpDTP::CsConnected: - waitForDtpToConnect = FALSE; + waitForDtpToConnect = false; startNextCmd(); return; case TQFtpDTP::CsHostNotFound: @@ -1013,11 +1013,11 @@ class TQFtpPrivate { public: TQFtpPrivate() : - close_waitForStateChange(FALSE), + close_waitForStateChange(false), state( TQFtp::Unconnected ), error( TQFtp::NoError ), - npWaitForLoginDone( FALSE ) - { pending.setAutoDelete( TRUE ); } + npWaitForLoginDone( false ) + { pending.setAutoDelete( true ); } TQFtpPI pi; TQPtrList<TQFtpCommand> pending; @@ -1039,7 +1039,7 @@ static TQFtpPrivate* d( const TQFtp* foo ) { if ( !d_ptr ) { d_ptr = new TQPtrDict<TQFtpPrivate>; - d_ptr->setAutoDelete( TRUE ); + d_ptr->setAutoDelete( true ); tqAddPostRoutine( cleanup_d_ptr ); } TQFtpPrivate* ret = d_ptr->find( (void*)foo ); @@ -1158,14 +1158,14 @@ static void delete_d( const TQFtp* foo ) stateChanged( HostLookup ) stateChanged( Connecting ) stateChanged( Connected ) - finished( 1, FALSE ) + finished( 1, false ) start( 2 ) stateChanged( LoggedIn ) - finished( 2, FALSE ) + finished( 2, false ) start( 3 ) - finished( 3, FALSE ) + finished( 3, false ) start( 4 ) dataTransferProgress( 0, 3798 ) @@ -1173,14 +1173,14 @@ static void delete_d( const TQFtp* foo ) readyRead() dataTransferProgress( 3798, 3798 ) readyRead() - finished( 4, FALSE ) + finished( 4, false ) start( 5 ) stateChanged( Closing ) stateChanged( Unconnected ) - finished( 5, FALSE ) + finished( 5, false ) - done( FALSE ) + done( false ) \endcode The dataTransferProgress() signal in the above example is useful @@ -1199,12 +1199,12 @@ static void delete_d( const TQFtp* foo ) stateChanged( HostLookup ) stateChanged( Connecting ) stateChanged( Connected ) - finished( 1, FALSE ) + finished( 1, false ) start( 2 ) - finished( 2, TRUE ) + finished( 2, true ) - done( TRUE ) + done( true ) \endcode You can then get details about the error with the error() and @@ -1361,8 +1361,8 @@ void TQFtp::init() \fn void TQFtp::commandFinished( int id, bool error ) This signal is emitted when processing the command identified by - \a id has finished. \a error is TRUE if an error occurred during - the processing; otherwise \a error is FALSE. + \a id has finished. \a error is true if an error occurred during + the processing; otherwise \a error is false. \sa commandStarted() done() error() errorString() */ @@ -1372,8 +1372,8 @@ void TQFtp::init() This signal is emitted when the last pending command has finished; (it is emitted after the last command's commandFinished() signal). - \a error is TRUE if an error occurred during the processing; - otherwise \a error is FALSE. + \a error is true if an error occurred during the processing; + otherwise \a error is false. \sa commandFinished() error() errorString() */ @@ -1797,11 +1797,11 @@ TQByteArray TQFtp::readAll() commandFinished() signal has not been emitted), this function sends an \c ABORT command to the server. When the server replies that the command is aborted, the commandFinished() signal with the - \c error argument set to \c TRUE is emitted for the command. Due + \c error argument set to \c true is emitted for the command. Due to timing issues, it is possible that the command had already finished before the abort request reached the server, in which case, the commandFinished() signal is emitted with the \c error - argument set to \c FALSE. + argument set to \c false. For all other commands that are affected by the abort(), no signals are emitted. @@ -1813,7 +1813,7 @@ TQByteArray TQFtp::readAll() \warning Some FTP servers, for example the BSD FTP daemon (version 0.3), wrongly return a positive reply even when an abort has occurred. For these servers the commandFinished() signal has its - error flag set to \c FALSE, even though the command did not + error flag set to \c false, even though the command did not complete successfully. \sa clearPendingCommands() @@ -1880,8 +1880,8 @@ TQIODevice* TQFtp::currentDevice() const } /*! - Returns TRUE if there are any commands scheduled that have not yet - been executed; otherwise returns FALSE. + Returns true if there are any commands scheduled that have not yet + been executed; otherwise returns false. The command that is being executed is \e not considered as a scheduled command. @@ -1927,7 +1927,7 @@ TQFtp::State TQFtp::state() const /*! Returns the last error that occurred. This is useful to find out what when wrong when receiving a commandFinished() or a done() - signal with the \c error argument set to \c TRUE. + signal with the \c error argument set to \c true. If you start a new command, the error status is reset to \c NoError. */ @@ -1941,7 +1941,7 @@ TQFtp::Error TQFtp::error() const Returns a human-readable description of the last error that occurred. This is useful for presenting a error message to the user when receiving a commandFinished() or a done() signal with - the \c error argument set to \c TRUE. + the \c error argument set to \c true. The error string is often (but not always) the reply from the server, so it is not always possible to translate the string. If @@ -2022,15 +2022,15 @@ void TQFtp::piFinished( const TQString& ) // don't get the commandFinished() signal before the stateChanged() // signal. if ( d->state != TQFtp::Unconnected ) { - d->close_waitForStateChange = TRUE; + d->close_waitForStateChange = true; return; } } - emit commandFinished( c->id, FALSE ); + emit commandFinished( c->id, false ); d->pending.removeFirst(); if ( d->pending.isEmpty() ) { - emit done( FALSE ); + emit done( false ); } else { startNextCommand(); } @@ -2085,11 +2085,11 @@ void TQFtp::piError( int errorCode, const TQString &text ) d->pi.clearPendingCommands(); clearPendingCommands(); - emit commandFinished( c->id, TRUE ); + emit commandFinished( c->id, true ); d->pending.removeFirst(); if ( d->pending.isEmpty() ) - emit done( TRUE ); + emit done( true ); else startNextCommand(); } @@ -2100,7 +2100,7 @@ void TQFtp::piConnectState( int state ) d->state = (State)state; emit stateChanged( d->state ); if ( d->close_waitForStateChange ) { - d->close_waitForStateChange = FALSE; + d->close_waitForStateChange = false; piFinished( tr( "Connection closed" ) ); } } @@ -2109,7 +2109,7 @@ void TQFtp::piFtpReply( int code, const TQString &text ) { if ( currentCommand() == RawCommand ) { TQFtpPrivate *d = ::d( this ); - d->pi.rawCommand = TRUE; + d->pi.rawCommand = true; emit rawCommandReply( code, text ); } } @@ -2206,7 +2206,7 @@ bool TQFtp::checkConnection( TQNetworkOperation *op ) connect( this, TQ_SIGNAL(readyRead()), this, TQ_SLOT(npReadyRead()) ); - d->npWaitForLoginDone = TRUE; + d->npWaitForLoginDone = true; switch ( op->operation() ) { case OpGet: case OpPut: @@ -2225,8 +2225,8 @@ bool TQFtp::checkConnection( TQNetworkOperation *op ) } if ( state() == LoggedIn ) - return TRUE; - return FALSE; + return true; + return false; } /*! \reimp @@ -2249,7 +2249,7 @@ void TQFtp::parseDir( const TQString &buffer, TQUrlInfo &info ) void TQFtp::npListInfo( const TQUrlInfo & i ) { if ( url() ) { - TQRegExp filt( url()->nameFilter(), FALSE, TRUE ); + TQRegExp filt( url()->nameFilter(), false, true ); if ( i.isDir() || filt.search( i.name() ) != -1 ) { emit newChild( i, operationInProgress() ); } @@ -2262,7 +2262,7 @@ void TQFtp::npDone( bool err ) { TQFtpPrivate *d = ::d( this ); - bool emitFinishedSignal = FALSE; + bool emitFinishedSignal = false; TQNetworkOperation *op = operationInProgress(); if ( op ) { if ( err ) { @@ -2292,7 +2292,7 @@ void TQFtp::npDone( bool err ) break; } } - emitFinishedSignal = TRUE; + emitFinishedSignal = true; } else if ( !d->npWaitForLoginDone ) { switch ( op->operation() ) { case OpRemove: @@ -2301,7 +2301,7 @@ void TQFtp::npDone( bool err ) case OpMkDir: { TQUrlInfo inf( op->arg( 0 ), 0, "", "", 0, TQDateTime(), - TQDateTime(), TRUE, FALSE, FALSE, TRUE, TRUE, TRUE ); + TQDateTime(), true, false, false, true, true, true ); emit newChild( inf, op ); emit createdDirectory( inf, op ); } @@ -2313,10 +2313,10 @@ void TQFtp::npDone( bool err ) break; } op->setState( StDone ); - emitFinishedSignal = TRUE; + emitFinishedSignal = true; } } - d->npWaitForLoginDone = FALSE; + d->npWaitForLoginDone = false; if ( state() == Unconnected ) { disconnect( this, TQ_SIGNAL(listInfo(const TQUrlInfo&)), diff --git a/src/network/tqhostaddress.cpp b/src/network/tqhostaddress.cpp index 07d08c492..766ca006f 100644 --- a/src/network/tqhostaddress.cpp +++ b/src/network/tqhostaddress.cpp @@ -45,7 +45,7 @@ class TQHostAddressPrivate { public: - TQHostAddressPrivate( TQ_UINT32 a_=0 ) : a(a_), isIp4(TRUE) + TQHostAddressPrivate( TQ_UINT32 a_=0 ) : a(a_), isIp4(true) { } TQHostAddressPrivate( TQ_UINT8 *a_ ); @@ -70,14 +70,14 @@ private: friend class TQHostAddress; }; -TQHostAddressPrivate::TQHostAddressPrivate(TQ_UINT8 *a_) : a(0), isIp4(FALSE) +TQHostAddressPrivate::TQHostAddressPrivate(TQ_UINT8 *a_) : a(0), isIp4(false) { for ( int i=0; i<16; i++ ) { a6.c[i] = a_[i]; } } -TQHostAddressPrivate::TQHostAddressPrivate(const Q_IPV6ADDR &a_) : a(0), isIp4(FALSE) +TQHostAddressPrivate::TQHostAddressPrivate(const Q_IPV6ADDR &a_) : a(0), isIp4(false) { a6 = a_; } @@ -212,31 +212,31 @@ void TQHostAddress::setAddress( TQ_UINT8 *ip6Addr ) #ifndef TQT_NO_STRINGLIST static bool parseIp4(const TQString& address, TQ_UINT32 *addr) { - TQStringList ipv4 = TQStringList::split(".", address, FALSE); + TQStringList ipv4 = TQStringList::split(".", address, false); if (ipv4.count() == 4) { int i = 0; - bool ok = TRUE; + bool ok = true; while(ok && i < 4) { uint byteValue = ipv4[i].toUInt(&ok); if (byteValue > 255) - ok = FALSE; + ok = false; if (ok) *addr = (*addr << 8) + byteValue; ++i; } if (ok) - return TRUE; + return true; } - return FALSE; + return false; } /*! \overload Sets the IPv4 or IPv6 address specified by the string - representation \a address (e.g. "127.0.0.1"). Returns TRUE and + representation \a address (e.g. "127.0.0.1"). Returns true and sets the address if the address was successfully parsed; otherwise - returns FALSE and leaves the address unchanged. + returns false and leaves the address unchanged. */ bool TQHostAddress::setAddress(const TQString& address) { @@ -246,46 +246,46 @@ bool TQHostAddress::setAddress(const TQString& address) TQ_UINT32 maybeIp4 = 0; if (parseIp4(address, &maybeIp4)) { setAddress(maybeIp4); - return TRUE; + return true; } // try ipv6 - TQStringList ipv6 = TQStringList::split(":", a, TRUE); + TQStringList ipv6 = TQStringList::split(":", a, true); int count = (int)ipv6.count(); if (count < 3) - return FALSE; // there must be at least two ":" + return false; // there must be at least two ":" if (count > 8) - return FALSE; // maximum of seven ":" exceeded + return false; // maximum of seven ":" exceeded TQ_UINT8 maybeIp6[16]; int mc = 16; int fillCount = 9 - count; for (int i=count-1; i>=0; --i) { if ( mc <= 0 ) - return FALSE; + return false; if (ipv6[i].isEmpty()) { if (i==count-1) { // special case: ":" is last character if (!ipv6[i-1].isEmpty()) - return FALSE; + return false; maybeIp6[--mc] = 0; maybeIp6[--mc] = 0; } else if (i==0) { // special case: ":" is first character if (!ipv6[i+1].isEmpty()) - return FALSE; + return false; maybeIp6[--mc] = 0; maybeIp6[--mc] = 0; } else { for (int j=0; j<fillCount; ++j) { if ( mc <= 0 ) - return FALSE; + return false; maybeIp6[--mc] = 0; maybeIp6[--mc] = 0; } } } else { - bool ok = FALSE; + bool ok = false; uint byteValue = ipv6[i].toUInt(&ok, 16); if (ok && byteValue <= 0xffff) { maybeIp6[--mc] = byteValue & 0xff; @@ -294,24 +294,24 @@ bool TQHostAddress::setAddress(const TQString& address) if (i == count-1) { // parse the ipv4 part of a mixed type if (!parseIp4(ipv6[i], &maybeIp4)) - return FALSE; + return false; maybeIp6[--mc] = maybeIp4 & 0xff; maybeIp6[--mc] = (maybeIp4 >> 8) & 0xff; maybeIp6[--mc] = (maybeIp4 >> 16) & 0xff; maybeIp6[--mc] = (maybeIp4 >> 24) & 0xff; --fillCount; } else { - return FALSE; + return false; } } } } if (mc == 0) { setAddress(maybeIp6); - return TRUE; + return true; } - return FALSE; + return false; } #endif @@ -326,8 +326,8 @@ bool TQHostAddress::isIp4Addr() const } /*! - Returns TRUE if the host address represents an IPv4 address; - otherwise returns FALSE. + Returns true if the host address represents an IPv4 address; + otherwise returns false. */ bool TQHostAddress::isIPv4Address() const { @@ -350,7 +350,7 @@ TQ_UINT32 TQHostAddress::ip4Addr() const For example, if the address is 127.0.0.1, the returned value is 2130706433 (i.e. 0x7f000001). - This value is only valid when isIp4Addr() returns TRUE. + This value is only valid when isIp4Addr() returns true. \sa toString() */ @@ -360,8 +360,8 @@ TQ_UINT32 TQHostAddress::toIPv4Address() const } /*! - Returns TRUE if the host address represents an IPv6 address; - otherwise returns FALSE. + Returns true if the host address represents an IPv6 address; + otherwise returns false. */ bool TQHostAddress::isIPv6Address() const { @@ -381,7 +381,7 @@ bool TQHostAddress::isIPv6Address() const } \endcode - This value is only valid when isIPv6Address() returns TRUE. + This value is only valid when isIPv6Address() returns true. \sa toString() */ @@ -424,8 +424,8 @@ TQString TQHostAddress::toString() const /*! - Returns TRUE if this host address is the same as \a other; - otherwise returns FALSE. + Returns true if this host address is the same as \a other; + otherwise returns false. */ bool TQHostAddress::operator==( const TQHostAddress & other ) const { @@ -434,7 +434,7 @@ bool TQHostAddress::operator==( const TQHostAddress & other ) const /*! - Returns TRUE if this host address is null (INADDR_ANY or in6addr_any). The + Returns true if this host address is null (INADDR_ANY or in6addr_any). The default constructor creates a null address, and that address isn't valid for any particular host or interface. */ @@ -445,9 +445,9 @@ bool TQHostAddress::isNull() const int i = 0; while( i < 16 ) { if ( d->a6.c[i++] != 0 ) - return FALSE; + return false; } - return TRUE; + return true; } #endif //TQT_NO_NETWORK diff --git a/src/network/tqhttp.cpp b/src/network/tqhttp.cpp index 389a731c7..bea20e42b 100644 --- a/src/network/tqhttp.cpp +++ b/src/network/tqhttp.cpp @@ -69,7 +69,7 @@ public: chunkedSize( -1 ), idleTimer( 0 ) { - pending.setAutoDelete( TRUE ); + pending.setAutoDelete( true ); } TQSocket socket; @@ -128,7 +128,7 @@ int TQHttpRequest::idCounter = 0; bool TQHttpRequest::hasRequestHeader() { - return FALSE; + return false; } TQHttpRequestHeader TQHttpRequest::requestHeader() @@ -148,14 +148,14 @@ public: TQHttpNormalRequest( const TQHttpRequestHeader &h, TQIODevice *d, TQIODevice *t ) : header(h), to(t) { - is_ba = FALSE; + is_ba = false; data.dev = d; } TQHttpNormalRequest( const TQHttpRequestHeader &h, TQByteArray *d, TQIODevice *t ) : header(h), to(t) { - is_ba = TRUE; + is_ba = true; data.ba = d; } @@ -216,7 +216,7 @@ void TQHttpNormalRequest::start( TQHttp *http ) bool TQHttpNormalRequest::hasRequestHeader() { - return TRUE; + return true; } TQHttpRequestHeader TQHttpNormalRequest::requestHeader() @@ -389,7 +389,7 @@ void TQHttpCloseRequest::start( TQHttp *http ) Constructs an empty HTTP header. */ TQHttpHeader::TQHttpHeader() - : valid( TRUE ) + : valid( true ) { } @@ -411,7 +411,7 @@ TQHttpHeader::TQHttpHeader( const TQHttpHeader& header ) key, colon, space, value. */ TQHttpHeader::TQHttpHeader( const TQString& str ) - : valid( TRUE ) + : valid( true ) { parse( str ); } @@ -434,7 +434,7 @@ TQHttpHeader& TQHttpHeader::operator=( const TQHttpHeader& h ) } /*! - Returns TRUE if the HTTP header is valid; otherwise returns FALSE. + Returns true if the HTTP header is valid; otherwise returns false. A TQHttpHeader is invalid if it was created by parsing a malformed string. */ @@ -448,7 +448,7 @@ bool TQHttpHeader::isValid() const the keys/values it finds. If the string is not parsed successfully the TQHttpHeader becomes \link isValid() invalid\endlink. - Returns TRUE if \a str was successfully parsed; otherwise returns FALSE. + Returns true if \a str was successfully parsed; otherwise returns false. \sa toString() */ @@ -457,12 +457,12 @@ bool TQHttpHeader::parse( const TQString& str ) TQStringList lst; int pos = str.find( '\n' ); if ( pos > 0 && str.at( pos - 1 ) == '\r' ) - lst = TQStringList::split( "\r\n", str.stripWhiteSpace(), FALSE ); + lst = TQStringList::split( "\r\n", str.stripWhiteSpace(), false ); else - lst = TQStringList::split( "\n", str.stripWhiteSpace(), FALSE ); + lst = TQStringList::split( "\n", str.stripWhiteSpace(), false ); if ( lst.isEmpty() ) - return TRUE; + return true; TQStringList lines; TQStringList::Iterator it = lst.begin(); @@ -483,11 +483,11 @@ bool TQHttpHeader::parse( const TQString& str ) it = lines.begin(); for( ; it != lines.end(); ++it ) { if ( !parseLine( *it, number++ ) ) { - valid = FALSE; - return FALSE; + valid = false; + return false; } } - return TRUE; + return true; } /*! \internal @@ -519,8 +519,8 @@ TQStringList TQHttpHeader::keys() const } /*! - Returns TRUE if the HTTP header has an entry with the given \a - key; otherwise returns FALSE. + Returns true if the HTTP header has an entry with the given \a + key; otherwise returns false. \sa value() setValue() keys() */ @@ -557,8 +557,8 @@ void TQHttpHeader::removeValue( const TQString& key ) /*! \internal Parses the single HTTP header line \a line which has the format key, colon, space, value, and adds key/value to the headers. The - linenumber is \a number. Returns TRUE if the line was successfully - parsed and the key/value added; otherwise returns FALSE. + linenumber is \a number. Returns true if the line was successfully + parsed and the key/value added; otherwise returns false. \sa parse() */ @@ -566,11 +566,11 @@ bool TQHttpHeader::parseLine( const TQString& line, int ) { int i = line.find( ":" ); if ( i == -1 ) - return FALSE; + return false; values.insert( line.left( i ).stripWhiteSpace().lower(), line.mid( i + 1 ).stripWhiteSpace() ); - return TRUE; + return true; } /*! @@ -595,8 +595,8 @@ TQString TQHttpHeader::toString() const } /*! - Returns TRUE if the header has an entry for the special HTTP - header field \c content-length; otherwise returns FALSE. + Returns true if the header has an entry for the special HTTP + header field \c content-length; otherwise returns false. \sa contentLength() setContentLength() */ @@ -628,8 +628,8 @@ void TQHttpHeader::setContentLength( int len ) } /*! - Returns TRUE if the header has an entry for the the special HTTP - header field \c content-type; otherwise returns FALSE. + Returns true if the header has an entry for the the special HTTP + header field \c content-type; otherwise returns false. \sa contentType() setContentType() */ @@ -701,7 +701,7 @@ void TQHttpHeader::setContentType( const TQString& type ) */ TQHttpResponseHeader::TQHttpResponseHeader() { - setValid( FALSE ); + setValid( false ); } /*! @@ -744,7 +744,7 @@ TQHttpResponseHeader::TQHttpResponseHeader( const TQString& str ) */ void TQHttpResponseHeader::setStatusLine( int code, const TQString& text, int majorVer, int minorVer ) { - setValid( TRUE ); + setValid( true ); statCode = code; reasonPhr = text; majVer = majorVer; @@ -800,7 +800,7 @@ bool TQHttpResponseHeader::parseLine( const TQString& line, int number ) TQString l = line.simplifyWhiteSpace(); if ( l.length() < 10 ) - return FALSE; + return false; if ( l.left( 5 ) == "HTTP/" && l[5].isDigit() && l[6] == '.' && l[7].isDigit() && l[8] == ' ' && l[9].isDigit() ) { @@ -816,10 +816,10 @@ bool TQHttpResponseHeader::parseLine( const TQString& line, int number ) reasonPhr = TQString::null; } } else { - return FALSE; + return false; } - return TRUE; + return true; } /*! \reimp @@ -878,7 +878,7 @@ TQString TQHttpResponseHeader::toString() const TQHttpRequestHeader::TQHttpRequestHeader() : TQHttpHeader() { - setValid( FALSE ); + setValid( false ); } /*! @@ -920,7 +920,7 @@ TQHttpRequestHeader::TQHttpRequestHeader( const TQString& str ) */ void TQHttpRequestHeader::setRequest( const TQString& method, const TQString& path, int majorVer, int minorVer ) { - setValid( TRUE ); + setValid( true ); m = method; p = path; majVer = majorVer; @@ -985,13 +985,13 @@ bool TQHttpRequestHeader::parseLine( const TQString& line, int number ) v[5].isDigit() && v[6] == '.' && v[7].isDigit() ) { majVer = v[5].latin1() - '0'; minVer = v[7].latin1() - '0'; - return TRUE; + return true; } } } } - return FALSE; + return false; } /*! \reimp @@ -1096,7 +1096,7 @@ TQString TQHttpRequestHeader::toString() const \code requestStarted( 1 ) - requestFinished( 1, FALSE ) + requestFinished( 1, false ) requestStarted( 2 ) stateChanged( Connecting ) @@ -1109,9 +1109,9 @@ TQString TQHttpRequestHeader::toString() const dataReadProgress( 18300, 0 ) readyRead( responseheader ) stateChanged( Connected ) - requestFinished( 2, FALSE ) + requestFinished( 2, false ) - done( FALSE ) + done( false ) stateChanged( Closing ) stateChanged( Unconnected ) @@ -1152,13 +1152,13 @@ TQString TQHttpRequestHeader::toString() const \code requestStarted( 1 ) - requestFinished( 1, FALSE ) + requestFinished( 1, false ) requestStarted( 2 ) stateChanged( HostLookup ) - requestFinished( 2, TRUE ) + requestFinished( 2, true ) - done( TRUE ) + done( true ) stateChanged( Unconnected ) \endcode @@ -1384,8 +1384,8 @@ TQHttp::~TQHttp() \fn void TQHttp::requestFinished( int id, bool error ) This signal is emitted when processing the request identified by - \a id has finished. \a error is TRUE if an error occurred during - the processing; otherwise \a error is FALSE. + \a id has finished. \a error is true if an error occurred during + the processing; otherwise \a error is false. \sa requestStarted() done() error() errorString() */ @@ -1395,8 +1395,8 @@ TQHttp::~TQHttp() This signal is emitted when the last pending request has finished; (it is emitted after the last request's requestFinished() signal). - \a error is TRUE if an error occurred during the processing; - otherwise \a error is FALSE. + \a error is true if an error occurred during the processing; + otherwise \a error is false. \sa requestFinished() error() errorString() */ @@ -1405,12 +1405,12 @@ TQHttp::~TQHttp() Aborts the current request and deletes all scheduled requests. For the current request, the requestFinished() signal with the \c - error argument \c TRUE is emitted. For all other requests that are + error argument \c true is emitted. For all other requests that are affected by the abort(), no signals are emitted. Since this slot also deletes the scheduled requests, there are no requests left and the done() signal is emitted (with the \c error - argument \c TRUE). + argument \c true). \sa clearPendingRequests() */ @@ -1497,7 +1497,7 @@ int TQHttp::currentId() const Returns the request header of the HTTP request being executed. If the request is one issued by setHost() or closeConnection(), it returns an invalid request header, i.e. - TQHttpRequestHeader::isValid() returns FALSE. + TQHttpRequestHeader::isValid() returns false. \sa currentId() */ @@ -1546,8 +1546,8 @@ TQIODevice* TQHttp::currentDestinationDevice() const } /*! - Returns TRUE if there are any requests scheduled that have not yet - been executed; otherwise returns FALSE. + Returns true if there are any requests scheduled that have not yet + been executed; otherwise returns false. The request that is being executed is \e not considered as a scheduled request. @@ -1825,10 +1825,10 @@ void TQHttp::finishedWithSuccess() if ( r == 0 ) return; - emit requestFinished( r->id, FALSE ); + emit requestFinished( r->id, false ); d->pending.removeFirst(); if ( d->pending.isEmpty() ) { - emit done( FALSE ); + emit done( false ); } else { startNextRequest(); } @@ -1842,10 +1842,10 @@ void TQHttp::finishedWithError( const TQString& detail, int errorCode ) d->error = (Error)errorCode; d->errorString = detail; - emit requestFinished( r->id, TRUE ); + emit requestFinished( r->id, true ); d->pending.clear(); - emit done( TRUE ); + emit done( true ); } void TQHttp::slotClosed() @@ -1944,19 +1944,19 @@ void TQHttp::slotReadyRead() if ( d->state != Reading ) { setState( Reading ); d->buffer = TQByteArray(); - d->readHeader = TRUE; + d->readHeader = true; d->headerStr = ""; d->bytesDone = 0; d->chunkedSize = -1; } while ( d->readHeader ) { - bool end = FALSE; + bool end = false; TQString tmp; while ( !end && d->socket.canReadLine() ) { tmp = d->socket.readLine(); if ( tmp == "\r\n" || tmp == "\n" ) - end = TRUE; + end = true; else d->headerStr += tmp; } @@ -1983,7 +1983,7 @@ void TQHttp::slotReadyRead() // POST method, we send both the request header and data in // one chunk. if (d->response.statusCode() != 100) { - d->readHeader = FALSE; + d->readHeader = false; if ( d->response.hasKey( "transfer-encoding" ) && d->response.value( "transfer-encoding" ).lower().contains( "chunked" ) ) d->chunkedSize = 0; @@ -1993,10 +1993,10 @@ void TQHttp::slotReadyRead() } if ( !d->readHeader ) { - bool everythingRead = FALSE; + bool everythingRead = false; if ( currentRequest().method() == "HEAD" ) { - everythingRead = TRUE; + everythingRead = true; } else { TQ_ULONG n = d->socket.bytesAvailable(); TQByteArray *arr = 0; @@ -2030,7 +2030,7 @@ void TQHttp::slotReadyRead() d->chunkedSize = -1; } if ( d->chunkedSize == -1 ) { - everythingRead = TRUE; + everythingRead = true; break; } @@ -2075,7 +2075,7 @@ void TQHttp::slotReadyRead() arr->resize( read ); } if ( d->bytesDone + bytesAvailable() + n == d->response.contentLength() ) - everythingRead = TRUE; + everythingRead = true; } else if ( n > 0 ) { // workaround for VC++ bug TQByteArray temp = d->socket.readAll(); @@ -2137,7 +2137,7 @@ TQHttp::State TQHttp::state() const /*! Returns the last error that occurred. This is useful to find out what happened when receiving a requestFinished() or a done() - signal with the \c error argument \c TRUE. + signal with the \c error argument \c true. If you start a new request, the error status is reset to \c NoError. */ @@ -2150,7 +2150,7 @@ TQHttp::Error TQHttp::error() const Returns a human-readable description of the last error that occurred. This is useful to present a error message to the user when receiving a requestFinished() or a done() signal with the \c - error argument \c TRUE. + error argument \c true. */ TQString TQHttp::errorString() const { diff --git a/src/network/tqserversocket.cpp b/src/network/tqserversocket.cpp index 456add216..d65eac0ad 100644 --- a/src/network/tqserversocket.cpp +++ b/src/network/tqserversocket.cpp @@ -147,7 +147,7 @@ TQServerSocket::TQServerSocket( TQObject *parent, const char *name ) /*! - Returns TRUE if the construction succeeded; otherwise returns FALSE. + Returns true if the construction succeeded; otherwise returns false. */ bool TQServerSocket::ok() const { @@ -166,7 +166,7 @@ void TQServerSocket::init( const TQHostAddress & address, TQ_UINT16 port, int ba // same address-port is in TIME_WAIT. Under Windows this is possible anyway // -- furthermore, the meaning of reusable is different: it means that you // can use the same address-port for multiple listening sockets. - d->s->setAddressReusable( TRUE ); + d->s->setAddressReusable( true ); #endif if ( d->s->bind( address, port ) && d->s->listen( backlog ) ) @@ -219,7 +219,7 @@ void TQServerSocket::incomingConnection( int ) /*! Returns the port number on which this server socket listens. This is always non-zero; if you specify 0 in the constructor, - TQServerSocket will pick a non-zero port itself. ok() must be TRUE + TQServerSocket will pick a non-zero port itself. ok() must be true before calling this function. \sa address() TQSocketDevice::port() @@ -245,7 +245,7 @@ int TQServerSocket::socket() const /*! Returns the address on which this object listens, or 0.0.0.0 if - this object listens on more than one address. ok() must be TRUE + this object listens on more than one address. ok() must be true before calling this function. \sa port() TQSocketDevice::address() 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; diff --git a/src/network/tqsocket.h b/src/network/tqsocket.h index 5af4a21ab..b6e050051 100644 --- a/src/network/tqsocket.h +++ b/src/network/tqsocket.h @@ -131,7 +131,7 @@ signals: void error( int ); protected slots: - virtual void sn_read( bool force=FALSE ); + virtual void sn_read( bool force=false ); virtual void sn_write(); private slots: diff --git a/src/network/tqsocketdevice.cpp b/src/network/tqsocketdevice.cpp index f82d1625f..8ae73f61a 100644 --- a/src/network/tqsocketdevice.cpp +++ b/src/network/tqsocketdevice.cpp @@ -237,7 +237,7 @@ TQSocketDevice::~TQSocketDevice() /*! - Returns TRUE if this is a valid socket; otherwise returns FALSE. + Returns true if this is a valid socket; otherwise returns false. \sa socket() */ @@ -333,13 +333,13 @@ void TQSocketDevice::setSocket( int socket, Type type ) bool TQSocketDevice::open( int mode ) { if ( isOpen() || !isValid() ) - return FALSE; + return false; #if defined(TQSOCKETDEVICE_DEBUG) tqDebug( "TQSocketDevice::open: mode %x", mode ); #endif setMode( mode & IO_ReadWrite ); setState( IO_Open ); - return TRUE; + return true; } @@ -381,19 +381,19 @@ TQIODevice::Offset TQSocketDevice::at() const \reimp The read/write index is meaningless for a socket, therefore this - function does nothing and returns TRUE. + function does nothing and returns true. */ bool TQSocketDevice::at( Offset ) { - return TRUE; + return true; } /*! \reimp - Returns TRUE if no data is currently available at the socket; - otherwise returns FALSE. + Returns true if no data is currently available at the socket; + otherwise returns false. */ bool TQSocketDevice::atEnd() const { @@ -445,8 +445,8 @@ int TQSocketDevice::ungetch( int ) /*! - Returns TRUE if the address of this socket can be used by other - sockets at the same time, and FALSE if this socket claims + Returns true if the address of this socket can be used by other + sockets at the same time, and false if this socket claims exclusive ownership. \sa setAddressReusable() @@ -459,8 +459,8 @@ bool TQSocketDevice::addressReusable() const /*! Sets the address of this socket to be usable by other sockets too - if \a enable is TRUE, and to be used exclusively by this socket if - \a enable is FALSE. + if \a enable is true, and to be used exclusively by this socket if + \a enable is false. When a socket is reusable, other sockets can use the same port number (and IP address), which is generally useful. Of course 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: |
