Esme Povirk (@madewokherd) commented about dlls/sane.ds/capability.c:
+ int samples_per_pixel; + struct option_descriptor opt;
TRACE("ICAP_BITDEPTH\n");
- possible_values[0] = activeDS.frame_params.depth; + get_sane_params(&activeDS.frame_params); // Updates activeDS.frame_params.format + samples_per_pixel=(activeDS.frame_params.format == FMT_RGB) ? 3 : 1; + + sane_depth=activeDS.frame_params.depth; + have_option_depth = + sane_find_option( "depth", TYPE_INT, &opt ) == TWCC_SUCCESS + && (opt.size==sizeof(TW_UINT32)); + if (have_option_depth) + { + twCC = sane_option_get_value(opt.optno, &sane_depth); I think this is effectively a dead assignment, as every defined case in the following switch statement overwrites it.
Technically, this also potentially overwrites the TWCC_BADCAP in the case where we're given an unsupported action. We'll probably have to do that in a default case in the switch statement. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9555#note_123482