From b2b4639f998e3362a182953ba974520ac99de0fc Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Mon, 23 Sep 2019 14:12:28 +0200 Subject: [PATCH] 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. --- include/catta/publish.h | 2 +- src/entry.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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; -- 2.39.5