]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
change rename option descriptor type
authorBastian Dehn <hhaalo@arcor.de>
Fri, 17 Oct 2025 17:30:23 +0000 (19:30 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Fri, 17 Oct 2025 17:30:23 +0000 (19:30 +0200)
src/kds_s2000w_handler_opts.c
src/kds_s2000w_option_descriptors.c
src/kds_s2000w_option_descriptors.h
tests/kds_s2000w_option_descriptor_tests.c

index 9d9c33e06fb256d3065b0c7e38741e3d6c0d5f9e..a15bc8077bec13accdcab190de0868f0f9b52196 100644 (file)
@@ -84,7 +84,7 @@ void _kds_s2000w_handler_opts_set_option_to_default(handler_t* h)
        resp = NULL;
 }
 
-json_object* _kds_s2000w_handler_opts_reset(const option_descriptor* descriptor, handler_t* h)
+json_object* _kds_s2000w_handler_opts_reset(const option_descriptor_t* descriptor, handler_t* h)
 {
        if (strcmp(descriptor->config_name, RESET) != 0)
                return json_object_object_get(h->scanner_config, CONFIGURATION);
@@ -125,7 +125,7 @@ json_object* _kds_s2000w_handler_opts_load_config(handler_t* h)
        return config;
 }
 
-void _kds_s2000w_handler_opts_set_valid_coord_x(option_descriptor* descriptor, handler_t* h)
+void _kds_s2000w_handler_opts_set_valid_coord_x(option_descriptor_t* descriptor, handler_t* h)
 {
        bool valid = h->coord->offset_x >= 0 && h->coord->offset_x <= 75;
        valid = valid && h->coord->width >= 10 && h->coord->width <= 85;
@@ -146,7 +146,7 @@ void _kds_s2000w_handler_opts_set_valid_coord_x(option_descriptor* descriptor, h
        json_object_set_int(value_object, h->coord->width);
 }
 
-void _kds_s2000w_handler_opts_set_valid_coord_y(option_descriptor* descriptor, handler_t* h)
+void _kds_s2000w_handler_opts_set_valid_coord_y(option_descriptor_t* descriptor, handler_t* h)
 {
        bool valid = h->coord->offset_y >= 0 && h->coord->offset_y <= 130;
        valid = valid && h->coord->height >= 10 && h->coord->height <= 140;
@@ -323,7 +323,7 @@ void _kds_s2000w_handler_opts_set_enable_color_drop_out_aggressiveness(json_obje
        color_drop_out_aggressiveness->cap &= ~SANE_CAP_SOFT_SELECT;
 }
 
-void _kds_s2000w_handler_opts_set_offset_x(const option_descriptor* descriptor, handler_t* h, const void* value)
+void _kds_s2000w_handler_opts_set_offset_x(const option_descriptor_t* descriptor, handler_t* h, const void* value)
 {
        if (strcmp(descriptor->config_name, IMAGE_OFFSET_X) != 0)
                return;
@@ -333,7 +333,7 @@ void _kds_s2000w_handler_opts_set_offset_x(const option_descriptor* descriptor,
        h->coord->offset_x = tenth_inch;
 }
 
-void _kds_s2000w_handler_opts_set_offset_y(const option_descriptor* descriptor, handler_t* h, const void* value)
+void _kds_s2000w_handler_opts_set_offset_y(const option_descriptor_t* descriptor, handler_t* h, const void* value)
 {
        if (strcmp(descriptor->config_name, IMAGE_OFFSET_Y) != 0)
                return;
@@ -343,7 +343,7 @@ void _kds_s2000w_handler_opts_set_offset_y(const option_descriptor* descriptor,
        h->coord->offset_y = tenth_inch;
 }
 
-void _kds_s2000w_handler_opts_set_width(const option_descriptor* descriptor, handler_t* h, const void* value)
+void _kds_s2000w_handler_opts_set_width(const option_descriptor_t* descriptor, handler_t* h, const void* value)
 {
        if (strcmp(descriptor->config_name, IMAGE_WIDTH) != 0)
                return;
@@ -355,7 +355,7 @@ void _kds_s2000w_handler_opts_set_width(const option_descriptor* descriptor, han
        h->coord->width = tenth_inch_width;
 }
 
-void _kds_s2000w_handler_opts_set_height(const option_descriptor* descriptor, handler_t* h, const void* value)
+void _kds_s2000w_handler_opts_set_height(const option_descriptor_t* descriptor, handler_t* h, const void* value)
 {
        if (strcmp(descriptor->config_name, IMAGE_HEIGHT) != 0)
                return;
@@ -367,7 +367,7 @@ void _kds_s2000w_handler_opts_set_height(const option_descriptor* descriptor, ha
        h->coord->height = tenth_inch_height;
 }
 
-void _kds_s2000w_handler_opts_set_info_option(const option_descriptor* descriptor, int32_t* info) {
+void _kds_s2000w_handler_opts_set_info_option(const option_descriptor_t* descriptor, int32_t* info) {
        if (info == NULL)
                return;
 
@@ -442,7 +442,7 @@ void kds_s2000w_handler_opts_get_option(handler_t* h, uint32_t option, void* val
 {
        json_object* config = _kds_s2000w_handler_opts_load_config(h);
 
-       option_descriptor* descriptor = kds_s2000w_option_descriptors_full_get_by_number(option);
+       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();
@@ -498,7 +498,7 @@ void kds_s2000w_handler_opts_set_option(handler_t* h, uint32_t option, void* val
                return;
 
        json_object* config = _kds_s2000w_handler_opts_load_config(h);
-       option_descriptor* descriptor = kds_s2000w_option_descriptors_full_get_by_number(option);
+       option_descriptor_t* descriptor = kds_s2000w_option_descriptors_full_get_by_number(option);
        json_object* value_object = json_object_object_get(config, descriptor->config_name);
 
        _kds_s2000w_handler_opts_set_offset_x(descriptor, h, value);
index e305573b8f12e291903f4ddd7b307f9e24f19a16..0bb90da9fa879455a8fc9950d7d745cddf4db069 100644 (file)
@@ -8,10 +8,10 @@
 #define PROFILE_230802_V1_0_36_MAX_OPTION_COUNT 26
 #define PROFILE_MIN_MAX_OPTION_COUNT 12
 
-option_descriptor** descriptors = NULL;
+option_descriptor_t** descriptors = NULL;
 uint8_t max_option_count = 0;
 
-void _kds_s2000w_option_descriptor_descriptor_free(option_descriptor* descriptor)
+void _kds_s2000w_option_descriptor_descriptor_free(option_descriptor_t* descriptor)
 {
        if (descriptor == NULL)
                return;
@@ -1519,12 +1519,12 @@ SANE_Status _kds_s2000w_option_descriptors_init_min_profile()
 {
        max_option_count = PROFILE_MIN_MAX_OPTION_COUNT;
 
-       descriptors = malloc(sizeof(option_descriptor*) * max_option_count);
+       descriptors = malloc(sizeof(option_descriptor_t*) * max_option_count);
        if (descriptors == NULL)
                return SANE_STATUS_NO_MEM;
 
        for (int i = 0; i < max_option_count; i++) {
-               descriptors[i] = malloc(sizeof(option_descriptor));
+               descriptors[i] = malloc(sizeof(option_descriptor_t));
                if (descriptors[i] == NULL) {
                        kds_s2000w_option_descriptors_free(descriptors);
                        descriptors = NULL;
@@ -1564,12 +1564,12 @@ SANE_Status _kds_s2000w_option_descriptors_init_230802_v1_0_36_profile()
 {
        max_option_count = PROFILE_230802_V1_0_36_MAX_OPTION_COUNT;
 
-       descriptors = malloc(sizeof(option_descriptor*) * max_option_count);
+       descriptors = malloc(sizeof(option_descriptor_t*) * max_option_count);
        if (descriptors == NULL)
                return SANE_STATUS_NO_MEM;
 
        for (int i = 0; i < max_option_count; i++) {
-               descriptors[i] = malloc(sizeof(option_descriptor));
+               descriptors[i] = malloc(sizeof(option_descriptor_t));
                if (descriptors[i] == NULL) {
                        kds_s2000w_option_descriptors_free(descriptors);
                        descriptors = NULL;
@@ -1637,12 +1637,12 @@ SANE_Status _kds_s2000w_option_descriptors_init_full_profile()
 {
        max_option_count = PROFILE_FULL_MAX_OPTION_COUNT;
 
-       descriptors = malloc(sizeof(option_descriptor*) * max_option_count);
+       descriptors = malloc(sizeof(option_descriptor_t*) * max_option_count);
        if (descriptors == NULL)
                return SANE_STATUS_NO_MEM;
 
        for (int i = 0; i < max_option_count; i++) {
-               descriptors[i] = malloc(sizeof(option_descriptor));
+               descriptors[i] = malloc(sizeof(option_descriptor_t));
                if (descriptors[i] == NULL) {
                        kds_s2000w_option_descriptors_free(descriptors);
                        descriptors = NULL;
@@ -1793,7 +1793,7 @@ uint8_t kds_s2000w_option_descriptors_get_max_option_count()
        return max_option_count;
 }
 
-option_descriptor* kds_s2000w_option_descriptors_full_get_by_number(uint32_t number)
+option_descriptor_t* kds_s2000w_option_descriptors_full_get_by_number(uint32_t number)
 {
        kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_full_get_by_number");
 
index 3f2be1e6c9bd87234249bc19b0db7a7511d7c8f8..3732d7899f70543855963aef0468dde1fb7301e6 100644 (file)
@@ -67,13 +67,13 @@ enum {
 typedef struct {
        const char* config_name;
        SANE_Option_Descriptor* descriptor;
-} option_descriptor;
+} option_descriptor_t;
 
 SANE_Status kds_s2000w_option_descriptors_init(uint8_t profile);
 void kds_s2000w_option_descriptors_free();
 
 uint8_t kds_s2000w_option_descriptors_get_max_option_count();
-option_descriptor* kds_s2000w_option_descriptors_full_get_by_number(uint32_t number);
+option_descriptor_t* kds_s2000w_option_descriptors_full_get_by_number(uint32_t number);
 SANE_Option_Descriptor* kds_s2000w_option_descriptors_get_by_number(uint32_t number);
 SANE_Option_Descriptor* kds_s2000w_option_descriptors_get_by_config_name(const char* name);
 
index eadb36404104d6ed17f579b42cdf2ebc1261da2e..93c13c8f6f9c615969ab6793f7549efe53e0c572 100644 (file)
@@ -853,7 +853,7 @@ void kds_s2000w_option_get_descriptor_over_max_options_test()
 
 void kds_s2000w_option_full_get_descriptor_by_number()
 {
-       option_descriptor* option = kds_s2000w_option_descriptors_full_get_by_number(31);
+       option_descriptor_t* option = kds_s2000w_option_descriptors_full_get_by_number(31);
 
        assert_string_equal(option->config_name, "Reset");
 }
@@ -862,7 +862,7 @@ void kds_s2000w_option_full_get_descriptor_over_max_options_test()
 {
        uint8_t max_option_count = kds_s2000w_option_descriptors_get_max_option_count();
 
-       option_descriptor* option = kds_s2000w_option_descriptors_full_get_by_number(max_option_count);
+       option_descriptor_t* option = kds_s2000w_option_descriptors_full_get_by_number(max_option_count);
 
        assert_null(option);
 }