]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
change configuration const
authorBastian Dehn <hhaalo@arcor.de>
Wed, 8 Oct 2025 11:07:56 +0000 (13:07 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Wed, 8 Oct 2025 11:07:56 +0000 (13:07 +0200)
src/kds_s2000w_handler_opts.c

index 2e7627a428356dcb040be9682ed9a279e989a07e..c51380c0c771e9c518804afe86d5de2112b8cfbb 100644 (file)
@@ -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);
        }