summaryrefslogtreecommitdiffstats
path: root/src/network/tqhostaddress.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/tqhostaddress.cpp')
-rw-r--r--src/network/tqhostaddress.cpp68
1 files changed, 34 insertions, 34 deletions
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