misc: fix unsigned int usage for ctype.h functions

Reported-by: "Yuriy M. Kaminskiy" <yumkam@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2016-10-26 10:13:03 +02:00
parent 82e8ddacb4
commit bae57b5a3c
5 changed files with 8 additions and 8 deletions

View File

@ -193,10 +193,10 @@ static int get_partno_from_device(char *partition, dev_t devno)
sz = strlen(partition);
p = partition + sz - 1;
if (!isdigit((unsigned int) *p))
if (!isdigit((unsigned char) *p))
goto err;
while (isdigit((unsigned int) *(p - 1))) p--;
while (isdigit((unsigned char) *(p - 1))) p--;
errno = 0;
partno = strtol(p, &end, 10);

View File

@ -1601,9 +1601,9 @@ static int gpt_entry_attrs_from_string(
p += sizeof(GPT_ATTRSTR_NOBLOCK) - 1;
/* GUID:<bit> as well as <bit> */
} else if (isdigit((unsigned int) *p)
} else if (isdigit((unsigned char) *p)
|| (strncmp(p, "GUID:", 5) == 0
&& isdigit((unsigned int) *(p + 5)))) {
&& isdigit((unsigned char) *(p + 5)))) {
char *end = NULL;
if (*p == 'G')

View File

@ -571,7 +571,7 @@ static int valid_pwd(const char *str)
const char *p;
for (p = str; p && *p; p++)
if (!isalnum((unsigned int) *p))
if (!isalnum((unsigned char) *p))
return 0;
return p > str ? 1 : 0;
}

View File

@ -685,7 +685,7 @@ static int valid_structured_data_id(const char *str)
for (p = str; p < at; p++) {
if (*p == '[' || *p == '=' || *p == '"' || *p == '@')
return 0;
if (isblank((unsigned int) *p) || iscntrl((unsigned int) *p))
if (isblank((unsigned char) *p) || iscntrl((unsigned char) *p))
return 0;
}
return 1;

View File

@ -641,8 +641,8 @@ static void safe_fwrite(const char *buf, size_t size, int indent, FILE *out)
i += len - 1;
#else
len = 1;
if (!isprint((unsigned int) *p) &&
!isspace((unsigned int) *p)) /* non-printable */
if (!isprint((unsigned char) *p) &&
!isspace((unsigned char) *p)) /* non-printable */
hex = 1;
#endif
if (hex)