QNetworkInterface: remove fallback code for Windows pre-XP and CE pre-4
authorThiago Macieira <thiago.macieira@intel.com>
Wed, 12 Aug 2015 01:04:50 +0000 (18:04 -0700)
committerThiago Macieira <thiago.macieira@intel.com>
Sun, 16 Aug 2015 18:12:51 +0000 (18:12 +0000)
All versions we support have support for the WinXP-style functions we
need, so we don't need the Win2k fallback.

Change-Id: I7de033f80b0e4431b7f1ffff13f99175a507a2ed
Reviewed-by: Richard J. Moore <rich@kde.org>
src/network/kernel/qnetworkinterface_win.cpp

index eeb2e1665a1d4d4f10c62ab95d90cf3d28ec19e2..a07840a848805f67ef796a6508635a7ee89bfe89 100644 (file)
@@ -222,67 +222,11 @@ static QList<QNetworkInterfacePrivate *> interfaceListingWinXP()
     return interfaces;
 }
 
-static QList<QNetworkInterfacePrivate *> interfaceListingWin2k()
-{
-    QList<QNetworkInterfacePrivate *> interfaces;
-    IP_ADAPTER_INFO staticBuf[2]; // 2 is arbitrary
-    PIP_ADAPTER_INFO pAdapter = staticBuf;
-    ULONG bufSize = sizeof staticBuf;
-
-    DWORD retval = ptrGetAdaptersInfo(pAdapter, &bufSize);
-    if (retval == ERROR_BUFFER_OVERFLOW) {
-        // need more memory
-        pAdapter = (IP_ADAPTER_INFO *)malloc(bufSize);
-        if (!pAdapter)
-            return interfaces;
-        // try again
-        if (ptrGetAdaptersInfo(pAdapter, &bufSize) != ERROR_SUCCESS) {
-            free(pAdapter);
-            return interfaces;
-        }
-    } else if (retval != ERROR_SUCCESS) {
-        // error
-        return interfaces;
-    }
-
-    // iterate over the list and add the entries to our listing
-    for (PIP_ADAPTER_INFO ptr = pAdapter; ptr; ptr = ptr->Next) {
-        QNetworkInterfacePrivate *iface = new QNetworkInterfacePrivate;
-        interfaces << iface;
-
-        iface->index = ptr->Index;
-        iface->flags = QNetworkInterface::IsUp | QNetworkInterface::IsRunning;
-        if (ptr->Type == MIB_IF_TYPE_PPP)
-            iface->flags |= QNetworkInterface::IsPointToPoint;
-        else
-            iface->flags |= QNetworkInterface::CanBroadcast;
-        iface->name = QString::fromLocal8Bit(ptr->AdapterName);
-        iface->hardwareAddress = QNetworkInterfacePrivate::makeHwAddress(ptr->AddressLength,
-                                                                         ptr->Address);
-
-        for (PIP_ADDR_STRING addr = &ptr->IpAddressList; addr; addr = addr->Next) {
-            QNetworkAddressEntry entry;
-            entry.setIp(QHostAddress(QLatin1String(addr->IpAddress.String)));
-            entry.setNetmask(QHostAddress(QLatin1String(addr->IpMask.String)));
-            // broadcast address is set on postProcess()
-
-            iface->addressEntries << entry;
-        }
-    }
-
-    if (pAdapter != staticBuf)
-        free(pAdapter);
-
-    return interfaces;
-}
-
 static QList<QNetworkInterfacePrivate *> interfaceListing()
 {
     resolveLibs();
     if (ptrGetAdaptersAddresses != NULL)
         return interfaceListingWinXP();
-    else if (ptrGetAdaptersInfo != NULL)
-        return interfaceListingWin2k();
 
     // failed
     return QList<QNetworkInterfacePrivate *>();