Esme Povirk (@madewokherd) commented about dlls/sane.ds/ui.c:
> return FALSE;
> }
>
> +static void set_value(struct option_descriptor* opt, ScannerOption* option)
This is called `set_value` but it gets the value?
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8778#note_113174
Esme Povirk (@madewokherd) commented about dlls/sane.ds/cfg.h:
> +{
> + int type;
> + CHAR name[64];
> + int optno;
> + union
> + {
> + int int_val;
> + BOOL bool_val;
> + CHAR str_val[255];
> + int fixed_val;
> + } value;
> + BOOL is_enabled;
> +} ScannerOption;
> +
> +BOOL save_to_file(WCHAR* path, ScannerOption *option);
> +BOOL load_from_file(WCHAR* path, int type, CHAR* name, void* value);
This interface seems like it would be inefficient - each setting saved is a complete read and write of the file, and each setting loaded is a complete read.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8778#note_113173
Esme Povirk (@madewokherd) commented about dlls/sane.ds/ui.c:
> if (rc != TWCC_SUCCESS)
> {
> ERR("Unable to read number of options\n");
> - return FALSE;
> + optcount = gOptCount;
What situation causes this failure, and why is using a previous cached value OK?
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8778#note_113172
Esme Povirk (@madewokherd) commented about dlls/sane.ds/ui.c:
> }
>
> control_len += len + padding;
> + optionsExist[cntOptionsExist] = opt.optno;
`optionsExist` is not bounds-checked.
`cntOptionsExist` is never reset to 0 if `create_options_page` is called multiple times.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8778#note_113171