From 10dd330e3c6b0eca2df0a053f178a95e105f4da8 Mon Sep 17 00:00:00 2001 From: d00f <8052722+DrDoof@users.noreply.github.com> Date: Fri, 18 Sep 2026 02:39:52 +0200 Subject: [PATCH] httpd: subtract through a pointer of known type uip_appdata is void *, so p - uip_appdata subtracts pointers of different types. SDCC accepts it, C does not, and no host compiler will build the file for a unit test. Cast to the type the byte count is meant in; the generated firmware code is unchanged. --- httpd/httpd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/httpd/httpd.c b/httpd/httpd.c index 74c11148..aba33e40 100644 --- a/httpd/httpd.c +++ b/httpd/httpd.c @@ -559,7 +559,7 @@ static void handle_config_fragment(__xdata uint8_t *p) __xdata uint16_t frag_len; uint8_t taken; - frag_len = uip_len - (p - uip_appdata); + frag_len = uip_len - (p - (__xdata uint8_t *)uip_appdata); if (pre_acc + frag_len >= CONFIG_UPLOAD_BUF) { print_string("Configuration too large, aborting.\n"); config_upload = 0; @@ -589,7 +589,7 @@ static void handle_firmware_fragment(__xdata uint8_t *p) __xdata struct httpd_state * __xdata s = &(uip_conn->appstate); __xdata uint16_t frag_len, payload_start; - frag_len = uip_len - (p - uip_appdata); + frag_len = uip_len - (p - (__xdata uint8_t *)uip_appdata); if (pre_acc + frag_len >= CONFIG_UPLOAD_BUF) { print_string("Firmware upload header too large, aborting.\n"); config_upload = 0; @@ -684,7 +684,7 @@ static uint8_t post_body_take(__xdata uint8_t *p) send_bad_request(); return 0; } - have = uip_len - (p - uip_appdata); + have = uip_len - (p - (__xdata uint8_t *)uip_appdata); if (have >= content_length) { p[content_length] = NUL; return 1;