Reconnect the progress callback. It may not get called

as often as you might expect, but at least it will get called
now.

Thanks to: David Topham for asking how this got disconnected.
This commit is contained in:
Tim Kientzle 2008-01-18 04:53:45 +00:00
parent 8d0a4dab61
commit 23b11f239a

View File

@ -67,6 +67,7 @@ get_extract(struct archive_read *a)
archive_set_error(&a->archive, ENOMEM, "Can't extract");
return (NULL);
}
memset(a->extract, 0, sizeof(*a->extract));
a->extract->ad = archive_write_disk_new();
if (a->extract->ad == NULL) {
archive_set_error(&a->archive, ENOMEM, "Can't extract");
@ -130,11 +131,13 @@ archive_read_extract_set_progress_callback(struct archive *_a,
static int
copy_data(struct archive *ar, struct archive *aw)
{
int r;
const void *buff;
size_t size;
off_t offset;
const void *buff;
struct extract *extract;
size_t size;
int r;
extract = get_extract((struct archive_read *)ar);
for (;;) {
r = archive_read_data_block(ar, &buff, &size, &offset);
if (r == ARCHIVE_EOF)
@ -149,6 +152,9 @@ copy_data(struct archive *ar, struct archive *aw)
"%s", archive_error_string(aw));
return (r);
}
if (extract->extract_progress)
(extract->extract_progress)
(extract->extract_progress_user_data);
}
}