mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-02-17 22:05:38 -05:00
spa: add spa_json_init_relax
spa_json_init assumes that we start in an object and always requires a key/value pair. If the last part is a key, it returns and error and does not want to return the key value. This causes problems when parsing AUX0,AUX1,AUX2 or any relaxed array withand odd number of elements. Make a new spa_json_init_relax that takes the type of the container we're assuming we're in and set the state of the parser to array when we are parsing a relaxed array. Fixes #4944
This commit is contained in:
parent
0276bb5b06
commit
94d0d8bc09
2 changed files with 10 additions and 1 deletions
|
|
@ -105,7 +105,7 @@ SPA_API_JSON_UTILS int spa_json_begin_container(struct spa_json * iter,
|
|||
spa_json_init(iter, data, size);
|
||||
res = spa_json_enter_container(iter, iter, type);
|
||||
if (res == -EPROTO && relax)
|
||||
spa_json_init(iter, data, size);
|
||||
spa_json_init_relax(iter, type, data, size);
|
||||
else if (res <= 0)
|
||||
return res;
|
||||
return 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue