int nparents, color_diff;
const char **label_path;
struct diff_words_data *diff_words;
+ int *found_changesp;
};
static void free_diff_words_data(struct emit_callback *ecbdata)
const char *set = diff_get_color(ecbdata->color_diff, DIFF_METAINFO);
const char *reset = diff_get_color(ecbdata->color_diff, DIFF_RESET);
+ *(ecbdata->found_changesp) = 1;
+
if (ecbdata->label_path[0]) {
const char *name_a_tab, *name_b_tab;
if (complete_rewrite) {
emit_rewrite_diff(name_a, name_b, one, two,
o->color_diff);
+ o->found_changes = 1;
goto free_ab_and_return;
}
}
else
printf("Binary files %s and %s differ\n",
lbl[0], lbl[1]);
+ o->found_changes = 1;
}
else {
/* Crazy xdl interfaces.. */
memset(&ecbdata, 0, sizeof(ecbdata));
ecbdata.label_path = lbl;
ecbdata.color_diff = o->color_diff;
+ ecbdata.found_changesp = &o->found_changes;
xpp.flags = XDF_NEED_MINIMAL | o->xdl_opts;
xecfg.ctxlen = o->context;
xecfg.flags = XDL_EMIT_FUNCNAMES;
return err;
}
}
- s->size = st.st_size;
+ s->size = xsize_t(st.st_size);
if (!s->size)
goto empty;
if (size_only)
}
}
else {
- char type[20];
+ enum object_type type;
struct sha1_size_cache *e;
if (size_only) {
s->size = e->size;
return 0;
}
- if (!sha1_object_info(s->sha1, type, &s->size))
+ type = sha1_object_info(s->sha1, &s->size);
+ if (type < 0)
locate_size_cache(s->sha1, 0, s->size);
}
else {
- s->data = read_sha1_file(s->sha1, type, &s->size);
+ s->data = read_sha1_file(s->sha1, &type, &s->size);
s->should_free = 1;
}
}
if (S_ISLNK(st.st_mode)) {
int ret;
char buf[PATH_MAX + 1]; /* ought to be SYMLINK_MAX */
+ size_t sz = xsize_t(st.st_size);
if (sizeof(buf) <= st.st_size)
die("symlink too long: %s", name);
- ret = readlink(name, buf, st.st_size);
+ ret = readlink(name, buf, sz);
if (ret < 0)
die("readlink(%s)", name);
- prep_temp_blob(temp, buf, st.st_size,
+ prep_temp_blob(temp, buf, sz,
(one->sha1_valid ?
one->sha1 : null_sha1),
(one->sha1_valid ?
/* user says num divided by scale and we say internally that
* is MAX_SCORE * num / scale.
*/
- return (num >= scale) ? MAX_SCORE : (MAX_SCORE * num / scale);
+ return (int)((num >= scale) ? MAX_SCORE : (MAX_SCORE * num / scale));
}
int diff_scoreopt_parse(const char *opt)