aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-03-01 01:09:53 +0100
committerMax Kellermann <max@duempel.org>2015-03-01 01:09:53 +0100
commit7ce96585f5e0a5786f17d7996252b5c58e60d0ed (patch)
tree32cba161d309fb1a8afc303d6813c55c5c707233
parent41cc31c124686304f2ce7098c16ab27b5f88057e (diff)
downloadmpd-7ce96585f5e0a5786f17d7996252b5c58e60d0ed.tar.gz
mpd-7ce96585f5e0a5786f17d7996252b5c58e60d0ed.tar.xz
mpd-7ce96585f5e0a5786f17d7996252b5c58e60d0ed.zip
fs/Path: add method GetSuffix()
Type-safe wrapper for uri_get_suffix().
-rw-r--r--Makefile.am4
-rw-r--r--src/TagFile.cxx2
-rw-r--r--src/fs/Path.cxx7
-rw-r--r--src/fs/Path.hxx3
-rw-r--r--src/playlist/PlaylistStream.cxx2
5 files changed, 14 insertions, 4 deletions
diff --git a/Makefile.am b/Makefile.am
index 2417b8c74..10b646726 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1635,12 +1635,12 @@ test_run_input_LDADD = \
$(ARCHIVE_LIBS) \
$(TAG_LIBS) \
libconf.a \
- libutil.a \
libevent.a \
libthread.a \
$(FS_LIBS) \
$(ICU_LDADD) \
libsystem.a \
+ libutil.a \
$(GLIB_LIBS)
test_run_input_SOURCES = test/run_input.cxx \
test/ScopeIOThread.hxx \
@@ -1682,12 +1682,12 @@ test_visit_archive_LDADD = \
$(ARCHIVE_LIBS) \
$(TAG_LIBS) \
libconf.a \
- libutil.a \
libevent.a \
libthread.a \
$(FS_LIBS) \
$(ICU_LDADD) \
libsystem.a \
+ libutil.a \
$(GLIB_LIBS)
test_visit_archive_SOURCES = test/visit_archive.cxx \
test/ScopeIOThread.hxx \
diff --git a/src/TagFile.cxx b/src/TagFile.cxx
index e4e9914e4..168be6063 100644
--- a/src/TagFile.cxx
+++ b/src/TagFile.cxx
@@ -87,7 +87,7 @@ tag_file_scan(Path path_fs, const tag_handler &handler, void *handler_ctx)
/* check if there's a suffix and a plugin */
- const char *suffix = uri_get_suffix(path_fs.c_str());
+ const char *suffix = path_fs.GetSuffix();
if (suffix == nullptr)
return false;
diff --git a/src/fs/Path.cxx b/src/fs/Path.cxx
index 5a21b698f..691284313 100644
--- a/src/fs/Path.cxx
+++ b/src/fs/Path.cxx
@@ -20,9 +20,16 @@
#include "config.h"
#include "Path.hxx"
#include "Charset.hxx"
+#include "util/UriUtil.hxx"
std::string
Path::ToUTF8() const
{
return ::PathToUTF8(c_str());
}
+
+const char *
+Path::GetSuffix() const
+{
+ return uri_get_suffix(c_str());
+}
diff --git a/src/fs/Path.hxx b/src/fs/Path.hxx
index 56459723d..8126a668a 100644
--- a/src/fs/Path.hxx
+++ b/src/fs/Path.hxx
@@ -161,6 +161,9 @@ public:
bool IsAbsolute() const {
return PathTraitsFS::IsAbsolute(c_str());
}
+
+ gcc_pure
+ const char *GetSuffix() const;
};
#endif
diff --git a/src/playlist/PlaylistStream.cxx b/src/playlist/PlaylistStream.cxx
index 32e049c78..b0febba2b 100644
--- a/src/playlist/PlaylistStream.cxx
+++ b/src/playlist/PlaylistStream.cxx
@@ -35,7 +35,7 @@ playlist_open_path_suffix(Path path, Mutex &mutex, Cond &cond)
{
assert(!path.IsNull());
- const char *suffix = uri_get_suffix(path.c_str());
+ const char *suffix = path.GetSuffix();
if (suffix == nullptr || !playlist_suffix_supported(suffix))
return nullptr;