]> git.ipfire.org Git - thirdparty/git.git/commit
patch-delta: use size_t for sizes
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Mon, 15 Jun 2026 11:52:24 +0000 (11:52 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 15 Jun 2026 14:45:40 +0000 (07:45 -0700)
commit33afe873381b21db08fa65e0910fd3bb69fd739b
treefc0b6cf31f34744440f8d4f2416a7cd5e4d887e7
parent8ea69373a42898a89c64df0fa731767cbeaba3dc
patch-delta: use size_t for sizes

`patch_delta()` takes the source and delta sizes by value and writes
back the reconstructed target size through an `unsigned long *`.  That
datatype cannot represent a value that exceeds 4 GiB on systems where
`unsigned long` is 32-bit (notably 64-bit Windows builds), though, even
though the delta encoding itself, the on-disk layout, and the in-memory
buffers happily carry such sizes. A `size_t` companion to
`get_delta_hdr_size()`, `get_delta_hdr_size_sz()`, was introduced in
17fa077596 (delta, packfile: use size_t for delta header sizes,
2026-05-08) precisely so that `patch_delta()` could be widened without
changing the on-the-wire decoding helper's signature.

Widen `patch_delta()`'s three size parameters to `size_t` and switch
its internal use of `get_delta_hdr_size()` to the `_sz` variant.
Then propagate the wider type through the callers.

Assisted-by: Opus 4.7
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
apply.c
builtin/index-pack.c
builtin/unpack-objects.c
delta.h
packfile.c
patch-delta.c
t/helper/test-delta.c