]> granicus.if.org Git - libmatroska/commitdiff
manually convert some loops to range ones
authorRosen Penev <rosenp@gmail.com>
Tue, 27 Sep 2022 00:12:37 +0000 (17:12 -0700)
committerRosen Penev <rosenp@gmail.com>
Sun, 2 Oct 2022 20:56:40 +0000 (13:56 -0700)
src/KaxBlock.cpp
src/KaxCluster.cpp

index 1aa6701b65595dc80f6df11212069c4b791fd4c4..3a52ef6451a24df19057eb09496cc70f361bb8e3 100644 (file)
@@ -396,9 +396,9 @@ filepos_t KaxInternalBlock::RenderData(IOCallback & output, bool /* bForceRender
     }
 
     // put the data of each frame
-    for (i=0; i<myBuffers.size(); i++) {
-      output.writeFully(myBuffers[i]->Buffer(), myBuffers[i]->Size());
-      SetSize_(GetSize() + myBuffers[i]->Size());
+    for (const auto& myBuf : myBuffers) {
+      output.writeFully(myBuf->Buffer(), myBuf->Size());
+      SetSize_(GetSize() + myBuf->Size());
     }
   }
 
index 40641c9954f8631c8a59fcf21add45dc5150117b..35b57171f9daa481a73c155e92fd57722ef1c511 100644 (file)
@@ -180,11 +180,11 @@ filepos_t KaxCluster::Render(IOCallback & output, KaxCues & CueToUpdate, bool bS
     }
   } else {
     // new school, using KaxBlockBlob
-    for (Index = 0; Index<Blobs.size(); Index++) {
-      if (Blobs[Index]->IsSimpleBlock())
-        PushElement( static_cast<KaxSimpleBlock&>(*Blobs[Index]));
+    for (const auto& blob : Blobs) {
+      if (blob->IsSimpleBlock())
+        PushElement( static_cast<KaxSimpleBlock&>(*blob));
       else
-        PushElement( static_cast<KaxBlockGroup&>(*Blobs[Index]));
+        PushElement( static_cast<KaxBlockGroup&>(*blob));
     }
 
     // SilentTracks handling
@@ -213,9 +213,8 @@ 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 (Index = 0; Index<Blobs.size(); Index++) {
-      CueToUpdate.PositionSet(*Blobs[Index]);
-    }
+    for (const auto& blob : Blobs)
+      CueToUpdate.PositionSet(*blob);
 
     Blobs.clear();
   }