mirror of
https://github.com/fmang/opustags.git
synced 2025-01-15 20:53:16 +01:00
case-insensitive field name for comment deletion
This commit is contained in:
parent
a9adc11cad
commit
e2a1c06005
@ -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
|
||||
|
@ -213,7 +213,7 @@ void ot::delete_comments(std::list<std::string>& 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);
|
||||
}
|
||||
}
|
||||
|
@ -462,7 +462,6 @@ status read_comments(FILE* input, std::list<std::string>& 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<std::string>& comments, const std::string& field_name);
|
||||
|
2
t/cli.cc
2
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");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user