[libcamera-devel] [PATCH 8/8] cam: options: Fix string concatenation

Kieran Bingham kieran.bingham at ideasonboard.com
Fri Apr 26 18:25:51 CEST 2019


On 26/04/2019 17:01, Laurent Pinchart wrote:
> Adding an integer value to a char pointer doesn't concatenate strings,
> it indexes in the pointed string. Fix it.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

This one looks a bit ugly ... but without a better suggestion, I'll just
blame C++ hehe:

Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>

> ---
>  src/cam/options.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/cam/options.cpp b/src/cam/options.cpp
> index b80d361eaaf4..bea4a600d1d5 100644
> --- a/src/cam/options.cpp
> +++ b/src/cam/options.cpp
> @@ -530,7 +530,7 @@ void OptionsParser::parseValueError(const Option &option)
>  	if (option.name)
>  		optionName = "--" + std::string(option.name);
>  	else
> -		optionName = "-" + static_cast<char>(option.opt);
> +		optionName = "-" + std::string(1, option.opt);
>  
>  	std::cerr << "Can't parse " << option.typeName()
>  		  << " argument for option " << optionName << std::endl;
> 

-- 
Regards
--
Kieran


More information about the libcamera-devel mailing list