From 847c48556bc8f7c17bd201ced9381e2fbb2d5d09 Mon Sep 17 00:00:00 2001 From: tpearson Date: Thu, 22 Jul 2010 00:17:47 +0000 Subject: Attempt to fix compilation when Avahi is not available git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1152784 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- dnssd/servicebrowser.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'dnssd/servicebrowser.cpp') diff --git a/dnssd/servicebrowser.cpp b/dnssd/servicebrowser.cpp index 542580c1b..20e1b11e0 100644 --- a/dnssd/servicebrowser.cpp +++ b/dnssd/servicebrowser.cpp @@ -26,7 +26,9 @@ #include "responder.h" #include "query.h" #include "servicebrowser.h" +#ifdef HAVE_DNSSD #include +#endif #include namespace DNSSD @@ -34,10 +36,10 @@ namespace DNSSD const QString ServiceBrowser::AllServices = "_services._dns-sd._udp"; -class ServiceBrowserPrivate +class ServiceBrowserPrivate { -public: - ServiceBrowserPrivate() : m_running(false) +public: + ServiceBrowserPrivate() : m_running(false) {} QValueList m_services; QValueList m_duringResolve; @@ -82,12 +84,16 @@ ServiceBrowser::ServiceBrowser(const QString& type,const QString& domain,int fla const ServiceBrowser::State ServiceBrowser::isAvailable() { +#ifdef HAVE_DNSSD AvahiClientState s = Responder::self().state(); #ifdef AVAHI_API_0_6 return (s==AVAHI_CLIENT_FAILURE) ? Stopped : Working; #else return (s==AVAHI_CLIENT_S_INVALID || s==AVAHI_CLIENT_DISCONNECTED) ? Stopped : Working; -#endif +#endif +#else + return Unsupported; +#endif } ServiceBrowser::~ ServiceBrowser() { @@ -158,7 +164,7 @@ void ServiceBrowser::removeDomain(const QString& domain) { while (d->resolvers[domain]) d->resolvers.remove(domain); QValueList::Iterator it = d->m_services.begin(); - while (it!=d->m_services.end()) + while (it!=d->m_services.end()) // use section to skip possible trailing dot if ((*it)->domain().section('.',0) == domain.section('.',0)) { emit serviceRemoved(*it); @@ -209,7 +215,7 @@ void ServiceBrowser::virtual_hook(int, void*) QValueList::Iterator ServiceBrowser::findDuplicate(RemoteService::Ptr src) { QValueList::Iterator itEnd = d->m_services.end(); - for (QValueList::Iterator it = d->m_services.begin(); it!=itEnd; ++it) + for (QValueList::Iterator it = d->m_services.begin(); it!=itEnd; ++it) if ((src->type()==(*it)->type()) && (src->serviceName()==(*it)->serviceName()) && (src->domain() == (*it)->domain())) return it; return itEnd; -- cgit v1.2.1