[vlc-commits] access/vcd: narrow scope of iteration variables

Filip Roséen git at videolan.org
Thu Oct 13 11:09:48 CEST 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Wed Oct 12 20:08:12 2016 +0200| [9882b4c81aba8ac97f8e2c34be4cf364773fcbe5] | committer: Jean-Baptiste Kempf

access/vcd: narrow scope of iteration variables

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9882b4c81aba8ac97f8e2c34be4cf364773fcbe5
---

 modules/access/vcd/cdrom.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/modules/access/vcd/cdrom.c b/modules/access/vcd/cdrom.c
index ed63d4f..afc48d9 100644
--- a/modules/access/vcd/cdrom.c
+++ b/modules/access/vcd/cdrom.c
@@ -455,8 +455,6 @@ int ioctl_GetTracksMap( vlc_object_t *p_this, const vcddev_t *p_vcddev,
 
         if( pp_sectors )
         {
-             int i;
-
              *pp_sectors = calloc( i_tracks + 1, sizeof(**pp_sectors) );
              if( *pp_sectors == NULL )
                  return 0;
@@ -484,7 +482,7 @@ int ioctl_GetTracksMap( vlc_object_t *p_this, const vcddev_t *p_vcddev,
              }
 
              /* Fill the p_sectors structure with the track/sector matches */
-             for( i = 0 ; i <= i_tracks ; i++ )
+             for( int i = 0 ; i <= i_tracks ; i++ )
              {
 #if defined( HAVE_SCSIREQ_IN_SYS_SCSIIO_H )
                  /* FIXME: is this ok? */
@@ -510,14 +508,12 @@ int ioctl_GetTracksMap( vlc_object_t *p_this, const vcddev_t *p_vcddev,
 
         if( pp_sectors )
         {
-            int i;
-
             *pp_sectors = calloc( i_tracks + 1, sizeof(**pp_sectors) );
             if( *pp_sectors == NULL )
                 return 0;
 
             /* Fill the p_sectors structure with the track/sector matches */
-            for( i = 0 ; i <= i_tracks ; i++ )
+            for( int i = 0 ; i <= i_tracks ; i++ )
             {
                 tocent.cdte_format = CDROM_LBA;
                 tocent.cdte_track =
@@ -547,7 +543,6 @@ int ioctl_ReadSectors( vlc_object_t *p_this, const vcddev_t *p_vcddev,
                        int i_sector, uint8_t *p_buffer, int i_nb, int i_type )
 {
     uint8_t *p_block;
-    int i;
 
     if( i_type == VCD_TYPE )
         p_block = malloc( VCD_SECTOR_SIZE * i_nb );
@@ -711,7 +706,7 @@ int ioctl_ReadSectors( vlc_object_t *p_this, const vcddev_t *p_vcddev,
         }
 
 #else
-        for( i = 0; i < i_nb; i++ )
+        for( int i = 0; i < i_nb; i++ )
         {
             int i_dummy = i_sector + i + 2 * CD_FRAMES;
 
@@ -740,7 +735,7 @@ int ioctl_ReadSectors( vlc_object_t *p_this, const vcddev_t *p_vcddev,
      * sectors read */
     if( i_type == VCD_TYPE )
     {
-        for( i = 0; i < i_nb; i++ )
+        for( int i = 0; i < i_nb; i++ )
         {
             memcpy( p_buffer + i * VCD_DATA_SIZE,
                     p_block + i * VCD_SECTOR_SIZE + VCD_DATA_START,



More information about the vlc-commits mailing list