input/Plugin: migrate open() from class Error to C++ exceptions
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#include "input/InputStream.hxx"
|
||||
#include "fs/Path.hxx"
|
||||
#include "util/RefCount.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
#include "util/Error.hxx"
|
||||
#include "util/Domain.hxx"
|
||||
|
||||
@@ -58,9 +59,8 @@ public:
|
||||
|
||||
virtual void Visit(ArchiveVisitor &visitor) override;
|
||||
|
||||
virtual InputStream *OpenStream(const char *path,
|
||||
Mutex &mutex, Cond &cond,
|
||||
Error &error) override;
|
||||
InputStream *OpenStream(const char *path,
|
||||
Mutex &mutex, Cond &cond) override;
|
||||
};
|
||||
|
||||
static constexpr Domain zzip_domain("zzip");
|
||||
@@ -129,15 +129,12 @@ struct ZzipInputStream final : public InputStream {
|
||||
|
||||
InputStream *
|
||||
ZzipArchiveFile::OpenStream(const char *pathname,
|
||||
Mutex &mutex, Cond &cond,
|
||||
Error &error)
|
||||
Mutex &mutex, Cond &cond)
|
||||
{
|
||||
ZZIP_FILE *_file = zzip_file_open(dir, pathname, 0);
|
||||
if (_file == nullptr) {
|
||||
error.Format(zzip_domain, "not found in the ZIP file: %s",
|
||||
pathname);
|
||||
return nullptr;
|
||||
}
|
||||
if (_file == nullptr)
|
||||
throw FormatRuntimeError("not found in the ZIP file: %s",
|
||||
pathname);
|
||||
|
||||
return new ZzipInputStream(*this, pathname,
|
||||
mutex, cond,
|
||||
|
Reference in New Issue
Block a user