This is an automated email from the ASF dual-hosted git repository.
pnoltes pushed a commit to branch feature/685-properties-json-serialization
in repository https://gitbox.apache.org/repos/asf/celix.git
The following commit(s) were added to
refs/heads/feature/685-properties-json-serialization by this push:
new ae4464ca gh-685: Fix incorrect celix_autoptr usage
ae4464ca is described below
commit ae4464ca46775eb69978d8bfc0de20564b5c553a
Author: Pepijn Noltes <[email protected]>
AuthorDate: Mon Apr 15 19:17:17 2024 +0200
gh-685: Fix incorrect celix_autoptr usage
---
libs/utils/gtest/src/PropertiesEncodingTestSuite.cc | 6 +++---
libs/utils/src/properties_encoding.c | 1 +
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
b/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
index 0771aa3c..1b0035c0 100644
--- a/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
+++ b/libs/utils/gtest/src/PropertiesEncodingTestSuite.cc
@@ -659,7 +659,7 @@ TEST_F(PropertiesSerializationTestSuite,
LoadPropertiesWithDuplicatesTest) {
EXPECT_EQ(3, celix_properties_getLong(props, "key", 0));
// When decoding the properties from the stream using a flog that does not
allow duplicates
- celix_autoptr(celix_properties_t) props2;
+ celix_properties_t* props2;
status = celix_properties_loadFromString2(jsonInput,
CELIX_PROPERTIES_DECODE_ERROR_ON_DUPLICATES, &props2);
// Then loading fails, because of a duplicate key
@@ -711,7 +711,7 @@ TEST_F(PropertiesSerializationTestSuite,
LoadPropertiesEscapedSlashesTest) {
EXPECT_STREQ("value7", celix_properties_getString(props, "object3/key4"));
// When decoding the properties from a string using a flag that allows
duplicates
- celix_autoptr(celix_properties_t) props2;
+ celix_properties_t* props2;
status = celix_properties_loadFromString2(jsonInput,
CELIX_PROPERTIES_DECODE_ERROR_ON_DUPLICATES, &props2);
// Then loading fails, because of a duplicate key
@@ -722,7 +722,7 @@ TEST_F(PropertiesSerializationTestSuite,
LoadPropertiesEscapedSlashesTest) {
celix_err_printErrors(stderr, "Test Error: ", "\n");
// When decoding the properties from a string using a flag that allows
collisions
- celix_autoptr(celix_properties_t) props3;
+ celix_properties_t* props3;
status = celix_properties_loadFromString2(jsonInput,
CELIX_PROPERTIES_DECODE_ERROR_ON_COLLISIONS, &props3);
// Then loading fails, because of a collision
diff --git a/libs/utils/src/properties_encoding.c
b/libs/utils/src/properties_encoding.c
index eba39207..74103f48 100644
--- a/libs/utils/src/properties_encoding.c
+++ b/libs/utils/src/properties_encoding.c
@@ -519,6 +519,7 @@ celix_properties_decodeValue(celix_properties_t* props,
const char* key, json_t*
}
static celix_status_t celix_properties_decodeFromJson(json_t* obj, int flags,
celix_properties_t** out) {
+ *out = NULL;
if (!json_is_object(obj)) {
celix_err_push("Expected json object.");
return CELIX_ILLEGAL_ARGUMENT;