CR comments

This commit is contained in:
Howard Stearns 2019-07-01 15:11:54 -07:00
parent 08ebd51559
commit ce26611e1f

View file

@ -74,6 +74,7 @@ void WINInstance::enumerateNics() {
// Start with the default from QT, getting the result into _nics: // Start with the default from QT, getting the result into _nics:
Instance::enumerateNics(); Instance::enumerateNics();
#ifdef Q_OS_WIN
// We can usually do better than the QNetworkInterface::humanReadableName() by // We can usually do better than the QNetworkInterface::humanReadableName() by
// matching up Iphlpapi.lib IP_ADAPTER_INFO by mac id. // matching up Iphlpapi.lib IP_ADAPTER_INFO by mac id.
ULONG buflen = sizeof(IP_ADAPTER_INFO); ULONG buflen = sizeof(IP_ADAPTER_INFO);
@ -91,7 +92,7 @@ void WINInstance::enumerateNics() {
// ...convert the json to a string without the colons... // ...convert the json to a string without the colons...
QString qtmac = nic[keys::nic::mac].get<std::string>().c_str(); QString qtmac = nic[keys::nic::mac].get<std::string>().c_str();
QString qtraw = qtmac.remove(QChar(':'), Qt::CaseInsensitive).toLower(); QString qtraw = qtmac.remove(QChar(':'), Qt::CaseInsensitive).toLower();
// ... and find the matching on in pAdapter: // ... and find the matching one in pAdapter:
for (IP_ADAPTER_INFO *pAdapter = pAdapterInfo; pAdapter; pAdapter = pAdapter->Next) { for (IP_ADAPTER_INFO *pAdapter = pAdapterInfo; pAdapter; pAdapter = pAdapter->Next) {
QByteArray wmac = QByteArray((const char *)(pAdapter->Address), pAdapter->AddressLength); QByteArray wmac = QByteArray((const char *)(pAdapter->Address), pAdapter->AddressLength);
QString wraw = wmac.toHex(); QString wraw = wmac.toHex();
@ -103,5 +104,8 @@ void WINInstance::enumerateNics() {
} }
} }
if (pAdapterInfo) free(pAdapterInfo); if (pAdapterInfo) {
free(pAdapterInfo);
}
#endif
} }