[libcamera-devel] [PATCH 2/2] Explicit cast to int

Kieran Bingham kieran.bingham at ideasonboard.com
Mon Apr 25 18:00:45 CEST 2022


Quoting Utkarsh Tiwari via libcamera-devel (2022-04-21 18:25:49)
> After introduction of float values to options the conversion of unsigned int to int or vice versa is regarded as the same rank as conversion to and from float. Fix this by using an explicit cast

As discussed on IRC, this patch probably needs to be first. Adjust the
commit message to say "In order to be able to use float values..." or
such.

Also - please wrap the message, and make sure you add your
Signed-off-by: tag.

--
Kieran


> ---
>  src/cam/stream_options.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/cam/stream_options.cpp b/src/cam/stream_options.cpp
> index 150bd27c..83d216b7 100644
> --- a/src/cam/stream_options.cpp
> +++ b/src/cam/stream_options.cpp
> @@ -90,8 +90,8 @@ int StreamKeyValueParser::updateConfiguration(CameraConfiguration *config,
>                 StreamConfiguration &cfg = config->at(i++);
>  
>                 if (opts.isSet("width") && opts.isSet("height")) {
> -                       cfg.size.width = opts["width"];
> -                       cfg.size.height = opts["height"];
> +                       cfg.size.width = static_cast<int>(opts["width"]);
> +                       cfg.size.height = static_cast<int>(opts["height"]);
>                 }
>  
>                 if (opts.isSet("pixelformat"))
> -- 
> 2.25.1
>


More information about the libcamera-devel mailing list