aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDenis Krjuchkov <denis@crazydev.net>2013-12-05 03:53:43 +0600
committerDenis Krjuchkov <denis@crazydev.net>2013-12-05 03:53:43 +0600
commit0a6c4c31b2a9e79c9c0119202f9e50e123f98ac6 (patch)
treeeeea8005badbf5b9c8ccea8b961ea498d2da3d47 /src
parent02fcf184b5620c9ccbbc26024f9b0f341061a39a (diff)
downloadmpd-0a6c4c31b2a9e79c9c0119202f9e50e123f98ac6.tar.gz
mpd-0a6c4c31b2a9e79c9c0119202f9e50e123f98ac6.tar.xz
mpd-0a6c4c31b2a9e79c9c0119202f9e50e123f98ac6.zip
fs/Traits: split PathTraits type into PathTraitsFS and PathTraitsUTF8
Diffstat (limited to 'src')
-rw-r--r--src/CommandLine.cxx2
-rw-r--r--src/ConfigPath.cxx2
-rw-r--r--src/DecoderThread.cxx2
-rw-r--r--src/Directory.cxx2
-rw-r--r--src/Mapper.cxx4
-rw-r--r--src/PlaylistFile.cxx2
-rw-r--r--src/PlaylistPrint.cxx2
-rw-r--r--src/PlaylistQueue.cxx2
-rw-r--r--src/PlaylistSave.cxx2
-rw-r--r--src/PlaylistSong.cxx6
-rw-r--r--src/QueueSave.cxx2
-rw-r--r--src/SongUpdate.cxx2
-rw-r--r--src/UpdateWalk.cxx8
-rw-r--r--src/archive/Bzip2ArchivePlugin.cxx2
-rw-r--r--src/fs/AllocatedPath.cxx6
-rw-r--r--src/fs/AllocatedPath.hxx20
-rw-r--r--src/fs/FileSystem.hxx14
-rw-r--r--src/fs/Path.cxx4
-rw-r--r--src/fs/Path.hxx8
-rw-r--r--src/fs/Traits.cxx20
-rw-r--r--src/fs/Traits.hxx65
-rw-r--r--src/input/ArchiveInputPlugin.cxx2
-rw-r--r--src/input/FileInputPlugin.cxx2
-rw-r--r--src/playlist/EmbeddedCuePlaylistPlugin.cxx4
24 files changed, 95 insertions, 90 deletions
diff --git a/src/CommandLine.cxx b/src/CommandLine.cxx
index 8d5b0dd31..5d4f1e7b2 100644
--- a/src/CommandLine.cxx
+++ b/src/CommandLine.cxx
@@ -188,7 +188,7 @@ static void help(void)
gcc_pure
static AllocatedPath
-PathBuildChecked(const AllocatedPath &a, PathTraits::const_pointer b)
+PathBuildChecked(const AllocatedPath &a, PathTraitsFS::const_pointer b)
{
if (a.IsNull())
return AllocatedPath::Null();
diff --git a/src/ConfigPath.cxx b/src/ConfigPath.cxx
index b88de3934..1aa874c5c 100644
--- a/src/ConfigPath.cxx
+++ b/src/ConfigPath.cxx
@@ -119,7 +119,7 @@ ParsePath(const char *path, Error &error)
return AllocatedPath::Null();
return AllocatedPath::Build(home, path2);
- } else if (!PathTraits::IsAbsoluteUTF8(path)) {
+ } else if (!PathTraitsUTF8::IsAbsolute(path)) {
error.Format(path_domain,
"not an absolute path: %s", path);
return AllocatedPath::Null();
diff --git a/src/DecoderThread.cxx b/src/DecoderThread.cxx
index dedc5834e..3ccbd1082 100644
--- a/src/DecoderThread.cxx
+++ b/src/DecoderThread.cxx
@@ -145,7 +145,7 @@ decoder_file_decode(const DecoderPlugin &plugin,
assert(decoder.stream_tag == nullptr);
assert(decoder.decoder_tag == nullptr);
assert(path != nullptr);
- assert(PathTraits::IsAbsoluteFS(path));
+ assert(PathTraitsFS::IsAbsolute(path));
assert(decoder.dc.state == DecoderState::START);
FormatDebug(decoder_thread_domain, "probing plugin %s", plugin.name);
diff --git a/src/Directory.cxx b/src/Directory.cxx
index b2942588e..a64b4d84c 100644
--- a/src/Directory.cxx
+++ b/src/Directory.cxx
@@ -114,7 +114,7 @@ Directory::GetName() const
{
assert(!IsRoot());
- return PathTraits::GetBaseUTF8(path);
+ return PathTraitsUTF8::GetBase(path);
}
Directory *
diff --git a/src/Mapper.cxx b/src/Mapper.cxx
index 2483f2fcf..fbe1e8c34 100644
--- a/src/Mapper.cxx
+++ b/src/Mapper.cxx
@@ -148,7 +148,7 @@ map_to_relative_path(const char *path_utf8)
return !music_dir_utf8.empty() &&
memcmp(path_utf8, music_dir_utf8.c_str(),
music_dir_utf8_length) == 0 &&
- PathTraits::IsSeparatorUTF8(path_utf8[music_dir_utf8_length])
+ PathTraitsUTF8::IsSeparator(path_utf8[music_dir_utf8_length])
? path_utf8 + music_dir_utf8_length + 1
: path_utf8;
}
@@ -232,7 +232,7 @@ map_song_fs(const Song &song)
std::string
map_fs_to_utf8(const char *path_fs)
{
- if (PathTraits::IsSeparatorFS(path_fs[0])) {
+ if (PathTraitsFS::IsSeparator(path_fs[0])) {
path_fs = music_dir_fs.RelativeFS(path_fs);
if (path_fs == nullptr || *path_fs == 0)
return std::string();
diff --git a/src/PlaylistFile.cxx b/src/PlaylistFile.cxx
index 8956bd3b5..c3209db0a 100644
--- a/src/PlaylistFile.cxx
+++ b/src/PlaylistFile.cxx
@@ -246,7 +246,7 @@ LoadPlaylistFile(const char *utf8path, Error &error)
if (!uri_has_scheme(s)) {
uri_utf8 = map_fs_to_utf8(s);
if (uri_utf8.empty()) {
- if (PathTraits::IsAbsoluteFS(s)) {
+ if (PathTraitsFS::IsAbsolute(s)) {
uri_utf8 = PathToUTF8(s);
if (uri_utf8.empty())
continue;
diff --git a/src/PlaylistPrint.cxx b/src/PlaylistPrint.cxx
index 5f1d3c893..e92d6e18a 100644
--- a/src/PlaylistPrint.cxx
+++ b/src/PlaylistPrint.cxx
@@ -148,7 +148,7 @@ playlist_provider_print(Client &client, const char *uri,
SongEnumerator &e, bool detail)
{
const std::string base_uri = uri != nullptr
- ? PathTraits::GetParentUTF8(uri)
+ ? PathTraitsUTF8::GetParent(uri)
: std::string(".");
Song *song;
diff --git a/src/PlaylistQueue.cxx b/src/PlaylistQueue.cxx
index 9e1295b35..3a7660134 100644
--- a/src/PlaylistQueue.cxx
+++ b/src/PlaylistQueue.cxx
@@ -35,7 +35,7 @@ playlist_load_into_queue(const char *uri, SongEnumerator &e,
bool secure)
{
const std::string base_uri = uri != nullptr
- ? PathTraits::GetParentUTF8(uri)
+ ? PathTraitsUTF8::GetParent(uri)
: std::string(".");
Song *song;
diff --git a/src/PlaylistSave.cxx b/src/PlaylistSave.cxx
index 481d9bf75..1006fdcc7 100644
--- a/src/PlaylistSave.cxx
+++ b/src/PlaylistSave.cxx
@@ -56,7 +56,7 @@ void
playlist_print_uri(FILE *file, const char *uri)
{
auto path = playlist_saveAbsolutePaths && !uri_has_scheme(uri) &&
- !PathTraits::IsAbsoluteUTF8(uri)
+ !PathTraitsUTF8::IsAbsolute(uri)
? map_uri_fs(uri)
: AllocatedPath::FromUTF8(uri);
diff --git a/src/PlaylistSong.cxx b/src/PlaylistSong.cxx
index 60774dc36..f6f602a3c 100644
--- a/src/PlaylistSong.cxx
+++ b/src/PlaylistSong.cxx
@@ -99,7 +99,7 @@ playlist_check_load_song(const Song *song, const char *uri, bool secure)
if (uri_has_scheme(uri)) {
dest = Song::NewRemote(uri);
- } else if (PathTraits::IsAbsoluteUTF8(uri) && secure) {
+ } else if (PathTraitsUTF8::IsAbsolute(uri) && secure) {
dest = Song::LoadFile(uri, nullptr);
if (dest == nullptr)
return nullptr;
@@ -142,13 +142,13 @@ playlist_check_translate_song(Song *song, const char *base_uri,
}
if (base_uri != nullptr && strcmp(base_uri, ".") == 0)
- /* PathTraits::GetParentUTF8() returns "." when there
+ /* PathTraitsUTF8::GetParent() returns "." when there
is no directory name in the given path; clear that
now, because it would break the database lookup
functions */
base_uri = nullptr;
- if (PathTraits::IsAbsoluteUTF8(uri)) {
+ if (PathTraitsUTF8::IsAbsolute(uri)) {
/* XXX fs_charset vs utf8? */
const char *suffix = map_to_relative_path(uri);
assert(suffix != nullptr);
diff --git a/src/QueueSave.cxx b/src/QueueSave.cxx
index af834090b..829a91de5 100644
--- a/src/QueueSave.cxx
+++ b/src/QueueSave.cxx
@@ -90,7 +90,7 @@ queue_load_song(TextFile &file, const char *line, queue &queue)
if (StringStartsWith(line, SONG_BEGIN)) {
const char *uri = line + sizeof(SONG_BEGIN) - 1;
- if (!uri_has_scheme(uri) && !PathTraits::IsAbsoluteUTF8(uri))
+ if (!uri_has_scheme(uri) && !PathTraitsUTF8::IsAbsolute(uri))
return;
Error error;
diff --git a/src/SongUpdate.cxx b/src/SongUpdate.cxx
index 06742991e..b4a9edc1a 100644
--- a/src/SongUpdate.cxx
+++ b/src/SongUpdate.cxx
@@ -43,7 +43,7 @@ Song::LoadFile(const char *path_utf8, Directory *parent)
Song *song;
bool ret;
- assert((parent == nullptr) == PathTraits::IsAbsoluteUTF8(path_utf8));
+ assert((parent == nullptr) == PathTraitsUTF8::IsAbsolute(path_utf8));
assert(!uri_has_scheme(path_utf8));
assert(strchr(path_utf8, '\n') == nullptr);
diff --git a/src/UpdateWalk.cxx b/src/UpdateWalk.cxx
index 26f96957e..811978d52 100644
--- a/src/UpdateWalk.cxx
+++ b/src/UpdateWalk.cxx
@@ -290,7 +290,7 @@ skip_symlink(const Directory *directory, const char *utf8_name)
const char *target_str = target.c_str();
- if (PathTraits::IsAbsoluteFS(target_str)) {
+ if (PathTraitsFS::IsAbsolute(target_str)) {
/* if the symlink points to an absolute path, see if
that path is inside the music directory */
const char *relative = map_to_relative_path(target_str);
@@ -301,7 +301,7 @@ skip_symlink(const Directory *directory, const char *utf8_name)
const char *p = target_str;
while (*p == '.') {
- if (p[1] == '.' && PathTraits::IsSeparatorFS(p[2])) {
+ if (p[1] == '.' && PathTraitsFS::IsSeparator(p[2])) {
/* "../" moves to parent directory */
directory = directory->parent;
if (directory == nullptr) {
@@ -311,7 +311,7 @@ skip_symlink(const Directory *directory, const char *utf8_name)
return !follow_outside_symlinks;
}
p += 3;
- } else if (PathTraits::IsSeparatorFS(p[1]))
+ } else if (PathTraitsFS::IsSeparator(p[1]))
/* eliminate "./" */
p += 2;
else
@@ -454,7 +454,7 @@ update_uri(const char *uri)
if (parent == nullptr)
return;
- const char *name = PathTraits::GetBaseUTF8(uri);
+ const char *name = PathTraitsUTF8::GetBase(uri);
struct stat st;
if (!skip_symlink(parent, name) &&
diff --git a/src/archive/Bzip2ArchivePlugin.cxx b/src/archive/Bzip2ArchivePlugin.cxx
index f3e093095..c2d312cd1 100644
--- a/src/archive/Bzip2ArchivePlugin.cxx
+++ b/src/archive/Bzip2ArchivePlugin.cxx
@@ -51,7 +51,7 @@ public:
Bzip2ArchiveFile(const char *path, InputStream *_is)
:ArchiveFile(bz2_archive_plugin),
- name(PathTraits::GetBaseUTF8(path)),
+ name(PathTraitsUTF8::GetBase(path)),
istream(_is) {
// remove .bz2 suffix
const size_t len = name.length();
diff --git a/src/fs/AllocatedPath.cxx b/src/fs/AllocatedPath.cxx
index 5da748ea8..9dc7a644c 100644
--- a/src/fs/AllocatedPath.cxx
+++ b/src/fs/AllocatedPath.cxx
@@ -75,14 +75,14 @@ AllocatedPath::RelativeFS(const char *other_fs) const
other_fs += l;
if (*other_fs != 0) {
- if (!PathTraits::IsSeparatorFS(*other_fs))
+ if (!PathTraitsFS::IsSeparator(*other_fs))
/* mismatch */
return nullptr;
/* skip remaining path separators */
do {
++other_fs;
- } while (PathTraits::IsSeparatorFS(*other_fs));
+ } while (PathTraitsFS::IsSeparator(*other_fs));
}
return other_fs;
@@ -94,7 +94,7 @@ AllocatedPath::ChopSeparators()
size_t l = length();
const char *p = data();
- while (l >= 2 && PathTraits::IsSeparatorFS(p[l - 1])) {
+ while (l >= 2 && PathTraitsFS::IsSeparator(p[l - 1])) {
--l;
#if GCC_CHECK_VERSION(4,7) && !defined(__clang__)
diff --git a/src/fs/AllocatedPath.hxx b/src/fs/AllocatedPath.hxx
index bc69bc618..d44953cd6 100644
--- a/src/fs/AllocatedPath.hxx
+++ b/src/fs/AllocatedPath.hxx
@@ -37,10 +37,10 @@ class Error;
* stored.
*/
class AllocatedPath {
- typedef PathTraits::string string;
- typedef PathTraits::value_type value_type;
- typedef PathTraits::pointer pointer;
- typedef PathTraits::const_pointer const_pointer;
+ typedef PathTraitsFS::string string;
+ typedef PathTraitsFS::value_type value_type;
+ typedef PathTraitsFS::pointer pointer;
+ typedef PathTraitsFS::const_pointer const_pointer;
string value;
@@ -57,7 +57,7 @@ class AllocatedPath {
static AllocatedPath Build(const_pointer a, size_t a_size,
const_pointer b, size_t b_size) {
- return AllocatedPath(PathTraits::BuildFS(a, a_size, b, b_size));
+ return AllocatedPath(PathTraitsFS::Build(a, a_size, b, b_size));
}
public:
/**
@@ -93,20 +93,20 @@ public:
*/
gcc_pure gcc_nonnull_all
static AllocatedPath Build(const_pointer a, const_pointer b) {
- return Build(a, PathTraits::GetLengthFS(a),
- b, PathTraits::GetLengthFS(b));
+ return Build(a, PathTraitsFS::GetLength(a),
+ b, PathTraitsFS::GetLength(b));
}
gcc_pure gcc_nonnull_all
static AllocatedPath Build(const_pointer a, const AllocatedPath &b) {
- return Build(a, PathTraits::GetLengthFS(a),
+ return Build(a, PathTraitsFS::GetLength(a),
b.value.c_str(), b.value.size());
}
gcc_pure gcc_nonnull_all
static AllocatedPath Build(const AllocatedPath &a, const_pointer b) {
return Build(a.value.c_str(), a.value.size(),
- b, PathTraits::GetLengthFS(b));
+ b, PathTraitsFS::GetLength(b));
}
gcc_pure
@@ -233,7 +233,7 @@ public:
gcc_pure
bool IsAbsolute() {
- return PathTraits::IsAbsoluteFS(c_str());
+ return PathTraitsFS::IsAbsolute(c_str());
}
};
diff --git a/src/fs/FileSystem.hxx b/src/fs/FileSystem.hxx
index 67c6eef3e..b4dd01cd3 100644
--- a/src/fs/FileSystem.hxx
+++ b/src/fs/FileSystem.hxx
@@ -36,39 +36,39 @@ namespace FOpenMode {
/**
* Open mode for reading text files.
*/
- constexpr PathTraits::const_pointer ReadText = "r";
+ constexpr PathTraitsFS::const_pointer ReadText = "r";
/**
* Open mode for reading binary files.
*/
- constexpr PathTraits::const_pointer ReadBinary = "rb";
+ constexpr PathTraitsFS::const_pointer ReadBinary = "rb";
/**
* Open mode for writing text files.
*/
- constexpr PathTraits::const_pointer WriteText = "w";
+ constexpr PathTraitsFS::const_pointer WriteText = "w";
/**
* Open mode for writing binary files.
*/
- constexpr PathTraits::const_pointer WriteBinary = "wb";
+ constexpr PathTraitsFS::const_pointer WriteBinary = "wb";
/**
* Open mode for appending text files.
*/
- constexpr PathTraits::const_pointer AppendText = "a";
+ constexpr PathTraitsFS::const_pointer AppendText = "a";
/**
* Open mode for appending binary files.
*/
- constexpr PathTraits::const_pointer AppendBinary = "ab";
+ constexpr PathTraitsFS::const_pointer AppendBinary = "ab";
}
/**
* Wrapper for fopen() that uses #Path names.
*/
static inline FILE *
-FOpen(Path file, PathTraits::const_pointer mode)
+FOpen(Path file, PathTraitsFS::const_pointer mode)
{
return fopen(file.c_str(), mode);
}
diff --git a/src/fs/Path.cxx b/src/fs/Path.cxx
index 0ff0591fb..4b7fb9319 100644
--- a/src/fs/Path.cxx
+++ b/src/fs/Path.cxx
@@ -36,14 +36,14 @@ Path::RelativeFS(const char *other_fs) const
other_fs += l;
if (*other_fs != 0) {
- if (!PathTraits::IsSeparatorFS(*other_fs))
+ if (!PathTraitsFS::IsSeparator(*other_fs))
/* mismatch */
return nullptr;
/* skip remaining path separators */
do {
++other_fs;
- } while (PathTraits::IsSeparatorFS(*other_fs));
+ } while (PathTraitsFS::IsSeparator(*other_fs));
}
return other_fs;
diff --git a/src/fs/Path.hxx b/src/fs/Path.hxx
index 296f4b286..807677f38 100644
--- a/src/fs/Path.hxx
+++ b/src/fs/Path.hxx
@@ -36,9 +36,9 @@
* instance lives, the string must not be invalidated.
*/
class Path {
- typedef PathTraits::value_type value_type;
- typedef PathTraits::pointer pointer;
- typedef PathTraits::const_pointer const_pointer;
+ typedef PathTraitsFS::value_type value_type;
+ typedef PathTraitsFS::pointer pointer;
+ typedef PathTraitsFS::const_pointer const_pointer;
const char *value;
@@ -139,7 +139,7 @@ public:
gcc_pure
bool IsAbsolute() {
- return PathTraits::IsAbsoluteFS(c_str());
+ return PathTraitsFS::IsAbsolute(c_str());
}
};
diff --git a/src/fs/Traits.cxx b/src/fs/Traits.cxx
index aaf0a59e1..3bbc67c5b 100644
--- a/src/fs/Traits.cxx
+++ b/src/fs/Traits.cxx
@@ -22,9 +22,9 @@
#include <string.h>
-PathTraits::string
-PathTraits::BuildFS(PathTraits::const_pointer a, size_t a_size,
- PathTraits::const_pointer b, size_t b_size)
+PathTraitsFS::string
+PathTraitsFS::Build(PathTraitsFS::const_pointer a, size_t a_size,
+ PathTraitsFS::const_pointer b, size_t b_size)
{
assert(a != nullptr);
assert(b != nullptr);
@@ -36,10 +36,10 @@ PathTraits::BuildFS(PathTraits::const_pointer a, size_t a_size,
string result(a, a_size);
- if (!IsSeparatorFS(a[a_size - 1]))
- result.push_back(SEPARATOR_FS);
+ if (!IsSeparator(a[a_size - 1]))
+ result.push_back(SEPARATOR);
- if (IsSeparatorFS(b[0]))
+ if (IsSeparator(b[0]))
result.append(b + 1, b_size - 1);
else
result.append(b, b_size);
@@ -48,22 +48,22 @@ PathTraits::BuildFS(PathTraits::const_pointer a, size_t a_size,
}
const char *
-PathTraits::GetBaseUTF8(const char *p)
+PathTraitsUTF8::GetBase(const char *p)
{
assert(p != nullptr);
- const char *slash = strrchr(p, SEPARATOR_UTF8);
+ const char *slash = strrchr(p, SEPARATOR);
return slash != nullptr
? slash + 1
: p;
}
std::string
-PathTraits::GetParentUTF8(const char *p)
+PathTraitsUTF8::GetParent(const char *p)
{
assert(p != nullptr);
- const char *slash = strrchr(p, SEPARATOR_UTF8);
+ const char *slash = strrchr(p, SEPARATOR);
return slash != nullptr
? std::string(p, slash)
: std::string(".");
diff --git a/src/fs/Traits.hxx b/src/fs/Traits.hxx
index 4eb0f24b9..9e8333238 100644
--- a/src/fs/Traits.hxx
+++ b/src/fs/Traits.hxx
@@ -33,56 +33,40 @@
#include <assert.h>
/**
- * This class describes the nature of a filesystem path.
+ * This class describes the nature of a native filesystem path.
*/
-struct PathTraits {
+struct PathTraitsFS {
typedef std::string string;
typedef char value_type;
typedef char *pointer;
typedef const char *const_pointer;
#ifdef WIN32
- static constexpr value_type SEPARATOR_FS = '\\';
+ static constexpr value_type SEPARATOR = '\\';
#else
- static constexpr value_type SEPARATOR_FS = '/';
+ static constexpr value_type SEPARATOR = '/';
#endif
- static constexpr char SEPARATOR_UTF8 = '/';
-
- static constexpr bool IsSeparatorFS(value_type ch) {
+ static constexpr bool IsSeparator(value_type ch) {
return
#ifdef WIN32
ch == '/' ||
#endif
- ch == SEPARATOR_FS;
- }
-
- static constexpr bool IsSeparatorUTF8(char ch) {
- return ch == SEPARATOR_UTF8;
- }
-
- gcc_pure
- static bool IsAbsoluteFS(const_pointer p) {
- assert(p != nullptr);
-#ifdef WIN32
- if (IsAlphaASCII(p[0]) && p[1] == ':' && IsSeparatorFS(p[2]))
- return true;
-#endif
- return IsSeparatorFS(*p);
+ ch == SEPARATOR;
}
gcc_pure
- static bool IsAbsoluteUTF8(const char *p) {
+ static bool IsAbsolute(const_pointer p) {
assert(p != nullptr);
#ifdef WIN32
- if (IsAlphaASCII(p[0]) && p[1] == ':' && IsSeparatorUTF8(p[2]))
+ if (IsAlphaASCII(p[0]) && p[1] == ':' && IsSeparator(p[2]))
return true;
#endif
- return IsSeparatorUTF8(*p);
+ return IsSeparator(*p);
}
gcc_pure
- static size_t GetLengthFS(const_pointer p) {
+ static size_t GetLength(const_pointer p) {
return strlen(p);
}
@@ -93,15 +77,36 @@ struct PathTraits {
* If both components are empty strings, empty string is returned.
*/
gcc_pure gcc_nonnull_all
- static string BuildFS(const_pointer a, size_t a_size,
- const_pointer b, size_t b_size);
+ static string Build(const_pointer a, size_t a_size,
+ const_pointer b, size_t b_size);
+};
+
+/**
+ * This class describes the nature of a MPD internal filesystem path.
+ */
+struct PathTraitsUTF8 {
+ static constexpr char SEPARATOR = '/';
+
+ static constexpr bool IsSeparator(char ch) {
+ return ch == SEPARATOR;
+ }
+
+ gcc_pure
+ static bool IsAbsolute(const char *p) {
+ assert(p != nullptr);
+#ifdef WIN32
+ if (IsAlphaASCII(p[0]) && p[1] == ':' && IsSeparator(p[2]))
+ return true;
+#endif
+ return IsSeparator(*p);
+ }
/**
* Determine the "base" file name of the given UTF-8 path.
* The return value points inside the given string.
*/
gcc_pure gcc_nonnull_all
- static const char *GetBaseUTF8(const char *p);
+ static const char *GetBase(const char *p);
/**
* Determine the "parent" file name of the given UTF-8 path.
@@ -109,7 +114,7 @@ struct PathTraits {
* separator in the given input string.
*/
gcc_pure gcc_nonnull_all
- static std::string GetParentUTF8(const char *p);
+ static std::string GetParent(const char *p);
};
#endif
diff --git a/src/input/ArchiveInputPlugin.cxx b/src/input/ArchiveInputPlugin.cxx
index 72572defc..5797caced 100644
--- a/src/input/ArchiveInputPlugin.cxx
+++ b/src/input/ArchiveInputPlugin.cxx
@@ -46,7 +46,7 @@ input_archive_open(const char *pathname,
const struct archive_plugin *arplug;
InputStream *is;
- if (!PathTraits::IsAbsoluteFS(pathname))
+ if (!PathTraitsFS::IsAbsolute(pathname))
return nullptr;
char *pname = g_strdup(pathname);
diff --git a/src/input/FileInputPlugin.cxx b/src/input/FileInputPlugin.cxx
index dd6a28b97..5a63a469c 100644
--- a/src/input/FileInputPlugin.cxx
+++ b/src/input/FileInputPlugin.cxx
@@ -60,7 +60,7 @@ input_file_open(const char *filename,
int fd, ret;
struct stat st;
- if (!PathTraits::IsAbsoluteFS(filename))
+ if (!PathTraitsFS::IsAbsolute(filename))
return nullptr;
fd = open_cloexec(filename, O_RDONLY|O_BINARY, 0);
diff --git a/src/playlist/EmbeddedCuePlaylistPlugin.cxx b/src/playlist/EmbeddedCuePlaylistPlugin.cxx
index f0612bf87..96d83b968 100644
--- a/src/playlist/EmbeddedCuePlaylistPlugin.cxx
+++ b/src/playlist/EmbeddedCuePlaylistPlugin.cxx
@@ -93,7 +93,7 @@ embcue_playlist_open_uri(const char *uri,
gcc_unused Mutex &mutex,
gcc_unused Cond &cond)
{
- if (!PathTraits::IsAbsoluteUTF8(uri))
+ if (!PathTraitsUTF8::IsAbsolute(uri))
/* only local files supported */
return nullptr;
@@ -116,7 +116,7 @@ embcue_playlist_open_uri(const char *uri,
return nullptr;
}
- playlist->filename = PathTraits::GetBaseUTF8(uri);
+ playlist->filename = PathTraitsUTF8::GetBase(uri);
playlist->next = &playlist->cuesheet[0];
playlist->parser = new CueParser();