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
eb86fdfb
Commit
eb86fdfb
authored
Jun 25, 2015
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SongFilter: return "const char *" instead of std::string
parent
c7712e2e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
15 deletions
+18
-15
SongFilter.cxx
src/SongFilter.cxx
+2
-2
SongFilter.hxx
src/SongFilter.hxx
+5
-5
Selection.cxx
src/db/Selection.cxx
+5
-2
ProxyDatabasePlugin.cxx
src/db/plugins/ProxyDatabasePlugin.cxx
+4
-4
UpnpDatabasePlugin.cxx
src/db/plugins/upnp/UpnpDatabasePlugin.cxx
+2
-2
No files found.
src/SongFilter.cxx
View file @
eb86fdfb
...
...
@@ -300,12 +300,12 @@ SongFilter::HasOtherThanBase() const
return
false
;
}
std
::
string
const
char
*
SongFilter
::
GetBase
()
const
{
for
(
const
auto
&
i
:
items
)
if
(
i
.
GetTag
()
==
LOCATE_TAG_BASE_TYPE
)
return
i
.
GetValue
();
return
std
::
string
()
;
return
nullptr
;
}
src/SongFilter.hxx
View file @
eb86fdfb
...
...
@@ -76,8 +76,8 @@ public:
return
fold_case
;
}
const
std
::
string
&
GetValue
()
const
{
return
value
;
const
char
*
GetValue
()
const
{
return
value
.
c_str
()
;
}
gcc_pure
gcc_nonnull
(
2
)
...
...
@@ -149,11 +149,11 @@ public:
bool
HasOtherThanBase
()
const
;
/**
* Returns the "base" specification (if there is one) or
an
*
empty string
.
* Returns the "base" specification (if there is one) or
*
nullptr
.
*/
gcc_pure
std
::
string
GetBase
()
const
;
const
char
*
GetBase
()
const
;
};
/**
...
...
src/db/Selection.cxx
View file @
eb86fdfb
...
...
@@ -26,8 +26,11 @@ DatabaseSelection::DatabaseSelection(const char *_uri, bool _recursive,
{
/* optimization: if the caller didn't specify a base URI, pick
the one from SongFilter */
if
(
uri
.
empty
()
&&
filter
!=
nullptr
)
uri
=
filter
->
GetBase
();
if
(
uri
.
empty
()
&&
filter
!=
nullptr
)
{
auto
base
=
filter
->
GetBase
();
if
(
base
!=
nullptr
)
uri
=
base
;
}
}
bool
...
...
src/db/plugins/ProxyDatabasePlugin.cxx
View file @
eb86fdfb
...
...
@@ -263,18 +263,18 @@ SendConstraints(mpd_connection *connection, const SongFilter::Item &item)
return
mpd_search_add_base_constraint
(
connection
,
MPD_OPERATOR_DEFAULT
,
item
.
GetValue
()
.
c_str
()
);
item
.
GetValue
());
#endif
case
LOCATE_TAG_FILE_TYPE
:
return
mpd_search_add_uri_constraint
(
connection
,
MPD_OPERATOR_DEFAULT
,
item
.
GetValue
()
.
c_str
()
);
item
.
GetValue
());
case
LOCATE_TAG_ANY_TYPE
:
return
mpd_search_add_any_tag_constraint
(
connection
,
MPD_OPERATOR_DEFAULT
,
item
.
GetValue
()
.
c_str
()
);
item
.
GetValue
());
default
:
tag
=
Convert
(
TagType
(
item
.
GetTag
()));
...
...
@@ -284,7 +284,7 @@ SendConstraints(mpd_connection *connection, const SongFilter::Item &item)
return
mpd_search_add_tag_constraint
(
connection
,
MPD_OPERATOR_DEFAULT
,
tag
,
item
.
GetValue
()
.
c_str
()
);
item
.
GetValue
());
}
}
...
...
src/db/plugins/upnp/UpnpDatabasePlugin.cxx
View file @
eb86fdfb
...
...
@@ -303,7 +303,7 @@ UpnpDatabase::SearchSongs(const ContentDirectoryService &server,
}
else
{
cond
+=
" = "
;
}
dquote
(
cond
,
item
.
GetValue
()
.
c_str
()
);
dquote
(
cond
,
item
.
GetValue
());
}
cond
+=
')'
;
}
...
...
@@ -339,7 +339,7 @@ UpnpDatabase::SearchSongs(const ContentDirectoryService &server,
}
else
{
cond
+=
" = "
;
}
dquote
(
cond
,
item
.
GetValue
()
.
c_str
()
);
dquote
(
cond
,
item
.
GetValue
());
}
}
...
...
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