From: Guus Sliepen Date: Mon, 23 Sep 2019 12:12:28 +0000 (+0200) Subject: Fix varargs warning for catta_server_add_service(). X-Git-Url: http://git.meshlink.io/?p=catta;a=commitdiff_plain;h=b2b4639f998e3362a182953ba974520ac99de0fc;hp=08ac450b42b7533e97c02c02bbbef8946b9582fb Fix varargs warning for catta_server_add_service(). Promote the type of the port argument, which comes right before any variable arguments, to ensure va_start() doesn't run into undefined behaviour. The alternative would be to shuffle the arguments so that a pointer is the last non-variable argument, but that would break the ABI. --- diff --git a/include/catta/publish.h b/include/catta/publish.h index ac39c96..1ebedb6 100644 --- a/include/catta/publish.h +++ b/include/catta/publish.h @@ -114,7 +114,7 @@ int catta_server_add_service( const char *type, /**< DNS-SD type, e.g. "_http._tcp" */ const char *domain, const char *host, /**< Host name where this servcie resides, or NULL if on the local host */ - uint16_t port, /**< Port number of the service */ + unsigned int port, /**< Port number of the service */ ... /**< Text records, terminated by NULL */) CATTA_GCC_SENTINEL; /** Mostly identical to catta_server_add_service(), but takes an CattaStringList object for the TXT records. The CattaStringList object is copied. */ diff --git a/src/entry.c b/src/entry.c index afa972a..b408701 100644 --- a/src/entry.c +++ b/src/entry.c @@ -715,7 +715,7 @@ int catta_server_add_service( const char *type, const char *domain, const char *host, - uint16_t port, + unsigned int port, ... ){ va_list va;