SANE_Option_Descriptor** descriptor_array = NULL;
-SANE_Word* constraint_dpi = NULL;
+SANE_Word constraint_dpi[] = {2, 200, 300};
+SANE_Word constraint_depth[] = {2, 1, 8};
+SANE_Range constraint_binarization_contrast = {-50, 50, 1};
+SANE_Range constraint_background_smoothing_aggressivness = {-10, 10, 1};
+SANE_Range constraint_color_drop_out_aggressiveness_range = {-10, 10, 1};
+SANE_Range constraint_color_balance_aggressiveness = {-2, 2, 1};
+SANE_Range constraint_color_balance_red = {-50, 50, 1};
+SANE_Range constraint_color_balance_green = {-50, 50, 1};
+SANE_Range constraint_color_balance_blue = {-50, 50, 1};
+SANE_Range constraint_foreground_boldness_aggressiveness = {-10, 10, 1};
SANE_String_Const* constraint_scanside = NULL;
SANE_String_Const* constraint_colormode = NULL;
SANE_String_Const* constraint_colordrop = NULL;
-SANE_Range* constraint_color_drop_out_aggressiveness_range = NULL;
SANE_String_Const* constraint_color_auto_brightnessmode = NULL;
SANE_String_Const* constraint_color_balance_mode = NULL;
-SANE_Range* constraint_color_balance_aggressiveness = NULL;
-SANE_Range* constraint_color_balance_red = NULL;
-SANE_Range* constraint_color_balance_green = NULL;
-SANE_Range* constraint_color_balance_blue = NULL;
SANE_String_Const* constraint_foreground_boldness_mode = NULL;
-SANE_Range* constraint_foreground_boldness_aggressiveness = NULL;
SANE_String_Const* constraint_background_smoothing_mode = NULL;
-SANE_Range* constraint_background_smoothing_aggressivness = NULL;
SANE_String_Const* constraint_binarization_mode = NULL;
-SANE_Range* constraint_binarization_contrast = NULL;
SANE_String_Const* constraint_max_document_length = NULL;
SANE_String_Const* constraint_scan_source = NULL;
-SANE_Word* constraint_depth = NULL;
SANE_Option_Descriptor* _kds_s2000w_option_descriptor_standard_group()
{
descriptor->unit = SANE_UNIT_DPI;
descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
descriptor->constraint_type = SANE_CONSTRAINT_WORD_LIST;
- constraint_dpi = malloc(sizeof(SANE_Int) * 3);
- constraint_dpi[0] = 2;
- constraint_dpi[1] = 200;
- constraint_dpi[2] = 300;
descriptor->constraint.word_list = constraint_dpi;
descriptor->type = SANE_TYPE_INT;
descriptor->size = sizeof(SANE_Int);
descriptor->desc = "colordropoutaggressiveness";
descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
descriptor->constraint_type = SANE_CONSTRAINT_RANGE;
- constraint_color_drop_out_aggressiveness_range = malloc(sizeof(SANE_Range));
- constraint_color_drop_out_aggressiveness_range->min = -10;
- constraint_color_drop_out_aggressiveness_range->max = 10;
- constraint_color_drop_out_aggressiveness_range->quant = 1;
- descriptor->constraint.range = constraint_color_drop_out_aggressiveness_range;
+ descriptor->constraint.range = &constraint_color_drop_out_aggressiveness_range;
descriptor->type = SANE_TYPE_INT;
descriptor->unit = SANE_UNIT_NONE;
descriptor->size = sizeof(SANE_Int);
descriptor->desc = "colorbalanceaggressiveness";
descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
descriptor->constraint_type = SANE_CONSTRAINT_RANGE;
- constraint_color_balance_aggressiveness = malloc(sizeof(SANE_Range));
- constraint_color_balance_aggressiveness->min = -2;
- constraint_color_balance_aggressiveness->max = 2;
- constraint_color_balance_aggressiveness->quant = 1;
- descriptor->constraint.range = constraint_color_balance_aggressiveness;
+ descriptor->constraint.range = &constraint_color_balance_aggressiveness;
descriptor->type = SANE_TYPE_INT;
descriptor->unit = SANE_UNIT_NONE;
descriptor->size = sizeof(SANE_Int);
descriptor->desc = "colorbalancered";
descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
descriptor->constraint_type = SANE_CONSTRAINT_RANGE;
- constraint_color_balance_red = malloc(sizeof(SANE_Range));
- constraint_color_balance_red->min = -50;
- constraint_color_balance_red->max = 50;
- constraint_color_balance_red->quant = 1;
- descriptor->constraint.range = constraint_color_balance_red;
+ descriptor->constraint.range = &constraint_color_balance_red;
descriptor->type = SANE_TYPE_INT;
descriptor->unit = SANE_UNIT_NONE;
descriptor->size = sizeof(SANE_Int);
descriptor->desc = "colorbalancegreen";
descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
descriptor->constraint_type = SANE_CONSTRAINT_RANGE;
- constraint_color_balance_green = malloc(sizeof(SANE_Range));
- constraint_color_balance_green->min = -50;
- constraint_color_balance_green->max = 50;
- constraint_color_balance_green->quant = 1;
- descriptor->constraint.range = constraint_color_balance_green;
+ descriptor->constraint.range = &constraint_color_balance_green;
descriptor->type = SANE_TYPE_INT;
descriptor->unit = SANE_UNIT_NONE;
descriptor->size = sizeof(SANE_Int);
descriptor->desc = "colorbalanceblue";
descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
descriptor->constraint_type = SANE_CONSTRAINT_RANGE;
- constraint_color_balance_blue = malloc(sizeof(SANE_Range));
- constraint_color_balance_blue->min = -50;
- constraint_color_balance_blue->max = 50;
- constraint_color_balance_blue->quant = 1;
- descriptor->constraint.range = constraint_color_balance_blue;
+ descriptor->constraint.range = &constraint_color_balance_blue;
descriptor->type = SANE_TYPE_INT;
descriptor->unit = SANE_UNIT_NONE;
descriptor->size = sizeof(SANE_Int);
descriptor->desc = "Foreground Boldness Mode";
descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
descriptor->constraint_type = SANE_CONSTRAINT_RANGE;
- constraint_foreground_boldness_aggressiveness = malloc(sizeof(SANE_Range));
- constraint_foreground_boldness_aggressiveness->min = -10;
- constraint_foreground_boldness_aggressiveness->max = 10;
- constraint_foreground_boldness_aggressiveness->quant = 1;
- descriptor->constraint.range = constraint_foreground_boldness_aggressiveness;
+ descriptor->constraint.range = &constraint_foreground_boldness_aggressiveness;
descriptor->type = SANE_TYPE_INT;
descriptor->unit = SANE_UNIT_NONE;
descriptor->size = sizeof(SANE_Int);
descriptor->desc = "Background Smoothing Aggressivenes";
descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
descriptor->constraint_type = SANE_CONSTRAINT_RANGE;
- constraint_background_smoothing_aggressivness = malloc(sizeof(SANE_Range));
- constraint_background_smoothing_aggressivness->min = -10;
- constraint_background_smoothing_aggressivness->max = 10;
- constraint_background_smoothing_aggressivness->quant = 1;
- descriptor->constraint.range = constraint_background_smoothing_aggressivness;
+ descriptor->constraint.range = &constraint_background_smoothing_aggressivness;
descriptor->type = SANE_TYPE_INT;
descriptor->unit = SANE_UNIT_NONE;
descriptor->size = sizeof(SANE_Int);
descriptor->desc = SANE_DESC_CONTRAST;
descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
descriptor->constraint_type = SANE_CONSTRAINT_RANGE;
- constraint_binarization_contrast = malloc(sizeof(SANE_Range));
- constraint_binarization_contrast->min = -50;
- constraint_binarization_contrast->max = 50;
- constraint_binarization_contrast->quant = 1;
- descriptor->constraint.range = constraint_binarization_contrast;
+ descriptor->constraint.range = &constraint_binarization_contrast;
descriptor->type = SANE_TYPE_INT;
descriptor->unit = SANE_UNIT_NONE;
descriptor->size = sizeof(SANE_Int);
descriptor->desc = SANE_DESC_BIT_DEPTH;
descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
descriptor->constraint_type = SANE_CONSTRAINT_WORD_LIST;
- constraint_depth = malloc(sizeof(SANE_Int) * 3);
- constraint_depth[0] = 2;
- constraint_depth[1] = 1;
- constraint_depth[2] = 8;
descriptor->constraint.word_list = constraint_depth;
descriptor->type = SANE_TYPE_INT;
descriptor->unit = SANE_UNIT_NONE;
void kds_s2000w_option_descriptor_free_option_descriptors()
{
debug_printf(ALL, "kds_s2000w_option_descriptor_free_option_descriptors");
- free(constraint_dpi);
- constraint_dpi = NULL;
free(constraint_scanside);
constraint_scanside = NULL;
free(constraint_colormode);
constraint_colormode = NULL;
free(constraint_colordrop);
constraint_colordrop = NULL;
- free(constraint_color_drop_out_aggressiveness_range);
- constraint_color_drop_out_aggressiveness_range = NULL;
free(constraint_color_auto_brightnessmode);
constraint_color_auto_brightnessmode = NULL;
free(constraint_color_balance_mode);
constraint_color_balance_mode = NULL;
- free(constraint_color_balance_aggressiveness);
- constraint_color_balance_aggressiveness = NULL;
- free(constraint_color_balance_red);
- constraint_color_balance_red = NULL;
- free(constraint_color_balance_green);
- constraint_color_balance_green = NULL;
- free(constraint_color_balance_blue);
- constraint_color_balance_blue = NULL;
free(constraint_foreground_boldness_mode);
constraint_foreground_boldness_mode = NULL;
- free(constraint_foreground_boldness_aggressiveness);
- constraint_foreground_boldness_aggressiveness = NULL;
free(constraint_background_smoothing_mode);
constraint_background_smoothing_mode = NULL;
- free(constraint_background_smoothing_aggressivness);
- constraint_background_smoothing_aggressivness = NULL;
free(constraint_binarization_mode);
constraint_binarization_mode = NULL;
- free(constraint_binarization_contrast);
- constraint_binarization_contrast = NULL;
free(constraint_max_document_length);
constraint_max_document_length = NULL;
free(constraint_scan_source);
constraint_scan_source = NULL;
- free(constraint_depth);
- constraint_depth = NULL;
for (int i = 0; i < MAX_OPTION_COUNT; i++) {
free(descriptor_array[i]);