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
1761fb14
Commit
1761fb14
authored
Aug 05, 2021
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fs/Traits: add PathTraitsUTF8::IsAbsoluteOrHasScheme()
parent
ef2fc4e6
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
3 deletions
+17
-3
Traits.cxx
src/fs/Traits.cxx
+7
-0
Traits.hxx
src/fs/Traits.hxx
+7
-0
PlaylistSong.cxx
src/playlist/PlaylistSong.cxx
+2
-2
DetachedSong.cxx
src/song/DetachedSong.cxx
+1
-1
No files found.
src/fs/Traits.cxx
View file @
1761fb14
...
...
@@ -19,6 +19,7 @@
#include "Traits.hxx"
#include "util/StringCompare.hxx"
#include "util/UriExtract.hxx"
#include <string.h>
...
...
@@ -220,6 +221,12 @@ PathTraitsUTF8::Build(string_view a, string_view b) noexcept
return
BuildPathImpl
<
PathTraitsUTF8
>
(
a
,
b
);
}
bool
PathTraitsUTF8
::
IsAbsoluteOrHasScheme
(
const_pointer
p
)
noexcept
{
return
IsAbsolute
(
p
)
||
uri_has_scheme
(
p
);
}
PathTraitsUTF8
::
const_pointer
PathTraitsUTF8
::
GetBase
(
const_pointer
p
)
noexcept
{
...
...
src/fs/Traits.hxx
View file @
1761fb14
...
...
@@ -274,6 +274,13 @@ struct PathTraitsUTF8 {
return
IsSeparator
(
*
p
);
}
/**
* Is this any kind of absolute URI? (Unlike IsAbsolute(),
* this includes URIs/URLs with a scheme)
*/
[[
gnu
::
pure
]]
[[
gnu
::
nonnull
]]
static
bool
IsAbsoluteOrHasScheme
(
const_pointer
p
)
noexcept
;
gcc_pure
gcc_nonnull_all
static
bool
IsSpecialFilename
(
const_pointer
name
)
noexcept
{
return
(
name
[
0
]
==
'.'
&&
name
[
1
]
==
0
)
||
...
...
src/playlist/PlaylistSong.cxx
View file @
1761fb14
...
...
@@ -92,8 +92,8 @@ playlist_check_translate_song(DetachedSong &song, std::string_view base_uri,
}
#endif
if
(
base_uri
.
data
()
!=
nullptr
&&
!
uri_has_scheme
(
uri
)
&&
!
PathTraitsUTF8
::
IsAbsolute
(
uri
))
if
(
base_uri
.
data
()
!=
nullptr
&&
!
PathTraitsUTF8
::
IsAbsolute
OrHasScheme
(
uri
))
song
.
SetURI
(
PathTraitsUTF8
::
Build
(
base_uri
,
uri
));
return
playlist_check_load_song
(
song
,
loader
);
...
...
src/song/DetachedSong.cxx
View file @
1761fb14
...
...
@@ -60,7 +60,7 @@ DetachedSong::IsInDatabase() const noexcept
GetRealURI() is never relative */
const
char
*
_uri
=
GetURI
();
return
!
uri_has_scheme
(
_uri
)
&&
!
PathTraitsUTF8
::
IsAbsolut
e
(
_uri
);
return
!
PathTraitsUTF8
::
IsAbsoluteOrHasSchem
e
(
_uri
);
}
SignedSongTime
...
...
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