From 7f614e92c8516175ca9a189c6e88f3f662e5ad38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= Date: Sat, 5 Sep 2009 12:00:55 +0300 Subject: [PATCH] duplicate: cleaning up --- modules/stream_out/duplicate.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/modules/stream_out/duplicate.c b/modules/stream_out/duplicate.c index 6a50fdc9a4..b8e2c3cb82 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 ) -- GitLab