[vlc-devel] commit: duplicate: cleaning up ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Sep 5 11:01:10 CEST 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Sep  5 12:00:55 2009 +0300| [7f614e92c8516175ca9a189c6e88f3f662e5ad38] | committer: Rémi Denis-Courmont 

duplicate: cleaning up

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

 modules/stream_out/duplicate.c |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/modules/stream_out/duplicate.c b/modules/stream_out/duplicate.c
index 6a50fdc..b8e2c3c 100644
--- a/modules/stream_out/duplicate.c
+++ b/modules/stream_out/duplicate.c
@@ -299,26 +299,27 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_t *id,
 /*****************************************************************************
  * Divers
  *****************************************************************************/
-static bool NumInRange( char *psz_range, int i_num )
+static bool NumInRange( const char *psz_range, int i_num )
 {
-    char *psz = strchr( psz_range, '-' );
+    const char *psz = strchr( psz_range, '-' );
     char *end;
     int  i_start, i_stop;
 
+    i_start = strtol( psz_range, &end, 0 );
+    if( end == psz_range )
+        i_start = i_num;
+
     if( psz )
     {
-        i_start = strtol( psz_range, &end, 0 );
-        if( end == psz_range ) i_start = i_num;
-
-        i_stop  = strtol( psz+1,       &end, 0 );
-        if( end == psz_range ) i_stop = i_num;
+        psz++;
+        i_stop = strtol( psz, &end, 0 );
+        if( end == psz )
+            i_stop = i_num
     }
     else
-    {
-        i_start = i_stop = strtol( psz_range, NULL, 0 );
-    }
+        i_stop = i_start;
 
-    return i_start <= i_num && i_num <= i_stop ? true : false;
+    return i_start <= i_num && i_num <= i_stop;
 }
 
 static bool ESSelected( es_format_t *fmt, char *psz_select )




More information about the vlc-devel mailing list