]> git.sesse.net Git - vlc/commitdiff
Reimplement NumInRange without strtol
authorHugo Beauzée-Luyssen <hugo@beauzee.fr>
Wed, 11 Mar 2015 09:35:22 +0000 (10:35 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Wed, 11 Mar 2015 09:38:13 +0000 (10:38 +0100)
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/stream_out/duplicate.c

index f22b3b051da86b6987243bcdb28ba74554e76f10..e51d9c169313e9f4f14e4f1cd17586f7d5115156 100644 (file)
@@ -307,7 +307,14 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
  *****************************************************************************/
 static bool NumInRange( const char *psz_range, int i_num )
 {
-    return true;
+    int beginRange, endRange;
+    int res = sscanf(psz_range, "%d-%d", &beginRange, &endRange);
+    if (res == 0)
+        return false;
+    else if (res == 1)
+        return beginRange == i_num;
+    return (i_num >= beginRange && i_num <= endRange)
+        || (beginRange > endRange && (i_num <= beginRange && i_num >= endRange));
 }
 
 static bool ESSelected( const es_format_t *fmt, char *psz_select )