combine-diff: stop truncating combined-diff blob sizes on Windows

Continue the size_t evacuation. With buffer_is_binary() widened
in the prior commit, every consumer that the size flows into in
combine-diff.c is size_t-ready, so widen grab_blob()'s out-param
outright and move the matching locals at its three call sites
together. grab_blob()'s body collapses to a direct
odb_read_object(&size) since the bridge variable is no longer
needed.

Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2026-06-05 18:07:31 +02:00
committed by Git for Windows Build Agent
parent 3a15c879b2
commit 9274460414

View File

@@ -304,7 +304,7 @@ static struct lline *coalesce_lines(struct lline *base, int *lenbase,
static char *grab_blob(struct repository *r,
const struct object_id *oid, unsigned int mode,
unsigned long *size, struct userdiff_driver *textconv,
size_t *size, struct userdiff_driver *textconv,
const char *path)
{
char *blob;
@@ -325,9 +325,7 @@ static char *grab_blob(struct repository *r,
*size = fill_textconv(r, textconv, df, &blob);
free_filespec(df);
} else {
size_t size_st = 0;
blob = odb_read_object(r->objects, oid, &type, &size_st);
*size = cast_size_t_to_ulong(size_st);
blob = odb_read_object(r->objects, oid, &type, size);
if (!blob)
die(_("unable to read %s"), oid_to_hex(oid));
if (type != OBJ_BLOB)
@@ -431,7 +429,7 @@ static void combine_diff(struct repository *r,
xdemitconf_t xecfg;
mmfile_t parent_file;
struct combine_diff_state state;
unsigned long sz;
size_t sz;
if (result_deleted)
return; /* result deleted */
@@ -1015,7 +1013,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
struct rev_info *rev)
{
struct diff_options *opt = &rev->diffopt;
unsigned long result_size, cnt, lno;
size_t result_size, cnt, lno;
int result_deleted = 0;
char *result, *cp;
struct sline *sline; /* survived lines */
@@ -1134,7 +1132,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
is_binary = buffer_is_binary(result, result_size);
for (i = 0; !is_binary && i < num_parent; i++) {
char *buf;
unsigned long size;
size_t size;
buf = grab_blob(opt->repo,
&elem->parent[i].oid,
elem->parent[i].mode,