diff --git a/taglib/ape/apetag.cpp b/taglib/ape/apetag.cpp index 71a98c18..4e282faa 100644 --- a/taglib/ape/apetag.cpp +++ b/taglib/ape/apetag.cpp @@ -167,14 +167,18 @@ void APE::Tag::setTrack(uint i) addValue("TRACK", String::number(i), true); } -// conversions of tag keys between what we use in PropertyMap and what's usual -// for APE tags -static const TagLib::uint keyConversionsSize = 5; //usual, APE -static const char *keyConversions[][2] = {{"TRACKNUMBER", "TRACK" }, - {"DATE", "YEAR" }, - {"ALBUMARTIST", "ALBUM ARTIST"}, - {"DISCNUMBER", "DISC" }, - {"REMIXER", "MIXARTIST" }}; +namespace +{ + // conversions of tag keys between what we use in PropertyMap and what's usual + // for APE tags + // usual, APE + const char *keyConversions[][2] = {{"TRACKNUMBER", "TRACK" }, + {"DATE", "YEAR" }, + {"ALBUMARTIST", "ALBUM ARTIST"}, + {"DISCNUMBER", "DISC" }, + {"REMIXER", "MIXARTIST" }}; + const size_t keyConversionsSize = sizeof(keyConversions) / sizeof(keyConversions[0]); +} PropertyMap APE::Tag::properties() const { @@ -184,14 +188,16 @@ PropertyMap APE::Tag::properties() const String tagName = it->first.upper(); // if the item is Binary or Locator, or if the key is an invalid string, // add to unsupportedData - if(it->second.type() != Item::Text || tagName.isEmpty()) + if(it->second.type() != Item::Text || tagName.isEmpty()) { properties.unsupportedData().append(it->first); + } else { // Some tags need to be handled specially - for(uint i = 0; i < keyConversionsSize; ++i) + for(size_t i = 0; i < keyConversionsSize; ++i) { if(tagName == keyConversions[i][1]) tagName = keyConversions[i][0]; - properties[tagName].append(it->second.toStringList()); + } + properties[tagName].append(it->second.toStringList()); } } return properties; diff --git a/taglib/mpc/mpcproperties.cpp b/taglib/mpc/mpcproperties.cpp index 2eb2f2a6..9437f22e 100644 --- a/taglib/mpc/mpcproperties.cpp +++ b/taglib/mpc/mpcproperties.cpp @@ -163,42 +163,42 @@ int MPC::Properties::albumPeak() const // private members //////////////////////////////////////////////////////////////////////////////// -unsigned long readSize(File *file, TagLib::uint &sizeLength, bool &eof) -{ - sizeLength = 0; - eof = false; - - unsigned char tmp; - unsigned long size = 0; - - do { - const ByteVector b = file->readBlock(1); - if(b.isEmpty()) { - eof = true; - break; - } - - tmp = b[0]; - size = (size << 7) | (tmp & 0x7F); - sizeLength++; - } while((tmp & 0x80)); - return size; -} - -unsigned long readSize(const ByteVector &data, TagLib::uint &pos) -{ - unsigned char tmp; - unsigned long size = 0; - - do { - tmp = data[pos++]; - size = (size << 7) | (tmp & 0x7F); - } while((tmp & 0x80) && (pos < data.size())); - return size; -} - namespace { + unsigned long readSize(File *file, TagLib::uint &sizeLength, bool &eof) + { + sizeLength = 0; + eof = false; + + unsigned char tmp; + unsigned long size = 0; + + do { + const ByteVector b = file->readBlock(1); + if(b.isEmpty()) { + eof = true; + break; + } + + tmp = b[0]; + size = (size << 7) | (tmp & 0x7F); + sizeLength++; + } while((tmp & 0x80)); + return size; + } + + unsigned long readSize(const ByteVector &data, TagLib::uint &pos) + { + unsigned char tmp; + unsigned long size = 0; + + do { + tmp = data[pos++]; + size = (size << 7) | (tmp & 0x7F); + } while((tmp & 0x80) && (pos < data.size())); + return size; + } + // This array looks weird, but the same as original MusePack code found at: // https://www.musepack.net/index.php?pg=src const unsigned short sftable [8] = { 44100, 48000, 37800, 32000, 0, 0, 0, 0 }; diff --git a/taglib/wavpack/wavpackproperties.cpp b/taglib/wavpack/wavpackproperties.cpp index 4e4ccd58..12d47c44 100644 --- a/taglib/wavpack/wavpackproperties.cpp +++ b/taglib/wavpack/wavpackproperties.cpp @@ -155,8 +155,8 @@ namespace #define SRATE_LSB 23 #define SRATE_MASK (0xfL << SRATE_LSB) -#define MIN_STREAM_VERS 0x402 -#define MAX_STREAM_VERS 0x410 +#define MIN_STREAM_VERS 0x402 +#define MAX_STREAM_VERS 0x410 #define FINAL_BLOCK 0x1000