[vlc-commits] commit: vod_rtsp: C99 for loop iterator declarations (Pierre Ynard )

git at videolan.org git at videolan.org
Wed Jun 2 06:08:29 CEST 2010


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Wed Jun  2 06:07:28 2010 +0200| [4e49a139a21a825f203f9b4fd0df72efcc4f082d] | committer: Pierre Ynard 

vod_rtsp: C99 for loop iterator declarations

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

 modules/misc/rtsp.c      |   20 +++++++-------------
 modules/stream_out/rtp.c |    3 +--
 2 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/modules/misc/rtsp.c b/modules/misc/rtsp.c
index 5e17e53..b03df5b 100644
--- a/modules/misc/rtsp.c
+++ b/modules/misc/rtsp.c
@@ -243,9 +243,8 @@ static char *SDPGenerate( const vod_media_t *, httpd_client_t *cl );
 static void sprintf_hexa( char *s, uint8_t *p_data, int i_data )
 {
     static const char hex[16] = "0123456789abcdef";
-    int i;
 
-    for( i = 0; i < i_data; i++ )
+    for( int i = 0; i < i_data; i++ )
     {
         s[2*i+0] = hex[(p_data[i]>>4)&0xf];
         s[2*i+1] = hex[(p_data[i]   )&0xf];
@@ -374,7 +373,6 @@ static void Close( vlc_object_t * p_this )
 static vod_media_t *MediaNew( vod_t *p_vod, const char *psz_name,
                               input_item_t *p_item )
 {
-    int i;
     vod_sys_t *p_sys = p_vod->p_sys;
 
     vod_media_t *p_media = calloc( 1, sizeof(vod_media_t) );
@@ -446,7 +444,7 @@ static vod_media_t *MediaNew( vod_t *p_vod, const char *psz_name,
 
     vlc_mutex_lock( &p_item->lock );
     msg_Dbg( p_vod, "media has %i declared ES", p_item->i_es );
-    for( i = 0; i < p_item->i_es; i++ )
+    for( int i = 0; i < p_item->i_es; i++ )
     {
         MediaAddES( p_vod, p_media, p_item->es[i] );
     }
@@ -725,10 +723,9 @@ static int MediaAddES( vod_t *p_vod, vod_media_t *p_media, es_format_t *p_fmt )
 static void MediaDelES( vod_t *p_vod, vod_media_t *p_media, es_format_t *p_fmt)
 {
     media_es_t *p_es = NULL;
-    int i;
 
     /* Find the ES */
-    for( i = 0; i < p_media->i_es; i++ )
+    for( int i = 0; i < p_media->i_es; i++ )
     {
         if( p_media->es[i]->fmt.i_cat == p_fmt->i_cat &&
             p_media->es[i]->fmt.i_codec == p_fmt->i_codec &&
@@ -887,9 +884,7 @@ static rtsp_client_t *RtspClientNew( vod_media_t *p_media, char *psz_session )
 
 static rtsp_client_t *RtspClientGet( vod_media_t *p_media, const char *psz_session )
 {
-    int i;
-
-    for( i = 0; psz_session && i < p_media->i_rtsp; i++ )
+    for( int i = 0; psz_session && i < p_media->i_rtsp; i++ )
     {
         if( !strcmp( p_media->rtsp[i]->psz_session, psz_session ) )
             return p_media->rtsp[i];
@@ -1079,7 +1074,7 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
         case HTTPD_MSG_PLAY:
         {
             char *psz_output, ip[NI_MAXNUMERICHOST];
-            int i, i_port_audio = 0, i_port_video = 0;
+            int i_port_audio = 0, i_port_video = 0;
 
             /* for now only multicast so easy */
             if( !psz_playnow )
@@ -1164,7 +1159,7 @@ static int RtspCallback( httpd_callback_sys_t *p_args, httpd_client_t *cl,
             p_rtsp->b_playing = true;
 
             /* FIXME for != 1 video and 1 audio */
-            for( i = 0; i < p_rtsp->i_es; i++ )
+            for( int i = 0; i < p_rtsp->i_es; i++ )
             {
                 if( p_rtsp->es[i]->p_media_es->fmt.i_cat == AUDIO_ES )
                     i_port_audio = p_rtsp->es[i]->i_port;
@@ -1305,7 +1300,6 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
     const char *psz_position = NULL;
     const char *psz_cseq = NULL;
     int i_cseq = 0;
-    int i;
 
     if( answer == NULL || query == NULL ) return VLC_SUCCESS;
 
@@ -1470,7 +1464,7 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl,
             p_rtsp = RtspClientGet( p_media, psz_session );
             if( !p_rtsp ) break;
 
-            for( i = 0; i < p_rtsp->i_es; i++ )
+            for( int i = 0; i < p_rtsp->i_es; i++ )
             {
                 if( p_rtsp->es[i]->p_media_es == p_es )
                 {
diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c
index 05b32d4..ef40d88 100644
--- a/modules/stream_out/rtp.c
+++ b/modules/stream_out/rtp.c
@@ -865,9 +865,8 @@ out:
 static void sprintf_hexa( char *s, uint8_t *p_data, int i_data )
 {
     static const char hex[16] = "0123456789abcdef";
-    int i;
 
-    for( i = 0; i < i_data; i++ )
+    for( int i = 0; i < i_data; i++ )
     {
         s[2*i+0] = hex[(p_data[i]>>4)&0xf];
         s[2*i+1] = hex[(p_data[i]   )&0xf];



More information about the vlc-commits mailing list