Hi, On Mon, Mar 13, 2023 at 11:02 AM Benjamin Gordon <[email protected]> wrote:
> 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 > > Some clarification in the SANE specification would be helpful here, even if it says that it "must be a valid string but content is not guaranteed to contain anything useful". Given the number of older backends that supply "", it is hard to determine what the originators of the spec had in mind. :( Cheers, Ralph
