[SV 57930] Cast char to unsigned char to call ctype functions

This cast was already done almost everywhere: fix some stragglers.

* src/load.c (load_file): Cast char to unsigned char.
* src/misc.c (strcasecmp, strncasecmp): [!POSIX] Ditto.
* src/dir.c (vms_hash): [VMS] Ditto.
* src/vms_progname.c (set_program_name): [VMS] Ditto.
* src/vms_jobs.c (posix_parse_dq): [VMS] Ditto.
(posix_parse_dollar): [VMS] Ditto.
(build_vms_cmd): [VMS] Ditto.
(child_execute_job): [VMS] Ditto.
This commit is contained in:
Paul Smith 2020-05-03 14:54:56 -04:00
parent c8a6263eb5
commit 1770540217
5 changed files with 16 additions and 16 deletions

View file

@ -175,7 +175,7 @@ vms_hash (const char *name)
while (*name)
{
unsigned char uc = *name;
unsigned char uc = (unsigned char) *name;
int g;
#ifdef HAVE_CASE_INSENSITIVE_FS
h = (h << 4) + (isupper (uc) ? tolower (uc) : uc);

View file

@ -195,7 +195,7 @@ load_file (const floc *flocp, const char **ldname, int noerror)
fp = *ldname;
else
++fp;
while (isalnum (*fp) || *fp == '_')
while (isalnum ((unsigned char) *fp) || *fp == '_')
*(p++) = *(fp++);
strcpy (p, SYMBOL_EXTENSION);
symname = new;

View file

@ -535,8 +535,8 @@ strcasecmp (const char *s1, const char *s2)
{
while (1)
{
int c1 = (int) *(s1++);
int c2 = (int) *(s2++);
int c1 = (unsigned char) *(s1++);
int c2 = (unsigned char) *(s2++);
if (isalpha (c1))
c1 = tolower (c1);
@ -560,8 +560,8 @@ strncasecmp (const char *s1, const char *s2, int n)
{
while (n-- > 0)
{
int c1 = (int) *(s1++);
int c2 = (int) *(s2++);
int c1 = (unsigned char) *(s1++);
int c2 = (unsigned char) *(s2++);
if (isalpha (c1))
c1 = tolower (c1);

View file

@ -409,7 +409,7 @@ set_program_name (const char *argv0)
int i;
i = 1;
while (isdigit (lastdot[i])) {
while (isdigit ((unsigned char) lastdot[i])) {
i++;
}
if (lastdot[i] == 0) {

View file

@ -367,7 +367,7 @@ posix_parse_dq (struct token_info *token)
}
INC_TOKEN_LEN_OR_BREAK;
}
else if (*p == '$' && isalpha (p[1]))
else if (*p == '$' && isalpha ((unsigned char) p[1]))
{
/* A symbol we should be able to substitute */
*q++ = '\'';
@ -506,7 +506,7 @@ posix_parse_dollar (struct token_info *token)
*q++ = '\'';
INC_TOKEN_LEN_OR_RETURN (p);
while ((isalnum (*p)) || (*p == '_'))
while ((isalnum ((unsigned char) *p)) || (*p == '_'))
{
*q++ = *p++;
INC_TOKEN_LEN_OR_BREAK;
@ -707,7 +707,7 @@ build_vms_cmd (char **cmd_tokens,
}
/* Optional whitespace */
if (isspace (cmd_tokens[cmd_tkn_index][0]))
if (isspace ((unsigned char) cmd_tokens[cmd_tkn_index][0]))
{
strcpy (&cmd[cmd_len], cmd_tokens[cmd_tkn_index]);
cmd_len += strlen (cmd_tokens[cmd_tkn_index]);
@ -789,7 +789,7 @@ build_vms_cmd (char **cmd_tokens,
if (cmd_tkn_index == append_token)
{
free (cmd_tokens[cmd_tkn_index++]);
if (isspace (cmd_tokens[cmd_tkn_index][0]))
if (isspace ((unsigned char) cmd_tokens[cmd_tkn_index][0]))
free (cmd_tokens[cmd_tkn_index++]);
free (cmd_tokens[cmd_tkn_index++]);
}
@ -987,7 +987,7 @@ child_execute_job (struct childbase *child, int good_stdin UNUSED, char *argv)
/* TODO: Should we diagnose if paren_level goes negative? */
break;
case '&':
if (isalpha (p[1]) && !vms_unix_simulation)
if (isalpha ((unsigned char) p[1]) && !vms_unix_simulation)
{
/* VMS symbol substitution */
p = parse_text (&token, 0);
@ -1061,7 +1061,7 @@ child_execute_job (struct childbase *child, int good_stdin UNUSED, char *argv)
UPDATE_TOKEN;
break;
case ':':
if ((p[1] == 0) || isspace (p[1]))
if ((p[1] == 0) || isspace ((unsigned char) p[1]))
{
/* Unix Null command - treat as comment until next command */
unix_echo_cmd = 0;
@ -1115,7 +1115,7 @@ child_execute_job (struct childbase *child, int good_stdin UNUSED, char *argv)
break;
default:
/* Skip repetitive whitespace */
if (isspace (*p))
if (isspace ((unsigned char) *p))
{
p = parse_char (&token, 1);
@ -1125,7 +1125,7 @@ child_execute_job (struct childbase *child, int good_stdin UNUSED, char *argv)
token_str[0] = ' ';
UPDATE_TOKEN;
while (isspace (*p))
while (isspace ((unsigned char) *p))
p++;
if (assignment_hack != 0)
assignment_hack++;
@ -1176,7 +1176,7 @@ child_execute_job (struct childbase *child, int good_stdin UNUSED, char *argv)
char * raw_append_file;
file_token = append_token;
file_token++;
if (isspace (cmd_tokens[file_token][0]))
if (isspace ((unsigned char) cmd_tokens[file_token][0]))
file_token++;
raw_append_file = vmsify (cmd_tokens[file_token], 0);
/* VMS DCL needs a trailing dot if null file extension */