mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
flac/metaflac: Do case-insensitve comparison of hex values
Patch-from: lvqcl <lvqcl.mail@gmail.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user