aboutsummaryrefslogtreecommitdiffstats
path: root/src/input/plugins
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-10-02 21:17:31 +0200
committerMax Kellermann <max@duempel.org>2014-10-02 21:50:14 +0200
commit7e12aea1d8f90d375627acc9f4a532009781aa26 (patch)
tree9092dc1a8e12928af37e234f4b1d57f42891c8d3 /src/input/plugins
parent20346b0da454a114a9eb3dc99fcdf5f984d45240 (diff)
downloadmpd-7e12aea1d8f90d375627acc9f4a532009781aa26.tar.gz
mpd-7e12aea1d8f90d375627acc9f4a532009781aa26.tar.xz
mpd-7e12aea1d8f90d375627acc9f4a532009781aa26.zip
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.
Diffstat (limited to 'src/input/plugins')
-rw-r--r--src/input/plugins/ArchiveInputPlugin.cxx21
-rw-r--r--src/input/plugins/FileInputPlugin.cxx19
2 files changed, 12 insertions, 28 deletions
diff --git a/src/input/plugins/ArchiveInputPlugin.cxx b/src/input/plugins/ArchiveInputPlugin.cxx
index 405e97a8c..da3d7ca71 100644
--- a/src/input/plugins/ArchiveInputPlugin.cxx
+++ b/src/input/plugins/ArchiveInputPlugin.cxx
@@ -71,25 +71,14 @@ OpenArchiveInputStream(Path path, Mutex &mutex, Cond &cond, Error &error)
return is;
}
-/**
- * select correct archive plugin to handle the input stream
- * may allow stacking of archive plugins. for example for handling
- * tar.gz a gzip handler opens file (through inputfile stream)
- * then it opens a tar handler and sets gzip inputstream as
- * parent_stream so tar plugin fetches file data from gzip
- * plugin and gzip fetches file from disk
- */
static InputStream *
-input_archive_open(const char *pathname,
- Mutex &mutex, Cond &cond,
- Error &error)
+input_archive_open(gcc_unused const char *filename,
+ gcc_unused Mutex &mutex, gcc_unused Cond &cond,
+ gcc_unused Error &error)
{
- if (!PathTraitsFS::IsAbsolute(pathname))
- return nullptr;
+ /* dummy method; use OpenArchiveInputStream() instead */
- /* TODO: the parameter is UTF-8, not filesystem charset */
- return OpenArchiveInputStream(Path::FromFS(pathname),
- mutex, cond, error);
+ return nullptr;
}
const InputPlugin input_plugin_archive = {
diff --git a/src/input/plugins/FileInputPlugin.cxx b/src/input/plugins/FileInputPlugin.cxx
index 1f9cf6edd..867b5722d 100644
--- a/src/input/plugins/FileInputPlugin.cxx
+++ b/src/input/plugins/FileInputPlugin.cxx
@@ -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;
-
- /* TODO: the parameter is UTF-8, not filesystem charset */
- const Path path = Path::FromFS(filename);
+ /* dummy method; use OpenFileInputStream() instead */
- return OpenFileInputStream(path, mutex, cond, error);
+ return nullptr;
}
bool