flac/metaflac: Do case-insensitve comparison of hex values
authorErik de Castro Lopo <erikd@mega-nerd.com>
Sat, 8 Aug 2015 22:43:29 +0000 (08:43 +1000)
committerErik de Castro Lopo <erikd@mega-nerd.com>
Sat, 8 Aug 2015 22:48:57 +0000 (08:48 +1000)
Patch-from: lvqcl <lvqcl.mail@gmail.com>

src/flac/utils.c
src/metaflac/options.c

index 2fab29e..444c98e 100644 (file)
@@ -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;
index 16713d2..db60d4e 100644 (file)
@@ -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);