video_filter: subsdelay: use C99 loop declarations
authorTristan Matthews <tmatth@videolan.org>
Mon, 31 Aug 2015 14:58:59 +0000 (10:58 -0400)
committerTristan Matthews <tmatth@videolan.org>
Mon, 31 Aug 2015 18:10:38 +0000 (14:10 -0400)
modules/video_filter/subsdelay.c

index 8d3299a..c0b07da 100644 (file)
@@ -516,11 +516,10 @@ static void SubsdelayHeapInit( subsdelay_heap_t *p_heap )
  *****************************************************************************/
 static void SubsdelayHeapDestroy( subsdelay_heap_t *p_heap )
 {
-    subsdelay_heap_entry_t *p_entry;
-
     SubsdelayHeapLock( p_heap );
 
-    for( p_entry = p_heap->p_head; p_entry != NULL; p_entry = p_entry->p_next )
+    for( subsdelay_heap_entry_t *p_entry = p_heap->p_head;
+         p_entry != NULL; p_entry = p_entry->p_next )
     {
         p_entry->p_subpic->i_stop = p_entry->p_source->i_stop;
 
@@ -537,7 +536,7 @@ static void SubsdelayHeapDestroy( subsdelay_heap_t *p_heap )
  *****************************************************************************/
 static subsdelay_heap_entry_t *SubsdelayHeapPush( subsdelay_heap_t *p_heap, subpicture_t *p_subpic, filter_t *p_filter )
 {
-    subsdelay_heap_entry_t *p_entry, *p_last, *p_new_entry;
+    subsdelay_heap_entry_t *p_last, *p_new_entry;
 
     if( p_heap->i_count >= SUBSDELAY_MAX_ENTRIES )
     {
@@ -554,7 +553,8 @@ static subsdelay_heap_entry_t *SubsdelayHeapPush( subsdelay_heap_t *p_heap, subp
 
     p_last = NULL;
 
-    for( p_entry = p_heap->p_head; p_entry != NULL; p_entry = p_entry->p_next )
+    for( subsdelay_heap_entry_t *p_entry = p_heap->p_head; p_entry != NULL;
+         p_entry = p_entry->p_next )
     {
         if( p_entry->p_source->i_start > p_subpic->i_start )
         {
@@ -598,11 +598,12 @@ static subsdelay_heap_entry_t *SubsdelayHeapPush( subsdelay_heap_t *p_heap, subp
  *****************************************************************************/
 static void SubsdelayHeapRemove( subsdelay_heap_t *p_heap, subsdelay_heap_entry_t *p_entry )
 {
-    subsdelay_heap_entry_t *p_curr, *p_prev;
+    subsdelay_heap_entry_t *p_prev;
 
     p_prev = NULL;
 
-    for( p_curr = p_heap->p_head; p_curr != NULL; p_curr = p_curr->p_next )
+    for( subsdelay_heap_entry_t *p_curr = p_heap->p_head; p_curr != NULL;
+         p_curr = p_curr->p_next )
     {
         if( p_curr == p_entry )
         {
@@ -629,11 +630,11 @@ static void SubsdelayHeapRemove( subsdelay_heap_t *p_heap, subsdelay_heap_entry_
 
 static void SubsdelayRebuildList( subsdelay_heap_t *p_heap )
 {
-    subsdelay_heap_entry_t *p_curr;
     int i_index;
 
     i_index = 0;
-    for( p_curr = p_heap->p_head; p_curr != NULL; p_curr = p_curr->p_next )
+    for( subsdelay_heap_entry_t *p_curr = p_heap->p_head; p_curr != NULL;
+         p_curr = p_curr->p_next )
     {
         p_heap->p_list[i_index] = p_curr;
         i_index++;
@@ -729,14 +730,14 @@ static void SubsdelayEntryDestroy( subsdelay_heap_entry_t *p_entry )
  *****************************************************************************/
 static int SubsdelayHeapCountOverlap( subsdelay_heap_t *p_heap, subsdelay_heap_entry_t *p_entry, mtime_t i_date )
 {
-    subsdelay_heap_entry_t *p_curr;
     int i_overlaps;
 
     VLC_UNUSED( p_heap );
 
     i_overlaps = 0;
 
-    for( p_curr = p_entry->p_next; p_curr != NULL; p_curr = p_curr->p_next )
+    for( subsdelay_heap_entry_t *p_curr = p_entry->p_next; p_curr != NULL;
+         p_curr = p_curr->p_next )
     {
         if( p_curr->p_source->i_start > i_date )
         {
@@ -771,7 +772,7 @@ static void SubsdelayEntryNewStopValueUpdated( subsdelay_heap_entry_t *p_entry )
 static void SubsdelayEnforceDelayRules( filter_t *p_filter )
 {
     subsdelay_heap_entry_t ** p_list;
-    int i, j, i_count, i_overlap;
+    int i_count, i_overlap;
     int64_t i_offset;
     int64_t i_min_stops_interval;
     int64_t i_min_stop_start_interval;
@@ -798,7 +799,7 @@ static void SubsdelayEnforceDelayRules( filter_t *p_filter )
                               |<-MinStopsInterval->|
     */
 
-    for( i = 0; i < i_count - 1; i++ )
+    for( int i = 0; i < i_count - 1; i++ )
     {
         p_list[i + 1]->i_new_stop = __MAX( p_list[i + 1]->i_new_stop,
                 p_list[i]->i_new_stop + i_min_stops_interval );
@@ -817,9 +818,9 @@ static void SubsdelayEnforceDelayRules( filter_t *p_filter )
           |<-MinStopStartInterval->|
     */
 
-    for( i = 0; i < i_count; i++ )
+    for( int i = 0; i < i_count; i++ )
     {
-        for( j = i + 1; j < __MIN( i_count, i + 1 + i_overlap ); j++ )
+        for( int j = i + 1; j < __MIN( i_count, i + 1 + i_overlap ); j++ )
         {
             i_offset = p_list[j]->p_source->i_start - p_list[i]->i_new_stop;
 
@@ -851,9 +852,9 @@ static void SubsdelayEnforceDelayRules( filter_t *p_filter )
     */
 
 
-    for( i = 0; i < i_count; i++ )
+    for( int i = 0; i < i_count; i++ )
     {
-        for( j = i + 1; j < __MIN( i_count, i + 1 + i_overlap ); j++ )
+        for( int j = i + 1; j < __MIN( i_count, i + 1 + i_overlap ); j++ )
         {
             i_offset = p_list[i]->i_new_stop - p_list[j]->p_source->i_start;
 
@@ -884,7 +885,7 @@ static void SubsdelayEnforceDelayRules( filter_t *p_filter )
                       [subtitle 3 ..............]
     */
 
-    for( i = 0; i < i_count - i_overlap; i++ )
+    for( int i = 0; i < i_count - i_overlap; i++ )
     {
         if( p_list[i]->i_new_stop > p_list[i + i_overlap]->p_source->i_start )
         {
@@ -894,7 +895,7 @@ static void SubsdelayEnforceDelayRules( filter_t *p_filter )
 
     /* finally - update all */
 
-    for( i = 0; i < i_count; i++ )
+    for( int i = 0; i < i_count; i++ )
     {
         SubsdelayEntryNewStopValueUpdated( p_list[i] );
     }
@@ -906,9 +907,8 @@ static void SubsdelayEnforceDelayRules( filter_t *p_filter )
  *****************************************************************************/
 static void SubsdelayRecalculateDelays( filter_t *p_filter )
 {
-    subsdelay_heap_entry_t *p_curr;
-
-    for( p_curr = p_filter->p_sys->heap.p_head; p_curr != NULL; p_curr = p_curr->p_next )
+    for( subsdelay_heap_entry_t *p_curr = p_filter->p_sys->heap.p_head;
+         p_curr != NULL; p_curr = p_curr->p_next )
     {
         if( !p_curr->b_update_ephemer )
         {