]> git.meshlink.io Git - catta/commitdiff
Improve compatibility with Bonjour's libdns_sd (Patch from Chris Rivera, closes ...
authorLennart Poettering <lennart@poettering.net>
Thu, 12 Apr 2007 21:04:32 +0000 (21:04 +0000)
committerLennart Poettering <lennart@poettering.net>
Thu, 12 Apr 2007 21:04:32 +0000 (21:04 +0000)
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1409 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

avahi-compat-libdns_sd/compat.c

index 9d8ff1c00e281bffbf161698880380a82ee9f0d7..36bb84a5784407afbe2d03cdaf4467a31211d945 100644 (file)
@@ -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;