From 9b7e3943b0e67af48fdbb993c5c4cc93dac81304 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 4 Mar 2010 18:04:40 +1000 Subject: Remove unnecessary qWarnings from bearer management code. --- src/plugins/bearer/icd/qicdengine.cpp | 23 +++----- src/plugins/bearer/icd/qnetworksession_impl.cpp | 13 ++--- .../bearer/nativewifi/qnativewifiengine.cpp | 62 ++++++++++++++++------ .../networkmanager/qnetworkmanagerservice.cpp | 8 --- src/plugins/bearer/nla/qnlaengine.cpp | 56 ++++++++----------- src/plugins/bearer/qnetworksession_impl.cpp | 4 -- 6 files changed, 77 insertions(+), 89 deletions(-) diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp index 206a6fd..5e506ef 100644 --- a/src/plugins/bearer/icd/qicdengine.cpp +++ b/src/plugins/bearer/icd/qicdengine.cpp @@ -206,14 +206,11 @@ void QIcdEngine::doRequestUpdate() QString iap_type = saved_ap.value("type").toString(); if (iap_type.startsWith("WLAN")) { ssid = saved_ap.value("wlan_ssid").toByteArray(); - if (ssid.isEmpty()) { - qWarning() << "Cannot get ssid for" << iap_id; + if (ssid.isEmpty()) continue; - } QString security_method = saved_ap.value("wlan_security").toString(); } else if (iap_type.isEmpty()) { - qWarning() << "IAP" << iap_id << "network type is not set! Skipping it"; continue; } else { #ifdef BEARER_MANAGEMENT_DEBUG @@ -270,7 +267,9 @@ void QIcdEngine::doRequestUpdate() scanned, error); if (!error.isEmpty()) { - qWarning() << "Network scanning failed" << error; +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "Network scanning failed" << error; +#endif } else { #ifdef BEARER_MANAGEMENT_DEBUG if (!scanned.isEmpty()) @@ -379,19 +378,13 @@ void QIcdEngine::deleteConfiguration(const QString &iap_id) * or read all the IAPs from db because it might take too much power * (multiple applications would need to scan and read all IAPs from db) */ - if (accessPointConfigurations.contains(iap_id)) { - QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(iap_id); - - if (ptr) { - ptr->isValid = false; + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(iap_id); + if (ptr) { #ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "IAP" << iap_id << "was removed from storage."; + qDebug() << "IAP" << iap_id << "was removed from storage."; #endif - emit configurationRemoved(ptr); - } else { - qWarning("Configuration not found for IAP %s", iap_id.toAscii().data()); - } + emit configurationRemoved(ptr); } else { #ifdef BEARER_MANAGEMENT_DEBUG qDebug("IAP: %s, already missing from the known list", iap_id.toAscii().data()); diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp index 03624fa..bb81408 100644 --- a/src/plugins/bearer/icd/qnetworksession_impl.cpp +++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp @@ -140,7 +140,9 @@ static DBusHandlerResult signal_handler(DBusConnection *, DBUS_TYPE_STRING, &network_type, DBUS_TYPE_STRING, &state, DBUS_TYPE_INVALID) == FALSE) { - qWarning() << QString("Failed to parse icd status signal: %1").arg(error.message); +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << QString("Failed to parse icd status signal: %1").arg(error.message); +#endif } else { QString _iap_id(iap_id); QString _network_type(network_type); @@ -166,7 +168,6 @@ void IcdListener::setup(QNetworkSessionPrivateImpl *d) dbus_connection = get_dbus_conn(&error); if (dbus_error_is_set(&error)) { - qWarning() << "Cannot get dbus connection."; dbus_error_free(&error); return; } @@ -176,7 +177,6 @@ void IcdListener::setup(QNetworkSessionPrivateImpl *d) dbus_bus_add_match(dbus_connection, ICD_DBUS_MATCH, &error); if (dbus_error_is_set(&error)) { - qWarning() << "Cannot add match" << ICD_DBUS_MATCH; dbus_error_free(&error); return; } @@ -185,7 +185,6 @@ void IcdListener::setup(QNetworkSessionPrivateImpl *d) ICD_DBUS_PATH, &icd_vtable, (void*)this) == FALSE) { - qWarning() << "Cannot register dbus signal handler, interface"<< ICD_DBUS_INTERFACE << "path" << ICD_DBUS_PATH; dbus_error_free(&error); return; } @@ -340,8 +339,6 @@ void QNetworkSessionPrivateImpl::updateIdentifier(QString &newId) } else { toIcdConfig(privateConfiguration(publicConfig))->network_attrs |= ICD_NW_ATTR_IAPNAME; if (privateConfiguration(publicConfig)->id != newId) { - qWarning() << "Your config id changed from" << privateConfiguration(publicConfig)->id - << "to" << newId; privateConfiguration(publicConfig)->id = newId; } } @@ -1015,25 +1012,21 @@ void QNetworkSessionPrivateImpl::stop() void QNetworkSessionPrivateImpl::migrate() { - qWarning("This platform does not support roaming (%s).", __FUNCTION__); } void QNetworkSessionPrivateImpl::accept() { - qWarning("This platform does not support roaming (%s).", __FUNCTION__); } void QNetworkSessionPrivateImpl::ignore() { - qWarning("This platform does not support roaming (%s).", __FUNCTION__); } void QNetworkSessionPrivateImpl::reject() { - qWarning("This platform does not support roaming (%s).", __FUNCTION__); } diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp index ec2da00..952a6a3 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp @@ -83,8 +83,10 @@ QNativeWifiEngine::QNativeWifiEngine(QObject *parent) DWORD result = local_WlanOpenHandle(1, 0, &clientVersion, &handle); if (result != ERROR_SUCCESS) { +#ifdef BEARER_MANAGEMENT_DEBUG if (result != ERROR_SERVICE_NOT_ACTIVE) - qWarning("%s: WlanOpenHandle failed with error %ld\n", __FUNCTION__, result); + qDebug("%s: WlanOpenHandle failed with error %ld\n", __FUNCTION__, result); +#endif return; } @@ -92,8 +94,10 @@ QNativeWifiEngine::QNativeWifiEngine(QObject *parent) result = local_WlanRegisterNotification(handle, WLAN_NOTIFICATION_SOURCE_ALL, true, WLAN_NOTIFICATION_CALLBACK(qNotificationCallback), this, 0, 0); +#ifdef BEARER_MANAGEMENT_DEBUG if (result != ERROR_SUCCESS) - qWarning("%s: WlanRegisterNotification failed with error %ld\n", __FUNCTION__, result); + qDebug("%s: WlanRegisterNotification failed with error %ld\n", __FUNCTION__, result); +#endif scanComplete(); } @@ -113,7 +117,9 @@ void QNativeWifiEngine::scanComplete() WLAN_INTERFACE_INFO_LIST *interfaceList; DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); if (result != ERROR_SUCCESS) { - qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); +#endif return; } @@ -124,8 +130,10 @@ void QNativeWifiEngine::scanComplete() result = local_WlanGetAvailableNetworkList(handle, &interface.InterfaceGuid, 3, 0, &networkList); if (result != ERROR_SUCCESS) { - qWarning("%s: WlanGetAvailableNetworkList failed with error %ld\n", - __FUNCTION__, result); +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("%s: WlanGetAvailableNetworkList failed with error %ld\n", + __FUNCTION__, result); +#endif continue; } @@ -229,7 +237,9 @@ QString QNativeWifiEngine::getInterfaceFromId(const QString &id) WLAN_INTERFACE_INFO_LIST *interfaceList; DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); if (result != ERROR_SUCCESS) { - qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); +#endif return QString(); } @@ -242,8 +252,10 @@ QString QNativeWifiEngine::getInterfaceFromId(const QString &id) wlan_intf_opcode_current_connection, 0, &dataSize, reinterpret_cast(&connectionAttributes), 0); if (result != ERROR_SUCCESS) { +#ifdef BEARER_MANAGEMENT_DEBUG if (result != ERROR_INVALID_STATE) - qWarning("%s: WlanQueryInterface failed with error %ld\n", __FUNCTION__, result); + qDebug("%s: WlanQueryInterface failed with error %ld\n", __FUNCTION__, result); +#endif continue; } @@ -280,7 +292,9 @@ bool QNativeWifiEngine::hasIdentifier(const QString &id) WLAN_INTERFACE_INFO_LIST *interfaceList; DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); if (result != ERROR_SUCCESS) { - qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); +#endif return false; } @@ -291,8 +305,10 @@ bool QNativeWifiEngine::hasIdentifier(const QString &id) result = local_WlanGetAvailableNetworkList(handle, &interface.InterfaceGuid, 3, 0, &networkList); if (result != ERROR_SUCCESS) { - qWarning("%s: WlanGetAvailableNetworkList failed with error %ld\n", - __FUNCTION__, result); +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("%s: WlanGetAvailableNetworkList failed with error %ld\n", + __FUNCTION__, result); +#endif continue; } @@ -335,7 +351,9 @@ void QNativeWifiEngine::connectToId(const QString &id) WLAN_INTERFACE_INFO_LIST *interfaceList; DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); if (result != ERROR_SUCCESS) { - qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); +#endif emit connectionError(id, InterfaceLookupError); return; } @@ -349,8 +367,10 @@ void QNativeWifiEngine::connectToId(const QString &id) result = local_WlanGetAvailableNetworkList(handle, &interface.InterfaceGuid, 3, 0, &networkList); if (result != ERROR_SUCCESS) { - qWarning("%s: WlanGetAvailableNetworkList failed with error %ld\n", - __FUNCTION__, result); +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("%s: WlanGetAvailableNetworkList failed with error %ld\n", + __FUNCTION__, result); +#endif continue; } @@ -378,7 +398,9 @@ void QNativeWifiEngine::connectToId(const QString &id) DWORD result = local_WlanConnect(handle, &interface.InterfaceGuid, ¶meters, 0); if (result != ERROR_SUCCESS) { - qWarning("%s: WlanConnect failed with error %ld\n", __FUNCTION__, result); +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("%s: WlanConnect failed with error %ld\n", __FUNCTION__, result); +#endif emit connectionError(id, ConnectError); break; } @@ -417,7 +439,9 @@ void QNativeWifiEngine::disconnectFromId(const QString &id) DWORD result = local_WlanDisconnect(handle, &guid, 0); if (result != ERROR_SUCCESS) { - qWarning("%s: WlanDisconnect failed with error %ld\n", __FUNCTION__, result); +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("%s: WlanDisconnect failed with error %ld\n", __FUNCTION__, result); +#endif emit connectionError(id, DisconnectionError); return; } @@ -431,14 +455,18 @@ void QNativeWifiEngine::requestUpdate() WLAN_INTERFACE_INFO_LIST *interfaceList; DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); if (result != ERROR_SUCCESS) { - qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); +#endif return; } for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) { result = local_WlanScan(handle, &interfaceList->InterfaceInfo[i].InterfaceGuid, 0, 0, 0); +#ifdef BEARER_MANAGEMENT_DEBUG if (result != ERROR_SUCCESS) - qWarning("%s: WlanScan failed with error %ld\n", __FUNCTION__, result); + qDebug("%s: WlanScan failed with error %ld\n", __FUNCTION__, result); +#endif } local_WlanFreeMemory(interfaceList); diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp index c780fbc..d23bb0d 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp @@ -199,7 +199,6 @@ QNetworkManagerInterfaceAccessPoint::QNetworkManagerInterfaceAccessPoint(const Q dbusConnection); if (!d->connectionInterface->isValid()) { d->valid = false; - qWarning() << "Could not find InterfaceAccessPoint"; return; } d->valid = true; @@ -308,7 +307,6 @@ QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &de dbusConnection); if (!d->connectionInterface->isValid()) { d->valid = false; - qWarning() << "Could not find NetworkManagerInterfaceDevice"; return; } d->valid = true; @@ -400,7 +398,6 @@ QNetworkManagerInterfaceDeviceWired::QNetworkManagerInterfaceDeviceWired(const Q dbusConnection, parent); if (!d->connectionInterface->isValid()) { d->valid = false; - qWarning() << "Could not find InterfaceDeviceWired"; return; } d->valid = true; @@ -478,7 +475,6 @@ QNetworkManagerInterfaceDeviceWireless::QNetworkManagerInterfaceDeviceWireless(c dbusConnection, parent); if (!d->connectionInterface->isValid()) { d->valid = false; - qWarning() << "Could not find InterfaceDeviceWireless"; return; } d->valid = true; @@ -596,7 +592,6 @@ QNetworkManagerSettings::QNetworkManagerSettings(const QString &settingsService, dbusConnection); if (!d->connectionInterface->isValid()) { d->valid = false; - //qWarning() << "Could not find NetworkManagerSettings"; return; } d->valid = true; @@ -660,7 +655,6 @@ QNetworkManagerSettingsConnection::QNetworkManagerSettingsConnection(const QStri QLatin1String(NM_DBUS_IFACE_SETTINGS_CONNECTION), dbusConnection, parent); if (!d->connectionInterface->isValid()) { - //qWarning() << "Could not find NetworkManagerSettingsConnection"; d->valid = false; return; } @@ -883,7 +877,6 @@ QNetworkManagerConnectionActive::QNetworkManagerConnectionActive( const QString dbusConnection, parent); if (!d->connectionInterface->isValid()) { d->valid = false; - //qWarning() << "Could not find NetworkManagerSettingsConnection"; return; } d->valid = true; @@ -978,7 +971,6 @@ QNetworkManagerIp4Config::QNetworkManagerIp4Config( const QString &deviceObjectP dbusConnection, parent); if (!d->connectionInterface->isValid()) { d->valid = false; - //qWarning() << "Could not find NetworkManagerIp4Config"; return; } d->valid = true; diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp index ff334e5..334eb14 100644 --- a/src/plugins/bearer/nla/qnlaengine.cpp +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -228,8 +228,11 @@ QNlaThread::~QNlaThread() if (handle) { /* cancel completion event */ - if (WSALookupServiceEnd(handle) == SOCKET_ERROR) - qWarning("WSALookupServiceEnd error %d", WSAGetLastError()); + if (WSALookupServiceEnd(handle) == SOCKET_ERROR) { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("WSALookupServiceEnd error %d", WSAGetLastError()); +#endif + } } mutex.unlock(); @@ -252,8 +255,11 @@ void QNlaThread::forceUpdate() if (handle) { /* cancel completion event */ - if (WSALookupServiceEnd(handle) == SOCKET_ERROR) - qWarning("WSALookupServiceEnd error %d", WSAGetLastError()); + if (WSALookupServiceEnd(handle) == SOCKET_ERROR) { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("WSALookupServiceEnd error %d", WSAGetLastError()); +#endif + } handle = 0; } mutex.unlock(); @@ -262,10 +268,8 @@ void QNlaThread::forceUpdate() void QNlaThread::run() { WSAEVENT changeEvent = WSACreateEvent(); - if (changeEvent == WSA_INVALID_EVENT) { - qWarning("WSACreateEvent error %d", WSAGetLastError()); + if (changeEvent == WSA_INVALID_EVENT) return; - } while (true) { fetchConfigurations(); @@ -284,10 +288,8 @@ void QNlaThread::run() int result = WSALookupServiceBegin(&qsRestrictions, LUP_RETURN_ALL, &handle); mutex.unlock(); - if (result == SOCKET_ERROR) { - qWarning("%s: WSALookupServiceBegin error %d", __FUNCTION__, WSAGetLastError()); + if (result == SOCKET_ERROR) break; - } WSACOMPLETION completion; WSAOVERLAPPED overlapped; @@ -303,11 +305,8 @@ void QNlaThread::run() result = WSANSPIoctl(handle, SIO_NSP_NOTIFY_CHANGE, 0, 0, 0, 0, &bytesReturned, &completion); if (result == SOCKET_ERROR) { - int error = WSAGetLastError(); - if (error != WSA_IO_PENDING) { - qWarning("WSANSPIoctl error %d", error); + if (WSAGetLastError() != WSA_IO_PENDING) break; - } } #ifndef Q_OS_WINCE @@ -325,7 +324,6 @@ void QNlaThread::run() if (handle) { result = WSALookupServiceEnd(handle); if (result == SOCKET_ERROR) { - qWarning("WSALookupServiceEnd error %d", WSAGetLastError()); mutex.unlock(); break; } @@ -360,7 +358,7 @@ DWORD QNlaThread::parseBlob(NLA_BLOB *blob, QNetworkConfigurationPrivate *cpPriv switch (blob->header.type) { case NLA_RAW_DATA: #ifdef BEARER_MANAGEMENT_DEBUG - qWarning("%s: unhandled header type NLA_RAW_DATA", __FUNCTION__); + qDebug("%s: unhandled header type NLA_RAW_DATA", __FUNCTION__); #endif break; case NLA_INTERFACE: @@ -372,7 +370,7 @@ DWORD QNlaThread::parseBlob(NLA_BLOB *blob, QNetworkConfigurationPrivate *cpPriv break; case NLA_802_1X_LOCATION: #ifdef BEARER_MANAGEMENT_DEBUG - qWarning("%s: unhandled header type NLA_802_1X_LOCATION", __FUNCTION__); + qDebug("%s: unhandled header type NLA_802_1X_LOCATION", __FUNCTION__); #endif break; case NLA_CONNECTIVITY: @@ -380,18 +378,15 @@ DWORD QNlaThread::parseBlob(NLA_BLOB *blob, QNetworkConfigurationPrivate *cpPriv cpPriv->internet = true; else cpPriv->internet = false; -#ifdef BEARER_MANAGEMENT_DEBUG - qWarning("%s: unhandled header type NLA_CONNECTIVITY", __FUNCTION__); -#endif break; case NLA_ICS: #ifdef BEARER_MANAGEMENT_DEBUG - qWarning("%s: unhandled header type NLA_ICS", __FUNCTION__); + qDebug("%s: unhandled header type NLA_ICS", __FUNCTION__); #endif break; default: #ifdef BEARER_MANAGEMENT_DEBUG - qWarning("%s: unhandled header type %d", __FUNCTION__, blob->header.type); + qDebug("%s: unhandled header type %d", __FUNCTION__, blob->header.type); #endif ; } @@ -462,7 +457,6 @@ void QNlaThread::fetchConfigurations() int result = WSALookupServiceBegin(&qsRestrictions, LUP_RETURN_ALL | LUP_DEEP, &hLookup); if (result == SOCKET_ERROR) { - qWarning("%s: WSALookupServiceBegin error %d", __FUNCTION__, WSAGetLastError()); mutex.lock(); fetchedConfigurations.clear(); mutex.unlock(); @@ -474,18 +468,8 @@ void QNlaThread::fetchConfigurations() result = WSALookupServiceNext(hLookup, LUP_RETURN_ALL, &bufferLength, reinterpret_cast(buffer)); - if (result == SOCKET_ERROR) { - int error = WSAGetLastError(); - - if (error == WSA_E_NO_MORE) - break; - - if (error == WSAEFAULT) - break; - - qWarning("WSALookupServiceNext error %d", WSAGetLastError()); + if (result == SOCKET_ERROR) break; - } QNetworkConfigurationPrivate *cpPriv = parseQuerySet(reinterpret_cast(buffer)); @@ -496,7 +480,9 @@ void QNlaThread::fetchConfigurations() if (hLookup) { result = WSALookupServiceEnd(hLookup); if (result == SOCKET_ERROR) { - qWarning("WSALookupServiceEnd error %d", WSAGetLastError()); +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("WSALookupServiceEnd error %d", WSAGetLastError()); +#endif } } diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp index 0ba1237..db1759c 100644 --- a/src/plugins/bearer/qnetworksession_impl.cpp +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -204,22 +204,18 @@ void QNetworkSessionPrivateImpl::stop() void QNetworkSessionPrivateImpl::migrate() { - qWarning("This platform does not support roaming (%s).", Q_FUNC_INFO); } void QNetworkSessionPrivateImpl::accept() { - qWarning("This platform does not support roaming (%s).", Q_FUNC_INFO); } void QNetworkSessionPrivateImpl::ignore() { - qWarning("This platform does not support roaming (%s).", Q_FUNC_INFO); } void QNetworkSessionPrivateImpl::reject() { - qWarning("This platform does not support roaming (%s).", Q_FUNC_INFO); } QNetworkInterface QNetworkSessionPrivateImpl::currentInterface() const -- cgit v0.12