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

Ralph Little skelband at gmail.com
Mon Mar 13 18:12:08 GMT 2023


Hi,

On Mon, Mar 13, 2023 at 11:02 AM Benjamin Gordon <bmgordon at chromium.org>
wrote:

> 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
>
>
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/sane-devel/attachments/20230313/292188f8/attachment.htm>


More information about the sane-devel mailing list