summaryrefslogtreecommitdiff
path: root/src/playlist
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/playlist
parent2bbff77e489ae72a332b18b122844bd761d75764 (diff)
Util/ASCII: add function StringEqualsCaseASCII()
Replaces GLib's g_ascii_strcasecmp().
Diffstat (limited to 'src/playlist')
-rw-r--r--src/playlist/AsxPlaylistPlugin.cxx13
-rw-r--r--src/playlist/EmbeddedCuePlaylistPlugin.cxx3
-rw-r--r--src/playlist/RssPlaylistPlugin.cxx13
3 files changed, 16 insertions, 13 deletions
diff --git a/src/playlist/AsxPlaylistPlugin.cxx b/src/playlist/AsxPlaylistPlugin.cxx
index ab204773f..14063fdf2 100644
--- a/src/playlist/AsxPlaylistPlugin.cxx
+++ b/src/playlist/AsxPlaylistPlugin.cxx
@@ -24,6 +24,7 @@
#include "InputStream.hxx"
#include "Song.hxx"
#include "tag/Tag.hxx"
+#include "util/ASCII.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
#include "Log.hxx"
@@ -75,7 +76,7 @@ get_attribute(const gchar **attribute_names, const gchar **attribute_values,
const gchar *name)
{
for (unsigned i = 0; attribute_names[i] != NULL; ++i)
- if (g_ascii_strcasecmp(attribute_names[i], name) == 0)
+ if (StringEqualsCaseASCII(attribute_names[i], name))
return attribute_values[i];
return NULL;
@@ -92,7 +93,7 @@ asx_start_element(gcc_unused GMarkupParseContext *context,
switch (parser->state) {
case AsxParser::ROOT:
- if (g_ascii_strcasecmp(element_name, "entry") == 0) {
+ if (StringEqualsCaseASCII(element_name, "entry")) {
parser->state = AsxParser::ENTRY;
parser->song = Song::NewRemote("asx:");
parser->tag = TAG_NUM_OF_ITEM_TYPES;
@@ -101,7 +102,7 @@ asx_start_element(gcc_unused GMarkupParseContext *context,
break;
case AsxParser::ENTRY:
- if (g_ascii_strcasecmp(element_name, "ref") == 0) {
+ if (StringEqualsCaseASCII(element_name, "ref")) {
const gchar *href = get_attribute(attribute_names,
attribute_values,
"href");
@@ -121,11 +122,11 @@ asx_start_element(gcc_unused GMarkupParseContext *context,
parser->song = song;
}
- } else if (g_ascii_strcasecmp(element_name, "author") == 0)
+ } else if (StringEqualsCaseASCII(element_name, "author"))
/* is that correct? or should it be COMPOSER
or PERFORMER? */
parser->tag = TAG_ARTIST;
- else if (g_ascii_strcasecmp(element_name, "title") == 0)
+ else if (StringEqualsCaseASCII(element_name, "title"))
parser->tag = TAG_TITLE;
break;
@@ -144,7 +145,7 @@ asx_end_element(gcc_unused GMarkupParseContext *context,
break;
case AsxParser::ENTRY:
- if (g_ascii_strcasecmp(element_name, "entry") == 0) {
+ if (StringEqualsCaseASCII(element_name, "entry")) {
if (strcmp(parser->song->uri, "asx:") != 0)
parser->songs.emplace_front(parser->song);
else
diff --git a/src/playlist/EmbeddedCuePlaylistPlugin.cxx b/src/playlist/EmbeddedCuePlaylistPlugin.cxx
index fe3b4ca12..50390dbd6 100644
--- a/src/playlist/EmbeddedCuePlaylistPlugin.cxx
+++ b/src/playlist/EmbeddedCuePlaylistPlugin.cxx
@@ -35,6 +35,7 @@
#include "TagFile.hxx"
#include "cue/CueParser.hxx"
#include "fs/Traits.hxx"
+#include "util/ASCII.hxx"
#include <glib.h>
#include <assert.h>
@@ -81,7 +82,7 @@ embcue_tag_pair(const char *name, const char *value, void *ctx)
EmbeddedCuePlaylist *playlist = (EmbeddedCuePlaylist *)ctx;
if (playlist->cuesheet == NULL &&
- g_ascii_strcasecmp(name, "cuesheet") == 0)
+ StringEqualsCaseASCII(name, "cuesheet"))
playlist->cuesheet = g_strdup(value);
}
diff --git a/src/playlist/RssPlaylistPlugin.cxx b/src/playlist/RssPlaylistPlugin.cxx
index 7faf6faac..4aa6f1026 100644
--- a/src/playlist/RssPlaylistPlugin.cxx
+++ b/src/playlist/RssPlaylistPlugin.cxx
@@ -24,6 +24,7 @@
#include "InputStream.hxx"
#include "Song.hxx"
#include "tag/Tag.hxx"
+#include "util/ASCII.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
#include "Log.hxx"
@@ -74,7 +75,7 @@ get_attribute(const gchar **attribute_names, const gchar **attribute_values,
const gchar *name)
{
for (unsigned i = 0; attribute_names[i] != NULL; ++i)
- if (g_ascii_strcasecmp(attribute_names[i], name) == 0)
+ if (StringEqualsCaseASCII(attribute_names[i], name))
return attribute_values[i];
return NULL;
@@ -91,7 +92,7 @@ rss_start_element(gcc_unused GMarkupParseContext *context,
switch (parser->state) {
case RssParser::ROOT:
- if (g_ascii_strcasecmp(element_name, "item") == 0) {
+ if (StringEqualsCaseASCII(element_name, "item")) {
parser->state = RssParser::ITEM;
parser->song = Song::NewRemote("rss:");
parser->tag = TAG_NUM_OF_ITEM_TYPES;
@@ -100,7 +101,7 @@ rss_start_element(gcc_unused GMarkupParseContext *context,
break;
case RssParser::ITEM:
- if (g_ascii_strcasecmp(element_name, "enclosure") == 0) {
+ if (StringEqualsCaseASCII(element_name, "enclosure")) {
const gchar *href = get_attribute(attribute_names,
attribute_values,
"url");
@@ -120,9 +121,9 @@ rss_start_element(gcc_unused GMarkupParseContext *context,
parser->song = song;
}
- } else if (g_ascii_strcasecmp(element_name, "title") == 0)
+ } else if (StringEqualsCaseASCII(element_name, "title"))
parser->tag = TAG_TITLE;
- else if (g_ascii_strcasecmp(element_name, "itunes:author") == 0)
+ else if (StringEqualsCaseASCII(element_name, "itunes:author"))
parser->tag = TAG_ARTIST;
break;
@@ -141,7 +142,7 @@ rss_end_element(gcc_unused GMarkupParseContext *context,
break;
case RssParser::ITEM:
- if (g_ascii_strcasecmp(element_name, "item") == 0) {
+ if (StringEqualsCaseASCII(element_name, "item")) {
if (strcmp(parser->song->uri, "rss:") != 0)
parser->songs.emplace_front(parser->song);
else