From: Bastian Dehn Date: Fri, 26 Sep 2025 08:00:42 +0000 (+0200) Subject: change option descriptors on heap X-Git-Tag: v1.1.8^2~12 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=d9fc6d7c0901e7f567ccd18524fdbc6f5694593e;p=sane-kds-s2000w-net.git change option descriptors on heap --- diff --git a/src/kds_s2000w_handler_opts.c b/src/kds_s2000w_handler_opts.c index d383e3f..68b962b 100644 --- a/src/kds_s2000w_handler_opts.c +++ b/src/kds_s2000w_handler_opts.c @@ -350,7 +350,7 @@ void kds_s2000w_handler_opts_get_option(handler* h, uint32_t option, void* value if (option == 2) { value_object = json_object_object_get(config, descriptor->config_name); - _kds_s2000w_handler_opts_write_value(value_object, descriptor->descriptor.type, value); + _kds_s2000w_handler_opts_write_value(value_object, descriptor->descriptor->type, value); if (strcmp(value, "Flatbed") == 0) h->current_scan_status->feeder = Flatbed; @@ -365,7 +365,7 @@ void kds_s2000w_handler_opts_get_option(handler* h, uint32_t option, void* value } value_object = json_object_object_get(config, descriptor->config_name); - _kds_s2000w_handler_opts_write_value(value_object, descriptor->descriptor.type, value); + _kds_s2000w_handler_opts_write_value(value_object, descriptor->descriptor->type, value); } void kds_s2000w_handler_opts_set_option(handler* h, uint32_t option, void* value, int32_t* info) @@ -387,7 +387,7 @@ void kds_s2000w_handler_opts_set_option(handler* h, uint32_t option, void* value json_object* value_object = NULL; value_object = json_object_object_get(config, descriptor->config_name); - _kds_s2000w_handler_opts_write_value_to_json(value_object, descriptor->descriptor.type, value); + _kds_s2000w_handler_opts_write_value_to_json(value_object, descriptor->descriptor->type, value); if (strcmp(descriptor->config_name, COLOR_MODE) == 0) { if (strcmp(value, "Flatbed") == 0) diff --git a/src/kds_s2000w_option_descriptors.c b/src/kds_s2000w_option_descriptors.c index 8638040..0c19925 100644 --- a/src/kds_s2000w_option_descriptors.c +++ b/src/kds_s2000w_option_descriptors.c @@ -11,20 +11,20 @@ option_descriptor** descriptors = NULL; uint8_t max_option_count = 0; -SANE_Option_Descriptor _kds_s2000w_option_descriptor_num_options() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_num_options() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_num_options"); - SANE_Option_Descriptor descriptor = { - SANE_NAME_NUM_OPTIONS, - SANE_TITLE_NUM_OPTIONS, - SANE_DESC_NUM_OPTIONS, - SANE_TYPE_INT, - SANE_UNIT_NONE, - sizeof(SANE_Int), - SANE_CAP_SOFT_DETECT, - SANE_CONSTRAINT_NONE - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = SANE_NAME_NUM_OPTIONS; + descriptor->title = SANE_TITLE_NUM_OPTIONS; + descriptor->desc = SANE_DESC_NUM_OPTIONS; + descriptor->type = SANE_TYPE_INT; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_Int); + descriptor->cap = SANE_CAP_SOFT_DETECT; + descriptor->constraint_type = SANE_CONSTRAINT_NONE; return descriptor; } @@ -32,25 +32,25 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_num_options() /******************************************************************************* * standard group *******************************************************************************/ -SANE_Option_Descriptor _kds_s2000w_option_descriptor_standard_group() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_standard_group() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_standard_group"); - SANE_Option_Descriptor descriptor = { - SANE_NAME_STANDARD, - SANE_TITLE_STANDARD, - SANE_DESC_STANDARD, - SANE_TYPE_GROUP, - SANE_UNIT_NONE, - 0, - SANE_CAP_SOFT_DETECT, - SANE_CONSTRAINT_NONE - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = SANE_NAME_STANDARD; + descriptor->title = SANE_TITLE_STANDARD; + descriptor->desc = SANE_DESC_STANDARD; + descriptor->type = SANE_TYPE_GROUP; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = 0; + descriptor->cap = SANE_CAP_SOFT_DETECT; + descriptor->constraint_type = SANE_CONSTRAINT_NONE; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_scan_source() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_scan_source() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_scan_source"); @@ -60,22 +60,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_scan_source() constraint[2] = "Flatbed"; constraint[3] = NULL; - SANE_Option_Descriptor descriptor = { - SANE_NAME_SCAN_SOURCE, - SANE_TITLE_SCAN_SOURCE, - SANE_DESC_SCAN_SOURCE, - SANE_TYPE_STRING, - SANE_UNIT_NONE, - sizeof(SANE_String_Const*) * 4, - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, - SANE_CONSTRAINT_STRING_LIST, - {.string_list = (SANE_String_Const*) constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = SANE_NAME_SCAN_SOURCE; + descriptor->title = SANE_TITLE_SCAN_SOURCE; + descriptor->desc = SANE_DESC_SCAN_SOURCE; + descriptor->type = SANE_TYPE_STRING; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_String_Const*) * 4; + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST; + descriptor->constraint.string_list = (SANE_String_Const*) constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_mode() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_color_mode() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_color_mode"); @@ -85,22 +85,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_mode() constraint[2] = "BW"; constraint[3] = NULL; - SANE_Option_Descriptor descriptor = { - SANE_NAME_SCAN_MODE, - SANE_TITLE_SCAN_MODE, - SANE_DESC_SCAN_MODE, - SANE_TYPE_STRING, - SANE_UNIT_NONE, - sizeof(SANE_String_Const*) * 4, - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, - SANE_CONSTRAINT_STRING_LIST, - {.string_list = (SANE_String_Const*) constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = SANE_NAME_SCAN_MODE; + descriptor->title = SANE_TITLE_SCAN_MODE; + descriptor->desc = SANE_DESC_SCAN_MODE; + descriptor->type = SANE_TYPE_STRING; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_String_Const*) * 4; + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST; + descriptor->constraint.string_list = (SANE_String_Const*) constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_dpi() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_dpi() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_dpi"); @@ -112,22 +112,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_dpi() constraint[4] = 300; constraint[5] = 600; - SANE_Option_Descriptor descriptor = { - SANE_NAME_SCAN_RESOLUTION, - SANE_TITLE_SCAN_RESOLUTION, - SANE_DESC_SCAN_RESOLUTION, - SANE_TYPE_INT, - SANE_UNIT_DPI, - sizeof(SANE_Int), - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, - SANE_CONSTRAINT_WORD_LIST, - {.word_list = constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = SANE_NAME_SCAN_RESOLUTION; + descriptor->title = SANE_TITLE_SCAN_RESOLUTION; + descriptor->desc = SANE_DESC_SCAN_RESOLUTION; + descriptor->type = SANE_TYPE_INT; + descriptor->unit = SANE_UNIT_DPI; + descriptor->size = sizeof(SANE_Int); + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + descriptor->constraint_type = SANE_CONSTRAINT_WORD_LIST; + descriptor->constraint.word_list = constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_scanside() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_scanside() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_scanside"); @@ -136,17 +136,17 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_scanside() constraint[1] = "Duplex"; constraint[2] = NULL; - SANE_Option_Descriptor descriptor = { - "scanside", - "Duplex Mode", - "Duplex Mode", - SANE_TYPE_STRING, - SANE_UNIT_NONE, - sizeof(SANE_String_Const*) * 3, - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, - SANE_CONSTRAINT_STRING_LIST, - {.string_list = (SANE_String_Const*) constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "scanside"; + descriptor->title = "Duplex Mode"; + descriptor->desc = "Duplex Mode"; + descriptor->type = SANE_TYPE_STRING; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_String_Const*) * 3; + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST; + descriptor->constraint.string_list = (SANE_String_Const*) constraint; return descriptor; } @@ -154,25 +154,25 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_scanside() /******************************************************************************* * geometry group *******************************************************************************/ -SANE_Option_Descriptor _kds_s2000w_option_descriptor_geometry_group() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_geometry_group() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_scan_area_group"); - SANE_Option_Descriptor descriptor = { - SANE_NAME_GEOMETRY, - SANE_TITLE_GEOMETRY, - SANE_DESC_GEOMETRY, - SANE_TYPE_GROUP, - SANE_UNIT_NONE, - 0, - SANE_CAP_SOFT_DETECT, - SANE_CONSTRAINT_NONE - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = SANE_NAME_GEOMETRY; + descriptor->title = SANE_TITLE_GEOMETRY; + descriptor->desc = SANE_DESC_GEOMETRY; + descriptor->type = SANE_TYPE_GROUP; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = 0; + descriptor->cap = SANE_CAP_SOFT_DETECT; + descriptor->constraint_type = SANE_CONSTRAINT_NONE; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_cropping_mode() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_cropping_mode() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_cropping_mode"); @@ -183,22 +183,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_cropping_mode() constraint[3] = "Manual"; constraint[4] = NULL; - SANE_Option_Descriptor descriptor = { - "cropping-mode", - "Cropping Mode", - "Cropping Mode", - SANE_TYPE_STRING, - SANE_UNIT_NONE, - sizeof(SANE_String_Const*) * 5, - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, - SANE_CONSTRAINT_STRING_LIST, - {.string_list = (SANE_String_Const*) constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "cropping-mode"; + descriptor->title = "Cropping Mode"; + descriptor->desc = "Cropping Mode"; + descriptor->type = SANE_TYPE_STRING; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_String_Const*) * 5; + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST; + descriptor->constraint.string_list = (SANE_String_Const*) constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_cropping_image() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_cropping_image() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_cropping_image"); @@ -207,22 +207,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_cropping_image() constraint[1] = "PartialDocument"; constraint[2] = NULL; - SANE_Option_Descriptor descriptor = { - "cropping-image", - "Cropping Image", - "Cropping Image", - SANE_TYPE_STRING, - SANE_UNIT_NONE, - sizeof(SANE_String_Const*) * 3, - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, - SANE_CONSTRAINT_STRING_LIST, - {.string_list = (SANE_String_Const*) constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "cropping-image"; + descriptor->title = "Cropping Image"; + descriptor->desc = "Cropping Image"; + descriptor->type = SANE_TYPE_STRING; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_String_Const*) * 3; + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST; + descriptor->constraint.string_list = (SANE_String_Const*) constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_image_offset_x() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_image_offset_x() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_image_offset_x"); @@ -231,22 +231,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_image_offset_x() constraint->max = 75; constraint->quant = 1; - SANE_Option_Descriptor descriptor = { - "image-offset-x", - "Image Offset X", - "Image Offset X", - SANE_TYPE_INT, - SANE_UNIT_NONE, - sizeof(SANE_Int), - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, - SANE_CONSTRAINT_RANGE, - {.range = constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "image-offset-x"; + descriptor->title = "Image Offset X"; + descriptor->desc = "Image Offset X"; + descriptor->type = SANE_TYPE_INT; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_Int); + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + descriptor->constraint_type = SANE_CONSTRAINT_RANGE; + descriptor->constraint.range = constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_image_offset_y() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_image_offset_y() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_image_offset_y"); @@ -255,22 +255,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_image_offset_y() constraint->max = 390; constraint->quant = 1; - SANE_Option_Descriptor descriptor = { - "image-offset-y", - "Image Offset Y", - "Image Offset Y", - SANE_TYPE_INT, - SANE_UNIT_NONE, - sizeof(SANE_Int), - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, - SANE_CONSTRAINT_RANGE, - {.range = constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "image-offset-y"; + descriptor->title = "Image Offset Y"; + descriptor->desc = "Image Offset Y"; + descriptor->type = SANE_TYPE_INT; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_Int); + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + descriptor->constraint_type = SANE_CONSTRAINT_RANGE; + descriptor->constraint.range = constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_image_width() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_image_width() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_image_width"); @@ -279,22 +279,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_image_width() constraint->max = 85; constraint->quant = 1; - SANE_Option_Descriptor descriptor = { - "image-width", - "Image Width", - "Image Width", - SANE_TYPE_INT, - SANE_UNIT_NONE, - sizeof(SANE_Int), - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, - SANE_CONSTRAINT_RANGE, - {.range = constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "image-width"; + descriptor->title = "Image Width"; + descriptor->desc = "Image Width"; + descriptor->type = SANE_TYPE_INT; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_Int); + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + descriptor->constraint_type = SANE_CONSTRAINT_RANGE; + descriptor->constraint.range = constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_image_height() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_image_height() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_image_height"); @@ -303,17 +303,17 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_image_height() constraint->max = 400; constraint->quant = 1; - SANE_Option_Descriptor descriptor = { - "image-height", - "Image Height", - "Image Height", - SANE_TYPE_INT, - SANE_UNIT_NONE, - sizeof(SANE_Int), - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, - SANE_CONSTRAINT_RANGE, - {.range = constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "image-height"; + descriptor->title = "Image Height"; + descriptor->desc = "Image Height"; + descriptor->type = SANE_TYPE_INT; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_Int); + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + descriptor->constraint_type = SANE_CONSTRAINT_RANGE; + descriptor->constraint.range = constraint; return descriptor; } @@ -321,25 +321,25 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_image_height() /******************************************************************************* * boldness smoothing group *******************************************************************************/ -SANE_Option_Descriptor _kds_s2000w_option_descriptor_boldness_smoothing_group() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_boldness_smoothing_group() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_advanced_group"); - SANE_Option_Descriptor descriptor = { - "boldness-smoothing", - "Boldness / Smoothing Options", - "Foreground boldness Options and background smoothing options", - SANE_TYPE_GROUP, - SANE_UNIT_NONE, - 0, - SANE_CAP_SOFT_DETECT, - SANE_CONSTRAINT_NONE - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "boldness-smoothing"; + descriptor->title = "Boldness / Smoothing Options"; + descriptor->desc = "Foreground boldness Options and background smoothing options"; + descriptor->type = SANE_TYPE_GROUP; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = 0; + descriptor->cap = SANE_CAP_SOFT_DETECT; + descriptor->constraint_type = SANE_CONSTRAINT_NONE; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_foreground_boldness_mode() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_foreground_boldness_mode() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_foreground_boldness_mode"); @@ -349,22 +349,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_foreground_boldness_mode() constraint[2] = "Automatic"; constraint[3] = NULL; - SANE_Option_Descriptor descriptor = { - "foreground-boldness-mode", - "Foreground Boldness Mode", - "Foreground Boldness Mode", - SANE_TYPE_STRING, - SANE_UNIT_NONE, - sizeof(SANE_String_Const*) * 4, - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, - SANE_CONSTRAINT_STRING_LIST, - {.string_list = (SANE_String_Const*) constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "foreground-boldness-mode"; + descriptor->title = "Foreground Boldness Mode"; + descriptor->desc = "Foreground Boldness Mode"; + descriptor->type = SANE_TYPE_STRING; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_String_Const*) * 4; + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST; + descriptor->constraint.string_list = (SANE_String_Const*) constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_foreground_boldness_aggressiveness() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_foreground_boldness_aggressiveness() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_foreground_boldness_aggressiveness"); @@ -373,22 +373,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_foreground_boldness_aggress constraint->max = 10; constraint->quant = 1; - SANE_Option_Descriptor descriptor = { - "foreground-boldness-aggressiveness", - "Foreground Boldness Aggressiveness", - "Foreground Boldness Aggressiveness", - SANE_TYPE_INT, - SANE_UNIT_NONE, - sizeof(SANE_Int), - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, - SANE_CONSTRAINT_RANGE, - {.range = constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "foreground-boldness-aggressiveness"; + descriptor->title = "Foreground Boldness Aggressiveness"; + descriptor->desc = "Foreground Boldness Aggressiveness"; + descriptor->type = SANE_TYPE_INT; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_Int); + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + descriptor->constraint_type = SANE_CONSTRAINT_RANGE; + descriptor->constraint.range = constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_background_smoothing_mode() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_background_smoothing_mode() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_background_smoothing_mode"); @@ -398,22 +398,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_background_smoothing_mode() constraint[2] = "Automatic"; constraint[3] = NULL; - SANE_Option_Descriptor descriptor = { - "background-smoothing-mode", - "Background Smoothing Mode", - "Background Smoothing Mode", - SANE_TYPE_STRING, - SANE_UNIT_NONE, - sizeof(SANE_String_Const*) * 4, - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, - SANE_CONSTRAINT_STRING_LIST, - {.string_list = (SANE_String_Const*) constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "background-smoothing-mode"; + descriptor->title = "Background Smoothing Mode"; + descriptor->desc = "Background Smoothing Mode"; + descriptor->type = SANE_TYPE_STRING; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_String_Const*) * 4; + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST; + descriptor->constraint.string_list = (SANE_String_Const*) constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_background_smoothing_aggressiveness() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_background_smoothing_aggressiveness() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_background_smoothing_aggressiveness"); @@ -422,17 +422,17 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_background_smoothing_aggres constraint->max = 10; constraint->quant = 1; - SANE_Option_Descriptor descriptor = { - "background-smoothing-aggressiveness", - "Background Smoothing Aggressiveness", - "Background Smoothing Aggressiveness", - SANE_TYPE_INT, - SANE_UNIT_NONE, - sizeof(SANE_Int), - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, - SANE_CONSTRAINT_RANGE, - {.range = constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "background-smoothing-aggressiveness"; + descriptor->title = "Background Smoothing Aggressiveness"; + descriptor->desc = "Background Smoothing Aggressiveness"; + descriptor->type = SANE_TYPE_INT; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_Int); + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + descriptor->constraint_type = SANE_CONSTRAINT_RANGE; + descriptor->constraint.range = constraint; return descriptor; } @@ -440,25 +440,25 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_background_smoothing_aggres /******************************************************************************* * boldness color group *******************************************************************************/ -SANE_Option_Descriptor _kds_s2000w_option_descriptor_boldness_color_group() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_boldness_color_group() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_boldness_color_group"); - SANE_Option_Descriptor descriptor = { - "color-options", - "Color Options", - "Color Options", - SANE_TYPE_GROUP, - SANE_UNIT_NONE, - 0, - SANE_CAP_SOFT_DETECT, - SANE_CONSTRAINT_NONE - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "color-options"; + descriptor->title = "Color Options"; + descriptor->desc = "Color Options"; + descriptor->type = SANE_TYPE_GROUP; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = 0; + descriptor->cap = SANE_CAP_SOFT_DETECT; + descriptor->constraint_type = SANE_CONSTRAINT_NONE; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_drop() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_color_drop() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_color_drop"); @@ -473,22 +473,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_drop() constraint[7] = "Multiple"; constraint[8] = NULL; - SANE_Option_Descriptor descriptor = { - "color-drop-out", - "Color Drop Out", - "Color Drop Out", - SANE_TYPE_STRING, - SANE_UNIT_NONE, - sizeof(SANE_String_Const*) * 9, - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, - SANE_CONSTRAINT_STRING_LIST, - {.string_list = (SANE_String_Const*) constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "color-drop-out"; + descriptor->title = "Color Drop Out"; + descriptor->desc = "Color Drop Out"; + descriptor->type = SANE_TYPE_STRING; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_String_Const) * 9; + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST; + descriptor->constraint.string_list = (SANE_String_Const*) constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_drop_out_aggressiveness() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_color_drop_out_aggressiveness() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_color_drop_out_aggressiveness"); @@ -497,22 +497,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_drop_out_aggressivene constraint->max = 10; constraint->quant = 1; - SANE_Option_Descriptor descriptor = { - "color-drop-out-aggressiveness", - "Color Drop Out Aggressiveness", - "Color Drop Out Aggressiveness", - SANE_TYPE_INT, - SANE_UNIT_NONE, - sizeof(SANE_Int), - SANE_CAP_SOFT_DETECT, - SANE_CONSTRAINT_RANGE, - {.range = constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "color-drop-out-aggressiveness"; + descriptor->title = "Color Drop Out Aggressiveness"; + descriptor->desc = "Color Drop Out Aggressiveness"; + descriptor->type = SANE_TYPE_INT; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_Int); + descriptor->cap = SANE_CAP_SOFT_DETECT; + descriptor->constraint_type = SANE_CONSTRAINT_RANGE; + descriptor->constraint.range = constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_auto_brightness_mode() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_color_auto_brightness_mode() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_color_auto_brightness_mode"); @@ -522,22 +522,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_auto_brightness_mode( constraint[2] = "Automatic"; constraint[3] = NULL; - SANE_Option_Descriptor descriptor = { - "color-auto-brightness-mode", - "Color Auto Brightness Mode", - "Color Auto Brightness Mode", - SANE_TYPE_STRING, - SANE_UNIT_NONE, - sizeof(SANE_String_Const*) * 4, - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, - SANE_CONSTRAINT_STRING_LIST, - {.string_list = (SANE_String_Const*) constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "color-auto-brightness-mode"; + descriptor->title = "Color Auto Brightness Mode"; + descriptor->desc = "Color Auto Brightness Mode"; + descriptor->type = SANE_TYPE_STRING; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_String_Const) * 4; + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST; + descriptor->constraint.string_list = (SANE_String_Const*) constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_brightness() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_color_brightness() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_color_brightness"); @@ -546,22 +546,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_brightness() constraint->max = 50; constraint->quant = 1; - SANE_Option_Descriptor descriptor = { - "color-brightness", - "Color Brightness", - "Color Brightness", - SANE_TYPE_INT, - SANE_UNIT_NONE, - sizeof(SANE_Int), - SANE_CAP_SOFT_DETECT, - SANE_CONSTRAINT_RANGE, - {.range = constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "color-brightness"; + descriptor->title = "Color Brightness"; + descriptor->desc = "Color Brightness"; + descriptor->type = SANE_TYPE_INT; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_Int); + descriptor->cap = SANE_CAP_SOFT_DETECT ; + descriptor->constraint_type = SANE_CONSTRAINT_RANGE; + descriptor->constraint.range = constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_contrast() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_color_contrast() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_color_contrast"); @@ -570,22 +570,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_contrast() constraint->max = 50; constraint->quant = 1; - SANE_Option_Descriptor descriptor = { - "color-contrast", - "Color Contrast", - "Color Contrast", - SANE_TYPE_INT, - SANE_UNIT_NONE, - sizeof(SANE_Int), - SANE_CAP_SOFT_DETECT, - SANE_CONSTRAINT_RANGE, - {.range = constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "color-contrast"; + descriptor->title = "Color Contrast"; + descriptor->desc = "Color Contrast"; + descriptor->type = SANE_TYPE_INT; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_Int); + descriptor->cap = SANE_CAP_SOFT_DETECT ; + descriptor->constraint_type = SANE_CONSTRAINT_RANGE; + descriptor->constraint.range = constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_balance_mode() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_color_balance_mode() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_color_balance_mode"); @@ -596,22 +596,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_balance_mode() constraint[3] = "AutomaticAdvanced"; constraint[4] = NULL; - SANE_Option_Descriptor descriptor = { - "color-balance-mode", - "Color Balance Mode", - "Color Balance Mode", - SANE_TYPE_STRING, - SANE_UNIT_NONE, - sizeof(SANE_String_Const*) * 5, - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, - SANE_CONSTRAINT_STRING_LIST, - {.string_list = (SANE_String_Const*) constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "color-balance-mode"; + descriptor->title = "Color Balance Mode"; + descriptor->desc = "Color Balance Mode"; + descriptor->type = SANE_TYPE_STRING; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_String_Const*) * 5; + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST; + descriptor->constraint.string_list = (SANE_String_Const*) constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_balance_agressiveness() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_color_balance_agressiveness() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_color_balancea_agressiveness"); @@ -620,22 +620,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_balance_agressiveness constraint->max = 2; constraint->quant = 1; - SANE_Option_Descriptor descriptor = { - "color-balance-aggressiveness", - "Color Balance Aggressiveness", - "Color Balance Aggressiveness", - SANE_TYPE_INT, - SANE_UNIT_NONE, - sizeof(SANE_Int), - SANE_CAP_SOFT_DETECT, - SANE_CONSTRAINT_RANGE, - {.range = constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "color-balance-aggressiveness"; + descriptor->title = "Color Balance Aggressiveness"; + descriptor->desc = "Color Balance Aggressiveness"; + descriptor->type = SANE_TYPE_INT; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_Int); + descriptor->cap = SANE_CAP_SOFT_DETECT ; + descriptor->constraint_type = SANE_CONSTRAINT_RANGE; + descriptor->constraint.range = constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_balance_red() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_color_balance_red() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_color_balance_red"); @@ -644,22 +644,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_balance_red() constraint->max = 50; constraint->quant = 1; - SANE_Option_Descriptor descriptor = { - "color-balance-red", - "Color Balance Red", - "Color Balance Red", - SANE_TYPE_INT, - SANE_UNIT_NONE, - sizeof(SANE_Int), - SANE_CAP_SOFT_DETECT, - SANE_CONSTRAINT_RANGE, - {.range = constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "color-balance-red"; + descriptor->title = "Color Balance Red"; + descriptor->desc = "Color Balance Red"; + descriptor->type = SANE_TYPE_INT; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_Int); + descriptor->cap = SANE_CAP_SOFT_DETECT ; + descriptor->constraint_type = SANE_CONSTRAINT_RANGE; + descriptor->constraint.range = constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_balance_green() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_color_balance_green() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_color_balance_green"); @@ -668,22 +668,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_balance_green() constraint->max = 50; constraint->quant = 1; - SANE_Option_Descriptor descriptor = { - "color-balance-green", - "Color Balance Green", - "Color Balance Green", - SANE_TYPE_INT, - SANE_UNIT_NONE, - sizeof(SANE_Int), - SANE_CAP_SOFT_DETECT, - SANE_CONSTRAINT_RANGE, - {.range = constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "color-balance-green"; + descriptor->title = "Color Balance Green"; + descriptor->desc = "Color Balance Green"; + descriptor->type = SANE_TYPE_INT; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_Int); + descriptor->cap = SANE_CAP_SOFT_DETECT ; + descriptor->constraint_type = SANE_CONSTRAINT_RANGE; + descriptor->constraint.range = constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_balance_blue() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_color_balance_blue() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_color_balance_blue"); @@ -692,22 +692,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_balance_blue() constraint->max = 50; constraint->quant = 1; - SANE_Option_Descriptor descriptor = { - "color-balance-blue", - "Color Balance Blue", - "Color Balance Blue", - SANE_TYPE_INT, - SANE_UNIT_NONE, - sizeof(SANE_Int), - SANE_CAP_SOFT_DETECT, - SANE_CONSTRAINT_RANGE, - {.range = constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "color-balance-blue"; + descriptor->title = "Color Balance Blue"; + descriptor->desc = "Color Balance Blue"; + descriptor->type = SANE_TYPE_INT; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_Int); + descriptor->cap = SANE_CAP_SOFT_DETECT ; + descriptor->constraint_type = SANE_CONSTRAINT_RANGE; + descriptor->constraint.range = constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_sharpen() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_color_sharpen() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_color_sharpen"); @@ -718,22 +718,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_sharpen() constraint[3] = "Exaggerated"; constraint[4] = NULL; - SANE_Option_Descriptor descriptor = { - "color-sharpen", - "Color Sharpen", - "Color Sharpen", - SANE_TYPE_STRING, - SANE_UNIT_NONE, - sizeof(SANE_String_Const*) * 5, - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, - SANE_CONSTRAINT_STRING_LIST, - {.string_list = (SANE_String_Const*) constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "color-sharpen"; + descriptor->title = "Color Sharpen"; + descriptor->desc = "Color Sharpen"; + descriptor->type = SANE_TYPE_STRING; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_String_Const*) * 5; + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST; + descriptor->constraint.string_list = (SANE_String_Const*) constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_binarization_contrast() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_binarization_contrast() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_binarization_contrast"); @@ -742,35 +742,35 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_binarization_contrast() constraint->max = 50; constraint->quant = 1; - SANE_Option_Descriptor descriptor = { - "binarization-contrast", - "Binarization Contrast", - "Binarization Contrast", - SANE_TYPE_INT, - SANE_UNIT_NONE, - sizeof(SANE_Int), - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, - SANE_CONSTRAINT_RANGE, - {.range = constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "binarization-contrast"; + descriptor->title = "Binarization Contrast"; + descriptor->desc = "Binarization Contrast"; + descriptor->type = SANE_TYPE_INT; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_Int); + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + descriptor->constraint_type = SANE_CONSTRAINT_RANGE; + descriptor->constraint.range = constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_config_reset() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_config_reset() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_config_reset"); - SANE_Option_Descriptor descriptor = { - "config-reset", - "Reset Config", - "Load default configuration from scanner", - SANE_TYPE_BUTTON, - SANE_UNIT_NONE, - 0, - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, - SANE_CONSTRAINT_NONE - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "config-reset"; + descriptor->title = "Reset Config"; + descriptor->desc = "Load default configuration from scanner"; + descriptor->type = SANE_TYPE_BUTTON; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = 0; + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + descriptor->constraint_type = SANE_CONSTRAINT_NONE; return descriptor; } @@ -778,43 +778,43 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_config_reset() /******************************************************************************* * image processing group *******************************************************************************/ -SANE_Option_Descriptor _kds_s2000w_option_descriptor_image_processing_group() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_image_processing_group() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_image_processing_group"); - SANE_Option_Descriptor descriptor = { - "image-processing-options", - "Image Processing Options", - "Image Processing Options", - SANE_TYPE_GROUP, - SANE_UNIT_NONE, - 0, - SANE_CAP_SOFT_DETECT | SANE_CAP_ADVANCED, - SANE_CONSTRAINT_NONE - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "image-processing-options"; + descriptor->title = "Image Processing Options"; + descriptor->desc = "Image Processing Options"; + descriptor->type = SANE_TYPE_GROUP; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = 0; + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_ADVANCED; + descriptor->constraint_type = SANE_CONSTRAINT_NONE; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_skip_blank_pages() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_skip_blank_pages() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_skip_blank_pages"); - SANE_Option_Descriptor descriptor = { - "skip-blank-pages", - "Blank Blank Pages", - "Blank Blank Pages", - SANE_TYPE_BOOL, - SANE_UNIT_NONE, - sizeof(SANE_Bool), - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED, - SANE_CONSTRAINT_NONE - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "skip-blank-pages"; + descriptor->title = "Blank Blank Pages"; + descriptor->desc = "Blank Blank Pages"; + descriptor->type = SANE_TYPE_BOOL; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_Bool); + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED; + descriptor->constraint_type = SANE_CONSTRAINT_NONE; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_skip_blank_page_content() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_skip_blank_page_content() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_skip_blank_page_content"); @@ -823,40 +823,40 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_skip_blank_page_content() constraint->max = 100; constraint->quant = 1; - SANE_Option_Descriptor descriptor = { - "skip-blank-page-content", - "Skip Blank Page Content", - "Skip Blank Page Content", - SANE_TYPE_INT, - SANE_UNIT_PERCENT, - sizeof(SANE_Int), - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED, - SANE_CONSTRAINT_RANGE, - {.range = constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "skip-blank-page-content"; + descriptor->title = "Skip Blank Page Content"; + descriptor->desc = "Skip Blank Page Content"; + descriptor->type = SANE_TYPE_INT; + descriptor->unit = SANE_UNIT_PERCENT; + descriptor->size = sizeof(SANE_Int); + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED; + descriptor->constraint_type = SANE_CONSTRAINT_RANGE; + descriptor->constraint.range = constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_hole_fill() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_hole_fill() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_hole_fill"); - SANE_Option_Descriptor descriptor = { - "hole-fill", - "Hole Fill", - "Hole Fill", - SANE_TYPE_BOOL, - SANE_UNIT_NONE, - sizeof(SANE_Bool), - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED, - SANE_CONSTRAINT_NONE, - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "hole-fill"; + descriptor->title = "Hole Fill"; + descriptor->desc = "Hole Fill"; + descriptor->type = SANE_TYPE_BOOL; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_Bool); + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED; + descriptor->constraint_type = SANE_CONSTRAINT_NONE; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_post_scan_rotation() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_post_scan_rotation() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_post_scan_rotation"); @@ -868,22 +868,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_post_scan_rotation() constraint[4] = "Automatic270"; constraint[5] = NULL; - SANE_Option_Descriptor descriptor = { - "post-scan-rotation", - "Post Scan Rotation", - "Post Scan Rotation", - SANE_TYPE_STRING, - SANE_UNIT_NONE, - sizeof(SANE_String_Const*) * 6, - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED, - SANE_CONSTRAINT_STRING_LIST, - {.string_list = (SANE_String_Const*) constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "post-scan-rotation"; + descriptor->title = "Post Scan Rotation"; + descriptor->desc = "Post Scan Rotation"; + descriptor->type = SANE_TYPE_STRING; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_String_Const*) * 6; + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED; + descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST; + descriptor->constraint.string_list = (SANE_String_Const*) constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_edge_fill() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_edge_fill() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_edge_fill"); @@ -893,22 +893,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_edge_fill() constraint[2] = "AutomaticIncludeTears"; constraint[3] = NULL; - SANE_Option_Descriptor descriptor = { - "edge-fill", - "Edge Fill", - "Edge Fill", - SANE_TYPE_STRING, - SANE_UNIT_NONE, - sizeof(SANE_String_Const*) * 4, - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED, - SANE_CONSTRAINT_STRING_LIST, - {.string_list = (SANE_String_Const*) constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "edge-fill"; + descriptor->title = "Edge Fill"; + descriptor->desc = "Edge Fill"; + descriptor->type = SANE_TYPE_STRING; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_String_Const*) * 4; + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED; + descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST; + descriptor->constraint.string_list = (SANE_String_Const*) constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_image_border() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_image_border() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_image_border"); @@ -918,22 +918,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_image_border() constraint[2] = "Remove"; constraint[3] = NULL; - SANE_Option_Descriptor descriptor = { - "image-border", - "Image Border", - "Image Border", - SANE_TYPE_STRING, - SANE_UNIT_NONE, - sizeof(SANE_String_Const*) * 4, - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED, - SANE_CONSTRAINT_STRING_LIST, - {.string_list = (SANE_String_Const*) constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "image-border"; + descriptor->title = "Image Border"; + descriptor->desc = "Image Border"; + descriptor->type = SANE_TYPE_STRING; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_String_Const*) * 4; + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED; + descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST; + descriptor->constraint.string_list = (SANE_String_Const*) constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_jpeg_quality() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_jpeg_quality() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_jpeg_quality"); @@ -945,17 +945,17 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_jpeg_quality() constraint[4] = "Superior"; constraint[5] = NULL; - SANE_Option_Descriptor descriptor = { - "jpeg-quality", - "Jpeg Quality", - "Jpeg Quality", - SANE_TYPE_STRING, - SANE_UNIT_NONE, - sizeof(SANE_String_Const*) * 6, - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED, - SANE_CONSTRAINT_STRING_LIST, - {.string_list = (SANE_String_Const*) constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "jpeg-quality"; + descriptor->title = "Jpeg Quality"; + descriptor->desc = "Jpeg Quality"; + descriptor->type = SANE_TYPE_STRING; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_String_Const*) * 6; + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED; + descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST; + descriptor->constraint.string_list = (SANE_String_Const*) constraint; return descriptor; } @@ -963,43 +963,43 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_jpeg_quality() /******************************************************************************* * feeder group *******************************************************************************/ -SANE_Option_Descriptor _kds_s2000w_option_descriptor_feeder_group() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_feeder_group() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_feeder_group"); - SANE_Option_Descriptor descriptor = { - "feeder-options", - "Feeder Options", - "Feeder Options", - SANE_TYPE_GROUP, - SANE_UNIT_NONE, - 0, - SANE_CAP_SOFT_DETECT | SANE_CAP_ADVANCED, - SANE_CONSTRAINT_NONE - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "feeder-options"; + descriptor->title = "Feeder Options"; + descriptor->desc = "Feeder Options"; + descriptor->type = SANE_TYPE_GROUP; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = 0; + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_ADVANCED; + descriptor->constraint_type = SANE_CONSTRAINT_NONE; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_autostart() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_autostart() { kds_s2000w_debug_printf(ALL, "_kds_s2000w_option_descriptor_autostart"); - SANE_Option_Descriptor descriptor = { - "autostart", - "Autostart", - "Autostart", - SANE_TYPE_BOOL, - SANE_UNIT_NONE, - sizeof(SANE_Int), - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED, - SANE_CONSTRAINT_NONE - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "autostart"; + descriptor->title = "Autostart"; + descriptor->desc = "Autostart"; + descriptor->type = SANE_TYPE_BOOL; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_Bool); + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED; + descriptor->constraint_type = SANE_CONSTRAINT_NONE; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_max_document_length() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_max_document_length() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_max_document_length"); @@ -1008,22 +1008,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_max_document_length() constraint->max = 400; constraint->quant = 1; - SANE_Option_Descriptor descriptor = { - "max-document-length", - "Max Document Length", - "Max Document Length", - SANE_TYPE_INT, - SANE_UNIT_NONE, - sizeof(SANE_Int), - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED, - SANE_CONSTRAINT_RANGE, - {.range = constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "max-document-length"; + descriptor->title = "Max Document Length"; + descriptor->desc = "Max Document Length"; + descriptor->type = SANE_TYPE_INT; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_Int); + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED; + descriptor->constraint_type = SANE_CONSTRAINT_RANGE; + descriptor->constraint.range = constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_transport_handling() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_transport_handling() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_transport_handling"); @@ -1034,22 +1034,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_transport_handling() constraint[3] = "Special"; constraint[4] = NULL; - SANE_Option_Descriptor descriptor = { - "transport-handling", - "Transport Handling", - "Transport Handling", - SANE_TYPE_STRING, - SANE_UNIT_NONE, - sizeof(SANE_String_Const*) * 5, - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED, - SANE_CONSTRAINT_STRING_LIST, - {.string_list = (SANE_String_Const*) constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "transport-handling"; + descriptor->title = "Transport Handling"; + descriptor->desc = "Transport Handling"; + descriptor->type = SANE_TYPE_STRING; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_String_Const*) * 5; + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED; + descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST; + descriptor->constraint.string_list = (SANE_String_Const*) constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_multifeed_sensitivity() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_multifeed_sensitivity() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_multifeed_sensitivity"); @@ -1060,22 +1060,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_multifeed_sensitivity() constraint[3] = "High"; constraint[4] = NULL; - SANE_Option_Descriptor descriptor = { - "multifeed-sensitivity", - "Multifeed Sensitivity", - "Multifeed Sensitivity", - SANE_TYPE_STRING, - SANE_UNIT_NONE, - sizeof(SANE_String_Const*) * 5, - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED, - SANE_CONSTRAINT_STRING_LIST, - {.string_list = (SANE_String_Const*) constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "multifeed-sensitivity"; + descriptor->title = "Multifeed Sensitivity"; + descriptor->desc = "Multifeed Sensitivity"; + descriptor->type = SANE_TYPE_STRING; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_String_Const*) * 5; + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED; + descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST; + descriptor->constraint.string_list = (SANE_String_Const*) constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_multifeed_response() +SANE_Option_Descriptor *_kds_s2000w_option_descriptor_multifeed_response() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_multifeed_response"); @@ -1084,22 +1084,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_multifeed_response() constraint[1] = "StopAndGenerateImage"; constraint[2] = NULL; - SANE_Option_Descriptor descriptor = { - "multifeed-response", - "Multifeed Response", - "Multifeed Response", - SANE_TYPE_STRING, - SANE_UNIT_NONE, - sizeof(SANE_String_Const*) * 3, - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED, - SANE_CONSTRAINT_STRING_LIST, - {.string_list = (SANE_String_Const*) constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "multifeed-response"; + descriptor->title = "Multifeed Response"; + descriptor->desc = "Multifeed Response"; + descriptor->type = SANE_TYPE_STRING; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_String_Const*) * 3; + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED; + descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST; + descriptor->constraint.string_list = (SANE_String_Const*) constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_document_feeder_timeout() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_document_feeder_timeout() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_document_feeder_timeout"); @@ -1108,22 +1108,22 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_document_feeder_timeout() constraint->max = 120; constraint->quant = 1; - SANE_Option_Descriptor descriptor = { - "document-feeder-timeout", - "Document Feeder Timeout", - "Document Feeder Timeout", - SANE_TYPE_INT, - SANE_UNIT_NONE, - sizeof(SANE_Int), - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED, - SANE_CONSTRAINT_RANGE, - {.range = constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "document-feeder-timeout"; + descriptor->title = "Document Feeder Timeout"; + descriptor->desc = "Document Feeder Timeout"; + descriptor->type = SANE_TYPE_INT; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_Int); + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED; + descriptor->constraint_type = SANE_CONSTRAINT_RANGE; + descriptor->constraint.range = constraint; return descriptor; } -SANE_Option_Descriptor _kds_s2000w_option_descriptor_document_feeder_timeout_response() +SANE_Option_Descriptor* _kds_s2000w_option_descriptor_document_feeder_timeout_response() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_document_feeder_timeout_response"); @@ -1133,17 +1133,17 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_document_feeder_timeout_res constraint[2] = "PauseAndWait"; constraint[3] = NULL; - SANE_Option_Descriptor descriptor = { - "document-feeder-timeout-response", - "Document Feeder Timeout Response", - "Document Feeder Timeout Response", - SANE_TYPE_STRING, - SANE_UNIT_NONE, - sizeof(SANE_String_Const*) * 4, - SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED, - SANE_CONSTRAINT_STRING_LIST, - {.string_list = (SANE_String_Const*) constraint} - }; + SANE_Option_Descriptor* descriptor = malloc(sizeof(SANE_Option_Descriptor)); + + descriptor->name = "document-feeder-timeout-response"; + descriptor->title = "Document Feeder Timeout Response"; + descriptor->desc = "Document Feeder Timeout Response"; + descriptor->type = SANE_TYPE_STRING; + descriptor->unit = SANE_UNIT_NONE; + descriptor->size = sizeof(SANE_String_Const*) * 4; + descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED; + descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST; + descriptor->constraint.string_list = (SANE_String_Const*) constraint; return descriptor; } @@ -1376,21 +1376,23 @@ void kds_s2000w_option_descriptors_free() kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptors_free"); for (int i = 0; i < max_option_count; i++) { - if (descriptors[i]->descriptor.constraint_type == SANE_CONSTRAINT_STRING_LIST) { - free((void*) descriptors[i]->descriptor.constraint.string_list); - descriptors[i]->descriptor.constraint.string_list = NULL; + if (descriptors[i]->descriptor->constraint_type == SANE_CONSTRAINT_STRING_LIST) { + free((void*) descriptors[i]->descriptor->constraint.string_list); + descriptors[i]->descriptor->constraint.string_list = NULL; } - if (descriptors[i]->descriptor.constraint_type == SANE_CONSTRAINT_WORD_LIST) { - free((void*) descriptors[i]->descriptor.constraint.word_list); - descriptors[i]->descriptor.constraint.word_list = NULL; + if (descriptors[i]->descriptor->constraint_type == SANE_CONSTRAINT_WORD_LIST) { + free((void*) descriptors[i]->descriptor->constraint.word_list); + descriptors[i]->descriptor->constraint.word_list = NULL; } - if (descriptors[i]->descriptor.constraint_type == SANE_CONSTRAINT_RANGE) { - free((void*) descriptors[i]->descriptor.constraint.range); - descriptors[i]->descriptor.constraint.range = NULL; + if (descriptors[i]->descriptor->constraint_type == SANE_CONSTRAINT_RANGE) { + free((void*) descriptors[i]->descriptor->constraint.range); + descriptors[i]->descriptor->constraint.range = NULL; } + free(descriptors[i]->descriptor); + descriptors[i]->descriptor = NULL; free(descriptors[i]); descriptors[i] = NULL; } @@ -1421,7 +1423,7 @@ SANE_Option_Descriptor* kds_s2000w_option_descriptors_get_by_number(uint32_t num if (number >= max_option_count) return NULL; - return &descriptors[number]->descriptor; + return descriptors[number]->descriptor; } SANE_Option_Descriptor* kds_s2000w_option_descriptors_get_by_name(const char* name) @@ -1429,8 +1431,8 @@ SANE_Option_Descriptor* kds_s2000w_option_descriptors_get_by_name(const char* na kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_get_by_name"); for (int i = 0; i < max_option_count; i++) { - if (strcmp(descriptors[i]->descriptor.name, name) == 0) - return &descriptors[i]->descriptor; + if (strcmp(descriptors[i]->descriptor->name, name) == 0) + return descriptors[i]->descriptor; } return NULL; diff --git a/src/kds_s2000w_option_descriptors.h b/src/kds_s2000w_option_descriptors.h index a9d8ef4..69b98aa 100644 --- a/src/kds_s2000w_option_descriptors.h +++ b/src/kds_s2000w_option_descriptors.h @@ -66,7 +66,7 @@ enum { typedef struct { const char* config_name; - SANE_Option_Descriptor descriptor; + SANE_Option_Descriptor* descriptor; } option_descriptor; void kds_s2000w_option_descriptors_init(uint8_t profile);