blame: widen struct blame_scoreboard.final_buf_size to size_t

Continue the size_t evacuation. final_buf_size is fed either from
textconv_object()'s now-size_t out-parameter, from
odb_read_object()'s size_t out-parameter (both bridged today
through a final_buf_size_st local + cast_size_t_to_ulong()), or
from o->file.size (mmfile_t, long). Widen the struct field, point
both producers straight at it, and drop the bridge variable along
with the cast.

builtin/blame.c only reads the field for pointer arithmetic and
comparisons, which promote cleanly.

Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2026-06-05 22:23:09 +02:00
parent 069ff038f7
commit 8849de1945
2 changed files with 3 additions and 5 deletions

View File

@@ -2861,20 +2861,18 @@ void setup_scoreboard(struct blame_scoreboard *sb,
sb->final_buf_size = o->file.size;
}
else {
size_t final_buf_size_st = 0;
o = get_origin(sb->final, sb->path);
if (fill_blob_sha1_and_mode(sb->repo, o))
die(_("no such path %s in %s"), sb->path, final_commit_name);
if (sb->revs->diffopt.flags.allow_textconv &&
textconv_object(sb->repo, sb->path, o->mode, &o->blob_oid, 1, (char **) &sb->final_buf,
&final_buf_size_st))
&sb->final_buf_size))
;
else
sb->final_buf = odb_read_object(the_repository->objects,
&o->blob_oid, &type,
&final_buf_size_st);
sb->final_buf_size = cast_size_t_to_ulong(final_buf_size_st);
&sb->final_buf_size);
if (!sb->final_buf)
die(_("cannot read blob %s for path %s"),

View File

@@ -117,7 +117,7 @@ struct blame_scoreboard {
* indexed with scoreboard.lineno[blame_entry.lno].
*/
char *final_buf;
unsigned long final_buf_size;
size_t final_buf_size;
/* linked list of blames */
struct blame_entry *ent;