From 6fe7f6c55df64dbcb3fe959bcf962e81d0b71fb4 Mon Sep 17 00:00:00 2001 From: Yangbo Lu Date: Tue, 24 Sep 2024 08:16:23 +0200 Subject: [PATCH] net: lib: http_server: fix snprintk issue of size_t The size_t type may vary from machines. Current snprintk code was causing below build issue on arm64. error: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'size_t' {aka 'long unsigned int'} [-Werror=format=]. Signed-off-by: Yangbo Lu --- subsys/net/lib/http/http_server_http1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/lib/http/http_server_http1.c b/subsys/net/lib/http/http_server_http1.c index ab98a1e85c3925..b8ffb53ebada65 100644 --- a/subsys/net/lib/http/http_server_http1.c +++ b/subsys/net/lib/http/http_server_http1.c @@ -237,7 +237,7 @@ static int http1_dynamic_response(struct http_client_ctx *client, struct http_re /* Send body data if provided */ if (rsp->body != NULL && rsp->body_len > 0) { - ret = snprintk(tmp, sizeof(tmp), "%x\r\n", rsp->body_len); + ret = snprintk(tmp, sizeof(tmp), "%zx\r\n", rsp->body_len); ret = http_server_sendall(client, tmp, ret); if (ret < 0) { return ret;