From: Johannes Schindelin via GitGitGadget Date: Thu, 13 Aug 2026 14:55:42 GMT Subject: [PATCH v3 04/13] pack-objects: widen `free_unpacked()` return to `size_t` Message-ID: <9850de1a91c826e673a1dd401c84a4c14c15c317.1786632952.git.gitgitgadget@gmail.com> In-Reply-To: From: Johannes Schindelin `free_unpacked()` sums two byte counts: `sizeof_delta_index()` and `SIZE(n->entry)`. The latter has been `size_t` since the prior topic "More work supporting objects larger than 4GB on Windows" widened `SIZE()`/`oe_size()` to `size_t`, so accumulating it into an `unsigned long` return was a silent Windows-only truncation on a packing run with many large objects. The sole caller, `find_deltas()`, still holds its own `mem_usage` in an `unsigned long` for now, and therefore still truncates silently. Assisted-by: Opus 4.7 Signed-off-by: Johannes Schindelin --- builtin/pack-objects.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 97246c69ae..503ebbf091 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -2972,9 +2972,9 @@ static unsigned int check_delta_limit(struct object_entry *me, unsigned int n) return m; } -static unsigned long free_unpacked(struct unpacked *n) +static size_t free_unpacked(struct unpacked *n) { - unsigned long freed_mem = sizeof_delta_index(n->index); + size_t freed_mem = sizeof_delta_index(n->index); free_delta_index(n->index); n->index = NULL; if (n->data) { -- gitgitgadget