From a95c00f77c4543c699a2c49563cd2b42f416b16d Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Mon, 10 Dec 2012 18:27:15 +0200 Subject: [PATCH] Zeroconf: Compile with QT_NO_CAST_FROM_ASCII Change-Id: If23da8a3ae819875c627d40375b908eb0ea73e3c Reviewed-by: Friedemann Kleint --- src/libs/zeroconf/avahiLib.cpp | 2 +- src/libs/zeroconf/embeddedLib.cpp | 6 +++--- src/libs/zeroconf/servicebrowser.cpp | 10 +++++----- src/libs/zeroconf/zeroconf.pro | 2 +- src/libs/zeroconf/zeroconf.qbs | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/libs/zeroconf/avahiLib.cpp b/src/libs/zeroconf/avahiLib.cpp index 06fa0173e92..43635b72f2f 100644 --- a/src/libs/zeroconf/avahiLib.cpp +++ b/src/libs/zeroconf/avahiLib.cpp @@ -467,7 +467,7 @@ extern "C" void cAvahiClientReply (AvahiClient * /*s*/, AvahiClientState state, break; case (AVAHI_CLIENT_S_RUNNING): /* Server state: RUNNING */ - lib->setError(false, QString("")); + lib->setError(false, QString()); break; case (AVAHI_CLIENT_S_COLLISION): /* Server state: COLLISION */ diff --git a/src/libs/zeroconf/embeddedLib.cpp b/src/libs/zeroconf/embeddedLib.cpp index 912ac24cae8..7ca74cd8bae 100644 --- a/src/libs/zeroconf/embeddedLib.cpp +++ b/src/libs/zeroconf/embeddedLib.cpp @@ -71,8 +71,8 @@ public: { if (daemonPath.isEmpty()) m_maxErrors = 0; - if (!daemonPath.isEmpty() && daemonPath.at(0) != '/' && daemonPath.at(0) != '.') - this->daemonPath = QCoreApplication::applicationDirPath() + QChar('/') + daemonPath; + if (!daemonPath.isEmpty() && daemonPath.at(0) != QLatin1Char('/') && daemonPath.at(0) != QLatin1Char('.')) + this->daemonPath = QCoreApplication::applicationDirPath() + QLatin1Char('/') + daemonPath; } ~EmbeddedZConfLib() @@ -114,7 +114,7 @@ public: QString daemonCmd = daemonPath; QStringList daemonArgs; #ifdef Q_OS_LINUX - if (QFile::exists("/tmp/mdnsd") && logger) + if (QFile::exists(QLatin1String("/tmp/mdnsd")) && logger) logger->appendError(ErrorMessage::WarningLevel, ZConfLib::tr("%1 detected a file at /tmp/mdnsd, daemon startup will probably fail.") .arg(name())); diff --git a/src/libs/zeroconf/servicebrowser.cpp b/src/libs/zeroconf/servicebrowser.cpp index a6303268c11..575c1792fd7 100644 --- a/src/libs/zeroconf/servicebrowser.cpp +++ b/src/libs/zeroconf/servicebrowser.cpp @@ -663,7 +663,7 @@ extern "C" void DNSSD_API cServiceResolveReply(DNSServiceRef << ((size_t)context); ServiceGatherer *ctxGatherer = reinterpret_cast(context); if (ctxGatherer){ - if (ctxGatherer->currentService->fullName() != fullname){ + if (ctxGatherer->currentService->fullName() != QString::fromLocal8Bit(fullname)) { qDebug() << "ServiceBrowser " << ctxGatherer->serviceBrowser->serviceType << " for service " << ctxGatherer->currentService->name() << " ignoring resolve reply for " << fullname << " vs. " @@ -1078,7 +1078,7 @@ void ServiceGatherer::serviceResolveReply(DNSServiceFlags fl } currentService->m_interfaceNr = interfaceIndex; currentService->m_port = port; - if (hostName != hosttarget) { + if (hostName != QString::fromUtf8(hosttarget)) { hostName = QString::fromUtf8(hosttarget); if (!currentService->host()) currentService->m_host = new QHostInfo(); @@ -1224,7 +1224,7 @@ void ServiceGatherer::addrReply(DNSServiceFlags flags, serviceBrowser->updateFlowStatusForFlags(flags); if (!currentService->host()) currentService->m_host = new QHostInfo(); - if (currentService->host()->hostName() != hostname) { + if (currentService->host()->hostName() != QString::fromUtf8(hostname)) { if ((flags & kDNSServiceFlagsAdd) == 1) currentService->m_host->setHostName(QString::fromUtf8(hostname)); if (currentService->host()->addresses().isEmpty()) { @@ -1475,9 +1475,9 @@ void ServiceBrowserPrivate::browseReply(DNSServiceFlags flag QString newServiceName = QString::fromUtf8(serviceName); QString newType = serviceType; QString newDomain = domain; - if (serviceType != regtype) // discard? should not happen... + if (serviceType != QString::fromUtf8(regtype)) // discard? should not happen... newType = QString::fromUtf8(regtype); - if (domain != replyDomain) + if (domain != QString::fromUtf8(replyDomain)) domain = QString::fromUtf8(replyDomain); QString fullName = toFullNameC(serviceName, regtype, replyDomain); updateFlowStatusForFlags(flags); diff --git a/src/libs/zeroconf/zeroconf.pro b/src/libs/zeroconf/zeroconf.pro index 0d5c07b31cc..e07dd11a5a7 100644 --- a/src/libs/zeroconf/zeroconf.pro +++ b/src/libs/zeroconf/zeroconf.pro @@ -5,7 +5,7 @@ CONFIG += exceptions TARGET = zeroconf TEMPLATE = lib -DEFINES += ZEROCONF_LIBRARY +DEFINES += ZEROCONF_LIBRARY QT_NO_CAST_FROM_ASCII SOURCES += servicebrowser.cpp \ embeddedLib.cpp \ diff --git a/src/libs/zeroconf/zeroconf.qbs b/src/libs/zeroconf/zeroconf.qbs index 04274fd6f69..5ca90c5df66 100644 --- a/src/libs/zeroconf/zeroconf.qbs +++ b/src/libs/zeroconf/zeroconf.qbs @@ -8,7 +8,7 @@ QtcLibrary { Depends { name: "Qt.network" } cpp.includePaths: base.concat(".") - cpp.defines: base.concat("ZEROCONF_LIBRARY") + cpp.defines: base.concat(["ZEROCONF_LIBRARY", "QT_NO_CAST_FROM_ASCII"]) Properties { condition: qbs.targetOS == "windows"