[libcamera-devel] [PATCH 22/30] cam: Make CamApp::cameraName() static

Laurent Pinchart laurent.pinchart at ideasonboard.com
Mon Jul 12 20:44:17 CEST 2021


Hi Kieran,

On Mon, Jul 12, 2021 at 04:50:01PM +0100, Kieran Bingham wrote:
> On 07/07/2021 03:19, Laurent Pinchart wrote:
> > The CamApp::cameraName() doesn't need to access any member of the CamApp
> > class. Make is static. While at is, drop an unneded const from the
> 
> s/is/it/
> 
> /unneded/unneeded/
> 
> > return value.
> 
> Hrm ... if this was the return value being const I would have expected
>  const std::string.
> 
> Is this const supposed to be declaring the member function as const on
> the class (not modifying the class) and perhaps misplaced?

It's misplaced indeed (not according to the C++ standard, but according
to our coding style), but qualifies the return value and should thus
have come first.

> Either-way,
> 
> Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> > ---
> >  src/cam/main.cpp | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/cam/main.cpp b/src/cam/main.cpp
> > index 19ed9837cf4f..03e62f305f24 100644
> > --- a/src/cam/main.cpp
> > +++ b/src/cam/main.cpp
> > @@ -44,7 +44,7 @@ private:
> >  	int infoConfiguration();
> >  	int run();
> >  
> > -	std::string const cameraName(const Camera *camera);
> > +	static std::string cameraName(const Camera *camera);
> >  
> >  	static CamApp *app_;
> >  	OptionsParser::Options options_;
> > @@ -319,7 +319,7 @@ int CamApp::run()
> >  	return 0;
> >  }
> >  
> > -std::string const CamApp::cameraName(const Camera *camera)
> > +std::string CamApp::cameraName(const Camera *camera)
> >  {
> >  	const ControlList &props = camera->properties();
> >  	bool addModel = true;

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list