diff options
author | Janne Anttila <janne.anttila@digia.com> | 2009-08-03 12:39:54 (GMT) |
---|---|---|
committer | Janne Anttila <janne.anttila@digia.com> | 2009-08-03 12:53:19 (GMT) |
commit | 78b769c7d433e38352ac936c4d1f2e35134f5fa0 (patch) | |
tree | f7289ef134c6593036931bc0ade775f928392df7 /src/network/kernel | |
parent | ae597a532683e5d544400b62497c870cf570b069 (diff) | |
download | Qt-78b769c7d433e38352ac936c4d1f2e35134f5fa0.zip Qt-78b769c7d433e38352ac936c4d1f2e35134f5fa0.tar.gz Qt-78b769c7d433e38352ac936c4d1f2e35134f5fa0.tar.bz2 |
Trailing whitespace and tab/space fixes for QtNetwork
Diffstat (limited to 'src/network/kernel')
-rw-r--r-- | src/network/kernel/qnetworkinterface.cpp | 6 | ||||
-rw-r--r-- | src/network/kernel/qnetworkinterface_symbian.cpp | 70 |
2 files changed, 38 insertions, 38 deletions
diff --git a/src/network/kernel/qnetworkinterface.cpp b/src/network/kernel/qnetworkinterface.cpp index 953722c..e588c18 100644 --- a/src/network/kernel/qnetworkinterface.cpp +++ b/src/network/kernel/qnetworkinterface.cpp @@ -128,7 +128,7 @@ QString QNetworkInterfacePrivate::makeHwAddress(int len, uchar *data) for (int i = 0; i < len; ++i) { if (i) result += QLatin1Char(':'); - + char buf[3]; #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && defined(_MSC_VER) && _MSC_VER >= 1400 sprintf_s(buf, 3, "%02hX", ushort(data[i])); @@ -603,13 +603,13 @@ QDebug operator<<(QDebug debug, const QNetworkInterface &networkInterface) << ", hardware address = " << networkInterface.hardwareAddress() << ", flags = "; flagsDebug(debug, networkInterface.flags()); -#if defined(Q_CC_RVCT) +#if defined(Q_CC_RVCT) // RVCT gets confused with << networkInterface.addressEntries(), reason unknown. debug.nospace() << ")\n"; #else debug.nospace() << ", entries = " << networkInterface.addressEntries() << ")\n"; -#endif +#endif return debug.space(); } #endif diff --git a/src/network/kernel/qnetworkinterface_symbian.cpp b/src/network/kernel/qnetworkinterface_symbian.cpp index d3aafa3..bec2dc3 100644 --- a/src/network/kernel/qnetworkinterface_symbian.cpp +++ b/src/network/kernel/qnetworkinterface_symbian.cpp @@ -69,14 +69,14 @@ static QNetworkInterface::InterfaceFlags convertFlags( const TSoInetInterfaceInf flags |= (aInfo.iState == EIfUp) ? QNetworkInterface::IsUp : QNetworkInterface::InterfaceFlag(0); // We do not have separate flag for running in Symbian OS flags |= (aInfo.iState == EIfUp) ? QNetworkInterface::IsRunning : QNetworkInterface::InterfaceFlag(0); - flags |= (aInfo.iFeatures&KIfCanBroadcast) ? QNetworkInterface::CanBroadcast : QNetworkInterface::InterfaceFlag(0); + flags |= (aInfo.iFeatures&KIfCanBroadcast) ? QNetworkInterface::CanBroadcast : QNetworkInterface::InterfaceFlag(0); flags |= (aInfo.iFeatures&KIfIsLoopback) ? QNetworkInterface::IsLoopBack : QNetworkInterface::InterfaceFlag(0); flags |= (aInfo.iFeatures&KIfIsPointToPoint) ? QNetworkInterface::IsPointToPoint : QNetworkInterface::InterfaceFlag(0); flags |= (aInfo.iFeatures&KIfCanMulticast) ? QNetworkInterface::CanMulticast : QNetworkInterface::InterfaceFlag(0); return flags; } -QString qstringFromDesc( const TDesC& aData ) +QString qstringFromDesc( const TDesC& aData ) { return QString::fromUtf16(aData.Ptr(), aData.Length()); } @@ -85,20 +85,20 @@ static QList<QNetworkInterfacePrivate *> interfaceListing() { TInt err( KErrNone ); QList<QNetworkInterfacePrivate *> interfaces; - + // Connect to Native socket server RSocketServ socketServ; err = socketServ.Connect(); if( err ) return interfaces; - + // Open dummy socket for interface queries RSocket socket; err = socket.Open( socketServ, _L("udp")); if( err ) { socketServ.Close(); - return interfaces; + return interfaces; } // Ask socket to start enumerating interfaces @@ -107,8 +107,8 @@ static QList<QNetworkInterfacePrivate *> interfaceListing() { socket.Close(); socketServ.Close(); - return interfaces; - } + return interfaces; + } int ifindex = 0; TPckgBuf<TSoInetInterfaceInfo> infoPckg; @@ -118,74 +118,74 @@ static QList<QNetworkInterfacePrivate *> interfaceListing() // Do not include IPv6 addresses because netmask and broadcast address cannot be determined correctly if( info.iName != KNullDesC && info.iAddress.IsV4Mapped() ) { - TName address; - QNetworkAddressEntry entry; - QNetworkInterfacePrivate *iface = 0; - - iface = new QNetworkInterfacePrivate; + TName address; + QNetworkAddressEntry entry; + QNetworkInterfacePrivate *iface = 0; + + iface = new QNetworkInterfacePrivate; iface->index = ifindex++; interfaces << iface; iface->name = qstringFromDesc( info.iName ); iface->flags = convertFlags( info ); - + if( /*info.iFeatures&KIfHasHardwareAddr &&*/ info.iHwAddr.Family() != KAFUnspec ) { - for ( TInt i = sizeof(SSockAddr); i < sizeof(SSockAddr) + info.iHwAddr.GetUserLen(); i++ ) + for ( TInt i = sizeof(SSockAddr); i < sizeof(SSockAddr) + info.iHwAddr.GetUserLen(); i++ ) { address.AppendNumFixedWidth(info.iHwAddr[i], EHex, 2); if( ( i + 1) < sizeof(SSockAddr) + info.iHwAddr.GetUserLen() ) address.Append( _L(":") ); - } - address.UpperCase(); + } + address.UpperCase(); iface->hardwareAddress = qstringFromDesc( address ); } - + // Get the address of the interface info.iAddress.Output(address); - entry.setIp( QHostAddress( qstringFromDesc( address ) ) ); + entry.setIp( QHostAddress( qstringFromDesc( address ) ) ); - // Get the interface netmask - // TODO: For some reason netmask is always 0.0.0.0 + // Get the interface netmask + // TODO: For some reason netmask is always 0.0.0.0 //info.iNetMask.Output(address); - //entry.setNetmask( QHostAddress( qstringFromDesc( address ) ) ); - + //entry.setNetmask( QHostAddress( qstringFromDesc( address ) ) ); + // Workaround: Let Symbian determine netmask based on IP address class // TODO: works only for IPv4 TInetAddr netmask; netmask.NetMask( info.iAddress ); netmask.Output(address); - entry.setNetmask( QHostAddress( qstringFromDesc( address ) ) ); - + entry.setNetmask( QHostAddress( qstringFromDesc( address ) ) ); + // Get the interface broadcast address - if (iface->flags & QNetworkInterface::CanBroadcast) + if (iface->flags & QNetworkInterface::CanBroadcast) { // For some reason broadcast address is always 0.0.0.0 // info.iBrdAddr.Output(address); - // entry.setBroadcast( QHostAddress( qstringFromDesc( address ) ) ); - + // entry.setBroadcast( QHostAddress( qstringFromDesc( address ) ) ); + // Workaround: Let Symbian determine broadcast address based on IP address // TODO: works only for IPv4 TInetAddr broadcast; - broadcast.NetBroadcast( info.iAddress ); + broadcast.NetBroadcast( info.iAddress ); broadcast.Output(address); entry.setBroadcast( QHostAddress( qstringFromDesc( address ) ) ); } - + // Add new entry to interface address entries - iface->addressEntries << entry; - -#if defined(QNETWORKINTERFACE_DEBUG) + iface->addressEntries << entry; + +#if defined(QNETWORKINTERFACE_DEBUG) printf("\n Found network interface %s, interface flags:\n\ IsUp = %d, IsRunning = %d, CanBroadcast = %d,\n\ IsLoopBack = %d, IsPointToPoint = %d, CanMulticast = %d, \n\ ip = %s, netmask = %s, broadcast = %s,\n\ - hwaddress = %s", + hwaddress = %s", iface->name.toLatin1().constData(), iface->flags & QNetworkInterface::IsUp, iface->flags & QNetworkInterface::IsRunning, iface->flags & QNetworkInterface::CanBroadcast, iface->flags & QNetworkInterface::IsLoopBack, iface->flags & QNetworkInterface::IsPointToPoint, iface->flags & QNetworkInterface::CanMulticast, entry.ip().toString().toLatin1().constData(), entry.netmask().toString().toLatin1().constData(), entry.broadcast().toString().toLatin1().constData(), - iface->hardwareAddress.toLatin1().constData()); -#endif + iface->hardwareAddress.toLatin1().constData()); +#endif } } |