]> granicus.if.org Git - libmatroska/commitdiff
[clang-tidy] use auto
authorRosen Penev <rosenp@gmail.com>
Fri, 22 May 2020 23:51:16 +0000 (16:51 -0700)
committerMoritz Bunkus <moritz@bunkus.org>
Mon, 22 Jun 2020 08:47:59 +0000 (10:47 +0200)
Found with modernize-use-auto

Signed-off-by: Rosen Penev <rosenp@gmail.com>
src/KaxBlock.cpp
src/KaxBlockData.cpp
src/KaxCluster.cpp
src/KaxCues.cpp
src/KaxCuesData.cpp
src/KaxSeekHead.cpp
src/KaxSegment.cpp
src/KaxTracks.cpp

index 9e59a0b017dd0dff568430037292818a2fa78bfb..1825781ad86ba6a07ba7f3918928b7fbe2a7d009 100644 (file)
@@ -48,11 +48,11 @@ START_LIBMATROSKA_NAMESPACE
 
 DataBuffer * DataBuffer::Clone()
 {
-  binary *ClonedData = (binary *)malloc(mySize * sizeof(binary));
+  auto ClonedData = (binary *)malloc(mySize * sizeof(binary));
   assert(ClonedData != nullptr);
   memcpy(ClonedData, myBuffer ,mySize );
 
-  SimpleDataBuffer * result = new SimpleDataBuffer(ClonedData, mySize, 0);
+  auto result = new SimpleDataBuffer(ClonedData, mySize, 0);
   result->bValidValue = bValidValue;
   return result;
 }
