From 854f901f491ccda79aee11edc3d59109cb229d28 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 26 Oct 2005 21:27:40 +0000 Subject: * avahi-utils: replace python avahi-browse with a version written in C. * remove -Wunused from GCC command line and use "unused" attribute instead * remove AVAHI_CLIENT_S_FAILURE and AVAHI_CLIENT_S_INVALID since these event's are never forwarded to the client anyway * make use of AVAHI_GCC_NORETURN * really send eror code with StateChange DBUS signals * ignore EINTR in avahi_simple_poll_loop() git-svn-id: file:///home/lennart/svn/public/avahi/trunk@879 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-compat-libdns_sd/compat.c | 25 +++------- avahi-compat-libdns_sd/txt-test.c | 3 +- avahi-compat-libdns_sd/unsupported.c | 90 ++++++++++++++++++------------------ 3 files changed, 55 insertions(+), 63 deletions(-) (limited to 'avahi-compat-libdns_sd') diff --git a/avahi-compat-libdns_sd/compat.c b/avahi-compat-libdns_sd/compat.c index a06ca68..afc9214 100644 --- a/avahi-compat-libdns_sd/compat.c +++ b/avahi-compat-libdns_sd/compat.c @@ -431,12 +431,12 @@ void DNSSD_API DNSServiceRefDeallocate(DNSServiceRef sdref) { static void service_browser_callback( AvahiServiceBrowser *b, AvahiIfIndex interface, - AvahiProtocol protocol, + AVAHI_GCC_UNUSED AvahiProtocol protocol, AvahiBrowserEvent event, const char *name, const char *type, const char *domain, - AvahiLookupResultFlags flags, + AVAHI_GCC_UNUSED AvahiLookupResultFlags flags, void *userdata) { DNSServiceRef sdref = userdata; @@ -476,11 +476,6 @@ static void generic_client_callback(AvahiClient *s, AvahiClientState state, void assert(sdref->n_ref >= 1); switch (state) { - case AVAHI_CLIENT_S_FAILURE: - - error = map_error(avahi_client_errno(s)); - - /* Fall through */ case AVAHI_CLIENT_DISCONNECTED: @@ -495,7 +490,6 @@ static void generic_client_callback(AvahiClient *s, AvahiClientState state, void case AVAHI_CLIENT_S_RUNNING: case AVAHI_CLIENT_S_COLLISION: - case AVAHI_CLIENT_S_INVALID: case AVAHI_CLIENT_S_REGISTERING: break; } @@ -563,16 +557,16 @@ finish: static void service_resolver_callback( AvahiServiceResolver *r, AvahiIfIndex interface, - AvahiProtocol protocol, + AVAHI_GCC_UNUSED AvahiProtocol protocol, AvahiResolverEvent event, const char *name, const char *type, const char *domain, const char *host_name, - const AvahiAddress *a, + AVAHI_GCC_UNUSED const AvahiAddress *a, uint16_t port, AvahiStringList *txt, - AvahiLookupResultFlags flags, + AVAHI_GCC_UNUSED AvahiLookupResultFlags flags, void *userdata) { DNSServiceRef sdref = userdata; @@ -695,10 +689,10 @@ int DNSSD_API DNSServiceConstructFullName ( static void domain_browser_callback( AvahiDomainBrowser *b, AvahiIfIndex interface, - AvahiProtocol protocol, + AVAHI_GCC_UNUSED AvahiProtocol protocol, AvahiBrowserEvent event, const char *domain, - AvahiLookupResultFlags flags, + AVAHI_GCC_UNUSED AvahiLookupResultFlags flags, void *userdata) { DNSServiceRef sdref = userdata; @@ -867,10 +861,6 @@ static void reg_client_callback(AvahiClient *s, AvahiClientState state, void* us reg_report_error(sdref, kDNSServiceErr_Unknown); break; - case AVAHI_CLIENT_S_FAILURE: - reg_report_error(sdref, map_error(avahi_client_errno(s))); - break; - case AVAHI_CLIENT_S_RUNNING: { int ret; @@ -909,7 +899,6 @@ static void reg_client_callback(AvahiClient *s, AvahiClientState state, void* us break; - case AVAHI_CLIENT_S_INVALID: case AVAHI_CLIENT_S_REGISTERING: /* Ignore */ break; diff --git a/avahi-compat-libdns_sd/txt-test.c b/avahi-compat-libdns_sd/txt-test.c index 61f1292..5999dd4 100644 --- a/avahi-compat-libdns_sd/txt-test.c +++ b/avahi-compat-libdns_sd/txt-test.c @@ -27,6 +27,7 @@ #include #include +#include #include "dns_sd.h" static void hexdump(const void* p, size_t size) { @@ -64,7 +65,7 @@ static void hexdump(const void* p, size_t size) { } -int main(int argc, char *argv[]) { +int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { const char *r; TXTRecordRef ref; uint8_t l; diff --git a/avahi-compat-libdns_sd/unsupported.c b/avahi-compat-libdns_sd/unsupported.c index 73e4697..0e08ad6 100644 --- a/avahi-compat-libdns_sd/unsupported.c +++ b/avahi-compat-libdns_sd/unsupported.c @@ -23,22 +23,24 @@ #include #endif +#include + #include "dns_sd.h" #include "warn.h" DNSServiceErrorType DNSSD_API DNSServiceRegisterRecord ( - DNSServiceRef sdRef, - DNSRecordRef *RecordRef, - DNSServiceFlags flags, - uint32_t interfaceIndex, - const char *fullname, - uint16_t rrtype, - uint16_t rrclass, - uint16_t rdlen, - const void *rdata, - uint32_t ttl, - DNSServiceRegisterRecordReply callBack, - void *context) { + AVAHI_GCC_UNUSED DNSServiceRef sdRef, + AVAHI_GCC_UNUSED DNSRecordRef *RecordRef, + AVAHI_GCC_UNUSED DNSServiceFlags flags, + AVAHI_GCC_UNUSED uint32_t interfaceIndex, + AVAHI_GCC_UNUSED const char *fullname, + AVAHI_GCC_UNUSED uint16_t rrtype, + AVAHI_GCC_UNUSED uint16_t rrclass, + AVAHI_GCC_UNUSED uint16_t rdlen, + AVAHI_GCC_UNUSED const void *rdata, + AVAHI_GCC_UNUSED uint32_t ttl, + AVAHI_GCC_UNUSED DNSServiceRegisterRecordReply callBack, + AVAHI_GCC_UNUSED void *context) { AVAHI_WARN_UNSUPPORTED; @@ -46,14 +48,14 @@ DNSServiceErrorType DNSSD_API DNSServiceRegisterRecord ( } DNSServiceErrorType DNSSD_API DNSServiceQueryRecord ( - DNSServiceRef *sdRef, - DNSServiceFlags flags, - uint32_t interfaceIndex, - const char *fullname, - uint16_t rrtype, - uint16_t rrclass, - DNSServiceQueryRecordReply callBack, - void *context) { + AVAHI_GCC_UNUSED DNSServiceRef *sdRef, + AVAHI_GCC_UNUSED DNSServiceFlags flags, + AVAHI_GCC_UNUSED uint32_t interfaceIndex, + AVAHI_GCC_UNUSED const char *fullname, + AVAHI_GCC_UNUSED uint16_t rrtype, + AVAHI_GCC_UNUSED uint16_t rrclass, + AVAHI_GCC_UNUSED DNSServiceQueryRecordReply callBack, + AVAHI_GCC_UNUSED void *context) { AVAHI_WARN_UNSUPPORTED; @@ -61,33 +63,33 @@ DNSServiceErrorType DNSSD_API DNSServiceQueryRecord ( } void DNSSD_API DNSServiceReconfirmRecord ( - DNSServiceFlags flags, - uint32_t interfaceIndex, - const char *fullname, - uint16_t rrtype, - uint16_t rrclass, - uint16_t rdlen, - const void *rdata) { + AVAHI_GCC_UNUSED DNSServiceFlags flags, + AVAHI_GCC_UNUSED uint32_t interfaceIndex, + AVAHI_GCC_UNUSED const char *fullname, + AVAHI_GCC_UNUSED uint16_t rrtype, + AVAHI_GCC_UNUSED uint16_t rrclass, + AVAHI_GCC_UNUSED uint16_t rdlen, + AVAHI_GCC_UNUSED const void *rdata) { AVAHI_WARN_UNSUPPORTED; return; } -DNSServiceErrorType DNSSD_API DNSServiceCreateConnection(DNSServiceRef *sdRef) { +DNSServiceErrorType DNSSD_API DNSServiceCreateConnection(AVAHI_GCC_UNUSED DNSServiceRef *sdRef) { AVAHI_WARN_UNSUPPORTED; return kDNSServiceErr_Unsupported; } DNSServiceErrorType DNSSD_API DNSServiceAddRecord( - DNSServiceRef sdRef, - DNSRecordRef *RecordRef, - DNSServiceFlags flags, - uint16_t rrtype, - uint16_t rdlen, - const void *rdata, - uint32_t ttl) { + AVAHI_GCC_UNUSED DNSServiceRef sdRef, + AVAHI_GCC_UNUSED DNSRecordRef *RecordRef, + AVAHI_GCC_UNUSED DNSServiceFlags flags, + AVAHI_GCC_UNUSED uint16_t rrtype, + AVAHI_GCC_UNUSED uint16_t rdlen, + AVAHI_GCC_UNUSED const void *rdata, + AVAHI_GCC_UNUSED uint32_t ttl) { AVAHI_WARN_UNSUPPORTED; @@ -95,12 +97,12 @@ DNSServiceErrorType DNSSD_API DNSServiceAddRecord( } DNSServiceErrorType DNSSD_API DNSServiceUpdateRecord( - DNSServiceRef sdRef, - DNSRecordRef RecordRef, - DNSServiceFlags flags, - uint16_t rdlen, - const void *rdata, - uint32_t ttl) { + AVAHI_GCC_UNUSED DNSServiceRef sdRef, + AVAHI_GCC_UNUSED DNSRecordRef RecordRef, + AVAHI_GCC_UNUSED DNSServiceFlags flags, + AVAHI_GCC_UNUSED uint16_t rdlen, + AVAHI_GCC_UNUSED const void *rdata, + AVAHI_GCC_UNUSED uint32_t ttl) { AVAHI_WARN_UNSUPPORTED; @@ -108,9 +110,9 @@ DNSServiceErrorType DNSSD_API DNSServiceUpdateRecord( } DNSServiceErrorType DNSSD_API DNSServiceRemoveRecord( - DNSServiceRef sdRef, - DNSRecordRef RecordRef, - DNSServiceFlags flags) { + AVAHI_GCC_UNUSED DNSServiceRef sdRef, + AVAHI_GCC_UNUSED DNSRecordRef RecordRef, + AVAHI_GCC_UNUSED DNSServiceFlags flags) { AVAHI_WARN_UNSUPPORTED; -- cgit