Util/ASCII: add function StringEqualsCaseASCII()
Replaces GLib's g_ascii_strcasecmp().
This commit is contained in:
@@ -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
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user