@@ -85,8 +85,8 @@ KaxInternalBlock::KaxInternalBlock(const KaxInternalBlock & ElementToClone)
   ,ParentCluster(ElementToClone.ParentCluster) ///< \todo not exactly
 {
   // add a clone of the list
-  std::vector<DataBuffer *>::const_iterator Itr = ElementToClone.myBuffers.begin();
-  std::vector<DataBuffer *>::iterator myItr = myBuffers.begin();
+  auto Itr = ElementToClone.myBuffers.begin();
+  auto myItr = myBuffers.begin();
   while (Itr != ElementToClone.myBuffers.end()) {
     *myItr = (*Itr)->Clone();
     ++Itr; ++myItr;
@@ -492,7 +492,7 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully)
       // put all Frames in the list
       if (mLacing == LACING_NONE) {
         FirstFrameLocation += Mem.GetPosition();
-        DataBuffer * soloFrame = new DataBuffer(BufferStart + Mem.GetPosition(), GetSize() - BlockHeadSize);
+        auto soloFrame = new DataBuffer(BufferStart + Mem.GetPosition(), GetSize() - BlockHeadSize);
         myBuffers.push_back(soloFrame);
         SizeList.resize(1);
         SizeList[0] = GetSize() - BlockHeadSize;
@@ -559,7 +559,7 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully)
         FirstFrameLocation += Mem.GetPosition();
 
         for (Index=0; Index<=FrameNum; Index++) {
-          DataBuffer * lacedFrame = new DataBuffer(BufferStart + Mem.GetPosition(), SizeList[Index]);
+          auto lacedFrame = new DataBuffer(BufferStart + Mem.GetPosition(), SizeList[Index]);
           myBuffers.push_back(lacedFrame);
           Mem.Skip(SizeList[Index]);
         }
@@ -724,7 +724,7 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully)
 
 bool KaxBlockGroup::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, LacingType lacing)
 {
-  KaxBlock & theBlock = GetChild<KaxBlock>(*this);
+  auto & theBlock = GetChild<KaxBlock>(*this);
   assert(ParentCluster != nullptr);
   theBlock.SetParent(*ParentCluster);
   ParentTrack = &track;
@@ -735,13 +735,13 @@ bool KaxBlockGroup::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataB
 {
   //  assert(past_timecode < 0);
 
-  KaxBlock & theBlock = GetChild<KaxBlock>(*this);
+  auto & theBlock = GetChild<KaxBlock>(*this);
   assert(ParentCluster != nullptr);
   theBlock.SetParent(*ParentCluster);
   ParentTrack = &track;
   bool bRes = theBlock.AddFrame(track, timecode, buffer, lacing);
 
-  KaxReferenceBlock & thePastRef = GetChild<KaxReferenceBlock>(*this);
+  auto & thePastRef = GetChild<KaxReferenceBlock>(*this);
   thePastRef.SetReferencedBlock(PastBlock);
   thePastRef.SetParentBlock(*this);
 
@@ -754,17 +754,17 @@ bool KaxBlockGroup::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataB
 
   //  assert(forw_timecode > 0);
 
-  KaxBlock & theBlock = GetChild<KaxBlock>(*this);
+  auto & theBlock = GetChild<KaxBlock>(*this);
   assert(ParentCluster != nullptr);
   theBlock.SetParent(*ParentCluster);
   ParentTrack = &track;
   bool bRes = theBlock.AddFrame(track, timecode, buffer, lacing);
 
-  KaxReferenceBlock & thePastRef = GetChild<KaxReferenceBlock>(*this);
+  auto & thePastRef = GetChild<KaxReferenceBlock>(*this);
   thePastRef.SetReferencedBlock(PastBlock);
   thePastRef.SetParentBlock(*this);
 
-  KaxReferenceBlock & theFutureRef = AddNewChild<KaxReferenceBlock>(*this);
+  auto & theFutureRef = AddNewChild<KaxReferenceBlock>(*this);
   theFutureRef.SetReferencedBlock(ForwBlock);
   theFutureRef.SetParentBlock(*this);
 
@@ -773,20 +773,20 @@ bool KaxBlockGroup::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataB
 
 bool KaxBlockGroup::AddFrame(const KaxTrackEntry & track, uint64 timecode, DataBuffer & buffer, const KaxBlockBlob * PastBlock, const KaxBlockBlob * ForwBlock, LacingType lacing)
 {
-  KaxBlock & theBlock = GetChild<KaxBlock>(*this);
+  auto & theBlock = GetChild<KaxBlock>(*this);
   assert(ParentCluster != nullptr);
   theBlock.SetParent(*ParentCluster);
   ParentTrack = &track;
   bool bRes = theBlock.AddFrame(track, timecode, buffer, lacing);
 
   if (PastBlock != nullptr) {
-    KaxReferenceBlock & thePastRef = GetChild<KaxReferenceBlock>(*this);
+    auto & thePastRef = GetChild<KaxReferenceBlock>(*this);
     thePastRef.SetReferencedBlock(PastBlock);
     thePastRef.SetParentBlock(*this);
   }
 
   if (ForwBlock != nullptr) {
-    KaxReferenceBlock & theFutureRef = AddNewChild<KaxReferenceBlock>(*this);
+    auto & theFutureRef = AddNewChild<KaxReferenceBlock>(*this);
     theFutureRef.SetReferencedBlock(ForwBlock);
     theFutureRef.SetParentBlock(*this);
   }
@@ -826,7 +826,7 @@ uint64 KaxInternalBlock::ClusterPosition() const
 unsigned int KaxBlockGroup::ReferenceCount() const
 {
   unsigned int Result = 0;
-  KaxReferenceBlock * MyBlockAdds = static_cast<KaxReferenceBlock *>(FindFirstElt(EBML_INFO(KaxReferenceBlock)));
+  auto MyBlockAdds = static_cast<KaxReferenceBlock *>(FindFirstElt(EBML_INFO(KaxReferenceBlock)));
   if (MyBlockAdds != nullptr) {
     Result++;
     while ((MyBlockAdds = static_cast<KaxReferenceBlock *>(FindNextElt(*MyBlockAdds))) != nullptr) {
@@ -838,7 +838,7 @@ unsigned int KaxBlockGroup::ReferenceCount() const
 
 const KaxReferenceBlock & KaxBlockGroup::Reference(unsigned int Index) const
 {
-  KaxReferenceBlock * MyBlockAdds = static_cast<KaxReferenceBlock *>(FindFirstElt(EBML_INFO(KaxReferenceBlock)));
+  auto MyBlockAdds = static_cast<KaxReferenceBlock *>(FindFirstElt(EBML_INFO(KaxReferenceBlock)));
   assert(MyBlockAdds != nullptr); // call of a non existing reference
 
   while (Index != 0) {
@@ -878,7 +878,7 @@ void KaxBlockGroup::SetBlockDuration(uint64 TimeLength)
 
 bool KaxBlockGroup::GetBlockDuration(uint64 &TheTimecode) const
 {
-  KaxBlockDuration * myDuration = static_cast<KaxBlockDuration *>(FindElt(EBML_INFO(KaxBlockDuration)));
+  auto myDuration = static_cast<KaxBlockDuration *>(FindElt(EBML_INFO(KaxBlockDuration)));
   if (myDuration == nullptr) {
     return false;
   }
@@ -889,13 +889,13 @@ bool KaxBlockGroup::GetBlockDuration(uint64 &TheTimecode) const
 }
 
 KaxBlockGroup::operator KaxInternalBlock &() {
-  KaxBlock & theBlock = GetChild<KaxBlock>(*this);
+  auto & theBlock = GetChild<KaxBlock>(*this);
   return theBlock;
 }
 
 void KaxBlockGroup::SetParent(KaxCluster & aParentCluster) {
   ParentCluster = &aParentCluster;
-  KaxBlock & theBlock = GetChild<KaxBlock>(*this);
+  auto & theBlock = GetChild<KaxBlock>(*this);
   theBlock.SetParent( aParentCluster );
 }
 
index cdaee0d9428f6846ad37dd5c4c8d03b8c01fdd10..f17ed00b544fb2c5ab7b2a5b24a5a50f276b7231 100644 (file)
@@ -104,7 +104,7 @@ void KaxReferenceBlock::SetReferencedBlock(const KaxBlockBlob * aRefdBlock)
 void KaxReferenceBlock::SetReferencedBlock(const KaxBlockGroup & aRefdBlock)
 {
   FreeBlob();
-  KaxBlockBlob *block_blob = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE);
+  auto block_blob = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE);
   block_blob->SetBlockGroup(*const_cast<KaxBlockGroup*>(&aRefdBlock));
   RefdBlock = block_blob;
   bOurBlob = true;
index d934954975b14ac19e015ca675f8d99f076b0ead..b371ca2f07ecc0cdd87371372492b5d9471c03dd 100644 (file)
@@ -54,7 +54,7 @@ KaxCluster::KaxCluster(const KaxCluster & ElementToClone)
   ,bSilentTracksUsed(ElementToClone.bSilentTracksUsed)
 {
   // update the parent of each children
-  EBML_MASTER_ITERATOR Itr = begin();
+  auto Itr = begin();
   while (Itr != end()) {
     if (EbmlId(**Itr) == EBML_ID(KaxBlockGroup)) {
       static_cast<KaxBlockGroup   *>(*Itr)->SetParent(*this);
@@ -152,7 +152,7 @@ filepos_t KaxCluster::Render(IOCallback & output, KaxCues & CueToUpdate, bool bS
   EBML_MASTER_ITERATOR TrkItr, Itr;
 
   // update the Timecode of the Cluster before writing
-  KaxClusterTimecode * Timecode = static_cast<KaxClusterTimecode *>(this->FindElt(EBML_INFO(KaxClusterTimecode)));
+  auto Timecode = static_cast<KaxClusterTimecode *>(this->FindElt(EBML_INFO(KaxClusterTimecode)));
   *static_cast<EbmlUInteger *>(Timecode) = GlobalTimecode() / GlobalTimecodeScale();
 
   if (Blobs.empty()) {
@@ -175,9 +175,9 @@ filepos_t KaxCluster::Render(IOCallback & output, KaxCues & CueToUpdate, bool bS
           }
           // the track wasn't found in this cluster
           if (Itr == end()) {
-            KaxClusterSilentTracks * SilentTracks = static_cast<KaxClusterSilentTracks *>(this->FindFirstElt(EBML_INFO(KaxClusterSilentTracks)));
+            auto SilentTracks = static_cast<KaxClusterSilentTracks *>(this->FindFirstElt(EBML_INFO(KaxClusterSilentTracks)));
             assert(SilentTracks != nullptr); // the flag bSilentTracksUsed should be set when creating the Cluster
-            KaxClusterSilentTrackNumber * trackelt = static_cast<KaxClusterSilentTrackNumber *>(SilentTracks->AddNewElt(EBML_INFO(KaxClusterSilentTrackNumber)));
+            auto trackelt = static_cast<KaxClusterSilentTrackNumber *>(SilentTracks->AddNewElt(EBML_INFO(KaxClusterSilentTrackNumber)));
             *static_cast<EbmlUInteger *>(trackelt) = tracknum;
           }
         }
@@ -215,9 +215,9 @@ filepos_t KaxCluster::Render(IOCallback & output, KaxCues & CueToUpdate, bool bS
           }
           // the track wasn't found in this cluster
           if (Index == ListSize()) {
-            KaxClusterSilentTracks * SilentTracks = static_cast<KaxClusterSilentTracks *>(this->FindFirstElt(EBML_INFO(KaxClusterSilentTracks)));
+            auto SilentTracks = static_cast<KaxClusterSilentTracks *>(this->FindFirstElt(EBML_INFO(KaxClusterSilentTracks)));
             assert(SilentTracks != nullptr); // the flag bSilentTracksUsed should be set when creating the Cluster
-            KaxClusterSilentTrackNumber * trackelt = static_cast<KaxClusterSilentTrackNumber *>(SilentTracks->AddNewElt(EBML_INFO(KaxClusterSilentTrackNumber)));
+            auto trackelt = static_cast<KaxClusterSilentTrackNumber *>(SilentTracks->AddNewElt(EBML_INFO(KaxClusterSilentTrackNumber)));
             *static_cast<EbmlUInteger *>(trackelt) = tracknum;
           }
         }
@@ -265,7 +265,7 @@ int16 KaxCluster::GetBlockLocalTimecode(uint64 aGlobalTimecode) const
 uint64 KaxCluster::GetBlockGlobalTimecode(int16 LocalTimecode)
 {
   if (!bFirstFrameInside) {
-    KaxClusterTimecode * Timecode = static_cast<KaxClusterTimecode *>(this->FindElt(EBML_INFO(KaxClusterTimecode)));
+    auto Timecode = static_cast<KaxClusterTimecode *>(this->FindElt(EBML_INFO(KaxClusterTimecode)));
     assert (bFirstFrameInside); // use the InitTimecode() hack for now
     MinTimecode = MaxTimecode = PreviousTimecode = *static_cast<EbmlUInteger *>(Timecode);
     bFirstFrameInside = true;
@@ -276,7 +276,7 @@ uint64 KaxCluster::GetBlockGlobalTimecode(int16 LocalTimecode)
 
 KaxBlockGroup & KaxCluster::GetNewBlock()
 {
-  KaxBlockGroup & MyBlock = AddNewChild<KaxBlockGroup>(*this);
+  auto & MyBlock = AddNewChild<KaxBlockGroup>(*this);
   MyBlock.SetParent(*this);
   return MyBlock;
 }
index f9f00b5dbd082d3fa570eabd6c677631f7c3c037..0fd1e54ad91690366960918ab14f0b36bedd386d 100644 (file)
@@ -85,7 +85,7 @@ void KaxCues::PositionSet(const KaxBlockBlob & BlockReference)
   for (ListIdx = myTempReferences.begin(); ListIdx != myTempReferences.end(); ++ListIdx) {
     if (*ListIdx == &BlockReference) {
       // found, now add the element to the entry list
-      KaxCuePoint & NewPoint = AddNewChild<KaxCuePoint>(*this);
+      auto & NewPoint = AddNewChild<KaxCuePoint>(*this);
       NewPoint.PositionSet(BlockReference, GlobalTimecodeScale());
       myTempReferences.erase(ListIdx);
       break;
@@ -103,7 +103,7 @@ void KaxCues::PositionSet(const KaxBlockGroup & BlockRef)
     if (refTmp.GlobalTimecode() == BlockRef.GlobalTimecode() &&
         refTmp.TrackNum() == BlockRef.TrackNumber()) {
       // found, now add the element to the entry list
-      KaxCuePoint & NewPoint = AddNewChild<KaxCuePoint>(*this);
+      auto & NewPoint = AddNewChild<KaxCuePoint>(*this);
       NewPoint.PositionSet(**ListIdx, GlobalTimecodeScale());
       myTempReferences.erase(ListIdx);
       break;
@@ -124,11 +124,11 @@ const KaxCuePoint * KaxCues::GetTimecodePoint(uint64 aTimecode) const
   EBML_MASTER_CONST_ITERATOR Itr;
   for (Itr = begin(); Itr != end(); ++Itr) {
     if (EbmlId(*(*Itr)) == EBML_ID(KaxCuePoint)) {
-      const KaxCuePoint *tmp = static_cast<const KaxCuePoint *>(*Itr);
+      auto tmp = static_cast<const KaxCuePoint *>(*Itr);
       // check the tile
-      const KaxCueTime *aTime = static_cast<const KaxCueTime *>(tmp->FindFirstElt(EBML_INFO(KaxCueTime)));
+      auto aTime = static_cast<const KaxCueTime *>(tmp->FindFirstElt(EBML_INFO(KaxCueTime)));
       if (aTime != nullptr) {
-        uint64 _Time = uint64(*aTime);
+        auto _Time = uint64(*aTime);
         if (_Time > aPrevTime && _Time < TimecodeToLocate) {
           aPrevTime = _Time;
           aPointPrev = tmp;
index 400d08c464b39fa5eb8e7f99ec7a7cafe9e273bf..adcc0dda9aabd9684fc0320dedb3fb0c999a0bf1 100644 (file)
@@ -50,28 +50,28 @@ START_LIBMATROSKA_NAMESPACE
 void KaxCuePoint::PositionSet(const KaxBlockGroup & BlockReference, uint64 GlobalTimecodeScale)
 {
   // fill me
-  KaxCueTime & NewTime = GetChild<KaxCueTime>(*this);
+  auto & NewTime = GetChild<KaxCueTime>(*this);
   *static_cast<EbmlUInteger*>(&NewTime) = BlockReference.GlobalTimecode() / GlobalTimecodeScale;
 
-  KaxCueTrackPositions & NewPositions = AddNewChild<KaxCueTrackPositions>(*this);
-  KaxCueTrack & TheTrack = GetChild<KaxCueTrack>(NewPositions);
+  auto & NewPositions = AddNewChild<KaxCueTrackPositions>(*this);
+  auto & TheTrack = GetChild<KaxCueTrack>(NewPositions);
   *static_cast<EbmlUInteger*>(&TheTrack) = BlockReference.TrackNumber();
 
-  KaxCueClusterPosition & TheClustPos = GetChild<KaxCueClusterPosition>(NewPositions);
+  auto & TheClustPos = GetChild<KaxCueClusterPosition>(NewPositions);
   *static_cast<EbmlUInteger*>(&TheClustPos) = BlockReference.ClusterPosition();
 
   // handle reference use
   if (BlockReference.ReferenceCount() != 0) {
     unsigned int i;
     for (i=0; i<BlockReference.ReferenceCount(); i++) {
-      KaxCueReference & NewRefs = AddNewChild<KaxCueReference>(NewPositions);
+      auto & NewRefs = AddNewChild<KaxCueReference>(NewPositions);
       NewRefs.AddReference(BlockReference.Reference(i).RefBlock(), GlobalTimecodeScale);
     }
   }
 
-  KaxCodecState *CodecState = static_cast<KaxCodecState *>(BlockReference.FindFirstElt(EBML_INFO(KaxCodecState)));
+  auto CodecState = static_cast<KaxCodecState *>(BlockReference.FindFirstElt(EBML_INFO(KaxCodecState)));
   if (CodecState != nullptr) {
-    KaxCueCodecState &CueCodecState = AddNewChild<KaxCueCodecState>(NewPositions);
+    auto &CueCodecState = AddNewChild<KaxCueCodecState>(NewPositions);
     *static_cast<EbmlUInteger*>(&CueCodecState) = BlockReference.GetParentCluster()->GetParentSegment()->GetRelativePosition(CodecState->GetElementPosition());
   }
 
@@ -83,14 +83,14 @@ void KaxCuePoint::PositionSet(const KaxBlockBlob & BlobReference, uint64 GlobalT
   const KaxInternalBlock &BlockReference = BlobReference;
 
   // fill me
-  KaxCueTime & NewTime = GetChild<KaxCueTime>(*this);
+  auto & NewTime = GetChild<KaxCueTime>(*this);
   *static_cast<EbmlUInteger*>(&NewTime) = BlockReference.GlobalTimecode() / GlobalTimecodeScale;
 
-  KaxCueTrackPositions & NewPositions = AddNewChild<KaxCueTrackPositions>(*this);
-  KaxCueTrack & TheTrack = GetChild<KaxCueTrack>(NewPositions);
+  auto & NewPositions = AddNewChild<KaxCueTrackPositions>(*this);
+  auto & TheTrack = GetChild<KaxCueTrack>(NewPositions);
   *static_cast<EbmlUInteger*>(&TheTrack) = BlockReference.TrackNum();
 
-  KaxCueClusterPosition & TheClustPos = GetChild<KaxCueClusterPosition>(NewPositions);
+  auto & TheClustPos = GetChild<KaxCueClusterPosition>(NewPositions);
   *static_cast<EbmlUInteger*>(&TheClustPos) = BlockReference.ClusterPosition();
 
 #if 0 // MATROSKA_VERSION >= 2
@@ -108,7 +108,7 @@ void KaxCuePoint::PositionSet(const KaxBlockBlob & BlobReference, uint64 GlobalT
     const KaxBlockGroup &BlockGroup = BlobReference;
     const KaxCodecState *CodecState = static_cast<KaxCodecState *>(BlockGroup.FindFirstElt(EBML_INFO(KaxCodecState)));
     if (CodecState != nullptr) {
-      KaxCueCodecState &CueCodecState = AddNewChild<KaxCueCodecState>(NewPositions);
+      auto &CueCodecState = AddNewChild<KaxCueCodecState>(NewPositions);
       *static_cast<EbmlUInteger*>(&CueCodecState) = BlockGroup.GetParentCluster()->GetParentSegment()->GetRelativePosition(CodecState->GetElementPosition());
     }
   }
@@ -122,10 +122,10 @@ void KaxCuePoint::PositionSet(const KaxBlockBlob & BlobReference, uint64 GlobalT
 void KaxCueReference::AddReference(const KaxBlockBlob & BlockReference, uint64 GlobalTimecodeScale)
 {
   const KaxInternalBlock & theBlock = BlockReference;
-  KaxCueRefTime & NewTime = GetChild<KaxCueRefTime>(*this);
+  auto & NewTime = GetChild<KaxCueRefTime>(*this);
   *static_cast<EbmlUInteger*>(&NewTime) = theBlock.GlobalTimecode() / GlobalTimecodeScale;
 
-  KaxCueRefCluster & TheClustPos = GetChild<KaxCueRefCluster>(*this);
+  auto & TheClustPos = GetChild<KaxCueRefCluster>(*this);
   *static_cast<EbmlUInteger*>(&TheClustPos) = theBlock.ClusterPosition();
 
 #ifdef OLD
@@ -147,11 +147,11 @@ bool KaxCuePoint::IsSmallerThan(const EbmlElement * Cmp) const
   const KaxCuePoint & theCmp = *static_cast<const KaxCuePoint *>(Cmp);
 
   // compare timecode
-  const KaxCueTime * TimeCodeA = static_cast<const KaxCueTime *>(FindElt(EBML_INFO(KaxCueTime)));
+  auto TimeCodeA = static_cast<const KaxCueTime *>(FindElt(EBML_INFO(KaxCueTime)));
   if (TimeCodeA == nullptr)
     return false;
 
-  const KaxCueTime * TimeCodeB = static_cast<const KaxCueTime *>(theCmp.FindElt(EBML_INFO(KaxCueTime)));
+  auto TimeCodeB = static_cast<const KaxCueTime *>(theCmp.FindElt(EBML_INFO(KaxCueTime)));
   if (TimeCodeB == nullptr)
     return false;
 
@@ -162,11 +162,11 @@ bool KaxCuePoint::IsSmallerThan(const EbmlElement * Cmp) const
     return false;
 
   // compare tracks (timecodes are equal)
-  const KaxCueTrack * TrackA = static_cast<const KaxCueTrack *>(FindElt(EBML_INFO(KaxCueTrack)));
+  auto TrackA = static_cast<const KaxCueTrack *>(FindElt(EBML_INFO(KaxCueTrack)));
   if (TrackA == nullptr)
     return false;
 
-  const KaxCueTrack * TrackB = static_cast<const KaxCueTrack *>(theCmp.FindElt(EBML_INFO(KaxCueTrack)));
+  auto TrackB = static_cast<const KaxCueTrack *>(theCmp.FindElt(EBML_INFO(KaxCueTrack)));
   if (TrackB == nullptr)
     return false;
 
@@ -181,7 +181,7 @@ bool KaxCuePoint::IsSmallerThan(const EbmlElement * Cmp) const
 
 bool KaxCuePoint::Timecode(uint64 & aTimecode, uint64 GlobalTimecodeScale) const
 {
-  const KaxCueTime *aTime = static_cast<const KaxCueTime *>(FindFirstElt(EBML_INFO(KaxCueTime)));
+  auto aTime = static_cast<const KaxCueTime *>(FindFirstElt(EBML_INFO(KaxCueTime)));
   if (aTime == nullptr)
     return false;
   aTimecode = uint64(*aTime) * GlobalTimecodeScale;
@@ -196,9 +196,9 @@ const KaxCueTrackPositions * KaxCuePoint::GetSeekPosition() const
   const KaxCueTrackPositions * result = nullptr;
   uint64 aPosition = EBML_PRETTYLONGINT(0xFFFFFFFFFFFFFFF);
   // find the position of the "earlier" Cluster
-  const KaxCueTrackPositions *aPoss = static_cast<const KaxCueTrackPositions *>(FindFirstElt(EBML_INFO(KaxCueTrackPositions)));
+  auto aPoss = static_cast<const KaxCueTrackPositions *>(FindFirstElt(EBML_INFO(KaxCueTrackPositions)));
   while (aPoss != nullptr) {
-    const KaxCueClusterPosition *aPos = static_cast<const KaxCueClusterPosition *>(aPoss->FindFirstElt(EBML_INFO(KaxCueClusterPosition)));
+    auto aPos = static_cast<const KaxCueClusterPosition *>(aPoss->FindFirstElt(EBML_INFO(KaxCueClusterPosition)));
     if (aPos != nullptr && uint64(*aPos) < aPosition) {
       aPosition = uint64(*aPos);
       result = aPoss;
@@ -211,7 +211,7 @@ const KaxCueTrackPositions * KaxCuePoint::GetSeekPosition() const
 
 uint64 KaxCueTrackPositions::ClusterPosition() const
 {
-  const KaxCueClusterPosition *aPos = static_cast<const KaxCueClusterPosition *>(FindFirstElt(EBML_INFO(KaxCueClusterPosition)));
+  auto aPos = static_cast<const KaxCueClusterPosition *>(FindFirstElt(EBML_INFO(KaxCueClusterPosition)));
   if (aPos == nullptr)
     return 0;
 
@@ -220,7 +220,7 @@ uint64 KaxCueTrackPositions::ClusterPosition() const
 
 uint16 KaxCueTrackPositions::TrackNumber() const
 {
-  const KaxCueTrack *aTrack = static_cast<const KaxCueTrack *>(FindFirstElt(EBML_INFO(KaxCueTrack)));
+  auto aTrack = static_cast<const KaxCueTrack *>(FindFirstElt(EBML_INFO(KaxCueTrack)));
   if (aTrack == nullptr)
     return 0;
 
index 4cf9b37bf95be1e3f64ebd264c29a51199020e1b..f1ed42d11be9769eb3d0a58ef725ff6787d6ecee 100644 (file)
@@ -49,13 +49,13 @@ START_LIBMATROSKA_NAMESPACE
 void KaxSeekHead::IndexThis(const EbmlElement & aElt, const KaxSegment & ParentSegment)
 {
   // create a new point
-  KaxSeek & aNewPoint = AddNewChild<KaxSeek>(*this);
+  auto & aNewPoint = AddNewChild<KaxSeek>(*this);
 
   // add the informations to this element
-  KaxSeekPosition & aNewPos = GetChild<KaxSeekPosition>(aNewPoint);
+  auto & aNewPos = GetChild<KaxSeekPosition>(aNewPoint);
   *static_cast<EbmlUInteger *>(&aNewPos) = ParentSegment.GetRelativePosition(aElt);
 
-  KaxSeekID & aNewID = GetChild<KaxSeekID>(aNewPoint);
+  auto & aNewID = GetChild<KaxSeekID>(aNewPoint);
   binary ID[4];
   ((const EbmlId&)aElt).Fill(ID);
   aNewID.CopyBuffer(ID, EBML_ID_LENGTH((const EbmlId&)aElt));
@@ -64,7 +64,7 @@ void KaxSeekHead::IndexThis(const EbmlElement & aElt, const KaxSegment & ParentS
 KaxSeek * KaxSeekHead::FindFirstOf(const EbmlCallbacks & Callbacks) const
 {
   // parse all the Entries and find the first to match the type
-  KaxSeek * aElt = static_cast<KaxSeek *>(FindFirstElt(EBML_INFO(KaxSeek)));
+  auto aElt = static_cast<KaxSeek *>(FindFirstElt(EBML_INFO(KaxSeek)));
   while (aElt != nullptr) {
     KaxSeekID * aId = nullptr;
     EBML_MASTER_ITERATOR Itr;
@@ -111,7 +111,7 @@ KaxSeek * KaxSeekHead::FindNextOf(const KaxSeek &aPrev) const
 
 int64 KaxSeek::Location() const
 {
-  KaxSeekPosition *aPos = static_cast<KaxSeekPosition*>(FindFirstElt(EBML_INFO(KaxSeekPosition)));
+  auto aPos = static_cast<KaxSeekPosition*>(FindFirstElt(EBML_INFO(KaxSeekPosition)));
   if (aPos == nullptr)
     return 0;
   return uint64(*aPos);
@@ -119,7 +119,7 @@ int64 KaxSeek::Location() const
 
 bool KaxSeek::IsEbmlId(const EbmlId & aId) const
 {
-  KaxSeekID *_Id = static_cast<KaxSeekID*>(FindFirstElt(EBML_INFO(KaxSeekID)));
+  auto _Id = static_cast<KaxSeekID*>(FindFirstElt(EBML_INFO(KaxSeekID)));
   if (_Id == nullptr)
     return false;
   EbmlId aEbmlId(_Id->GetBuffer(), _Id->GetSize());
@@ -128,10 +128,10 @@ bool KaxSeek::IsEbmlId(const EbmlId & aId) const
 
 bool KaxSeek::IsEbmlId(const KaxSeek & aPoint) const
 {
-  KaxSeekID *_IdA = static_cast<KaxSeekID*>(FindFirstElt(EBML_INFO(KaxSeekID)));
+  auto _IdA = static_cast<KaxSeekID*>(FindFirstElt(EBML_INFO(KaxSeekID)));
   if (_IdA == nullptr)
     return false;
-  KaxSeekID *_IdB = static_cast<KaxSeekID*>(aPoint.FindFirstElt(EBML_INFO(KaxSeekID)));
+  auto _IdB = static_cast<KaxSeekID*>(aPoint.FindFirstElt(EBML_INFO(KaxSeekID)));
   if (_IdB == nullptr)
     return false;
   EbmlId aEbmlIdA(_IdA->GetBuffer(), _IdA->GetSize());
index d364c57893617a214b4a1b6f3f8cd980c4fc7c06..ce960ac6a2afe932948cc2556bfcf303ad4f0372 100644 (file)
@@ -56,7 +56,7 @@ KaxSegment::KaxSegment(const KaxSegment & ElementToClone)
   :EbmlMaster(ElementToClone)
 {
   // update the parent of each children
-  EBML_MASTER_ITERATOR Itr = begin();
+  auto Itr = begin();
   while (Itr != end()) {
     if (EbmlId(**Itr) == EBML_ID(KaxCluster)) {
       static_cast<KaxCluster *>(*Itr)->SetParent(*this);
index d56a824263c7b03cfab1c11ca6676eb2c482781e..85a1baaec0bfe16e57892a585e97ca30a21f3143 100644 (file)
@@ -47,7 +47,7 @@ KaxTrackEntry::KaxTrackEntry(EBML_EXTRA_DEF)
 
 void KaxTrackEntry::EnableLacing(bool bEnable)
 {
-  KaxTrackFlagLacing & myLacing = GetChild<KaxTrackFlagLacing>(*this);
+  auto & myLacing = GetChild<KaxTrackFlagLacing>(*this);
   *(static_cast<EbmlUInteger *>(&myLacing)) = bEnable ? 1 : 0;
 }