pack-objects: drop the last size shim in write_no_reuse_object()

Continue the size_t evacuation that this series and the merged
js/objects-larger-than-4gb-on-windows topic are advancing for
>4 GiB objects on Windows: with the odb readers and the zlib
helpers reached from do_compress() now widened end-to-end, the
last cast_size_t_to_ulong() shim in this function can be removed,
and do_compress() itself can carry the new size type through.

Two cast_size_t_to_ulong() shims remain in this file; they feed
the tree-walk API, which is still narrow and is a separate
widening topic.

write_no_reuse_object()'s return type and the hashfile API are
still narrow but unchanged in observable behaviour: on 64-bit
Linux ulong coincides with size_t, and on Windows these were the
narrow fenceposts the prior topics deliberately left in place.
Their widening is left to follow-ups touching the hashfile API
and the write_object() caller chain.

Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2026-06-05 14:39:26 +02:00
committed by Git for Windows Build Agent
parent 73b6c0b23f
commit b41a74397d

View File

@@ -381,11 +381,11 @@ static void *get_delta(struct object_entry *entry)
return delta_buf;
}
static unsigned long do_compress(void **pptr, unsigned long size)
static size_t do_compress(void **pptr, size_t size)
{
git_zstream stream;
void *in, *out;
unsigned long maxsize;
size_t maxsize;
struct repo_config_values *cfg = repo_config_values(the_repository);
git_deflate_init(&stream, cfg->pack_compression_level);
@@ -511,7 +511,7 @@ static inline int oe_size_greater_than(struct packing_data *pack,
static unsigned long write_no_reuse_object(struct hashfile *f, struct object_entry *entry,
unsigned long limit, int usable_delta)
{
unsigned long size, datalen;
size_t size, datalen;
unsigned char header[MAX_PACK_OBJECT_HEADER],
dheader[MAX_PACK_OBJECT_HEADER];
unsigned hdrlen;
@@ -530,11 +530,9 @@ static unsigned long write_no_reuse_object(struct hashfile *f, struct object_ent
type = st->type;
size = st->size;
} else {
size_t size_st = 0;
buf = odb_read_object(the_repository->objects,
&entry->idx.oid, &type,
&size_st);
size = cast_size_t_to_ulong(size_st);
&size);
if (!buf)
die(_("unable to read %s"),
oid_to_hex(&entry->idx.oid));