diff mbox series

[v2,04/10] Fix usage of GET_FIELD_INT()

Message ID 20240712152253.3702-5-ceggers@arri.de
State Accepted
Headers show
Series parser: fix various data type problems | expand

Commit Message

Christian Eggers July 12, 2024, 3:22 p.m. UTC
Add explicit pointer casts and sync behavior between libjson and
libconfig adaptors.

Signed-off-by: Christian Eggers <ceggers@arri.de>
---
 corelib/parsing_library_libjson.c | 2 +-
 corelib/server_utils.c            | 2 +-
 corelib/swupdate_settings.c       | 4 ++--
 mongoose/mongoose_interface.c     | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/corelib/parsing_library_libjson.c b/corelib/parsing_library_libjson.c
index d454aa79c540..fee7bbe3ad7b 100644
--- a/corelib/parsing_library_libjson.c
+++ b/corelib/parsing_library_libjson.c
@@ -129,7 +129,7 @@  static void get_value_json(json_object *e, void *dest, field_type_t expected_typ
 		*(bool *)dest = json_object_get_boolean(e);
 		break;
 	case json_type_int:
-		*(unsigned int *)dest = json_object_get_int(e);
+		*(int *)dest = json_object_get_int(e);
 		break;
 	case json_type_double:
 		*(double *)dest = json_object_get_double(e);
diff --git a/corelib/server_utils.c b/corelib/server_utils.c
index 33c2d9a07ae2..e38425638a34 100644
--- a/corelib/server_utils.c
+++ b/corelib/server_utils.c
@@ -22,7 +22,7 @@  int channel_settings(void *elem, void *data)
 	channel_data_t *chan = (channel_data_t *)data;
 
 	GET_FIELD_INT(LIBCFG_PARSER, elem, "retry",
-		&chan->retries);
+		(int *)&chan->retries);
 
 	GET_FIELD_STRING_RESET(LIBCFG_PARSER, elem, "max-download-speed", tmp);
 	if (strlen(tmp)) {
diff --git a/corelib/swupdate_settings.c b/corelib/swupdate_settings.c
index 28d89a1436c7..e23c9f296606 100644
--- a/corelib/swupdate_settings.c
+++ b/corelib/swupdate_settings.c
@@ -95,8 +95,8 @@  static int get_run_as(void *elem, void *data)
 {
 	struct run_as *pid = (struct run_as *)data;
 
-	GET_FIELD_INT(LIBCFG_PARSER, elem, "userid", &pid->userid);
-	GET_FIELD_INT(LIBCFG_PARSER, elem, "groupid", &pid->groupid);
+	GET_FIELD_INT(LIBCFG_PARSER, elem, "userid", (int *)&pid->userid);
+	GET_FIELD_INT(LIBCFG_PARSER, elem, "groupid", (int *)&pid->groupid);
 
 	return 0;
 }
diff --git a/mongoose/mongoose_interface.c b/mongoose/mongoose_interface.c
index 3fbe88e2ca54..8635bbaf4c82 100644
--- a/mongoose/mongoose_interface.c
+++ b/mongoose/mongoose_interface.c
@@ -770,7 +770,7 @@  static int mongoose_settings(void *elem, void  __attribute__ ((__unused__)) *dat
 	}
 	GET_FIELD_BOOL(LIBCFG_PARSER, elem, "run-postupdate", &run_postupdate);
 
-	GET_FIELD_INT(LIBCFG_PARSER, elem, "timeout", &watchdog_conn);
+	GET_FIELD_INT(LIBCFG_PARSER, elem, "timeout", (int *)&watchdog_conn);
 
 	return 0;
 }