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
7fdd8014
Commit
7fdd8014
authored
Apr 24, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DatabaseCommands: simplify the handle_list() argument parser
parent
27002ad1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
DatabaseCommands.cxx
src/command/DatabaseCommands.cxx
+12
-9
No files found.
src/command/DatabaseCommands.cxx
View file @
7fdd8014
...
...
@@ -179,16 +179,20 @@ handle_listall(Client &client, gcc_unused int argc, char *argv[])
CommandResult
handle_list
(
Client
&
client
,
int
argc
,
char
*
argv
[])
{
unsigned
tagType
=
locate_parse_type
(
argv
[
1
]);
ConstBuffer
<
const
char
*>
args
(
argv
+
1
,
argc
-
1
);
const
char
*
tag_name
=
args
.
shift
();
unsigned
tagType
=
locate_parse_type
(
tag_name
);
if
(
tagType
>=
TAG_NUM_OF_ITEM_TYPES
&&
tagType
!=
LOCATE_TAG_FILE_TYPE
)
{
command_error
(
client
,
ACK_ERROR_ARG
,
"
\"
%s
\"
is not known"
,
argv
[
1
]);
command_error
(
client
,
ACK_ERROR_ARG
,
"Unknown tag type: %s"
,
tag_name
);
return
CommandResult
::
ERROR
;
}
SongFilter
*
filter
;
if
(
argc
==
3
)
{
SongFilter
*
filter
=
nullptr
;
if
(
args
.
size
==
1
)
{
/* for compatibility with < 0.12.0 */
if
(
tagType
!=
TAG_ALBUM
)
{
command_error
(
client
,
ACK_ERROR_ARG
,
...
...
@@ -197,10 +201,10 @@ handle_list(Client &client, int argc, char *argv[])
return
CommandResult
::
ERROR
;
}
filter
=
new
SongFilter
((
unsigned
)
TAG_ARTIST
,
argv
[
2
]);
}
else
if
(
argc
>
2
)
{
ConstBuffer
<
const
char
*>
args
(
argv
+
2
,
argc
-
2
);
filter
=
new
SongFilter
((
unsigned
)
TAG_ARTIST
,
args
.
shift
());
}
if
(
!
args
.
IsEmpty
())
{
filter
=
new
SongFilter
();
if
(
!
filter
->
Parse
(
args
,
false
))
{
delete
filter
;
...
...
@@ -208,8 +212,7 @@ handle_list(Client &client, int argc, char *argv[])
"not able to parse args"
);
return
CommandResult
::
ERROR
;
}
}
else
filter
=
nullptr
;
}
Error
error
;
CommandResult
ret
=
...
...
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