mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-04 15:40:44 +00:00
libdiff: More type issues.
Sponsored by: Klara, Inc. Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D45080
This commit is contained in:
parent
b985c9cafd
commit
b95e96028e
|
@ -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:")) {
|
||||
|
|
Loading…
Reference in a new issue