From: Rosen Penev Date: Sun, 2 Oct 2022 21:14:08 +0000 (-0700) Subject: replace auto&& with const ref X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=522e38736b3976f5fac217639b29eeda25fe2d79;p=libmatroska replace auto&& with const ref auto&& is universal in that it evaluates to const and non const references. Probably clearer to use regular ones. Signed-off-by: Rosen Penev --- diff --git a/src/FileKax.cpp b/src/FileKax.cpp index 4f11874..338e1e1 100644 --- a/src/FileKax.cpp +++ b/src/FileKax.cpp @@ -98,7 +98,7 @@ void FileMatroska::Close(const uint32 aTimeLength) // get the Track-entry size uint32 track_entries_size = 0; - for (auto&& myTrack : myTracks) { + for (const auto& myTrack : myTracks) { track_entries_size += myTrack->default_size(); } @@ -106,7 +106,7 @@ void FileMatroska::Close(const uint32 aTimeLength) myStreamInfo.TimeLength = aTimeLength; myMainHeader.Render(myFile, myStreamInfo); - for (auto&& track : myTracks) { + for (auto& track : myTracks) { delete track; } } @@ -118,7 +118,7 @@ filepos_t FileMatroska::RenderHead(const std::string & aEncoderApp) { try { uint32 track_entries_size = 0; - for (auto&& myTrack : myTracks) { + for (const auto& myTrack : myTracks) { track_entries_size += myTrack->default_size(); } @@ -134,7 +134,7 @@ filepos_t FileMatroska::RenderHead(const std::string & aEncoderApp) myStreamInfo.CodecEntryPosition = myStreamInfo.MainHeaderSize + myStreamInfo.TrackEntriesSize; myStreamInfo.CodecEntrySize = 4; - for (auto&& myTrack : myTracks) { + for (const auto& myTrack : myTracks) { myStreamInfo.CodecEntrySize += myTrack->CodecSize(); } @@ -288,7 +288,7 @@ void FileMatroska::SelectReadingTrack(Track * aTrack, bool select) if (IsMyTrack(aTrack)) { // here we have the right track // check if it's not already selected - for (auto&& num : mySelectedTracks) { + for (const auto& num : mySelectedTracks) { if (num == aTrack->TrackNumber()) break; } diff --git a/src/KaxCluster.cpp b/src/KaxCluster.cpp index 4b13af2..d380b80 100644 --- a/src/KaxCluster.cpp +++ b/src/KaxCluster.cpp @@ -153,7 +153,7 @@ filepos_t KaxCluster::Render(IOCallback & output, KaxCues & CueToUpdate, bool bS // check the parent cluster for existing tracks and see if they are contained in this cluster or not if (bSilentTracksUsed) { auto MyTracks = static_cast(ParentSegment->FindElt(EBML_INFO(KaxTracks))); - for (auto&& Trk : *MyTracks) { + for (const auto& Trk : *MyTracks) { if (EbmlId(*Trk) == EBML_ID(KaxTrackEntry)) { auto entry = static_cast(Trk); auto tracknum = static_cast(entry->TrackNumber()); @@ -173,7 +173,7 @@ filepos_t KaxCluster::Render(IOCallback & output, KaxCues & CueToUpdate, bool bS Result = EbmlMaster::Render(output, bSaveDefault); // For all Blocks add their position on the CueEntry - for (auto&& element : ElementList) { + for (const auto& element : ElementList) { if (EbmlId(*element) == EBML_ID(KaxBlockGroup)) { CueToUpdate.PositionSet(*static_cast(element)); } @@ -191,7 +191,7 @@ filepos_t KaxCluster::Render(IOCallback & output, KaxCues & CueToUpdate, bool bS // check the parent cluster for existing tracks and see if they are contained in this cluster or not if (bSilentTracksUsed) { auto MyTracks = static_cast(ParentSegment->FindElt(EBML_INFO(KaxTracks))); - for (auto&& Trk : *MyTracks) { + for (const auto& Trk : *MyTracks) { if (EbmlId(*Trk) == EBML_ID(KaxTrackEntry)) { auto entry = static_cast(Trk); auto tracknum = static_cast(entry->TrackNumber()); @@ -268,7 +268,7 @@ KaxBlockGroup & KaxCluster::GetNewBlock() void KaxCluster::ReleaseFrames() { - for (auto&& element : ElementList) { + for (const auto& element : ElementList) { if (EbmlId(*element) == EBML_ID(KaxBlockGroup)) { static_cast(element)->ReleaseFrames(); }