fix compiler warnings: -Wtype-limits (comparsion always false)

This commit is contained in:
[anp/hsw] 2024-08-03 10:32:53 +07:00
parent 1db0c81930
commit da15c82273
2 changed files with 4 additions and 10 deletions

View File

@ -74,7 +74,7 @@ static const char* eai_str(int r)
}
}
bool dom_valid(char *dom)
bool dom_valid(uint8_t *dom)
{
if (!dom || *dom=='.') return false;
for (; *dom; dom++)
@ -82,7 +82,7 @@ bool dom_valid(char *dom)
return false;
return true;
}
void invalid_domain_beautify(char *dom)
void invalid_domain_beautify(uint8_t *dom)
{
for (int i = 0; *dom && i < 64; i++, dom++)
if (*dom < 0x20 || *dom>0x7F) *dom = '?';
@ -238,7 +238,7 @@ static void *t_resolver(void *arg)
else
VLOG("wrong address family %s", s_ip);
}
else if (dom_valid(dom))
else if (dom_valid((uint8_t *)dom))
{
VLOG("resolving %s", dom);
for (i = 0; i < RESOLVER_EAGAIN_ATTEMPTS; i++)
@ -261,7 +261,7 @@ static void *t_resolver(void *arg)
{
char dom2[sizeof(dom)];
strcpy(dom2,dom);
invalid_domain_beautify(dom2);
invalid_domain_beautify((uint8_t *)dom2);
VLOG("invalid domain : %s", dom2);
}
interlocked_fprintf(is_ok ? glob.F_log_resolved : glob.F_log_failed,"%s\n",dom);

View File

@ -103,9 +103,6 @@ int hkdfExtract(SHAversion whichSha,
salt_len = USHAHashSize(whichSha);
memset(nullSalt, '\0', salt_len);
}
else if (salt_len < 0) {
return shaBadParam;
}
return hmac(whichSha, ikm, ikm_len, salt, salt_len, prk);
}
@ -154,9 +151,6 @@ int hkdfExpand(SHAversion whichSha, const uint8_t prk[], size_t prk_len,
info = (const unsigned char *)"";
info_len = 0;
}
else if (info_len < 0) {
return shaBadParam;
}
if (okm_len <= 0) return shaBadParam;
if (!okm) return shaBadParam;