mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-09 13:29:59 -05:00
modargs: Ensure modargs can be accessed in their raw form.
When dealing with proplists passed as modargs, we need the unescaped form in order to properly deal with quotes (ticks + double quotes). As the previous code always called pa_unescape() before adding it into the modarg hashmap, this was impossible. This modification simply stores two proplists. If the unescaped value is different from the raw value, we also keep the raw form. When parsing proplist arguments, we use this raw form and do the unescaping ourselves when processing it. This changes the current behaviour which required you to double escape proplists arguments. This double escape mechanism did allow you to mix and match what types of quotes you used to delimit the individial proplist values, but it made the actual data much harder to pass in. This approach has the drawback that you cannot mix and match the quotes you use, but this is a very minor issue and IMO pales in comparison to the general clarity gained. See the discussion on the mailing list for more background: http://lists.freedesktop.org/archives/pulseaudio-discuss/2011-September/011220.html
This commit is contained in:
parent
e93b32744c
commit
3542112888
2 changed files with 66 additions and 36 deletions
|
|
@ -81,7 +81,7 @@ int main(int argc, char*argv[]) {
|
|||
printf("%s\n", v);
|
||||
pa_xfree(v);
|
||||
|
||||
pa_assert_se(ma = pa_modargs_new("foo='foobar=waldo foo2=\"lj\\\\\"dhflh\" foo3=\\'kjlskj\\\\\\'\\''", x));
|
||||
pa_assert_se(ma = pa_modargs_new("foo='foobar=waldo foo2=\"lj\\\"dhflh\" foo3=\"kjlskj\\'\"'", x));
|
||||
pa_assert_se(a = pa_proplist_new());
|
||||
|
||||
pa_assert_se(pa_modargs_get_proplist(ma, "foo", a, PA_UPDATE_REPLACE) >= 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue