diff options
author | Max Kellermann <max@musicpd.org> | 2019-03-15 20:32:03 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2019-03-16 13:23:02 +0100 |
commit | 3bf521d5caadb395bd26e0df82d8d8d3de78b599 (patch) | |
tree | 9dbac69b4c80163305f6447f2894a11a9e520e3d /src/song | |
parent | 0acb55cde5565b63f5b4289437436186d56071be (diff) |
song/TagSongFilter: apply negation properly to multiple tag values
The old implementation didn't make a lot of sense; the "!=" operator
was not actually the opposite of "==".
Closes https://github.com/MusicPlayerDaemon/MPD/issues/505
Diffstat (limited to 'src/song')
-rw-r--r-- | src/song/TagSongFilter.cxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/song/TagSongFilter.cxx b/src/song/TagSongFilter.cxx index df92ed435..00f2021aa 100644 --- a/src/song/TagSongFilter.cxx +++ b/src/song/TagSongFilter.cxx @@ -43,8 +43,8 @@ TagSongFilter::Match(const Tag &tag) const noexcept visited_types[i.type] = true; if ((type == TAG_NUM_OF_ITEM_TYPES || i.type == type) && - filter.Match(i.value)) - return true; + filter.MatchWithoutNegation(i.value)) + return !filter.IsNegated(); } if (type < TAG_NUM_OF_ITEM_TYPES && !visited_types[type]) { @@ -61,7 +61,7 @@ TagSongFilter::Match(const Tag &tag) const noexcept for (const auto &item : tag) { if (item.type == tag2 && - filter.Match(item.value)) { + filter.MatchWithoutNegation(item.value)) { result = true; break; } @@ -69,7 +69,7 @@ TagSongFilter::Match(const Tag &tag) const noexcept return true; })) - return result; + return result != filter.IsNegated(); /* If the search critieron was not visited during the sweep through the song's tag, it means this field @@ -78,10 +78,10 @@ TagSongFilter::Match(const Tag &tag) const noexcept then it's a match as well and we should return true. */ if (filter.empty()) - return true; + return !filter.IsNegated(); } - return false; + return filter.IsNegated(); } bool |