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
87015121
Commit
87015121
authored
Apr 03, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/SplitString: convert parameter to std::string_view
parent
ae4fd576
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
7 deletions
+9
-7
UpnpDatabasePlugin.cxx
src/db/plugins/upnp/UpnpDatabasePlugin.cxx
+1
-1
SplitString.cxx
src/util/SplitString.cxx
+5
-4
SplitString.hxx
src/util/SplitString.hxx
+3
-2
No files found.
src/db/plugins/upnp/UpnpDatabasePlugin.cxx
View file @
87015121
...
...
@@ -591,7 +591,7 @@ UpnpDatabase::Visit(const DatabaseSelection &selection,
{
DatabaseVisitorHelper
helper
(
CheckSelection
(
selection
),
visit_song
);
auto
vpath
=
SplitString
(
selection
.
uri
.
c_str
()
,
'/'
);
auto
vpath
=
SplitString
(
selection
.
uri
,
'/'
);
if
(
vpath
.
empty
())
{
for
(
const
auto
&
server
:
discovery
->
GetDirectories
())
{
if
(
visit_directory
)
{
...
...
src/util/SplitString.cxx
View file @
87015121
/*
* Copyright
(C) 2013-2016
Max Kellermann <max.kellermann@gmail.com>
* Copyright
2013-2020
Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
...
...
@@ -32,13 +32,14 @@
#include "StringStrip.hxx"
std
::
forward_list
<
std
::
string
>
SplitString
(
const
char
*
s
,
char
separator
,
bool
strip
)
noexcept
SplitString
(
std
::
string_view
_
s
,
char
separator
,
bool
strip
)
noexcept
{
StringView
s
(
_s
);
if
(
strip
)
s
=
StripLeft
(
s
);
s
.
StripLeft
(
);
std
::
forward_list
<
std
::
string
>
list
;
if
(
*
s
==
0
)
if
(
s
.
empty
()
)
return
list
;
auto
i
=
list
.
before_begin
();
...
...
src/util/SplitString.hxx
View file @
87015121
/*
* Copyright
(C) 2013-2016
Max Kellermann <max.kellermann@gmail.com>
* Copyright
2013-2020
Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
...
...
@@ -32,6 +32,7 @@
#include <forward_list>
#include <string>
#include <string_view>
/**
* Split a string at a certain separator character into sub strings
...
...
@@ -44,6 +45,6 @@
* (and not a list with an empty string).
*/
std
::
forward_list
<
std
::
string
>
SplitString
(
const
char
*
s
,
char
separator
,
bool
strip
=
true
)
noexcept
;
SplitString
(
std
::
string_view
s
,
char
separator
,
bool
strip
=
true
)
noexcept
;
#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