mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
conf: handle !null checks
This commit is contained in:
parent
6c6046f5ac
commit
afd0affd97
1 changed files with 11 additions and 6 deletions
|
|
@ -606,18 +606,25 @@ static bool find_match(struct spa_json *arr, const struct spa_dict *props)
|
|||
int len;
|
||||
|
||||
while (spa_json_get_string(&it[0], key, sizeof(key)) > 0) {
|
||||
bool success = false;
|
||||
bool success = false, is_null;
|
||||
int skip = 0;
|
||||
|
||||
if ((len = spa_json_next(&it[0], &value)) <= 0)
|
||||
break;
|
||||
|
||||
if (len > 0 && value[0] == '!') {
|
||||
success = !success;
|
||||
skip++;
|
||||
}
|
||||
|
||||
str = spa_dict_lookup(props, key);
|
||||
|
||||
if (spa_json_is_null(value, len)) {
|
||||
success = str == NULL;
|
||||
is_null = spa_json_is_null(value+skip, len-skip);
|
||||
if (is_null || str == NULL) {
|
||||
if (is_null && str == NULL)
|
||||
success = !success;
|
||||
} else {
|
||||
if (spa_json_parse_stringn(value, len, val, sizeof(val)) < 0)
|
||||
if (spa_json_parse_stringn(value+skip, len-skip, val, sizeof(val)) < 0)
|
||||
continue;
|
||||
value = val;
|
||||
len = strlen(val);
|
||||
|
|
@ -625,8 +632,6 @@ static bool find_match(struct spa_json *arr, const struct spa_dict *props)
|
|||
success = !success;
|
||||
skip++;
|
||||
}
|
||||
}
|
||||
if (str != NULL) {
|
||||
if (value[skip] == '~') {
|
||||
regex_t preg;
|
||||
int res;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue