diff --git a/opustags.1 b/opustags.1 index 142d207..fd123de 100644 --- a/opustags.1 +++ b/opustags.1 @@ -68,8 +68,8 @@ Use \fB-y\fP to allow overwriting. Note that this option is not needed when the output is a special file like \fI/dev/null\fP. .TP .B \-d, \-\-delete \fIFIELD\fP -Delete all the tags whose field name is \fIFIELD\fP. They may be several one of them, though usually -there is only one of each type. +Delete all the tags whose field name is \fIFIELD\fP. The field names are case-insensitive, and +expected to be ASCII. .TP .B \-a, \-\-add \fIFIELD=VALUE\fP Add a tag. Note that multiple tags with the same field name are perfectly acceptable, so you can add diff --git a/src/cli.cc b/src/cli.cc index 486b170..c1663c6 100644 --- a/src/cli.cc +++ b/src/cli.cc @@ -213,7 +213,7 @@ void ot::delete_comments(std::list& comments, const std::string& fi auto current = it++; if (current->size() > field_len + 1 && (*current)[field_len] == '=' && - strncmp(current->data(), field_name.data(), field_len) == 0) + strncasecmp(current->data(), field_name.data(), field_len) == 0) comments.erase(current); } } diff --git a/src/opustags.h b/src/opustags.h index de8368a..7b1e659 100644 --- a/src/opustags.h +++ b/src/opustags.h @@ -462,7 +462,6 @@ status read_comments(FILE* input, std::list& comments); /** * Remove all the comments whose field name is equal to the special one, case-sensitive. * - * \todo Become case-insensitive. * \todo Accept fields like X=Y to remove only comments X=Y, instead of all X. */ void delete_comments(std::list& comments, const std::string& field_name); diff --git a/t/cli.cc b/t/cli.cc index 4275ba8..fce7216 100644 --- a/t/cli.cc +++ b/t/cli.cc @@ -104,7 +104,7 @@ static void check_delete_comments() throw failure("should not have deleted anything"); ot::delete_comments(edited, "Title"); - C expected = {"TITLE=X", "ARTIST=A", "artIst=B"}; + C expected = {"ARTIST=A", "artIst=B"}; if (!std::equal(edited.begin(), edited.end(), expected.begin(), expected.end())) throw failure("did not delete Title correctly"); }