]> granicus.if.org Git - taglib/commitdiff
Surround some internal stuff by anonymous namespaces.
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Wed, 2 Dec 2015 03:00:43 +0000 (12:00 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Wed, 2 Dec 2015 03:00:43 +0000 (12:00 +0900)
taglib/ape/apetag.cpp
taglib/mpc/mpcproperties.cpp
taglib/wavpack/wavpackproperties.cpp

index 71a98c18721219092b16f312d71057bc45db8967..4e282faaecd21523fbdc4cdbf2627b314e419eae 100644 (file)
@@ -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;
index 2eb2f2a69960161675c239921b632912638813c8..9437f22e0e48ba622522a46ca03f075090536254 100644 (file)
@@ -163,42 +163,42 @@ int MPC::Properties::albumPeak() const
 // 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 };
index 4e4ccd58292c0eaf5fcc6d3ed0bf832d44616b85..12d47c44550729c0493f3425b8e3d7c1c3f36cc1 100644 (file)
@@ -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