]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
fix set configuration
authorBastian Dehn <hhaalo@arcor.de>
Sun, 26 Oct 2025 20:49:50 +0000 (21:49 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 26 Oct 2025 20:49:50 +0000 (21:49 +0100)
src/kds_s2000w_handler_opts.c

index dbd6b9c9bbd21e452030da44ad2d64cabddbc7d8..898fdcdb102a6113b49d709370c9d1b34acc8e93 100644 (file)
@@ -169,7 +169,11 @@ void _kds_s2000w_handler_opts_set_width_or_height_min(option_descriptor_t* descr
 
 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);
+       json_object* config = json_object_new_object();
+       json_object* config_value = NULL;
+       json_object_deep_copy(h->scanner_config, &config_value, json_c_shallow_copy_default);
+       json_object_object_add(config, CONFIGURATION, config_value);
+       const char* json_string = json_object_to_json_string_ext(config, JSON_C_TO_STRING_PLAIN);
        response_t* resp = kds_s2000w_client_response_init();
        resp->size = sizeof(char) * strlen(json_string);
        resp->code = 0;
@@ -181,6 +185,8 @@ void _kds_s2000w_handler_opts_set_options(handler_t* h)
 
        kds_s2000w_client_response_free(resp);
        resp = NULL;
+       json_object_put(config);
+       config = NULL;
 }
 
 void _kds_s2000w_handler_opts_load_config(handler_t* h)