[libcamera-devel] [PATCH] libcamera: control_serializer: Use explicit ControlTypeNone case
Kieran Bingham
kieran.bingham at ideasonboard.com
Mon Mar 2 16:35:23 CET 2020
Hi Laurent,
On 01/03/2020 16:02, Laurent Pinchart wrote:
> Replace the default case with an explicit ControlTypeNone case in
> ControlSerializer::load() to catch ommissions when adding new control
> types.
>
s/ommissions/omissions/
This sounds good. Does it cause any issue with no default case found?
In fact looking again, Of course this now means that the compiler will
warn us here if an option is not handled by the case statement.
Excellent.
Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> ---
> src/libcamera/control_serializer.cpp | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/libcamera/control_serializer.cpp b/src/libcamera/control_serializer.cpp
> index 5537c5466025..e78fca88cfea 100644
> --- a/src/libcamera/control_serializer.cpp
> +++ b/src/libcamera/control_serializer.cpp
> @@ -361,7 +361,7 @@ ControlValue ControlSerializer::load<ControlValue>(ControlType type,
> return ControlValue(value);
> }
>
> - default:
> + case ControlTypeNone:
> return ControlValue();
> }
> }
>
--
Regards
--
Kieran
More information about the libcamera-devel
mailing list