aboutsummaryrefslogtreecommitdiffstats
path: root/src/SongFilter.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/SongFilter.cxx')
-rw-r--r--src/SongFilter.cxx15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/SongFilter.cxx b/src/SongFilter.cxx
index 5860b5ddd..4fc7145da 100644
--- a/src/SongFilter.cxx
+++ b/src/SongFilter.cxx
@@ -23,12 +23,12 @@
#include "DetachedSong.hxx"
#include "tag/Tag.hxx"
#include "util/ConstBuffer.hxx"
+#include "util/StringAPI.hxx"
#include "util/ASCII.hxx"
#include "util/UriUtil.hxx"
#include "lib/icu/Collate.hxx"
#include <assert.h>
-#include <string.h>
#include <stdlib.h>
#define LOCATE_TAG_FILE_KEY "file"
@@ -55,12 +55,12 @@ locate_parse_type(const char *str)
}
gcc_pure
-static std::string
+static AllocatedString<>
ImportString(const char *p, bool fold_case)
{
return fold_case
? IcuCaseFold(p)
- : std::string(p);
+ : AllocatedString<>::Duplicate(p);
}
SongFilter::Item::Item(unsigned _tag, const char *_value, bool _fold_case)
@@ -70,7 +70,7 @@ SongFilter::Item::Item(unsigned _tag, const char *_value, bool _fold_case)
}
SongFilter::Item::Item(unsigned _tag, time_t _time)
- :tag(_tag), time(_time)
+ :tag(_tag), value(nullptr), time(_time)
{
}
@@ -85,10 +85,11 @@ SongFilter::Item::StringMatch(const char *s) const
assert(tag != LOCATE_TAG_MODIFIED_SINCE);
if (fold_case) {
- const std::string folded = IcuCaseFold(s);
- return folded.find(value) != folded.npos;
+ const auto folded = IcuCaseFold(s);
+ assert(!folded.IsNull());
+ return StringFind(folded.c_str(), value.c_str()) != nullptr;
} else {
- return s == value;
+ return StringIsEqual(s, value.c_str());
}
}