From b2ae5298a765f83dd142564adfdcaf5b2d34ff52 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 31 May 2019 18:40:24 +0200 Subject: [PATCH] archive/iso9660: implement seeking --- NEWS | 1 + src/archive/plugins/Iso9660ArchivePlugin.cxx | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/NEWS b/NEWS index b80e5b19c..207c28226 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,7 @@ ver 0.21.26 (not yet released) - bzip2: fix crash on corrupt bzip2 file - bzip2: flush output at end of input file - iso9660: fix unaligned reads + - iso9660: support seeking - zzip: fix crash on corrupt ZIP file * decoder - sndfile: fix lost samples at end of file diff --git a/src/archive/plugins/Iso9660ArchivePlugin.cxx b/src/archive/plugins/Iso9660ArchivePlugin.cxx index f81f6fd98..be319d2a7 100644 --- a/src/archive/plugins/Iso9660ArchivePlugin.cxx +++ b/src/archive/plugins/Iso9660ArchivePlugin.cxx @@ -198,12 +198,20 @@ public: lsn(_lsn) { size = _size; + seekable = true; SetReady(); } /* virtual methods from InputStream */ bool IsEOF() noexcept override; size_t Read(void *ptr, size_t size) override; + + void Seek(offset_type new_offset) override { + if (new_offset > size) + throw std::runtime_error("Invalid seek offset"); + + offset = new_offset; + } }; InputStreamPtr