diff mbox series

[v2,03/10] Fix usage of GET_FIELD_BOOL()

Message ID 20240712152253.3702-4-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
GET_FIELD_BOOL(), expects a pointer to a bool value. Synchronize
behavior between libconfig and libjson adaptors.

Signed-off-by: Christian Eggers <ceggers@arri.de>
---
 core/stream_interface.c           | 2 +-
 corelib/parsing_library_libjson.c | 2 +-
 include/swupdate_image.h          | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/core/stream_interface.c b/core/stream_interface.c
index 5f3ad2e3fd93..eecc672ca157 100644
--- a/core/stream_interface.c
+++ b/core/stream_interface.c
@@ -288,7 +288,7 @@  static int extract_files(int fd, struct swupdate_cfg *software)
 							return -1;
 						}
 						/* Avoid trying to adjust again later */
-						part->install_directly = 1;
+						part->install_directly = true;
 					}
 				}
 				img->fdin = fd;
diff --git a/corelib/parsing_library_libjson.c b/corelib/parsing_library_libjson.c
index 187e4eadcc16..d454aa79c540 100644
--- a/corelib/parsing_library_libjson.c
+++ b/corelib/parsing_library_libjson.c
@@ -126,7 +126,7 @@  static void get_value_json(json_object *e, void *dest, field_type_t expected_typ
 		return;
 	switch (type) {
 	case json_type_boolean:
-		*(unsigned int *)dest = json_object_get_boolean(e);
+		*(bool *)dest = json_object_get_boolean(e);
 		break;
 	case json_type_int:
 		*(unsigned int *)dest = json_object_get_int(e);
diff --git a/include/swupdate_image.h b/include/swupdate_image.h
index e214aafc2965..26ace79499ac 100644
--- a/include/swupdate_image.h
+++ b/include/swupdate_image.h
@@ -32,8 +32,8 @@  typedef enum {
 struct sw_version {
 	char name[SWUPDATE_GENERAL_STRING_SIZE];
 	char version[SWUPDATE_GENERAL_STRING_SIZE];
-	int install_if_different;
-	int install_if_higher;
+	bool install_if_different;
+	bool install_if_higher;
 	LIST_ENTRY(sw_version) next;
 };
 
@@ -57,7 +57,7 @@  struct img_type {
 	bool preserve_attributes; /* whether to preserve attributes in archives */
 	bool is_encrypted;
 	char ivt_ascii[33];
-	int install_directly;
+	bool install_directly;
 	int is_script;
 	int is_partitioner;
 	struct dict properties;