diff options
author | David Faure <faure@kde.org> | 2012-02-17 14:16:55 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-17 16:42:28 +0100 |
commit | e5bcb4844d71b833d62aedcca3829f44b505dbb0 (patch) | |
tree | 466bd8d79fb1e12120540f00b72758a9361caf65 /src/plugins/bearer | |
parent | aee4cbf22a5942c7bd4b9545a8fcb7cf2930e0ee (diff) |
No need to stat with QFile::exists before QFile::open, for reading.
Change-Id: I14ca7f8a377bca39004defc96d69d62c151181f5
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Jeremy Katz <jeremy.katz@nokia.com>
Diffstat (limited to 'src/plugins/bearer')
-rw-r--r-- | src/plugins/bearer/connman/qconnmanengine.cpp | 4 | ||||
-rw-r--r-- | src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp index 1a874a92b7..0e54668394 100644 --- a/src/plugins/bearer/connman/qconnmanengine.cpp +++ b/src/plugins/bearer/connman/qconnmanengine.cpp @@ -255,7 +255,7 @@ quint64 QConnmanEngine::bytesWritten(const QString &id) quint64 result = 0; QString devFile = getInterfaceFromId(id); QFile tx("/sys/class/net/"+devFile+"/statistics/tx_bytes"); - if(tx.exists() && tx.open(QIODevice::ReadOnly | QIODevice::Text)) { + if (tx.open(QIODevice::ReadOnly | QIODevice::Text)) { QTextStream in(&tx); in >> result; tx.close(); @@ -270,7 +270,7 @@ quint64 QConnmanEngine::bytesReceived(const QString &id) quint64 result = 0; QString devFile = getInterfaceFromId(id); QFile rx("/sys/class/net/"+devFile+"/statistics/rx_bytes"); - if(rx.exists() && rx.open(QIODevice::ReadOnly | QIODevice::Text)) { + if (rx.open(QIODevice::ReadOnly | QIODevice::Text)) { QTextStream in(&rx); in >> result; rx.close(); diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index fd79cff484..a71a241ea6 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -837,7 +837,7 @@ quint64 QNetworkManagerEngine::bytesWritten(const QString &id) quint64 result = Q_UINT64_C(0); QFile tx(devFile); - if (tx.exists() && tx.open(QIODevice::ReadOnly | QIODevice::Text)) { + if (tx.open(QIODevice::ReadOnly | QIODevice::Text)) { QTextStream in(&tx); in >> result; tx.close(); @@ -865,7 +865,7 @@ quint64 QNetworkManagerEngine::bytesReceived(const QString &id) quint64 result = Q_UINT64_C(0); QFile tx(devFile); - if (tx.exists() && tx.open(QIODevice::ReadOnly | QIODevice::Text)) { + if (tx.open(QIODevice::ReadOnly | QIODevice::Text)) { QTextStream in(&tx); in >> result; tx.close(); |