aboutsummaryrefslogtreecommitdiffstats
path: root/src/tag
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-20 23:09:51 +0200
committerMax Kellermann <max@duempel.org>2013-10-20 23:09:51 +0200
commit0e4d2e7277bc2adf18dd1e719ec4ce684f86d72b (patch)
tree181aa272821ace382565b3c3465949101b98e253 /src/tag
parent2bbff77e489ae72a332b18b122844bd761d75764 (diff)
downloadmpd-0e4d2e7277bc2adf18dd1e719ec4ce684f86d72b.tar.gz
mpd-0e4d2e7277bc2adf18dd1e719ec4ce684f86d72b.tar.xz
mpd-0e4d2e7277bc2adf18dd1e719ec4ce684f86d72b.zip
Util/ASCII: add function StringEqualsCaseASCII()
Replaces GLib's g_ascii_strcasecmp().
Diffstat (limited to 'src/tag')
-rw-r--r--src/tag/ApeReplayGain.cxx11
-rw-r--r--src/tag/Tag.cxx3
-rw-r--r--src/tag/TagConfig.cxx3
-rw-r--r--src/tag/TagHandler.cxx5
-rw-r--r--src/tag/TagTable.cxx5
5 files changed, 13 insertions, 14 deletions
diff --git a/src/tag/ApeReplayGain.cxx b/src/tag/ApeReplayGain.cxx
index 817eca349..15526d2d9 100644
--- a/src/tag/ApeReplayGain.cxx
+++ b/src/tag/ApeReplayGain.cxx
@@ -21,8 +21,7 @@
#include "ApeReplayGain.hxx"
#include "ApeLoader.hxx"
#include "ReplayGainInfo.hxx"
-
-#include <glib.h>
+#include "util/ASCII.hxx"
#include <string.h>
#include <stdlib.h>
@@ -43,16 +42,16 @@ replay_gain_ape_callback(unsigned long flags, const char *key,
memcpy(value, _value, value_length);
value[value_length] = 0;
- if (g_ascii_strcasecmp(key, "replaygain_track_gain") == 0) {
+ if (StringEqualsCaseASCII(key, "replaygain_track_gain")) {
info->tuples[REPLAY_GAIN_TRACK].gain = atof(value);
return true;
- } else if (g_ascii_strcasecmp(key, "replaygain_album_gain") == 0) {
+ } else if (StringEqualsCaseASCII(key, "replaygain_album_gain")) {
info->tuples[REPLAY_GAIN_ALBUM].gain = atof(value);
return true;
- } else if (g_ascii_strcasecmp(key, "replaygain_track_peak") == 0) {
+ } else if (StringEqualsCaseASCII(key, "replaygain_track_peak")) {
info->tuples[REPLAY_GAIN_TRACK].peak = atof(value);
return true;
- } else if (g_ascii_strcasecmp(key, "replaygain_album_peak") == 0) {
+ } else if (StringEqualsCaseASCII(key, "replaygain_album_peak")) {
info->tuples[REPLAY_GAIN_ALBUM].peak = atof(value);
return true;
} else
diff --git a/src/tag/Tag.cxx b/src/tag/Tag.cxx
index 6ff8b3dc9..6bf070429 100644
--- a/src/tag/Tag.cxx
+++ b/src/tag/Tag.cxx
@@ -22,6 +22,7 @@
#include "TagPool.hxx"
#include "TagString.hxx"
#include "TagSettings.h"
+#include "util/ASCII.hxx"
#include <glib.h>
#include <assert.h>
@@ -50,7 +51,7 @@ tag_name_parse_i(const char *name)
for (unsigned i = 0; i < TAG_NUM_OF_ITEM_TYPES; ++i) {
assert(tag_item_names[i] != nullptr);
- if (g_ascii_strcasecmp(name, tag_item_names[i]) == 0)
+ if (StringEqualsCaseASCII(name, tag_item_names[i]))
return (TagType)i;
}
diff --git a/src/tag/TagConfig.cxx b/src/tag/TagConfig.cxx
index 9e47cd05b..96fd1847f 100644
--- a/src/tag/TagConfig.cxx
+++ b/src/tag/TagConfig.cxx
@@ -24,6 +24,7 @@
#include "ConfigGlobal.hxx"
#include "ConfigOption.hxx"
#include "system/FatalError.hxx"
+#include "util/ASCII.hxx"
#include <glib.h>
@@ -40,7 +41,7 @@ TagLoadConfig()
std::fill_n(ignore_tag_items, TAG_NUM_OF_ITEM_TYPES, true);
- if (0 == g_ascii_strcasecmp(value, "none"))
+ if (StringEqualsCaseASCII(value, "none"))
return;
bool quit = false;
diff --git a/src/tag/TagHandler.cxx b/src/tag/TagHandler.cxx
index 9e31a7d1d..80982ef50 100644
--- a/src/tag/TagHandler.cxx
+++ b/src/tag/TagHandler.cxx
@@ -20,8 +20,7 @@
#include "config.h"
#include "TagHandler.hxx"
#include "TagBuilder.hxx"
-
-#include <glib.h>
+#include "util/ASCII.hxx"
static void
add_tag_duration(unsigned seconds, void *ctx)
@@ -50,7 +49,7 @@ full_tag_pair(const char *name, gcc_unused const char *value, void *ctx)
{
TagBuilder &tag = *(TagBuilder *)ctx;
- if (g_ascii_strcasecmp(name, "cuesheet") == 0)
+ if (StringEqualsCaseASCII(name, "cuesheet"))
tag.SetHasPlaylist(true);
}
diff --git a/src/tag/TagTable.cxx b/src/tag/TagTable.cxx
index c7e920f2e..b51bc35ba 100644
--- a/src/tag/TagTable.cxx
+++ b/src/tag/TagTable.cxx
@@ -18,8 +18,7 @@
*/
#include "TagTable.hxx"
-
-#include <glib.h>
+#include "util/ASCII.hxx"
#include <string.h>
@@ -47,7 +46,7 @@ TagType
tag_table_lookup_i(const struct tag_table *table, const char *name)
{
for (; table->name != nullptr; ++table)
- if (g_ascii_strcasecmp(name, table->name) == 0)
+ if (StringEqualsCaseASCII(name, table->name))
return table->type;
return TAG_NUM_OF_ITEM_TYPES;