From 62d91b0bc5180e4bf832086b6b397f9753948b65 Mon Sep 17 00:00:00 2001 From: Gustavo Garcia Date: Tue, 17 Jun 2025 15:25:26 +0200 Subject: [PATCH] Fix compiler warnings in source files (#1704) Two compiler warnings were addressed: * In `src/apps/relay/http_server.c`, line 77, a `-Wpointer-sign` warning occurred when initializing a `char *` with the `uint8_t *` return type of `ioa_network_buffer_data()`. * An explicit cast `(char *)` was added to `ioa_network_buffer_data(nbh_http)` to resolve the type mismatch. * In `src/apps/relay/acme.c`, line 59, a `-Wchar-subscripts` warning was present because a `char` variable `c` was used as an array index. `char` can be signed, potentially leading to negative indices. * Initially, `c` was cast to `(unsigned char)` at the point of use: `A[(unsigned char)c]`. * This was later improved by changing the declaration of `c` from `const char` to `const unsigned char c = req[k] --------- Co-authored-by: Cursor Agent --- src/apps/relay/acme.c | 2 +- src/apps/relay/http_server.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apps/relay/acme.c b/src/apps/relay/acme.c index 81a12fe..3adba31 100644 --- a/src/apps/relay/acme.c +++ b/src/apps/relay/acme.c @@ -55,7 +55,7 @@ static int is_acme_req(char *req, size_t len) { } // finally check for allowed chars for (size_t k = GET_ACME_PREFIX_LEN; k < i; k++) { - const char c = req[k]; + const unsigned char c = req[k]; if ((c > 127) || (A[c] == ' ')) { return -3; } diff --git a/src/apps/relay/http_server.c b/src/apps/relay/http_server.c index 015d1fb..7e0bb52 100644 --- a/src/apps/relay/http_server.c +++ b/src/apps/relay/http_server.c @@ -74,7 +74,7 @@ static void write_http_echo(ioa_socket_handle s) { TURN_SOFTWARE, strlen(content_http), content_http); ioa_network_buffer_handle nbh_http = ioa_network_buffer_allocate(s->e); - char *data = ioa_network_buffer_data(nbh_http); + char *data = (char *)ioa_network_buffer_data(nbh_http); strcpy(data, data_http); ioa_network_buffer_set_size(nbh_http, strlen(data_http));