aboutsummaryrefslogtreecommitdiffstats
path: root/src/SongFilter.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-02-17 23:22:56 +0100
committerMax Kellermann <max@duempel.org>2014-02-18 09:18:42 +0100
commit3a818b6d45bc6b01c0092afc3f420ced668e9967 (patch)
tree56a1e6924e376422dc8734a07da5c9a03fecaf46 /src/SongFilter.cxx
parent1709ab6810486648ac23bcf683d4e2326ede9d5a (diff)
downloadmpd-3a818b6d45bc6b01c0092afc3f420ced668e9967.tar.gz
mpd-3a818b6d45bc6b01c0092afc3f420ced668e9967.tar.xz
mpd-3a818b6d45bc6b01c0092afc3f420ced668e9967.zip
SongFilter: disable g_utf8_casefold() without GLib
Temporary hack for the experimental no-GLib build.
Diffstat (limited to '')
-rw-r--r--src/SongFilter.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/SongFilter.cxx b/src/SongFilter.cxx
index 637150c37..77fea606e 100644
--- a/src/SongFilter.cxx
+++ b/src/SongFilter.cxx
@@ -26,7 +26,9 @@
#include "util/ASCII.hxx"
#include "util/UriUtil.hxx"
+#ifdef HAVE_GLIB
#include <glib.h>
+#endif
#include <assert.h>
#include <string.h>
@@ -56,10 +58,15 @@ gcc_pure
static std::string
CaseFold(const char *p)
{
+#ifdef HAVE_GLIB
char *q = g_utf8_casefold(p, -1);
std::string result(q);
g_free(q);
return result;
+#else
+ // TODO: implement without GLib
+ return p;
+#endif
}
gcc_pure
@@ -83,9 +90,16 @@ SongFilter::Item::StringMatch(const char *s) const
assert(s != nullptr);
if (fold_case) {
+#ifdef HAVE_GLIB
char *p = g_utf8_casefold(s, -1);
+#else
+ // TODO: implement without GLib
+ const char *p = s;
+#endif
const bool result = strstr(p, value.c_str()) != NULL;
+#ifdef HAVE_GLIB
g_free(p);
+#endif
return result;
} else {
return s == value;