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
45b60b3d
Commit
45b60b3d
authored
Mar 13, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fs/Traits: GetParent() returns std::string_view
parent
cefc7739
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
15 deletions
+15
-15
FileCommands.cxx
src/command/FileCommands.cxx
+3
-3
Traits.cxx
src/fs/Traits.cxx
+4
-4
Traits.hxx
src/fs/Traits.hxx
+2
-2
PlaylistQueue.cxx
src/playlist/PlaylistQueue.cxx
+3
-3
Print.cxx
src/playlist/Print.cxx
+3
-3
No files found.
src/command/FileCommands.cxx
View file @
45b60b3d
...
...
@@ -169,7 +169,7 @@ handle_read_comments(Client &client, Request args, Response &r)
* opened file or #nullptr on failure.
*/
static
InputStreamPtr
find_stream_art
(
const
char
*
directory
,
Mutex
&
mutex
)
find_stream_art
(
std
::
string_view
directory
,
Mutex
&
mutex
)
{
static
constexpr
char
const
*
art_names
[]
=
{
"cover.png"
,
...
...
@@ -195,11 +195,11 @@ find_stream_art(const char *directory, Mutex &mutex)
static
CommandResult
read_stream_art
(
Response
&
r
,
const
char
*
uri
,
size_t
offset
)
{
std
::
string
art_directory
=
PathTraitsUTF8
::
GetParent
(
uri
);
const
auto
art_directory
=
PathTraitsUTF8
::
GetParent
(
uri
);
Mutex
mutex
;
InputStreamPtr
is
=
find_stream_art
(
art_directory
.
c_str
()
,
mutex
);
InputStreamPtr
is
=
find_stream_art
(
art_directory
,
mutex
);
if
(
is
==
nullptr
)
{
r
.
Error
(
ACK_ERROR_NO_EXIST
,
"No file exists"
);
...
...
src/fs/Traits.cxx
View file @
45b60b3d
...
...
@@ -64,7 +64,7 @@ GetBasePathImpl(typename Traits::const_pointer p) noexcept
}
template
<
typename
Traits
>
typename
Traits
::
string
typename
Traits
::
string
_view
GetParentPathImpl
(
typename
Traits
::
const_pointer
p
)
noexcept
{
#if !CLANG_CHECK_VERSION(3,6)
...
...
@@ -81,7 +81,7 @@ GetParentPathImpl(typename Traits::const_pointer p) noexcept
if
(
Traits
::
IsDrive
(
p
)
&&
sep
==
p
+
2
)
return
{
p
,
3u
};
#endif
return
{
p
,
s
ep
};
return
{
p
,
s
ize_t
(
sep
-
p
)
};
}
template
<
typename
Traits
>
...
...
@@ -130,7 +130,7 @@ PathTraitsFS::GetBase(PathTraitsFS::const_pointer p) noexcept
return
GetBasePathImpl
<
PathTraitsFS
>
(
p
);
}
PathTraitsFS
::
string
PathTraitsFS
::
string
_view
PathTraitsFS
::
GetParent
(
PathTraitsFS
::
const_pointer
p
)
noexcept
{
return
GetParentPathImpl
<
PathTraitsFS
>
(
p
);
...
...
@@ -168,7 +168,7 @@ PathTraitsUTF8::GetBase(const_pointer p) noexcept
return
GetBasePathImpl
<
PathTraitsUTF8
>
(
p
);
}
PathTraitsUTF8
::
string
PathTraitsUTF8
::
string
_view
PathTraitsUTF8
::
GetParent
(
const_pointer
p
)
noexcept
{
return
GetParentPathImpl
<
PathTraitsUTF8
>
(
p
);
...
...
src/fs/Traits.hxx
View file @
45b60b3d
...
...
@@ -138,7 +138,7 @@ struct PathTraitsFS {
* separator in the given input string.
*/
gcc_pure
gcc_nonnull_all
static
string
GetParent
(
const_pointer
p
)
noexcept
;
static
string
_view
GetParent
(
const_pointer
p
)
noexcept
;
/**
* Determine the relative part of the given path to this
...
...
@@ -247,7 +247,7 @@ struct PathTraitsUTF8 {
* separator in the given input string.
*/
gcc_pure
gcc_nonnull_all
static
string
GetParent
(
const_pointer
p
)
noexcept
;
static
string
_view
GetParent
(
const_pointer
p
)
noexcept
;
/**
* Determine the relative part of the given path to this
...
...
src/playlist/PlaylistQueue.cxx
View file @
45b60b3d
...
...
@@ -41,9 +41,9 @@ playlist_load_into_queue(const char *uri, SongEnumerator &e,
playlist
&
dest
,
PlayerControl
&
pc
,
const
SongLoader
&
loader
)
{
const
std
::
string
base_uri
=
uri
!=
nullptr
const
auto
base_uri
=
uri
!=
nullptr
?
PathTraitsUTF8
::
GetParent
(
uri
)
:
std
::
string
(
"."
)
;
:
"."
;
std
::
unique_ptr
<
DetachedSong
>
song
;
for
(
unsigned
i
=
0
;
...
...
@@ -54,7 +54,7 @@ playlist_load_into_queue(const char *uri, SongEnumerator &e,
continue
;
}
if
(
!
playlist_check_translate_song
(
*
song
,
base_uri
.
c_str
()
,
if
(
!
playlist_check_translate_song
(
*
song
,
base_uri
,
loader
))
{
continue
;
}
...
...
src/playlist/Print.cxx
View file @
45b60b3d
...
...
@@ -36,13 +36,13 @@ playlist_provider_print(Response &r,
const
char
*
uri
,
SongEnumerator
&
e
,
bool
detail
)
noexcept
{
const
std
::
string
base_uri
=
uri
!=
nullptr
const
auto
base_uri
=
uri
!=
nullptr
?
PathTraitsUTF8
::
GetParent
(
uri
)
:
std
::
string
(
"."
)
;
:
"."
;
std
::
unique_ptr
<
DetachedSong
>
song
;
while
((
song
=
e
.
NextSong
())
!=
nullptr
)
{
if
(
playlist_check_translate_song
(
*
song
,
base_uri
.
c_str
()
,
if
(
playlist_check_translate_song
(
*
song
,
base_uri
,
loader
)
&&
detail
)
song_print_info
(
r
,
*
song
);
...
...
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