Skip to contentSkip to conversation

grub-core/net/http.c: Fix gcc-13 errors relating to type signedness

PATCH Superseded Mate Kukri 2 participants 2 messages Nov 26, 2023 – Nov 29, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Mate Kukri

author
#0 lore raw

PATCH 1/1 grub-core/net/http.c: Fix gcc-13 errors relating to type signedness

Add explicit casts of HTTP_PORT to int to match the type of the port variable.

---
 grub-core/net/http.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
grub-core/net/http.c +2 -2
index df690acf6..d7b91c1f6 100644
@@ -405,9 +405,9 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
   grub_memcpy (ptr, "\r\n", 2);
 
   grub_dprintf ("http", "opening path %s on host %s TCP port %d\n",
-		data->filename, server, port ? port : HTTP_PORT);
+		data->filename, server, port ? port : (int) HTTP_PORT);
   data->sock = grub_net_tcp_open (server,
-				  port ? port : HTTP_PORT, http_receive,
+				  port ? port : (int) HTTP_PORT, http_receive,
 				  http_err, NULL,
 				  file);
   if (!data->sock)
Signature · 7 lines
2.39.2


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#1 lore raw
Quoted 13 lines · Mate Kukri

Add explicit casts of HTTP_PORT to int to match the type of the port variable.

---
 grub-core/net/http.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
grub-core/net/http.c +0 -0
index df690acf6..d7b91c1f6 100644

grub-core/net/http.c http_establish (struct grub_file *file, grub_off_t offset, int initial) · line 410

Quoted 8 lines
grub-core/net/http.c +2 -2
@@ -405,9 +405,9 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
   grub_memcpy (ptr, "\r\n", 2);
 
   grub_dprintf ("http", "opening path %s on host %s TCP port %d\n",
-		data->filename, server, port ? port : HTTP_PORT);
+		data->filename, server, port ? port : (int) HTTP_PORT);
   data->sock = grub_net_tcp_open (server,
-				  port ? port : HTTP_PORT, http_receive,
+				  port ? port : (int) HTTP_PORT, http_receive,

Why do not define HTTP_PORT as "#define HTTP_PORT ((grub_uint16_t) 80)"? However, then I would define port as grub_uint16_t too...

Daniel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel