]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
change get zero option
authorBastian Dehn <hhaalo@arcor.de>
Sun, 26 Oct 2025 14:04:46 +0000 (15:04 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 26 Oct 2025 14:04:46 +0000 (15:04 +0100)
src/kds_s2000w_handler_opts.c

index ee3f8ac13b53f20909259d1fc05df5514fb17f64..91cdbfafa31b8e7b6f1eaf8d426f2be4558757ba 100644 (file)
@@ -108,6 +108,12 @@ json_object* _kds_s2000w_handler_opts_reset(const option_descriptor_t* descripto
        return h->scanner_config;
 }
 
+int32_t _kds_s2000w_handler_opts_get_zero_option(void* value) {
+       int32_t* int_value = (int32_t*) value;
+       *int_value = kds_s2000w_option_descriptors_get_max_option_count();
+       return GOOD;
+}
+
 void _kds_s2000w_handler_opts_set_options(handler_t* h)
 {
        const char* json_string = json_object_to_json_string_ext(h->scanner_config, JSON_C_TO_STRING_PLAIN);
@@ -482,11 +488,8 @@ int32_t kds_s2000w_handler_opts_get_option(handler_t* h, uint32_t option, void*
        json_object* config = _kds_s2000w_handler_opts_load_config(h);
 
        option_descriptor_t* descriptor = kds_s2000w_option_descriptors_full_get_by_number(option);
-       if (strcmp(descriptor->config_name, OPTION_COUNT) == 0) {
-               int32_t* int_value = (int32_t*) value;
-               *int_value = kds_s2000w_option_descriptors_get_max_option_count();
-               return GOOD;
-       }
+       if (strcmp(descriptor->config_name, OPTION_COUNT) == 0)
+               return _kds_s2000w_handler_opts_get_zero_option(value);
 
        json_object* value_object = json_object_object_get(config, descriptor->config_name);