Merge commit 'fml/master'
[paraslash.git] / grab_client.c
index 4be23d7..77d3616 100644 (file)
@@ -97,15 +97,15 @@ static int check_gc_args(struct grab_client *gc)
                if (gc->audio_format_num < 0)
                        return gc->audio_format_num;
        }
-       if (c->slot_arg > MAX_STREAM_SLOTS)
+       if (c->slot_arg >= MAX_STREAM_SLOTS)
                return -E_BAD_GC_SLOT;
-       if (c->filter_num_arg <= 0)
+       if (c->filter_num_arg < 0)
                return -E_BAD_GC_FILTER_NUM;
        if (c->audio_format_given) {
-               if (num_filters(gc->audio_format_num) < c->filter_num_arg)
+               if (num_filters(gc->audio_format_num) <= c->filter_num_arg)
                        return -E_BAD_GC_FILTER_NUM;
        } else
-               if (c->filter_num_arg > max_num_filters())
+               if (c->filter_num_arg >= max_num_filters())
                        return -E_BAD_GC_FILTER_NUM;
 
        return 1;
@@ -190,10 +190,8 @@ void activate_inactive_grab_clients(int slot_num, int audio_format_num,
                                audio_format_num)
                        continue;
                filter_num = gc->conf->filter_num_arg;
-               if (filter_num >= 0 && filter_num >= num_filters(gc->audio_format_num))
+               if (filter_num >= num_filters(gc->audio_format_num))
                        continue;
-               if (filter_num < 0)
-                       filter_num = 0;
                fn = fc->filter_nodes + filter_num;
                activate_grab_client(gc, fn);
        }