mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
spa: add spa_json_object_next
This gets the next key and value from an object. This function is better because it will skip key/value pairs that don't fit in the array to hold the key. The previous code patter would stop parsing the object as soon as a key larger than the available space was found.
This commit is contained in:
parent
cd81b5f39a
commit
ce390d5b22
24 changed files with 171 additions and 269 deletions
|
|
@ -1140,9 +1140,7 @@ static int parse_value(const char *str, struct param_info *info)
|
|||
info->type = TYPE_MIN_MAX;
|
||||
info->n_vals = 2;
|
||||
spa_json_enter(&it[0], &it[1]);
|
||||
while (spa_json_get_string(&it[1], key, sizeof(key)) > 0) {
|
||||
if ((len = spa_json_next(&it[1], &val)) <= 0)
|
||||
break;
|
||||
while ((len = spa_json_object_next(&it[1], key, sizeof(key), &val)) > 0) {
|
||||
if (info->collect(val, len, &v) < 0)
|
||||
continue;
|
||||
if (spa_streq(key, "min"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue