input/Open: use OpenLocalInputStream()

Make the "open" method of plugins "file" and "archive" dummy methods
that always fail.  Instead, let InputStream::Open() hard-code access
to these two plugins by using OpenLocalInputStream().  This allows
simplifyin the algorithm for falling back to probing archive plugins.
This commit is contained in:
Max Kellermann
2014-10-02 21:17:31 +02:00
parent 20346b0da4
commit 7e12aea1d8
5 changed files with 34 additions and 33 deletions

@@ -68,9 +68,8 @@ OpenFileInputStream(Path path,
{
const int fd = OpenFile(path, O_RDONLY|O_BINARY, 0);
if (fd < 0) {
if (errno != ENOTDIR)
error.FormatErrno("Failed to open \"%s\"",
path.c_str());
error.FormatErrno("Failed to open \"%s\"",
path.c_str());
return nullptr;
}
@@ -96,17 +95,13 @@ OpenFileInputStream(Path path,
}
static InputStream *
input_file_open(const char *filename,
Mutex &mutex, Cond &cond,
Error &error)
input_file_open(gcc_unused const char *filename,
gcc_unused Mutex &mutex, gcc_unused Cond &cond,
gcc_unused Error &error)
{
if (!PathTraitsFS::IsAbsolute(filename))
return nullptr;
/* dummy method; use OpenFileInputStream() instead */
/* TODO: the parameter is UTF-8, not filesystem charset */
const Path path = Path::FromFS(filename);
return OpenFileInputStream(path, mutex, cond, error);
return nullptr;
}
bool