[x265] x265_atobool & parseName

Steve Borho steve at borho.org
Mon Feb 24 21:59:00 CET 2014


On Mon, Feb 24, 2014 at 11:54 AM, dave <dtyx265 at gmail.com> wrote:
> x265_atobool is made to process boolean cli options as --<option>
> <yes,true,1 || no,false,0> which currently no option is setup for in
> long_options[].  Currently, it is setup for boolean cli options in the form
> of --[no-]<option>.  Which form do we want?  Both?

CLI users must use --[no]- prefixes to toggle booleans.  These params
will have NULL values passed to x265_param_parse, which is then turned
into "true" or "false" based on the presence of a "no-" name prefix.

API users have more flexibility.  They can use the no- prefix or pass
in bool string values.

> By passing bError to parseName then to x265_atoi and setting it a less
> informative error message is generated than x265_check_params would
> generate.  It looks like bError is intended for a bad cli option and not a
> bad argument.  I would like to remove the use of bError in parseName,
> x265_atoi and x265_atof and let x265_check_params do its job. Unless anyone
> objects.

bError is intended for bad name and for bad value type.

If you want to allow items not on the list passed to parseName(), you
can clear bError explicitly, for example:

p->foo = parseName(stringTable, value, bError);
if (bError)
   bError = sscanf("%d:%d", &p->bar, &p->baz) != 2;

In general I would prefer for invalid CLI arguments to be caught in
parseName() if possible.  Range checking and logic validations belong
in x265_check_params() but data type/list validations should be in
x265_param_parse().

--
Steve


More information about the x265-devel mailing list