aboutsummaryrefslogtreecommitdiffstats
path: root/src/fs
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/Traits.cxx8
-rw-r--r--src/fs/Traits.hxx15
2 files changed, 14 insertions, 9 deletions
diff --git a/src/fs/Traits.cxx b/src/fs/Traits.cxx
index 3bbc67c5b..47feda25b 100644
--- a/src/fs/Traits.cxx
+++ b/src/fs/Traits.cxx
@@ -47,8 +47,8 @@ PathTraitsFS::Build(PathTraitsFS::const_pointer a, size_t a_size,
return result;
}
-const char *
-PathTraitsUTF8::GetBase(const char *p)
+PathTraitsUTF8::const_pointer
+PathTraitsUTF8::GetBase(PathTraitsUTF8::const_pointer p)
{
assert(p != nullptr);
@@ -58,8 +58,8 @@ PathTraitsUTF8::GetBase(const char *p)
: p;
}
-std::string
-PathTraitsUTF8::GetParent(const char *p)
+PathTraitsUTF8::string
+PathTraitsUTF8::GetParent(PathTraitsUTF8::const_pointer p)
{
assert(p != nullptr);
diff --git a/src/fs/Traits.hxx b/src/fs/Traits.hxx
index 45e4f7682..6ec5ebd2b 100644
--- a/src/fs/Traits.hxx
+++ b/src/fs/Traits.hxx
@@ -85,14 +85,19 @@ struct PathTraitsFS {
* This class describes the nature of a MPD internal filesystem path.
*/
struct PathTraitsUTF8 {
- static constexpr char SEPARATOR = '/';
+ typedef std::string string;
+ typedef char value_type;
+ typedef char *pointer;
+ typedef const char *const_pointer;
- static constexpr bool IsSeparator(char ch) {
+ static constexpr value_type SEPARATOR = '/';
+
+ static constexpr bool IsSeparator(value_type ch) {
return ch == SEPARATOR;
}
gcc_pure gcc_nonnull_all
- static bool IsAbsolute(const char *p) {
+ static bool IsAbsolute(const_pointer p) {
assert(p != nullptr);
#ifdef WIN32
if (IsAlphaASCII(p[0]) && p[1] == ':' && IsSeparator(p[2]))
@@ -106,7 +111,7 @@ struct PathTraitsUTF8 {
* The return value points inside the given string.
*/
gcc_pure gcc_nonnull_all
- static const char *GetBase(const char *p);
+ static const_pointer GetBase(const_pointer p);
/**
* Determine the "parent" file name of the given UTF-8 path.
@@ -114,7 +119,7 @@ struct PathTraitsUTF8 {
* separator in the given input string.
*/
gcc_pure gcc_nonnull_all
- static std::string GetParent(const char *p);
+ static string GetParent(const_pointer p);
};
#endif