aboutsummaryrefslogtreecommitdiffstats
path: root/src/fs
diff options
context:
space:
mode:
authorDenis Krjuchkov <denis@crazydev.net>2013-12-05 13:20:55 +0600
committerDenis Krjuchkov <denis@crazydev.net>2013-12-05 15:05:01 +0600
commitda50c888fe708b67f287bc211854c3e83f54ce9a (patch)
tree6954557f8216863415217ba70bc48bdca33b2841 /src/fs
parent62dc8e4131c4d7784bd500edeaff93ed23807b5f (diff)
downloadmpd-da50c888fe708b67f287bc211854c3e83f54ce9a.tar.gz
mpd-da50c888fe708b67f287bc211854c3e83f54ce9a.tar.xz
mpd-da50c888fe708b67f287bc211854c3e83f54ce9a.zip
fs/Traits.hxx: introduce PathTraitsXXX::IsDrive function
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/Traits.hxx18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/fs/Traits.hxx b/src/fs/Traits.hxx
index ff7978b6b..927496e53 100644
--- a/src/fs/Traits.hxx
+++ b/src/fs/Traits.hxx
@@ -68,11 +68,18 @@ struct PathTraitsFS {
#endif
}
+#ifdef WIN32
+ gcc_pure gcc_nonnull_all
+ static constexpr bool IsDrive(const_pointer p) {
+ return IsAlphaASCII(p[0]) && p[1] == ':';
+ }
+#endif
+
gcc_pure gcc_nonnull_all
static bool IsAbsolute(const_pointer p) {
assert(p != nullptr);
#ifdef WIN32
- if (IsAlphaASCII(p[0]) && p[1] == ':' && IsSeparator(p[2]))
+ if (IsDrive(p) && IsSeparator(p[2]))
return true;
#endif
return IsSeparator(*p);
@@ -135,11 +142,18 @@ struct PathTraitsUTF8 {
return strrchr(p, SEPARATOR);
}
+#ifdef WIN32
+ gcc_pure gcc_nonnull_all
+ static constexpr bool IsDrive(const_pointer p) {
+ return IsAlphaASCII(p[0]) && p[1] == ':';
+ }
+#endif
+
gcc_pure gcc_nonnull_all
static bool IsAbsolute(const_pointer p) {
assert(p != nullptr);
#ifdef WIN32
- if (IsAlphaASCII(p[0]) && p[1] == ':' && IsSeparator(p[2]))
+ if (IsDrive(p) && IsSeparator(p[2]))
return true;
#endif
return IsSeparator(*p);