From: Rosen Penev Date: Sun, 17 May 2020 01:56:35 +0000 (-0700) Subject: [clang-tidy] do not use else after return X-Git-Tag: release-1.6.0~15 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fe755c269ff1e1fdd3ee2c43cb150678e4ff0a59;p=libmatroska [clang-tidy] do not use else after return Found with readability-else-after-return Signed-off-by: Rosen Penev --- diff --git a/src/KaxBlock.cpp b/src/KaxBlock.cpp index c2f406c..981ea10 100644 --- a/src/KaxBlock.cpp +++ b/src/KaxBlock.cpp @@ -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 &() diff --git a/src/KaxCluster.cpp b/src/KaxCluster.cpp index 65616eb..36fd05d 100644 --- a/src/KaxCluster.cpp +++ b/src/KaxCluster.cpp @@ -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)