Util/ASCII: add StringEqualsCaseASCII() overload with length

Replaces GLib's g_ascii_strncasecmp().
This commit is contained in:
Max Kellermann
2013-10-21 08:42:55 +02:00
parent 0e4d2e7277
commit 222dc8a239
6 changed files with 23 additions and 11 deletions

View File

@@ -25,6 +25,7 @@
#include "tag/TagTable.hxx"
#include "tag/TagBuilder.hxx"
#include "ReplayGainInfo.hxx"
#include "util/ASCII.hxx"
#include <glib.h>
@@ -135,7 +136,7 @@ flac_comment_value(const FLAC__StreamMetadata_VorbisComment_Entry *entry,
const char *comment = (const char*)entry->entry;
if (entry->length <= name_length ||
g_ascii_strncasecmp(comment, name, name_length) != 0)
StringEqualsCaseASCII(comment, name, name_length))
return nullptr;
if (comment[name_length] == '=') {

View File

@@ -25,6 +25,7 @@
#include "tag/TagHandler.hxx"
#include "tag/TagBuilder.hxx"
#include "ReplayGainInfo.hxx"
#include "util/ASCII.hxx"
#include <glib.h>
@@ -38,7 +39,7 @@ vorbis_comment_value(const char *comment, const char *needle)
{
size_t len = strlen(needle);
if (g_ascii_strncasecmp(comment, needle, len) == 0 &&
if (StringEqualsCaseASCII(comment, needle, len) &&
comment[len] == '=')
return comment + len + 1;