Silence some compiler warnings from the NetBSD build

This commit is contained in:
dmiller 2026-08-20 17:40:54 +00:00
parent b8032c2d28
commit c1086f1e15
6 changed files with 8 additions and 12 deletions

View file

@ -133,12 +133,13 @@ eth_get(eth_t *e, eth_addr_t *ea)
if (addr_ston((struct sockaddr *)sdl, &ha) == 0)
break;
}
free(buf);
if (p >= buf + len) {
free(buf);
errno = ESRCH;
return (-1);
}
free(buf);
memcpy(ea, &ha.addr_eth, sizeof(*ea));
return (0);

View file

@ -1164,8 +1164,6 @@ bool DNS::ResolverImpl::process_result(const std::string &name, const DNS::Recor
}
const struct sockaddr_storage *ss = NULL;
const DNS::A_Record *a_rec = NULL;
sockaddr_storage ip;
ip.ss_family = AF_UNSPEC;
switch (reqt->type) {
case DNS::A:
case DNS::AAAA:
@ -1305,9 +1303,6 @@ void DNS::ResolverImpl::handle_read(nsock_pool nsp, nsock_event evt, dns_server
return;
}
sockaddr_storage ip;
ip.ss_family = AF_UNSPEC;
for(std::list<DNS::Answer>::const_iterator it = p.answers.begin();
it != p.answers.end(); ++it )
{

View file

@ -229,10 +229,10 @@ int parse_ip_options(const char *txt, u8 *data, int datalen, int* firsthopoff, i
case SLASH:
// parse \x00 string
if(*c == 'x'){// just ignore this char
base = 16;
base = 16;
break;
}
if(isxdigit(*c)){
if(isxdigit((unsigned char)*c)){
strtolbyte = strtol(c, &n, base);
if((strtolbyte < 0) || (strtolbyte > 255)){
if(errstr) Snprintf(errstr, errstrlen, "invalid ipv4 address format");

View file

@ -1098,7 +1098,7 @@ static const char *parse_http_version(const char *s, enum http_version *version)
/* Any version is accepted and not a parse error,
* but only 1.0 and 1.1 are understood. */
q = p;
while (*q && (isdigit(*q) || (*q == '.' && dot++ == 0))) {
while (*q && (isdigit((unsigned char)*q) || (*q == '.' && dot++ == 0))) {
q++;
}
if (*q != '\0' && *q != ' ' && !is_crlf(q)) {

View file

@ -298,11 +298,11 @@ static int parse_uri(const char *proxystr, const char *end, struct uri *uri) {
/* Scheme, section 3.1. */
p = proxystr;
if (!isalpha(*p))
if (!isalpha((unsigned char)*p))
goto fail;
q = p;
while (isalpha(*q) || isdigit(*q) || *q == '+' || *q == '-' || *q == '.') {
while (isalpha((unsigned char)*q) || isdigit((unsigned char)*q) || *q == '+' || *q == '-' || *q == '.') {
q++;
if (q >= end)
goto fail;

View file

@ -90,7 +90,7 @@ class StringPoolItem {
// asdfq <> asdf
bool operator< (const StringPoolItem& other) const {
return this->len < other.len || this->len == other.len && memcmp(this->str, other.str, other.len) < 0;
return this->len < other.len || (this->len == other.len && memcmp(this->str, other.str, other.len) < 0);
}
};