]> granicus.if.org Git - libmatroska/commitdiff
clang-tidy: remove non const operator
authorRosen Penev <rosenp@gmail.com>
Sat, 15 Oct 2022 16:53:24 +0000 (09:53 -0700)
committerRosen Penev <rosenp@gmail.com>
Sat, 15 Oct 2022 17:03:23 +0000 (10:03 -0700)
Found with readability-make-member-function-const

Signed-off-by: Rosen Penev <rosenp@gmail.com>
matroska/KaxBlock.h
src/KaxBlock.cpp
src/KaxBlockData.cpp
src/KaxCues.cpp
src/KaxCuesData.cpp

index 7be8d098a00685ea40634e371aa60f8ed5ce039e..6021d32300b2d927b1a90a2444f0c59afc110200 100644 (file)
@@ -327,10 +327,10 @@ public:
       delete Block.group;
   }
 
-  operator KaxBlockGroup &();
+  operator KaxBlockGroup &() const;
   operator const KaxBlockGroup &() const;
-  operator KaxSimpleBlock &();
-  operator KaxInternalBlock &();
+  operator KaxSimpleBlock &() const;
+  operator KaxInternalBlock &() const;
   operator const KaxInternalBlock &() const;
 
   void SetBlockGroup( KaxBlockGroup &BlockRef );
index 90fb4f3d67e21acd3b40f44129e50fe83bc91177..0adc48e77535eb3e57990977d2fd6d7785101fad 100644 (file)
@@ -932,7 +932,7 @@ std::int64_t KaxInternalBlock::GetFrameSize(std::size_t FrameNumber)
   return _Result;
 }
 
-KaxBlockBlob::operator KaxBlockGroup &()
+KaxBlockBlob::operator KaxBlockGroup &() const
 {
   assert(!bUseSimpleBlock);
   assert(Block.group);
@@ -946,7 +946,7 @@ KaxBlockBlob::operator const KaxBlockGroup &() const
   return *Block.group;
 }
 
-KaxBlockBlob::operator KaxInternalBlock &()
+KaxBlockBlob::operator KaxInternalBlock &() const
 {
   assert(Block.group);
   if (bUseSimpleBlock)
@@ -962,7 +962,7 @@ KaxBlockBlob::operator const KaxInternalBlock &() const
   return *Block.group;
 }
 
-KaxBlockBlob::operator KaxSimpleBlock &()
+KaxBlockBlob::operator KaxSimpleBlock &() const
 {
   assert(bUseSimpleBlock);
   assert(Block.simpleblock);
@@ -985,8 +985,8 @@ bool KaxBlockBlob::AddFrameAuto(const KaxTrackEntry & track, std::uint64_t timec
       Block.simpleblock->SetDiscardable(false);
     } else {
       Block.simpleblock->SetKeyframe(false);
-      if ((!ForwBlock || static_cast<const KaxInternalBlock &>(*ForwBlock).GlobalTimecode() <= timecode) &&
-          (!PastBlock || static_cast<const KaxInternalBlock &>(*PastBlock).GlobalTimecode() <= timecode))
+      if ((!ForwBlock || static_cast<KaxInternalBlock &>(*ForwBlock).GlobalTimecode() <= timecode) &&
+          (!PastBlock || static_cast<KaxInternalBlock &>(*PastBlock).GlobalTimecode() <= timecode))
         Block.simpleblock->SetDiscardable(false);
       else
         Block.simpleblock->SetDiscardable(true);
index 63c2d4b0d177d794349f22898c920908bc6d956e..e7f4c7cff8d769f28f9ec7afcdd3805632156c7a 100644 (file)
@@ -76,7 +76,7 @@ filepos_t KaxReferenceBlock::UpdateSize(bool bSaveDefault, bool bForceRender)
     assert(RefdBlock);
     assert(ParentBlock);
 
-    const auto &block = static_cast<const KaxInternalBlock&>(*RefdBlock);
+    auto &block = static_cast<KaxInternalBlock&>(*RefdBlock);
     SetValue(static_cast<std::int64_t>(block.GlobalTimecode()) - static_cast<std::int64_t>(ParentBlock->GlobalTimecode()) / static_cast<std::int64_t>(ParentBlock->GlobalTimecodeScale()));
   }
   return EbmlSInteger::UpdateSize(bSaveDefault, bForceRender);
index 8677dc6367c7c7c2a040f7eb7e33447bda1d42a7..f14157a1ca997280cd5f81d533e59dd9e73ab462 100644 (file)
@@ -93,7 +93,7 @@ void KaxCues::PositionSet(const KaxBlockGroup & BlockRef)
   // look for the element in the temporary references
   auto it = std::find_if(myTempReferences.begin(), myTempReferences.end(),
     [&](const KaxBlockBlob *myTempReference)
-      { const auto &refTmp = static_cast<const KaxInternalBlock &>(*myTempReference);
+      { auto& refTmp = static_cast<KaxInternalBlock &>(*myTempReference);
         return refTmp.GlobalTimecode() == BlockRef.GlobalTimecode()
             && refTmp.TrackNum() == BlockRef.TrackNumber(); });
 
index d69f105b889492aa5c848be09847a0581287b354..7cf768e0a5edb7c53cc47442cbfca81f23da4176 100644 (file)
@@ -78,11 +78,11 @@ void KaxCuePoint::PositionSet(const KaxBlockGroup & BlockReference, std::uint64_
 
 void KaxCuePoint::PositionSet(const KaxBlockBlob & BlobReference, std::uint64_t GlobalTimecodeScale)
 {
-  const auto &BlockReference = static_cast<const KaxInternalBlock&>(BlobReference);
+  auto &BlockReference = static_cast<KaxInternalBlock&>(BlobReference);
   const KaxBlockGroup *BlockGroupPointer = nullptr;
 
   if (!BlobReference.IsSimpleBlock()) {
-    const auto &BlockGroup = static_cast<const KaxBlockGroup&>(BlobReference);
+    auto &BlockGroup = static_cast<KaxBlockGroup&>(BlobReference);
     BlockGroupPointer = &BlockGroup;
   }
   PositionSet(BlockReference, BlockGroupPointer, GlobalTimecodeScale);
@@ -133,8 +133,8 @@ void KaxCuePoint::PositionSet(const KaxInternalBlock & BlockReference, const Kax
 */
 void KaxCueReference::AddReference(const KaxBlockBlob & BlockReference, std::uint64_t GlobalTimecodeScale)
 {
-  const auto& theBlock = static_cast<const KaxInternalBlock&>(BlockReference);
-  auto & NewTime = GetChild<KaxCueRefTime>(*this);
+  auto& theBlock = static_cast<KaxInternalBlock&>(BlockReference);
+  auto& NewTime = GetChild<KaxCueRefTime>(*this);
   *static_cast<EbmlUInteger*>(&NewTime) = theBlock.GlobalTimecode() / GlobalTimecodeScale;
 
   auto & TheClustPos = GetChild<KaxCueRefCluster>(*this);