]> granicus.if.org Git - taglib/commitdiff
Add missing consts.
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Sat, 21 Jan 2017 02:09:05 +0000 (11:09 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Sat, 21 Jan 2017 02:09:05 +0000 (11:09 +0900)
taglib/mpeg/mpegfile.cpp
taglib/mpeg/mpegutils.h

index 64cae2d31d06e45f711e711eafc759562668670f..96f1cf42e8eced609e517767bd24162ea120c6b2 100644 (file)
@@ -358,7 +358,7 @@ long MPEG::File::nextFrameOffset(long position)
       frameSyncBytes[0] = frameSyncBytes[1];
       frameSyncBytes[1] = buffer[i];
       if(isFrameSync(frameSyncBytes)) {
-        Header header(this, position + i - 1, true);
+        const Header header(this, position + i - 1, true);
         if(header.isValid())
           return position + i - 1;
       }
@@ -385,7 +385,7 @@ long MPEG::File::previousFrameOffset(long position)
       frameSyncBytes[1] = frameSyncBytes[0];
       frameSyncBytes[0] = buffer[i];
       if(isFrameSync(frameSyncBytes)) {
-        Header header(this, position + i, true);
+        const Header header(this, position + i, true);
         if(header.isValid())
           return position + i + header.frameLength();
       }
@@ -488,7 +488,7 @@ long MPEG::File::findID3v2()
   if(readBlock(headerID.size()) == headerID)
     return 0;
 
-  Header firstHeader(this, 0, true);
+  const Header firstHeader(this, 0, true);
   if(firstHeader.isValid())
     return -1;
 
@@ -508,7 +508,7 @@ long MPEG::File::findID3v2()
       frameSyncBytes[0] = frameSyncBytes[1];
       frameSyncBytes[1] = buffer[i];
       if(isFrameSync(frameSyncBytes)) {
-        Header header(this, position + i - 1, true);
+        const Header header(this, position + i - 1, true);
         if(header.isValid())
           return -1;
       }
index 1cee918a6cddc78f3d3832adc2770c0a4484b031..8b8cfd69490bf16fe76436c14ddcfee1e28d0078 100644 (file)
@@ -45,12 +45,12 @@ namespace TagLib
        * \note This does not check the length of the vector, since this is an
        * internal utility function.
        */
-      inline bool isFrameSync(const ByteVector &bytes)
+      inline bool isFrameSync(const ByteVector &bytes, long offset = 0)
       {
         // 0xFF in the second byte is possible in theory, but it's very unlikely.
 
-        const unsigned char b1 = bytes[0];
-        const unsigned char b2 = bytes[1];
+        const unsigned char b1 = bytes[offset + 0];
+        const unsigned char b2 = bytes[offset + 1];
         return (b1 == 0xFF && b2 != 0xFF && (b2 & 0xE0) == 0xE0);
       }