Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.6:Update
wireplumber
0003-json-utils-fix-overriding-of-non-container...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0003-json-utils-fix-overriding-of-non-container-values-when.patch of Package wireplumber
From e6a70db254585b2cd9f3265fdafc884a48c3682d Mon Sep 17 00:00:00 2001 From: George Kiagiadakis <george.kiagiadakis@collabora.com> Date: Fri, 3 May 2024 15:54:37 +0300 Subject: [PATCH] json-utils: fix overriding of non-container values when merging Non-container values should always be overriden Fixes: #653 --- lib/wp/json-utils.c | 4 ++-- tests/wplua/scripts/json.lua | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/wp/json-utils.c b/lib/wp/json-utils.c index 53d1b2b1b..936ad449e 100644 --- a/lib/wp/json-utils.c +++ b/lib/wp/json-utils.c @@ -211,12 +211,12 @@ merge_json_objects (WpSpaJson *a, WpSpaJson *b) g_return_val_if_fail (wp_iterator_next (it, &item), NULL); val = g_value_dup_boxed (&item); - if (!override && + if (!override && wp_spa_json_is_container (val) && (wp_spa_json_object_get (a, key_str, "J", &j, NULL) || wp_spa_json_object_get (a, override_key_str, "J", &j, NULL))) { g_autoptr (WpSpaJson) merged = wp_json_utils_merge_containers (j, val); if (!merged) { - wp_warning ("skipping merge of %s as JSON values are not compatible", + wp_warning ("skipping merge of %s as JSON values are not compatible containers", key_str); continue; } diff --git a/tests/wplua/scripts/json.lua b/tests/wplua/scripts/json.lua index 03e14ba6d..5489bab23 100644 --- a/tests/wplua/scripts/json.lua +++ b/tests/wplua/scripts/json.lua @@ -241,6 +241,7 @@ assert (type (val.args.test) == "table") assert (val.args.test[1] == 0) assert (val.args.test[2] == 1) +-- merge json = Json.Array { "foo" } json2 = Json.Array { "bar" } json = json:merge(json2) @@ -263,3 +264,9 @@ assert (val["1"] == 1) assert (val["2"] == 2) assert (val["3"] == 3) assert (val["4"] == 4) + +json = Json.Object { ["a"] = "foo" } +json2 = Json.Object { ["a"] = "bar" } +json = json:merge(json2) +val = json:parse () +assert (val["a"] == "bar") -- GitLab
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor