t/helper/test-pack-deltas: drop the delta_size cast in write_ref_delta()

Tidies up the bridge variable introduced in the create_delta() /
diff_delta() widening commit earlier in this series. With the test
helper's local do_compress() also widened to size_t in pass, the
narrowing into the unsigned long delta_size local that compress
expected is gone, the size_st bridge is unnecessary, and the cast
goes away. encode_in_pack_object_header() takes uintmax_t and
hashwrite() takes uint32_t, both unchanged.

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:50:00 +02:00
parent e9aa08fde6
commit 3796065a3d

View File

@@ -18,7 +18,7 @@ static const char *usage_str[] = {
NULL
};
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;
@@ -48,8 +48,8 @@ static void write_ref_delta(struct hashfile *f,
struct object_id *base)
{
unsigned char header[MAX_PACK_OBJECT_HEADER];
unsigned long delta_size, compressed_size, hdrlen;
size_t size, base_size, delta_size_st = 0;
unsigned long compressed_size, hdrlen;
size_t size, base_size, delta_size;
enum object_type type;
void *base_buf, *delta_buf;
void *buf = odb_read_object(the_repository->objects,
@@ -65,8 +65,7 @@ static void write_ref_delta(struct hashfile *f,
die("unable to read %s", oid_to_hex(base));
delta_buf = diff_delta(base_buf, base_size,
buf, size, &delta_size_st, 0);
delta_size = cast_size_t_to_ulong(delta_size_st);
buf, size, &delta_size, 0);
compressed_size = do_compress(&delta_buf, delta_size);