]> granicus.if.org Git - libmatroska/commitdiff
[clang-tidy] do not use else after return
authorRosen Penev <rosenp@gmail.com>
Sun, 17 May 2020 01:56:35 +0000 (18:56 -0700)
committerMoritz Bunkus <moritz@bunkus.org>
Mon, 22 Jun 2020 08:36:44 +0000 (10:36 +0200)
Found with readability-else-after-return

Signed-off-by: Rosen Penev <rosenp@gmail.com>
src/KaxBlock.cpp
src/KaxCluster.cpp

index c2f406c1779c9ad352936303a17518355c0490d6..981ea10cc5902f7555a040b6e71ed8b2eae915cf 100644 (file)
@@ -131,8 +131,8 @@ bool KaxInternalBlock::AddFrame(const KaxTrackEntry & track, uint64 timecode, Da
     // a frame in a lace is not efficient when the place necessary to code it in a lace is bigger
     // than the size of a simple Block. That means more than 6 bytes (4 in struct + 2 for EBML) to code the size
     return (buffer.Size() < 6*0xFF);
-  else
-    return true;
+
+  return true;
 }
 
 /*!
@@ -157,10 +157,10 @@ LacingType KaxInternalBlock::GetBestLacingType() const {
     EbmlLacingSize += CodedSizeLengthSigned(int64(myBuffers[i]->Size()) - int64(myBuffers[i - 1]->Size()), 0);
   if (SameSize)
     return LACING_FIXED;
-  else if (XiphLacingSize < EbmlLacingSize)
+  if (XiphLacingSize < EbmlLacingSize)
     return LACING_XIPH;
-  else
-    return LACING_EBML;
+
+  return LACING_EBML;
 }
 
 filepos_t KaxInternalBlock::UpdateSize(bool /* bSaveDefault */, bool /* bForceRender */)
@@ -958,8 +958,7 @@ KaxBlockBlob::operator KaxInternalBlock &()
   assert(Block.group);
   if (bUseSimpleBlock)
     return *Block.simpleblock;
-  else
-    return *Block.group;
+  return *Block.group;
 }
 
 KaxBlockBlob::operator const KaxInternalBlock &() const
@@ -967,8 +966,7 @@ KaxBlockBlob::operator const KaxInternalBlock &() const
   assert(Block.group);
   if (bUseSimpleBlock)
     return *Block.simpleblock;
-  else
-    return *Block.group;
+  return *Block.group;
 }
 
 KaxBlockBlob::operator KaxSimpleBlock &()
index 65616ebb42b62ce7d35433dd9572b2730d2cf9ea..36fd05d79bf91ce3bfdfb99913f53fb076671274 100644 (file)
@@ -102,28 +102,26 @@ bool KaxCluster::AddFrameInternal(const KaxTrackEntry & track, uint64 timecode,
       if (currentNewBlock->AddFrame(track, timecode, buffer, *PastBlock, *ForwBlock, lacing)) {
         // more data are allowed in this Block
         return true;
-      } else {
-        currentNewBlock = NULL;
-        return false;
       }
-    } else {
-      if (currentNewBlock->AddFrame(track, timecode, buffer, *PastBlock, lacing)) {
-        // more data are allowed in this Block
-        return true;
-      } else {
-        currentNewBlock = NULL;
-        return false;
-      }
-    }
-  } else {
-    if (currentNewBlock->AddFrame(track, timecode, buffer, lacing)) {
-      // more data are allowed in this Block
-      return true;
-    } else {
+
       currentNewBlock = NULL;
       return false;
     }
+    if (currentNewBlock->AddFrame(track, timecode, buffer, *PastBlock, lacing)) {
+        // more data are allowed in this Block
+        return true;
+      }
+    currentNewBlock = NULL;
+    return false;
   }
+
+  if (currentNewBlock->AddFrame(track, timecode, buffer, lacing)) {
+    // more data are allowed in this Block
+    return true;
+  }
+
+  currentNewBlock = NULL;
+  return false;
 }
 
 bool KaxCluster::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, KaxBlockGroup * & MyNewBlock, LacingType lacing)