Skip to content

Commit

Permalink
Avoid ctype.h abuse: cast char to unsigned char first.
Browse files Browse the repository at this point in the history
fix #3151
  • Loading branch information
riastradh authored Jul 11, 2024
1 parent e2ffb53 commit 2ee20ca
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/builtin.c
Original file line number Diff line number Diff line change
Expand Up @@ -1474,7 +1474,7 @@ static jv f_strptime(jq_state *jq, jv a, jv b) {
}
#endif
const char *end = strptime(input, fmt, &tm);
if (end == NULL || (*end != '\0' && !isspace(*end))) {
if (end == NULL || (*end != '\0' && !isspace((unsigned char)*end))) {
return ret_error2(a, b, jv_string_fmt("date \"%s\" does not match format \"%s\"", input, fmt));
}
jv_free(b);
Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static void die() {
}

static int isoptish(const char* text) {
return text[0] == '-' && (text[1] == '-' || isalpha(text[1]));
return text[0] == '-' && (text[1] == '-' || isalpha((unsigned char)text[1]));
}

static int isoption(const char* text, char shortopt, const char* longopt, size_t *short_opts) {
Expand Down

0 comments on commit 2ee20ca

Please sign in to comment.