Skip to content

Commit 3c84974

Browse files
Junio C HamanoLinus Torvalds
authored andcommitted
[PATCH] Fixlets on top of Nico's clean-up.
If we prefer 0 as maxsize for diff_delta() to say "unlimited", let's be consistent about it. This patch also fixes type mismatch in a call to get_delta_hdr_size() from packed_delta_info(). Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent dcde55b commit 3c84974

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

diffcore-break.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static int should_break(struct diff_filespec *src,
6565

6666
delta = diff_delta(src->data, src->size,
6767
dst->data, dst->size,
68-
&delta_size, ~0UL);
68+
&delta_size, 0);
6969

7070
/* Estimate the edit size by interpreting delta. */
7171
if (count_delta(delta, delta_size,

sha1_file.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -598,9 +598,9 @@ static int packed_delta_info(unsigned char *base_sha1,
598598
char *type,
599599
unsigned long *sizep)
600600
{
601-
unsigned char *data;
601+
const unsigned char *data;
602602
unsigned char delta_head[64];
603-
unsigned long data_size, result_size, base_size, verify_base_size;
603+
unsigned long result_size, base_size, verify_base_size;
604604
z_stream stream;
605605
int st;
606606

@@ -609,13 +609,10 @@ static int packed_delta_info(unsigned char *base_sha1,
609609
if (sha1_object_info(base_sha1, type, &base_size))
610610
die("cannot get info for delta-pack base");
611611

612-
data = base_sha1 + 20;
613-
data_size = left - 20;
614-
615612
memset(&stream, 0, sizeof(stream));
616613

617-
stream.next_in = data;
618-
stream.avail_in = data_size;
614+
data = stream.next_in = base_sha1 + 20;
615+
stream.avail_in = left - 20;
619616
stream.next_out = delta_head;
620617
stream.avail_out = sizeof(delta_head);
621618

test-delta.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ int main(int argc, char *argv[])
6161
if (argv[1][1] == 'd')
6262
out_buf = diff_delta(from_buf, from_size,
6363
data_buf, data_size,
64-
&out_size, ~0UL);
64+
&out_size, 0);
6565
else
6666
out_buf = patch_delta(from_buf, from_size,
6767
data_buf, data_size,

0 commit comments

Comments
 (0)