From e77f18727478ff7f5d135a11bb96d6f42c82d127 Mon Sep 17 00:00:00 2001 From: Emil Engler Date: Fri, 2 Apr 2021 21:02:12 +0200 Subject: sample: use unsigned short instead of int for port The C standard gurantees that an unsigned short is at least up to 65535 huge. Enough to store every TCP port. Also the parameter PORT is overgiven to the `htons()` function which assumes that the parameter is of type `uint16_t` which unsigned short is on most platforms. --- sample/hello-world.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sample') diff --git a/sample/hello-world.c b/sample/hello-world.c index a13e06af..f3b9b4d6 100644 --- a/sample/hello-world.c +++ b/sample/hello-world.c @@ -27,7 +27,7 @@ static const char MESSAGE[] = "Hello, World!\n"; -static const int PORT = 9995; +static const unsigned short PORT = 9995; static void listener_cb(struct evconnlistener *, evutil_socket_t, struct sockaddr *, int socklen, void *); -- cgit v1.2.1