From 9c64dce9ff27c9193417202f797be82fe21140e0 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Fri, 5 Oct 2012 10:50:00 -0400 Subject: fix totally backwards strstr matching This never could have worked except on exact matches. The arguments to strstr were reversed, and barring that, interesting results were filtered OUT. --- ponymix.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ponymix.c b/ponymix.c index c7eff30..028e401 100644 --- a/ponymix.c +++ b/ponymix.c @@ -284,7 +284,7 @@ static void sink_add_cb(pa_context UNUSED *c, const pa_sink_info *i, int eol, struct cb_data_t *pony = raw; if (eol) return; - if (pony->glob && strstr(pony->glob, i->name) != NULL) + if (pony->glob && strstr(i->name, pony->glob) == NULL) return; io_list_add(pony->list, sink_new(i)); } @@ -295,8 +295,8 @@ static void sink_input_add_cb(pa_context UNUSED *c, const pa_sink_input_info *i, struct cb_data_t *pony = raw; if (eol) return; - if (pony->glob && !(strstr(pony->glob, i->name) == NULL || - strstr(pony->glob, pa_proplist_gets(i->proplist, PA_PROP_APPLICATION_NAME)) == NULL)) + if (pony->glob && strstr(i->name, pony->glob) == NULL && + strstr(pa_proplist_gets(i->proplist, PA_PROP_APPLICATION_NAME), pony->glob) == NULL) return; io_list_add(pony->list, sink_input_new(i)); } @@ -306,7 +306,7 @@ static void source_add_cb(pa_context UNUSED *c, const pa_source_info *i, int eol struct cb_data_t *pony = raw; if (eol) return; - if (pony->glob && strstr(pony->glob, i->name) != NULL) + if (pony->glob && strstr(i->name, pony->glob) == NULL) return; io_list_add(pony->list, source_new(i)); } @@ -317,8 +317,8 @@ static void source_output_add_cb(pa_context UNUSED *c, const pa_source_output_in struct cb_data_t *pony = raw; if (eol) return; - if (pony->glob && !(strstr(pony->glob, i->name) == NULL || - strstr(pony->glob, pa_proplist_gets(i->proplist, PA_PROP_APPLICATION_NAME)) == NULL)) + if (pony->glob && strstr(i->name, pony->glob) == NULL && + strstr(pa_proplist_gets(i->proplist, PA_PROP_APPLICATION_NAME), pony->glob) == NULL) return; io_list_add(pony->list, source_output_new(i)); } -- cgit v1.2.3