Skip to content

Commit

Permalink
[PATCH] Fixlets on top of Nico's clean-up.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano authored and Linus Torvalds committed Jun 29, 2005
1 parent dcde55b commit 3c84974
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion diffcore-break.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static int should_break(struct diff_filespec *src,

delta = diff_delta(src->data, src->size,
dst->data, dst->size,
&delta_size, ~0UL);
&delta_size, 0);

/* Estimate the edit size by interpreting delta. */
if (count_delta(delta, delta_size,
Expand Down
11 changes: 4 additions & 7 deletions sha1_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -598,9 +598,9 @@ static int packed_delta_info(unsigned char *base_sha1,
char *type,
unsigned long *sizep)
{
unsigned char *data;
const unsigned char *data;
unsigned char delta_head[64];
unsigned long data_size, result_size, base_size, verify_base_size;
unsigned long result_size, base_size, verify_base_size;
z_stream stream;
int st;

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

data = base_sha1 + 20;
data_size = left - 20;

memset(&stream, 0, sizeof(stream));

stream.next_in = data;
stream.avail_in = data_size;
data = stream.next_in = base_sha1 + 20;
stream.avail_in = left - 20;
stream.next_out = delta_head;
stream.avail_out = sizeof(delta_head);

Expand Down
2 changes: 1 addition & 1 deletion test-delta.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ int main(int argc, char *argv[])
if (argv[1][1] == 'd')
out_buf = diff_delta(from_buf, from_size,
data_buf, data_size,
&out_size, ~0UL);
&out_size, 0);
else
out_buf = patch_delta(from_buf, from_size,
data_buf, data_size,
Expand Down

0 comments on commit 3c84974

Please sign in to comment.