From 38399303042f02250ca225f9c1ecbb00de192ef3 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Wed, 8 Oct 2025 13:07:56 +0200 Subject: [PATCH] change configuration const --- src/kds_s2000w_handler_opts.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/kds_s2000w_handler_opts.c b/src/kds_s2000w_handler_opts.c index 2e7627a..c51380c 100644 --- a/src/kds_s2000w_handler_opts.c +++ b/src/kds_s2000w_handler_opts.c @@ -8,6 +8,7 @@ #define AUTOSTART_ON 1 #define GUI_DPI 300 +#define CONFIGURATION "Configuration" void _kds_s2000w_handler_opts_write_value_to_json(json_object* value_object, SANE_Value_Type value_type, void* value) { @@ -54,7 +55,7 @@ void _kds_s2000w_handler_opts_set_valid_coord(option_descriptor* descriptor, han kds_s2000w_debug_printf_int(DEBUG, "valid width", h->coord->width); kds_s2000w_debug_printf_int(DEBUG, "valid height", h->coord->height); - json_object* config = json_object_object_get(h->current_scanner_config, "Configuration"); + json_object* config = json_object_object_get(h->current_scanner_config, CONFIGURATION); json_object* value_object = json_object_object_get(config, IMAGE_OFFSET_X); json_object_set_int(value_object, h->coord->offset_x); value_object = json_object_object_get(config, IMAGE_OFFSET_Y); @@ -100,7 +101,7 @@ void _kds_s2000w_handler_opts_set_option_to_default(handler* h) json_object* capabilities = json_tokener_parse(resp->data); json_object* default_values = json_object_object_get(capabilities, "Defaults"); json_object* default_config = json_object_new_object(); - json_object_object_add(default_config, "Configuration", default_values); + json_object_object_add(default_config, CONFIGURATION, default_values); json_object_put(h->current_scanner_config); h->current_scanner_config = NULL; @@ -405,12 +406,12 @@ void kds_s2000w_handler_opts_get_option(handler* h, uint32_t option, void* value json_object* config = NULL; if (h->current_scanner_config == NULL) { _kds_s2000w_handler_opts_load_options(h); - config = json_object_object_get(h->current_scanner_config, "Configuration"); + config = json_object_object_get(h->current_scanner_config, CONFIGURATION); _kds_s2000w_handler_opts_set_autostart_on(config); _kds_s2000w_handler_opts_set_options(h); } - config = json_object_object_get(h->current_scanner_config, "Configuration"); + config = json_object_object_get(h->current_scanner_config, CONFIGURATION); option_descriptor* descriptor = kds_s2000w_option_descriptors_full_get_by_number(option); if (strcmp(descriptor->config_name, OPTION_COUNT) == 0) { @@ -484,12 +485,12 @@ void kds_s2000w_handler_opts_set_option(handler* h, uint32_t option, void* value json_object* config = NULL; if (h->current_scanner_config == NULL) { _kds_s2000w_handler_opts_load_options(h); - config = json_object_object_get(h->current_scanner_config, "Configuration"); + config = json_object_object_get(h->current_scanner_config, CONFIGURATION); _kds_s2000w_handler_opts_set_autostart_on(config); } if (h->current_scanner_config != NULL) - config = json_object_object_get(h->current_scanner_config, "Configuration"); + config = json_object_object_get(h->current_scanner_config, CONFIGURATION); option_descriptor* descriptor = kds_s2000w_option_descriptors_full_get_by_number(option); json_object* value_object = json_object_object_get(config, descriptor->config_name); @@ -519,7 +520,7 @@ void kds_s2000w_handler_opts_set_option(handler* h, uint32_t option, void* value if (strcmp(descriptor->config_name, RESET) == 0) { _kds_s2000w_handler_opts_set_option_to_default(h); - config = json_object_object_get(h->current_scanner_config, "Configuration"); + config = json_object_object_get(h->current_scanner_config, CONFIGURATION); _kds_s2000w_handler_opts_set_autostart_on(config); } -- 2.47.3