commit 1dce05e8f99e9ab3e9229bf59e061ad0201a08e8 from: Omar Polo date: Thu Nov 17 11:24:43 2022 UTC always cast ctype' is*() arguments to unsigned char Almost all had already an unsigned argument (uint8_t or unsigned char), but cast anyway in case the types are changed in the future. ok stsp@ commit - 29c010c8648ec861ee463bc8fa8c66a64dd01154 commit + 1dce05e8f99e9ab3e9229bf59e061ad0201a08e8 blob - 238ecb9d0ee975efd8eacc55de14b8cfb69792de blob + 32023105af9438217a65a1bf6b821e4d225516d1 --- lib/diff_atomize_text.c +++ lib/diff_atomize_text.c @@ -69,7 +69,7 @@ diff_data_atomize_text_lines_fd(struct diff_data *d) while (eol == 0 && i < r) { if (buf[i] != '\r' && buf[i] != '\n') { if (!ignore_whitespace - || !isspace(buf[i])) + || !isspace((unsigned char)buf[i])) hash = diff_atom_hash_update( hash, buf[i]); if (buf[i] == '\0') @@ -142,7 +142,7 @@ diff_data_atomize_text_lines_mmap(struct diff_data *d) while (line_end < end && *line_end != '\r' && *line_end != '\n') { if (!ignore_whitespace - || !isspace(*line_end)) + || !isspace((unsigned char)*line_end)) hash = diff_atom_hash_update(hash, *line_end); if (*line_end == '\0') embedded_nul = true; blob - 26fa788bccf6fc4e54a3c2efe5e6a389a1d34032 blob + 25d476df152bc9f65ca65f47590adcfc8ef6ae48 --- lib/diff_main.c +++ lib/diff_main.c @@ -62,11 +62,11 @@ buf_cmp(const unsigned char *left, size_t left_len, unsigned char cl = left[il]; unsigned char cr = right[ir]; - if (isspace(cl) && il < left_len) { + if (isspace((unsigned char)cl) && il < left_len) { il++; continue; } - if (isspace(cr) && ir < right_len) { + if (isspace((unsigned char)cr) && ir < right_len) { ir++; continue; } @@ -80,12 +80,12 @@ buf_cmp(const unsigned char *left, size_t left_len, } while (il < left_len) { unsigned char cl = left[il++]; - if (!isspace(cl)) + if (!isspace((unsigned char)cl)) return 1; } while (ir < right_len) { unsigned char cr = right[ir++]; - if (!isspace(cr)) + if (!isspace((unsigned char)cr)) return -1; } blob - bc44a51ea36b8a3a7cd5581e6787fcdda23168c6 blob + 8b2477047aa2fbba35eb20ce030a857b1d0c4664 --- lib/diff_output.c +++ lib/diff_output.c @@ -262,7 +262,7 @@ diff_output_trailing_newline_msg(struct diff_output_in static bool is_function_prototype(unsigned char ch) { - return (isalpha(ch) || ch == '_' || ch == '$'); + return (isalpha((unsigned char)ch) || ch == '_' || ch == '$'); } #define begins_with(s, pre) (strncmp(s, pre, sizeof(pre)-1) == 0)