diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2019-04-23 16:13:12 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2019-04-24 07:06:38 +0000 |
commit | c17d6d4e4657416051847d2c78ef944ea8f362f8 (patch) | |
tree | 2f2d5703d6369113663ad319336ccee9c1facc39 /src/network/kernel | |
parent | 7d646508c8219408f90103ed13613db8d01a4065 (diff) |
Fix compiling with QHOSTINFO_DEBUG enabled
Since we require getaddrinfo and freeaddrinfo, those symbols are
not resolved dynamically, and will never be null, which causes compile
errors.
Correctly appending a string literal shuts up compiler warnings.
Change-Id: I0096dca6a77ad86e0c89890444b8d7bbb38a40f2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/network/kernel')
-rw-r--r-- | src/network/kernel/qhostinfo_win.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/network/kernel/qhostinfo_win.cpp b/src/network/kernel/qhostinfo_win.cpp index c51e9968f8..ef7cff46f1 100644 --- a/src/network/kernel/qhostinfo_win.cpp +++ b/src/network/kernel/qhostinfo_win.cpp @@ -79,9 +79,8 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName) QHostInfo results; #if defined(QHOSTINFO_DEBUG) - qDebug("QHostInfoAgent::fromName(): looking up \"%s\" (IPv6 support is %s)", - hostName.toLatin1().constData(), - (getaddrinfo && freeaddrinfo) ? "enabled" : "disabled"); + qDebug("QHostInfoAgent::fromName(%s) looking up...", + hostName.toLatin1().constData()); #endif QHostAddress address; @@ -129,6 +128,12 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName) if (err == 0) { QList<QHostAddress> addresses; for (addrinfo *p = res; p != 0; p = p->ai_next) { +#ifdef QHOSTINFO_DEBUG + qDebug() << "getaddrinfo node: flags:" << p->ai_flags << "family:" << p->ai_family + << "ai_socktype:" << p->ai_socktype << "ai_protocol:" << p->ai_protocol + << "ai_addrlen:" << p->ai_addrlen; +#endif + switch (p->ai_family) { case AF_INET: { QHostAddress addr; @@ -163,7 +168,7 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName) QString tmp; QList<QHostAddress> addresses = results.addresses(); for (int i = 0; i < addresses.count(); ++i) { - if (i != 0) tmp += ", "; + if (i != 0) tmp += QLatin1String(", "); tmp += addresses.at(i).toString(); } qDebug("QHostInfoAgent::run(): found %i entries: {%s}", |