mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Cast to unsigned char when using ctype macros
This commit is contained in:
parent
836480951e
commit
88a6dd1e81
2 changed files with 12 additions and 12 deletions
|
|
@ -871,7 +871,7 @@ char* strpolish(char* s)
|
|||
char* i = s;
|
||||
|
||||
while (*i) {
|
||||
if (isspace(*i) || !isprint(*i))
|
||||
if (isspace((unsigned char)*i) || !isprint((unsigned char)*i))
|
||||
*i = ' ';
|
||||
++i;
|
||||
}
|
||||
|
|
@ -1180,7 +1180,7 @@ int mkancestor(const char* file)
|
|||
|
||||
#ifdef _WIN32
|
||||
/* if it's a drive specification like "C:" */
|
||||
if (isalpha(dir[0]) && dir[1] == ':' && dir[2] == 0) {
|
||||
if (isalpha((unsigned char)dir[0]) && dir[1] == ':' && dir[2] == 0) {
|
||||
/* nothing more to do */
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1799,9 +1799,9 @@ char* strdup_nofail(const char* str)
|
|||
static int smatch(const char* str, const char* pattern)
|
||||
{
|
||||
while (*pattern) {
|
||||
if (isspace(*pattern)) {
|
||||
if (isspace((unsigned char)*pattern)) {
|
||||
++pattern;
|
||||
while (isspace(*str))
|
||||
while (isspace((unsigned char)*str))
|
||||
++str;
|
||||
} else if (*pattern == *str) {
|
||||
++pattern;
|
||||
|
|
@ -1961,7 +1961,7 @@ int smartctl_attribute(FILE* f, const char* file, const char* name, struct smart
|
|||
log_tag("smartctl:%s:%s:out: %s\n", file, name, s);
|
||||
|
||||
/* skip initial spaces */
|
||||
while (isspace(*s))
|
||||
while (isspace((unsigned char)*s))
|
||||
++s;
|
||||
|
||||
if (*s == 0) {
|
||||
|
|
|
|||
|
|
@ -609,7 +609,7 @@ static int tagread(const char* path, const char* tag, char* value, size_t value_
|
|||
|
||||
/* start with a space */
|
||||
if (p != buf) {
|
||||
if (!isspace(*p))
|
||||
if (!isspace((unsigned char)*p))
|
||||
continue;
|
||||
++p;
|
||||
}
|
||||
|
|
@ -636,7 +636,7 @@ static int tagread(const char* path, const char* tag, char* value, size_t value_
|
|||
|
||||
/* terminate at the first space */
|
||||
e = i;
|
||||
while (*e != 0 && !isspace(*e))
|
||||
while (*e != 0 && !isspace((unsigned char)*e))
|
||||
++e;
|
||||
*e = 0;
|
||||
|
||||
|
|
@ -1533,7 +1533,7 @@ static dev_t devread(const char* path)
|
|||
}
|
||||
|
||||
mi = strtoul(e + 1, &e, 10);
|
||||
if (*e != 0 && !isspace(*e)) {
|
||||
if (*e != 0 && !isspace((unsigned char)*e)) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal(EEXTERNAL, "Invalid format in '%s' for '%s'.\n", path, buf);
|
||||
return 0;
|
||||
|
|
@ -1675,17 +1675,17 @@ static int devstat(dev_t device, uint64_t* count)
|
|||
unsigned long long v;
|
||||
|
||||
/* skip spaces */
|
||||
while (*i && isspace(*i))
|
||||
while (*i && isspace((unsigned char)*i))
|
||||
++i;
|
||||
|
||||
/* read digits */
|
||||
n = i;
|
||||
while (*i && isdigit(*i))
|
||||
while (*i && isdigit((unsigned char)*i))
|
||||
++i;
|
||||
|
||||
if (i == n) /* if no digit, abort */
|
||||
break;
|
||||
if (*i == 0 || !isspace(*i)) /* if no space, abort */
|
||||
if (*i == 0 || !isspace((unsigned char)*i)) /* if no space, abort */
|
||||
break;
|
||||
*i++ = 0; /* put a terminator */
|
||||
|
||||
|
|
@ -2617,7 +2617,7 @@ int ambient_temperature(void)
|
|||
continue;
|
||||
|
||||
temp = strtol(value, &e, 10) / 1000;
|
||||
if (*e != 0 && !isspace(*e))
|
||||
if (*e != 0 && !isspace((unsigned char)*e))
|
||||
continue;
|
||||
|
||||
/* cut the file name at "_input" */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue