for (p = buf;;) {
/* Skip whitespace. */
- while (*p && isspace(*p))
+ while (*p && isspace(_UC(*p)))
p++;
if (!*p)
break;
p++;
*p++ = '\0';
} else {
- while (*p && !isspace(*p))
+ while (*p && !isspace(_UC(*p)))
p++;
if (*p)
*p++ = '\0';
# define uintmax_t unsigned long
# endif
+/*
+ * quick macro when you need to pass an unsigned char instead of a char.
+ * this is true for some implementations of the is*() functions, for
+ * example.
+ */
+#define _UC(c) ((unsigned char)(c))
+
int app_RAND_load_file(const char *file, int dont_warn);
int app_RAND_write_file(const char *file);
/*
goto end;
}
for ( ; *p; p++) {
- if (!isxdigit(*p)) {
+ if (!isxdigit(_UC(*p))) {
BIO_printf(bio_err,
"entry %d: bad char 0%o '%c' in serial number\n",
i + 1, *p, *p);
for (; *p; p++) {
if (*p != '%')
*out++ = *p;
- else if (isxdigit(p[1]) && isxdigit(p[2])) {
+ else if (isxdigit(_UC(p[1])) && isxdigit(_UC(p[2]))) {
*out++ = (app_hex(p[1]) << 4) | app_hex(p[2]);
p += 2;
}
for (byte = 0; *in; ++in) {
char c;
- if (isspace(*in))
+ if (isspace(_UC(*in)))
continue;
- c = tolower(*in);
+ c = tolower(_UC(*in));
if ('0' <= c && c <= '9') {
byte |= c - '0';
} else if ('a' <= c && c <= 'f') {
e = restore_errno();
if (((v == LONG_MIN || v == LONG_MAX) && e == ERANGE) ||
- endp == in || !isspace(*endp) ||
+ endp == in || !isspace(_UC(*endp)) ||
v != (*result = (uint8_t) v)) {
return -1;
}
- for (in = endp; isspace(*in); ++in)
+ for (in = endp; isspace(_UC(*in)); ++in)
continue;
*inptr = in;
break;
case OPT_PSK:
for (p = psk_key = opt_arg(); *p; p++) {
- if (isxdigit(*p))
+ if (isxdigit(_UC(*p)))
continue;
BIO_printf(bio_err, "Not a hex number '%s'\n", psk_key);
goto end;
case OPT_PSK:
#ifndef OPENSSL_NO_PSK
for (p = psk_key = opt_arg(); *p; p++) {
- if (isxdigit(*p))
+ if (isxdigit(_UC(*p)))
continue;
BIO_printf(bio_err, "Not a hex number '%s'\n", *argv);
goto end;
#include "../e_os.h"
+#define _UC(c) ((unsigned char)(c))
+
static const char *progname;
/*
}
/* Trim trailing whitespace */
- while (n > 0 && isspace(buf[n-1]))
+ while (n > 0 && isspace(_UC(buf[n-1])))
buf[--n] = '\0';
return buf;
for (byte = 0; *in; ++in) {
char c;
- if (isspace(*in))
+ if (isspace(_UC(*in)))
continue;
- c = tolower(*in);
+ c = tolower(_UC(*in));
if ('0' <= c && c <= '9') {
byte |= c - '0';
} else if ('a' <= c && c <= 'f') {
e = restore_errno();
if (((v == LONG_MIN || v == LONG_MAX) && e == ERANGE) ||
- endp == cp || !isspace(*endp) ||
+ endp == cp || !isspace(_UC(*endp)) ||
v != (*(uint8_t *)result = (uint8_t) v)) {
return -1;
}
- for (cp = endp; isspace(*cp); ++cp)
+ for (cp = endp; isspace(_UC(*cp)); ++cp)
continue;
return cp - in;
}
static int allws(const char *cp)
{
while (*cp)
- if (!isspace(*cp++))
+ if (!isspace(_UC(*cp++)))
return 0;
return 1;
}