aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2024-05-03 16:32:41 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2024-05-03 16:32:41 +0000
commitb95e96028e5a53116462151aee8fda7523a68d09 (patch)
tree6245ed206b788001ff903065515da64404e8bdc9 /contrib
parentb985c9cafd2aedac5cf92428c0211485ea4ede24 (diff)
downloadsrc-b95e96028e5a53116462151aee8fda7523a68d09.tar.gz
src-b95e96028e5a53116462151aee8fda7523a68d09.zip
libdiff: More type issues.
Sponsored by: Klara, Inc. Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D45080
Diffstat (limited to 'contrib')
-rw-r--r--contrib/libdiff/lib/diff_output.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/contrib/libdiff/lib/diff_output.c b/contrib/libdiff/lib/diff_output.c
index 78d9b8942077..3b84608882f6 100644
--- a/contrib/libdiff/lib/diff_output.c
+++ b/contrib/libdiff/lib/diff_output.c
@@ -75,8 +75,8 @@ diff_output_lines(struct diff_output_info *outinfo, FILE *dest,
foreach_diff_atom(atom, start_atom, count) {
off_t outlen = 0;
int i, ch, nbuf = 0;
- unsigned int len = atom->len;
- unsigned char buf[DIFF_OUTPUT_BUF_SIZE + 1 /* '\n' */];
+ size_t len = atom->len, wlen;
+ char buf[DIFF_OUTPUT_BUF_SIZE + 1 /* '\n' */];
size_t n;
n = strlcpy(buf, prefix, sizeof(buf));
@@ -97,19 +97,19 @@ diff_output_lines(struct diff_output_info *outinfo, FILE *dest,
if (rc)
return rc;
if (nbuf >= DIFF_OUTPUT_BUF_SIZE) {
- rc = fwrite(buf, 1, nbuf, dest);
- if (rc != nbuf)
+ wlen = fwrite(buf, 1, nbuf, dest);
+ if (wlen != nbuf)
return errno;
- outlen += rc;
+ outlen += wlen;
nbuf = 0;
}
buf[nbuf++] = ch;
}
buf[nbuf++] = '\n';
- rc = fwrite(buf, 1, nbuf, dest);
- if (rc != nbuf)
+ wlen = fwrite(buf, 1, nbuf, dest);
+ if (wlen != nbuf)
return errno;
- outlen += rc;
+ outlen += wlen;
if (outinfo) {
ARRAYLIST_ADD(offp, outinfo->line_offsets);
if (offp == NULL)
@@ -253,7 +253,7 @@ diff_output_trailing_newline_msg(struct diff_output_info *outinfo, FILE *dest,
}
static bool
-is_function_prototype(unsigned char ch)
+is_function_prototype(char ch)
{
return (isalpha((unsigned char)ch) || ch == '_' || ch == '$' ||
ch == '-' || ch == '+');
@@ -268,7 +268,7 @@ diff_output_match_function_prototype(char *prototype, size_t prototype_size,
{
struct diff_atom *start_atom, *atom;
const struct diff_data *data;
- unsigned char buf[DIFF_FUNCTION_CONTEXT_SIZE];
+ char buf[DIFF_FUNCTION_CONTEXT_SIZE];
const char *state = NULL;
int rc, i, ch;
@@ -285,7 +285,7 @@ diff_output_match_function_prototype(char *prototype, size_t prototype_size,
rc = get_atom_byte(&ch, atom, 0);
if (rc)
return rc;
- buf[0] = (unsigned char)ch;
+ buf[0] = ch;
if (!is_function_prototype(buf[0]))
continue;
for (i = 1; i < atom->len && i < sizeof(buf) - 1; i++) {
@@ -294,7 +294,7 @@ diff_output_match_function_prototype(char *prototype, size_t prototype_size,
return rc;
if (ch == '\n')
break;
- buf[i] = (unsigned char)ch;
+ buf[i] = ch;
}
buf[i] = '\0';
if (begins_with(buf, "private:")) {