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
{
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;
// private members
////////////////////////////////////////////////////////////////////////////////
-unsigned long readSize(File *file, TagLib::uint &sizeLength, bool &eof)
+namespace
{
- sizeLength = 0;
- eof = false;
+ 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;
+ }
- unsigned char tmp;
- unsigned long size = 0;
+ tmp = b[0];
+ size = (size << 7) | (tmp & 0x7F);
+ sizeLength++;
+ } while((tmp & 0x80));
+ return size;
+ }
- do {
- const ByteVector b = file->readBlock(1);
- if(b.isEmpty()) {
- eof = true;
- break;
- }
+ unsigned long readSize(const ByteVector &data, TagLib::uint &pos)
+ {
+ unsigned char tmp;
+ unsigned long size = 0;
- 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;
-}
+ do {
+ tmp = data[pos++];
+ size = (size << 7) | (tmp & 0x7F);
+ } while((tmp & 0x80) && (pos < data.size()));
+ return size;
+ }
-namespace
-{
// 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 };