cam: Support base 16 and base 8 when parsing integer options

Integer options have to use base 10. This isn't user-friendly when
specifying pixel formats. Detect the base automatically to support base
16. As a side effect, integer values starting with 0 will be interpreted
in base 8.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
Laurent Pinchart
2019-06-19 13:48:38 +03:00
parent b4f3fc1d56
commit 20807a8c17

View File

@@ -79,7 +79,7 @@ bool OptionsBase<T>::parseValue(const T &opt, const Option &option,
if (optarg) {
char *endptr;
integer = strtoul(optarg, &endptr, 10);
integer = strtoul(optarg, &endptr, 0);
if (*endptr != '\0')
return false;
} else {