]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
change option descriptor array to heap
authorBastian Dehn <hhaalo@arcor.de>
Tue, 30 Jul 2024 11:19:13 +0000 (13:19 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Tue, 30 Jul 2024 11:19:13 +0000 (13:19 +0200)
src/kds_s2000w_option_descriptors.c
tests/kds_s2000w_net_get_opt_tests.c

index 2bcfd491152d0819ad469e54f2b10aa99d490e43..6f0a864fa5a47b012f757cbf9400b859346b2b9b 100644 (file)
@@ -3,7 +3,7 @@
 #include "kds_s2000w_option_descriptors.h"
 #include "kds_s2000w_debug.h"
 
-SANE_Option_Descriptor descriptor_array[MAX_OPTION_COUNT];
+SANE_Option_Descriptor* descriptor_array = NULL;
 
 SANE_Word constraint_dpi[] = {2, 200, 300};
 SANE_Range constraint_binarization_contrast = {-50, 50, 1};
@@ -516,6 +516,7 @@ void kds_s2000w_option_descriptor_init_option_descriptors()
 {
        debug_printf(ALL, "kds_s2000w_option_descriptor_init_option_descriptors");
 
+       descriptor_array = malloc(sizeof(SANE_Option_Descriptor) * MAX_OPTION_COUNT);
        descriptor_array[0] = _kds_s2000w_option_descriptor_num_options();
        descriptor_array[1] = _kds_s2000w_option_descriptor_standard_group();
        descriptor_array[2] = _kds_s2000w_option_descriptor_scan_source();
@@ -563,6 +564,8 @@ void kds_s2000w_option_descriptor_free_option_descriptors()
        constraint_max_document_length = NULL;
        free(constraint_scan_source);
        constraint_scan_source = NULL;
+       free(descriptor_array);
+       descriptor_array = NULL;
 }
 
 SANE_Option_Descriptor* kds_s2000w_option_get_descriptor(int option)
index a28ae4ab7c5d589978ad47e5db0622d6f249ccf1..2cc3599ce5b083b3a914efc9c41d55dd83c2d27d 100644 (file)
@@ -35,7 +35,7 @@ void sane_kds_s2000w_net_control_get_option_zero(void** state)
 
        _sane_kds_s2000w_net_control_option(h, 0, SANE_ACTION_GET_VALUE, &value, NULL);
 
-       assert_int_equal(value, 23);
+       assert_int_equal(value, 22);
 
        free_handler(h);
        h = NULL;