[sane-devel] Blank names and descs for Group options

Benjamin Gordon bmgordon at chromium.org
Mon Mar 13 18:01:48 GMT 2023


On Mon, Mar 13, 2023 at 11:03 AM Ralph Little <skelband at gmail.com> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/sane-devel/attachments/20230313/79556230/attachment.htm>


More information about the sane-devel mailing list