From e3a57272a712542e739b97db31efebc4cc17c53a Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 1 Oct 2016 18:19:57 +0200 Subject: stream_libarchive: add some more points at which reading can be stopped --- stream/stream_libarchive.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'stream') diff --git a/stream/stream_libarchive.c b/stream/stream_libarchive.c index 50177028ea..a840de706b 100644 --- a/stream/stream_libarchive.c +++ b/stream/stream_libarchive.c @@ -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) { -- cgit v1.2.3