From 42ec67168ac86ae163f6b67e87429586895f1d06 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 25 Jul 2018 11:29:14 +0200 Subject: [PATCH] command/Database: don't use locate_parse_type() --- src/command/DatabaseCommands.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/command/DatabaseCommands.cxx b/src/command/DatabaseCommands.cxx index 6123d28c2..7fb1c3b06 100644 --- a/src/command/DatabaseCommands.cxx +++ b/src/command/DatabaseCommands.cxx @@ -33,6 +33,7 @@ #include "util/ConstBuffer.hxx" #include "util/Exception.hxx" #include "util/StringAPI.hxx" +#include "util/ASCII.hxx" #include "SongFilter.hxx" #include "BulkEdit.hxx" @@ -247,12 +248,12 @@ CommandResult handle_list(Client &client, Request args, Response &r) { const char *tag_name = args.shift(); - unsigned tagType = locate_parse_type(tag_name); - - if (tagType == LOCATE_TAG_FILE_TYPE) + if (StringEqualsCaseASCII(tag_name, "file") || + StringEqualsCaseASCII(tag_name, "filename")) return handle_list_file(client, args, r); - if (tagType >= TAG_NUM_OF_ITEM_TYPES) { + const auto tagType = tag_name_parse_i(tag_name); + if (tagType == TAG_NUM_OF_ITEM_TYPES) { r.FormatError(ACK_ERROR_ARG, "Unknown tag type: %s", tag_name); return CommandResult::ERROR; @@ -301,14 +302,13 @@ handle_list(Client &client, Request args, Response &r) } } - if (tagType < TAG_NUM_OF_ITEM_TYPES && - group_mask.Test(TagType(tagType))) { + if (group_mask.Test(tagType)) { r.Error(ACK_ERROR_ARG, "Conflicting group"); return CommandResult::ERROR; } PrintUniqueTags(r, client.GetPartition(), - TagType(tagType), group_mask, filter.get()); + tagType, group_mask, filter.get()); return CommandResult::OK; }