From ff419492931de3748936967da36948af7a04d7a0 Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 27 Jun 2011 17:52:36 +0000 Subject: TQt4 convert kmyfirewall This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmyfirewall@1238525 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kmyfirewall/core/ipaddress.cpp | 58 +++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'kmyfirewall/core/ipaddress.cpp') diff --git a/kmyfirewall/core/ipaddress.cpp b/kmyfirewall/core/ipaddress.cpp index c8dc147..453d94d 100644 --- a/kmyfirewall/core/ipaddress.cpp +++ b/kmyfirewall/core/ipaddress.cpp @@ -75,7 +75,7 @@ int IPAddress::operator==( const IPAddress& addr ) { } } if ( ident ) - return EQUAL; + return ETQUAL; if ( m_digits[ first_diff ] > addr.getDigit( first_diff ) ) return SMALLER; @@ -95,19 +95,19 @@ bool IPAddress::setAddress( int fi, int se, int th, int fo ) { return true; } -bool IPAddress::setAddress( const QString& input ) { - QString inp = input; +bool IPAddress::setAddress( const TQString& input ) { + TQString inp = input; m_checkInput->checkInput( inp, "IP", m_err ); if ( m_err->errType() != KMFError::OK ) { kdDebug() << "WARNING: Given wron IP address string: " << inp << endl; return false; } int pos; - QString str_num; + TQString str_num; bool valid = true; int counter = 0; while ( !inp.isEmpty() ) { - pos = inp.find( "." ); + pos = inp.tqfind( "." ); if ( pos > -1 ) { str_num = inp.left( pos ); // kdDebug() << "IP Num Part: " << str_num << endl; @@ -141,18 +141,18 @@ bool IPAddress::setAddress( const QString& input ) { return true; } -const QString& IPAddress::toString() const { - QString fi = ""; - QString se = ""; - QString th = ""; - QString fo = ""; - return *( new QString( fi.setNum( m_digits[0] ) + "." + se.setNum( m_digits[1] ) + "." + th.setNum( m_digits[2] ) + "." + fo.setNum( m_digits[3] ) ) ); +const TQString& IPAddress::toString() const { + TQString fi = ""; + TQString se = ""; + TQString th = ""; + TQString fo = ""; + return *( new TQString( fi.setNum( m_digits[0] ) + "." + se.setNum( m_digits[1] ) + "." + th.setNum( m_digits[2] ) + "." + fo.setNum( m_digits[3] ) ) ); } // static stuff IPAddress& IPAddress::calcNetworkMaskFromLength( int len ) { - QValueList list; + TQValueList list; int nextOne = 0; int digit1 = IPAddress::calcLenthToMaskDigit( len, &nextOne ); int digit2 = IPAddress::calcLenthToMaskDigit( nextOne, &nextOne ); @@ -203,14 +203,14 @@ int IPAddress::calcLenthToMask( IPAddress& addr) { } - int mask = 0; + int tqmask = 0; for (int loop=0; loop<4; loop++) { int div = 256; while ( div > 1) { div = div/2; int test = m[loop] - div; if ( test >-1) { - mask=mask+1; + tqmask=tqmask+1; m[loop]=test; } else { break; @@ -218,8 +218,8 @@ int IPAddress::calcLenthToMask( IPAddress& addr) { } } - // kdDebug() << "Returning: " << mask << endl; - return mask; + // kdDebug() << "Returning: " << tqmask << endl; + return tqmask; } bool IPAddress::isValidAddress( IPAddress& addr) { @@ -309,27 +309,27 @@ bool IPAddress::isValidMask( IPAddress& addr) { bool IPAddress::hostsOnSameNetwork( IPAddress& host1, IPAddress& host2, int len ) { // kdDebug() << "IPAddress::hostsOnSameNetwork( IPAddress&, IPAddress&, int )" << endl; - IPAddress mask = IPAddress::calcNetworkMaskFromLength( len ); - return ( IPAddress::hostsOnSameNetwork( host1, host2, mask ) ); + IPAddress tqmask = IPAddress::calcNetworkMaskFromLength( len ); + return ( IPAddress::hostsOnSameNetwork( host1, host2, tqmask ) ); } -bool IPAddress::hostsOnSameNetwork( IPAddress& host1, IPAddress& host2, IPAddress& mask ) { +bool IPAddress::hostsOnSameNetwork( IPAddress& host1, IPAddress& host2, IPAddress& tqmask ) { kdDebug() << "IPAddress::hostsOnSameNetwork( IPAddress&, IPAddress&, int )" << endl; kdDebug() << "Host 1: " << host1.toString() << endl; kdDebug() << "Host 2: " << host2.toString() << endl; - kdDebug() << "Mask: " << mask.toString() << endl; -// IPAddress mask = IPAddress::calcNetworkMaskFromLength( len ); + kdDebug() << "Mask: " << tqmask.toString() << endl; +// IPAddress tqmask = IPAddress::calcNetworkMaskFromLength( len ); - int nOctA1=host1.getDigit(0) & mask.getDigit(0); - int nOctA2=host1.getDigit(1) & mask.getDigit(1); - int nOctA3=host1.getDigit(2) & mask.getDigit(2); - int nOctA4=host1.getDigit(3) & mask.getDigit(3); + int nOctA1=host1.getDigit(0) & tqmask.getDigit(0); + int nOctA2=host1.getDigit(1) & tqmask.getDigit(1); + int nOctA3=host1.getDigit(2) & tqmask.getDigit(2); + int nOctA4=host1.getDigit(3) & tqmask.getDigit(3); - int nOctB1=host2.getDigit(0) & mask.getDigit(0); - int nOctB2=host2.getDigit(1) & mask.getDigit(1); - int nOctB3=host2.getDigit(2) & mask.getDigit(2); - int nOctB4=host2.getDigit(3) & mask.getDigit(3); + int nOctB1=host2.getDigit(0) & tqmask.getDigit(0); + int nOctB2=host2.getDigit(1) & tqmask.getDigit(1); + int nOctB3=host2.getDigit(2) & tqmask.getDigit(2); + int nOctB4=host2.getDigit(3) & tqmask.getDigit(3); if ((nOctA1==nOctB1) && (nOctA2==nOctB2) && (nOctA3==nOctB3) && (nOctA4==nOctB4)) { kdDebug() << "Hosts on same net." << endl; -- cgit v1.2.3