[libcamera-devel,22/30] cam: Make CamApp::cameraName() static
diff mbox series

Message ID 20210707021941.20804-23-laurent.pinchart@ideasonboard.com
State Superseded
Headers show
Series
  • Multi-camera support in the cam application
Related show

Commit Message

Laurent Pinchart July 7, 2021, 2:19 a.m. UTC
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
return value.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/cam/main.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Kieran Bingham July 12, 2021, 3:50 p.m. UTC | #1
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?

Either-way,

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


> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@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;
>
Laurent Pinchart July 12, 2021, 6:44 p.m. UTC | #2
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@ideasonboard.com>
> 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@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;

Patch
diff mbox series

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;