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
2429cc87
Commit
2429cc87
authored
Apr 03, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fs/Traits: convert first Relative() parameter to std::string_view
parent
3a83a6b5
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
11 additions
and
15 deletions
+11
-15
Traits.cxx
src/fs/Traits.cxx
+4
-6
Traits.hxx
src/fs/Traits.hxx
+2
-4
CurlStorage.cxx
src/storage/plugins/CurlStorage.cxx
+1
-1
LocalStorage.cxx
src/storage/plugins/LocalStorage.cxx
+1
-1
NfsStorage.cxx
src/storage/plugins/NfsStorage.cxx
+1
-1
SmbclientStorage.cxx
src/storage/plugins/SmbclientStorage.cxx
+1
-1
UdisksStorage.cxx
src/storage/plugins/UdisksStorage.cxx
+1
-1
No files found.
src/fs/Traits.cxx
View file @
2429cc87
...
...
@@ -86,10 +86,9 @@ GetParentPathImpl(typename Traits::const_pointer p) noexcept
template
<
typename
Traits
>
typename
Traits
::
const_pointer
RelativePathImpl
(
typename
Traits
::
const_pointer
base
,
RelativePathImpl
(
typename
Traits
::
string_view
base
,
typename
Traits
::
const_pointer
other
)
noexcept
{
assert
(
base
!=
nullptr
);
assert
(
other
!=
nullptr
);
other
=
StringAfterPrefix
(
other
,
base
);
...
...
@@ -99,7 +98,7 @@ RelativePathImpl(typename Traits::const_pointer base,
if
(
*
other
!=
0
)
{
if
(
!
Traits
::
IsSeparator
(
*
other
))
{
if
(
*
base
!=
0
&&
Traits
::
IsSeparator
(
other
[
-
1
]))
if
(
!
base
.
empty
()
&&
Traits
::
IsSeparator
(
other
[
-
1
]))
/* "other" has no more slash, but the
matching base ended with a slash:
enough to detect a match */
...
...
@@ -137,7 +136,7 @@ PathTraitsFS::GetParent(PathTraitsFS::const_pointer p) noexcept
}
PathTraitsFS
::
const_pointer
PathTraitsFS
::
Relative
(
const_pointer
base
,
const_pointer
other
)
noexcept
PathTraitsFS
::
Relative
(
string_view
base
,
const_pointer
other
)
noexcept
{
return
RelativePathImpl
<
PathTraitsFS
>
(
base
,
other
);
}
...
...
@@ -175,8 +174,7 @@ PathTraitsUTF8::GetParent(const_pointer p) noexcept
}
PathTraitsUTF8
::
const_pointer
PathTraitsUTF8
::
Relative
(
const_pointer
base
,
const_pointer
other
)
noexcept
PathTraitsUTF8
::
Relative
(
string_view
base
,
const_pointer
other
)
noexcept
{
return
RelativePathImpl
<
PathTraitsUTF8
>
(
base
,
other
);
}
src/fs/Traits.hxx
View file @
2429cc87
...
...
@@ -147,8 +147,7 @@ struct PathTraitsFS {
* nullptr on mismatch.
*/
gcc_pure
gcc_nonnull_all
static
const_pointer
Relative
(
const_pointer
base
,
const_pointer
other
)
noexcept
;
static
const_pointer
Relative
(
string_view
base
,
const_pointer
other
)
noexcept
;
/**
* Constructs the path from the given components.
...
...
@@ -256,8 +255,7 @@ struct PathTraitsUTF8 {
* nullptr on mismatch.
*/
gcc_pure
gcc_nonnull_all
static
const_pointer
Relative
(
const_pointer
base
,
const_pointer
other
)
noexcept
;
static
const_pointer
Relative
(
string_view
base
,
const_pointer
other
)
noexcept
;
/**
* Constructs the path from the given components.
...
...
src/storage/plugins/CurlStorage.cxx
View file @
2429cc87
...
...
@@ -81,7 +81,7 @@ CurlStorage::MapUTF8(const char *uri_utf8) const noexcept
const
char
*
CurlStorage
::
MapToRelativeUTF8
(
const
char
*
uri_utf8
)
const
noexcept
{
return
PathTraitsUTF8
::
Relative
(
base
.
c_str
()
,
return
PathTraitsUTF8
::
Relative
(
base
,
CurlUnescape
(
uri_utf8
).
c_str
());
}
...
...
src/storage/plugins/LocalStorage.cxx
View file @
2429cc87
...
...
@@ -129,7 +129,7 @@ LocalStorage::MapFS(const char *uri_utf8) const noexcept
const
char
*
LocalStorage
::
MapToRelativeUTF8
(
const
char
*
uri_utf8
)
const
noexcept
{
return
PathTraitsUTF8
::
Relative
(
base_utf8
.
c_str
()
,
uri_utf8
);
return
PathTraitsUTF8
::
Relative
(
base_utf8
,
uri_utf8
);
}
StorageFileInfo
...
...
src/storage/plugins/NfsStorage.cxx
View file @
2429cc87
...
...
@@ -246,7 +246,7 @@ NfsStorage::MapUTF8(const char *uri_utf8) const noexcept
const
char
*
NfsStorage
::
MapToRelativeUTF8
(
const
char
*
uri_utf8
)
const
noexcept
{
return
PathTraitsUTF8
::
Relative
(
base
.
c_str
()
,
uri_utf8
);
return
PathTraitsUTF8
::
Relative
(
base
,
uri_utf8
);
}
static
void
...
...
src/storage/plugins/SmbclientStorage.cxx
View file @
2429cc87
...
...
@@ -87,7 +87,7 @@ SmbclientStorage::MapUTF8(const char *uri_utf8) const noexcept
const
char
*
SmbclientStorage
::
MapToRelativeUTF8
(
const
char
*
uri_utf8
)
const
noexcept
{
return
PathTraitsUTF8
::
Relative
(
base
.
c_str
()
,
uri_utf8
);
return
PathTraitsUTF8
::
Relative
(
base
,
uri_utf8
);
}
static
StorageFileInfo
...
...
src/storage/plugins/UdisksStorage.cxx
View file @
2429cc87
...
...
@@ -347,7 +347,7 @@ UdisksStorage::MapUTF8(const char *uri_utf8) const noexcept
const
char
*
UdisksStorage
::
MapToRelativeUTF8
(
const
char
*
uri_utf8
)
const
noexcept
{
return
PathTraitsUTF8
::
Relative
(
base_uri
.
c_str
()
,
uri_utf8
);
return
PathTraitsUTF8
::
Relative
(
base_uri
,
uri_utf8
);
}
static
std
::
unique_ptr
<
Storage
>
...
...
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