mirror of
https://github.com/git-for-windows/git.git
synced 2026-06-24 03:34:47 -05:00
diff: stop truncating the deflated-binary-diff size on Windows
Continue the size_t evacuation around large object handling: with deflate_it() and the locals around it widened, the cast_size_t_to_ulong() shim the prior delta_delta() widening had to leave behind in emit_binary_diff_body() goes away. deflate_it() is file-static; the only callers are the two in emit_binary_diff_body() already touched here. emit_diff_symbol() formats the resulting sizes via uintmax_t / %"PRIuMAX", so the diff output is not affected; only the per-process upper bound on a binary patch chunk that this function can address grows beyond 4 GiB on Windows. Assisted-by: Opus 4.7 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
16
diff.c
16
diff.c
@@ -3606,8 +3606,8 @@ static int checkdiff_consume(void *priv, char *line, unsigned long len)
|
||||
}
|
||||
|
||||
static unsigned char *deflate_it(char *data,
|
||||
unsigned long size,
|
||||
unsigned long *result_size)
|
||||
size_t size,
|
||||
size_t *result_size)
|
||||
{
|
||||
size_t bound;
|
||||
unsigned char *deflated;
|
||||
@@ -3636,10 +3636,10 @@ static void emit_binary_diff_body(struct diff_options *o,
|
||||
void *delta;
|
||||
void *deflated;
|
||||
void *data;
|
||||
unsigned long orig_size;
|
||||
unsigned long delta_size;
|
||||
unsigned long deflate_size;
|
||||
unsigned long data_size;
|
||||
size_t orig_size;
|
||||
size_t delta_size;
|
||||
size_t deflate_size;
|
||||
size_t data_size;
|
||||
|
||||
/* We could do deflated delta, or we could do just deflated two,
|
||||
* whichever is smaller.
|
||||
@@ -3647,11 +3647,9 @@ static void emit_binary_diff_body(struct diff_options *o,
|
||||
delta = NULL;
|
||||
deflated = deflate_it(two->ptr, two->size, &deflate_size);
|
||||
if (one->size && two->size) {
|
||||
size_t delta_size_st = 0;
|
||||
delta = diff_delta(one->ptr, one->size,
|
||||
two->ptr, two->size,
|
||||
&delta_size_st, deflate_size);
|
||||
delta_size = cast_size_t_to_ulong(delta_size_st);
|
||||
&delta_size, deflate_size);
|
||||
if (delta) {
|
||||
void *to_free = delta;
|
||||
orig_size = delta_size;
|
||||
|
||||
Reference in New Issue
Block a user