]> git.sesse.net Git - vlc/commitdiff
duplicate: cleaning up
authorRémi Denis-Courmont <remi@remlab.net>
Sat, 5 Sep 2009 09:00:55 +0000 (12:00 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sat, 5 Sep 2009 09:00:55 +0000 (12:00 +0300)
modules/stream_out/duplicate.c

index 6a50fdc9a4b76c2a631616a2087f430ae9855cc6..b8e2c3cb82058a44b79271a375115314a4dfe2e3 100644 (file)
@@ -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 )