stream_libarchive: add some more points at which reading can be stopped

This commit is contained in:
wm4 2016-10-01 18:19:57 +02:00
parent 486b3ce6f8
commit e3a57272a7
1 changed files with 4 additions and 1 deletions

View File

@ -274,7 +274,7 @@ bool mp_archive_next_entry(struct mp_archive *mpa)
talloc_free(mpa->entry_filename);
mpa->entry_filename = NULL;
for (;;) {
while (!mp_cancel_test(mpa->primary_src->cancel)) {
struct archive_entry *entry;
int r = archive_read_next_header(mpa->arch, &entry);
if (r == ARCHIVE_EOF)
@ -367,6 +367,9 @@ static int archive_entry_seek(stream_t *s, int64_t newpos)
// skip function either).
char buffer[4096];
while (newpos > s->pos) {
if (mp_cancel_test(s->cancel))
return -1;
int size = MPMIN(newpos - s->pos, sizeof(buffer));
int r = archive_read_data(p->mpa->arch, buffer, size);
if (r < 0) {