Squash warning

This commit is contained in:
Sergey Lyubka committed 2025-03-29 18:59:01 +00:00
1 parent e2ee356a87
commit 40a2a8822f
2 files changed
+5 -3

No files matched your search

+3 -2
View File
@@ -4361,7 +4361,8 @@ static const uint8_t broadcast[] = {255, 255, 255, 255, 255, 255};
// RFC-2131 #4.3.6, #4.4.1; RFC-2132 #9.8 // RFC-2131 #4.3.6, #4.4.1; RFC-2132 #9.8
static void tx_dhcp_request_sel(struct mg_tcpip_if *ifp, uint32_t ip_req, static void tx_dhcp_request_sel(struct mg_tcpip_if *ifp, uint32_t ip_req,
uint32_t ip_srv) { uint32_t ip_srv) {
uint8_t extra = (ifp->enable_req_dns ? 1 : 0) + (ifp->enable_req_sntp ? 1 : 0); uint8_t extra = (uint8_t) ((ifp->enable_req_dns ? 1 : 0) +
(ifp->enable_req_sntp ? 1 : 0));
size_t len = strlen(ifp->dhcp_name); size_t len = strlen(ifp->dhcp_name);
size_t olen = 21 + len + extra + 2 + 1; // Total length of options size_t olen = 21 + len + extra + 2 + 1; // Total length of options
uint8_t *opts = alloca(olen), *p = opts; // Allocate options uint8_t *opts = alloca(olen), *p = opts; // Allocate options
@@ -4374,7 +4375,7 @@ static void tx_dhcp_request_sel(struct mg_tcpip_if *ifp, uint32_t ip_req,
if (ifp->enable_req_dns) *p++ = 6; // DNS if (ifp->enable_req_dns) *p++ = 6; // DNS
if (ifp->enable_req_sntp) *p++ = 42; // SNTP if (ifp->enable_req_sntp) *p++ = 42; // SNTP
*p++ = 255; // End of options *p++ = 255; // End of options
assert((size_t) (p - opts) < olen); // assert((size_t) (p - opts) < olen);
tx_dhcp(ifp, (uint8_t *) broadcast, 0, 0xffffffff, opts, olen, 0); tx_dhcp(ifp, (uint8_t *) broadcast, 0, 0xffffffff, opts, olen, 0);
MG_DEBUG(("DHCP req sent")); MG_DEBUG(("DHCP req sent"));
} }
+2 -1
View File
@@ -280,7 +280,8 @@ static const uint8_t broadcast[] = {255, 255, 255, 255, 255, 255};
// RFC-2131 #4.3.6, #4.4.1; RFC-2132 #9.8 // RFC-2131 #4.3.6, #4.4.1; RFC-2132 #9.8
static void tx_dhcp_request_sel(struct mg_tcpip_if *ifp, uint32_t ip_req, static void tx_dhcp_request_sel(struct mg_tcpip_if *ifp, uint32_t ip_req,
uint32_t ip_srv) { uint32_t ip_srv) {
uint8_t extra = (ifp->enable_req_dns ? 1 : 0) + (ifp->enable_req_sntp ? 1 : 0); uint8_t extra = (uint8_t) ((ifp->enable_req_dns ? 1 : 0) +
(ifp->enable_req_sntp ? 1 : 0));
size_t len = strlen(ifp->dhcp_name); size_t len = strlen(ifp->dhcp_name);
size_t olen = 21 + len + extra + 2 + 1; // Total length of options size_t olen = 21 + len + extra + 2 + 1; // Total length of options
uint8_t *opts = alloca(olen), *p = opts; // Allocate options uint8_t *opts = alloca(olen), *p = opts; // Allocate options