Commit 92285393 authored by Erik de Castro Lopo's avatar Erik de Castro Lopo
Browse files

flac/metaflac: Do case-insensitve comparison of hex values

Patch-from: lvqcl <lvqcl.mail@gmail.com>
parent 11230878
......@@ -409,7 +409,7 @@ FLAC__bool flac__utils_get_channel_mask_tag(const FLAC__StreamMetadata *object,
return false;
if(0 == (p = strchr((const char *)object->data.vorbis_comment.comments[offset].entry, '='))) /* should never happen, but just in case */
return false;
if(strncmp(p, "=0x", 3))
if(FLAC__STRNCASECMP(p, "=0x", 3))
return false;
if(sscanf(p+3, "%x", &val) != 1)
return false;
......
......@@ -1023,7 +1023,7 @@ FLAC__bool parse_block_type(const char *in, Argument_BlockType *out)
if(strlen(r) == sizeof (out->entries[entry].application_id)) {
memcpy(out->entries[entry].application_id, r, sizeof (out->entries[entry].application_id));
}
else if(strlen(r) == 10 && strncmp(r, "0x", 2) == 0 && strspn(r+2, "0123456789ABCDEFabcdef") == 8) {
else if(strlen(r) == 10 && FLAC__STRNCASECMP(r, "0x", 2) == 0 && strspn(r+2, "0123456789ABCDEFabcdef") == 8) {
FLAC__uint32 x = strtoul(r+2, 0, 16);
out->entries[entry].application_id[3] = (FLAC__byte)(x & 0xff);
out->entries[entry].application_id[2] = (FLAC__byte)((x>>=8) & 0xff);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment