On Mon, Mar 13, 2023 at 11:03 AM Ralph Little <[email protected]> wrote:
> Hi, > Wanted to get views from the more seasoned devs on this topic. > The SANE API spec says that Name and Desc for attributes are not valid for > options of type SANE_TYPE_GROUP, but is not prescriptive about what those > values should be initialized to in those cases. > > My gut says that they should be NULL, but a lot of backends set them to "". > > >From the poking around I've done, at least some frontends assume name has a valid pointer in it. I found a couple where they dereference name without checking if it's NULL at all and others that skip over options that have name == NULL. scanimage itself falls into the second category in print_options(), so it doesn't print groups unless they have a non-NULL name pointer. It seems like even if NULL is technically a valid value here, better compatibility with existing frontends is achieved by setting it to "". Thanks, Benjamin
