BUILD: tree-wide: cast arguments to tolower/toupper to unsigned char (2)

Fix build warning on NetBSD by reapplying f278eec37a ("BUILD: tree-wide:
cast arguments to tolower/toupper to unsigned char").

This should fix issue #2551.
This commit is contained in:
Aurelien DARRAGON 2024-07-18 13:20:04 +02:00
parent fcd4bf54c8
commit d3d35f0fc6
7 changed files with 13 additions and 13 deletions

View File

@ -1192,7 +1192,7 @@ static inline void update_char_fingerprint(uint8_t *fp, char prev, char curr)
switch (prev) {
case 0: from = 28; break; // begin
case 'a'...'z': from = prev - 'a' + 1; break;
case 'A'...'Z': from = tolower(prev) - 'a' + 1; break;
case 'A'...'Z': from = tolower((unsigned char)prev) - 'a' + 1; break;
case '0'...'9': from = 27; break;
default: from = 28; break;
}
@ -1200,7 +1200,7 @@ static inline void update_char_fingerprint(uint8_t *fp, char prev, char curr)
switch (curr) {
case 0: to = 28; break; // end
case 'a'...'z': to = curr - 'a' + 1; break;
case 'A'...'Z': to = tolower(curr) - 'a' + 1; break;
case 'A'...'Z': to = tolower((unsigned char)curr) - 'a' + 1; break;
case '0'...'9': to = 27; break;
default: to = 28; break;
}

View File

@ -836,7 +836,7 @@ static void resolv_check_response(struct resolv_resolution *res)
/* convert the key to lookup in lower case */
for (i = 0 ; item->data.target[i] ; i++)
target[i] = tolower(item->data.target[i]);
target[i] = tolower((unsigned char)item->data.target[i]);
target[i] = 0;
node = ebis_lookup(&srvrq->named_servers, target);
@ -1810,7 +1810,7 @@ int resolv_dn_label_to_str(const char *dn, int dn_len, char *str, int str_len)
*ptr++ = '.';
/* copy the string at i+1 to lower case */
for (; sz > 0; sz--)
*(ptr++) = tolower(dn[++i]);
*(ptr++) = tolower((unsigned char)dn[++i]);
}
*ptr++ = '\0';
return (ptr - str);
@ -1850,7 +1850,7 @@ int resolv_str_to_dn_label(const char *str, int str_len, char *dn, int dn_len)
offset = i+1;
continue;
}
dn[i+1] = tolower(str[i]);
dn[i+1] = tolower((unsigned char)str[i]);
}
dn[offset] = i - offset;
dn[i+1] = '\0';

View File

@ -422,7 +422,7 @@ static void srv_state_srv_update(struct server *srv, int version, char **params)
* lookup is case sensitive but we don't care
*/
for (i = 0; tmp[i]; i++)
tmp[i] = tolower(tmp[i]);
tmp[i] = tolower((unsigned char)tmp[i]);
/* insert in tree and set the srvrq expiration date */
ebis_insert(&srv->srvrq->named_servers, &srv->host_dn);

View File

@ -345,7 +345,7 @@ int ssl_sock_switchctx_cbk(SSL *ssl, int *al, void *arg)
sni_lookup:
/* we need to transform this a NULL-ended string in lowecase */
for (i = 0; i < trash.size && i < servername_len; i++)
trash.area[i] = tolower(servername[i]);
trash.area[i] = tolower((unsigned char)servername[i]);
trash.area[i] = 0;
HA_RWLOCK_RDLOCK(SNI_LOCK, &s->sni_lock);
@ -630,7 +630,7 @@ int ssl_sock_switchctx_wolfSSL_cbk(WOLFSSL* ssl, void* arg)
/* we need to transform this into a NULL-ended string in lowecase */
for (i = 0; i < trash.size && servername[i] != '\0'; i++)
trash.area[i] = tolower(servername[i]);
trash.area[i] = tolower((unsigned char)servername[i]);
trash.area[i] = 0;
servername = trash.area;

View File

@ -1484,7 +1484,7 @@ smp_fetch_ssl_fc_ec(const struct arg *args, struct sample *smp, const char *kw,
int i;
for (i = 0; curve_name[i]; i++)
curve_name[i] = toupper(curve_name[i]);
curve_name[i] = toupper((unsigned char)curve_name[i]);
}
# else
nid = SSL_get_negotiated_group(ssl);

View File

@ -6260,10 +6260,10 @@ void update_word_fingerprint(uint8_t *fp, const char *word)
from = 28; // begin
for (p = word; *p; p++) {
c = tolower(*p);
c = tolower((unsigned char)*p);
switch(c) {
case 'a'...'z': to = c - 'a' + 1; break;
case 'A'...'Z': to = tolower(c) - 'a' + 1; break;
case 'A'...'Z': to = tolower((unsigned char )c) - 'a' + 1; break;
case '0'...'9': to = 27; break;
default: to = 28; break;
}

View File

@ -177,8 +177,8 @@ enum uri_normalizer_err uri_normalizer_percent_upper(const struct ist input, int
if (istlen(scanner) >= 2) {
if (ishex(istptr(scanner)[0]) && ishex(istptr(scanner)[1])) {
output = __istappend(output, current);
output = __istappend(output, toupper(istshift(&scanner)));
output = __istappend(output, toupper(istshift(&scanner)));
output = __istappend(output, toupper((unsigned char)istshift(&scanner)));
output = __istappend(output, toupper((unsigned char)istshift(&scanner)));
continue;
}
}