Skip to content

Commit

Permalink
net: lib: http_server: fix snprintk issue of size_t
Browse files Browse the repository at this point in the history
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 <yangbo.lu@nxp.com>
  • Loading branch information
yangbolu1991 authored and nashif committed Sep 25, 2024
1 parent 99e6280 commit 6fe7f6c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion subsys/net/lib/http/http_server_http1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6fe7f6c

Please sign in to comment.