From 511bbee5e4da8e71b5da8521a162941398ebfdba Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 12 Apr 2007 21:04:32 +0000 Subject: [PATCH] Improve compatibility with Bonjour's libdns_sd (Patch from Chris Rivera, closes #118) git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1409 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-compat-libdns_sd/compat.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/avahi-compat-libdns_sd/compat.c b/avahi-compat-libdns_sd/compat.c index 9d8ff1c..36bb84a 100644 --- a/avahi-compat-libdns_sd/compat.c +++ b/avahi-compat-libdns_sd/compat.c @@ -612,12 +612,10 @@ DNSServiceErrorType DNSSD_API DNSServiceBrowse( AVAHI_WARN_LINKAGE; - if (!ret_sdref) + if (!ret_sdref || !regtype) return kDNSServiceErr_BadParam; *ret_sdref = NULL; - assert(regtype); - if (interface == kDNSServiceInterfaceIndexLocalOnly || flags != 0) { AVAHI_WARN_UNSUPPORTED; return kDNSServiceErr_Unsupported; @@ -739,15 +737,10 @@ DNSServiceErrorType DNSSD_API DNSServiceResolve( AVAHI_WARN_LINKAGE; - if (!ret_sdref) + if (!ret_sdref || !name || !regtype || !domain || !callback) return kDNSServiceErr_BadParam; *ret_sdref = NULL; - assert(name); - assert(regtype); - assert(domain); - assert(callback); - if (interface == kDNSServiceInterfaceIndexLocalOnly || flags != 0) { AVAHI_WARN_UNSUPPORTED; return kDNSServiceErr_Unsupported; @@ -795,9 +788,8 @@ int DNSSD_API DNSServiceConstructFullName ( AVAHI_WARN_LINKAGE; - assert(fullName); - assert(regtype); - assert(domain); + if (!fullName || !regtype || !domain) + return -1; if (avahi_service_name_join(fullName, kDNSServiceMaxDomainName, service, regtype, domain) < 0) return -1; @@ -856,12 +848,10 @@ DNSServiceErrorType DNSSD_API DNSServiceEnumerateDomains( AVAHI_WARN_LINKAGE; - if (!ret_sdref) + if (!ret_sdref || !callback) return kDNSServiceErr_BadParam; *ret_sdref = NULL; - assert(callback); - if (interface == kDNSServiceInterfaceIndexLocalOnly || (flags != kDNSServiceFlagsBrowseDomains && flags != kDNSServiceFlagsRegistrationDomains)) { AVAHI_WARN_UNSUPPORTED; @@ -1100,14 +1090,14 @@ DNSServiceErrorType DNSSD_API DNSServiceRegister ( AVAHI_WARN_LINKAGE; - if (!ret_sdref) + if (!ret_sdref || !regtype) return kDNSServiceErr_BadParam; *ret_sdref = NULL; - if (!regtype) - return kDNSServiceErr_BadParam; - - assert(txtRecord || txtLen == 0); + if (!txtRecord) { + txtLen = 1; + txtRecord = ""; + } if (interface == kDNSServiceInterfaceIndexLocalOnly || flags) { AVAHI_WARN_UNSUPPORTED; -- 2.39.5