Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
403bd77e
Commit
403bd77e
authored
Dec 05, 2013
by
Denis Krjuchkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fs/Traits: improve compatibility between PathTraitsFS and PathTraitsUTF8
parent
b397c461
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
9 deletions
+14
-9
Traits.cxx
src/fs/Traits.cxx
+4
-4
Traits.hxx
src/fs/Traits.hxx
+10
-5
No files found.
src/fs/Traits.cxx
View file @
403bd77e
...
@@ -47,8 +47,8 @@ PathTraitsFS::Build(PathTraitsFS::const_pointer a, size_t a_size,
...
@@ -47,8 +47,8 @@ PathTraitsFS::Build(PathTraitsFS::const_pointer a, size_t a_size,
return
result
;
return
result
;
}
}
const
char
*
PathTraitsUTF8
::
const_pointer
PathTraitsUTF8
::
GetBase
(
const
char
*
p
)
PathTraitsUTF8
::
GetBase
(
PathTraitsUTF8
::
const_pointer
p
)
{
{
assert
(
p
!=
nullptr
);
assert
(
p
!=
nullptr
);
...
@@ -58,8 +58,8 @@ PathTraitsUTF8::GetBase(const char *p)
...
@@ -58,8 +58,8 @@ PathTraitsUTF8::GetBase(const char *p)
:
p
;
:
p
;
}
}
std
::
string
PathTraitsUTF8
::
string
PathTraitsUTF8
::
GetParent
(
const
char
*
p
)
PathTraitsUTF8
::
GetParent
(
PathTraitsUTF8
::
const_pointer
p
)
{
{
assert
(
p
!=
nullptr
);
assert
(
p
!=
nullptr
);
...
...
src/fs/Traits.hxx
View file @
403bd77e
...
@@ -85,14 +85,19 @@ struct PathTraitsFS {
...
@@ -85,14 +85,19 @@ struct PathTraitsFS {
* This class describes the nature of a MPD internal filesystem path.
* This class describes the nature of a MPD internal filesystem path.
*/
*/
struct
PathTraitsUTF8
{
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
;
return
ch
==
SEPARATOR
;
}
}
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
bool
IsAbsolute
(
const
char
*
p
)
{
static
bool
IsAbsolute
(
const
_pointer
p
)
{
assert
(
p
!=
nullptr
);
assert
(
p
!=
nullptr
);
#ifdef WIN32
#ifdef WIN32
if
(
IsAlphaASCII
(
p
[
0
])
&&
p
[
1
]
==
':'
&&
IsSeparator
(
p
[
2
]))
if
(
IsAlphaASCII
(
p
[
0
])
&&
p
[
1
]
==
':'
&&
IsSeparator
(
p
[
2
]))
...
@@ -106,7 +111,7 @@ struct PathTraitsUTF8 {
...
@@ -106,7 +111,7 @@ struct PathTraitsUTF8 {
* The return value points inside the given string.
* The return value points inside the given string.
*/
*/
gcc_pure
gcc_nonnull_all
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.
* Determine the "parent" file name of the given UTF-8 path.
...
@@ -114,7 +119,7 @@ struct PathTraitsUTF8 {
...
@@ -114,7 +119,7 @@ struct PathTraitsUTF8 {
* separator in the given input string.
* separator in the given input string.
*/
*/
gcc_pure
gcc_nonnull_all
gcc_pure
gcc_nonnull_all
static
st
d
::
string
GetParent
(
const
char
*
p
);
static
st
ring
GetParent
(
const_pointer
p
);
};
};
#endif
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment