[libcamera-devel,4/5] libcamera: log: Fix coding style warnings

Message ID 20190117202043.21420-5-kieran.bingham@ideasonboard.com
State Accepted
Headers show
Series
  • General fixes
Related show

Commit Message

Kieran Bingham Jan. 17, 2019, 8:20 p.m. UTC
The checkstyle utility highlights some minor warnings against the logger
implementation.

Fix these up.

Fixes: edbd2059d8a4 ("libcamera: Add initial logger")
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 src/libcamera/include/log.h | 6 +++---
 src/libcamera/log.cpp       | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Laurent Pinchart Jan. 17, 2019, 8:42 p.m. UTC | #1
Hi Kieran,

Thank you for the patch.

On Thu, Jan 17, 2019 at 08:20:42PM +0000, Kieran Bingham wrote:
> The checkstyle utility highlights some minor warnings against the logger
> implementation.
> 
> Fix these up.
> 
> Fixes: edbd2059d8a4 ("libcamera: Add initial logger")
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  src/libcamera/include/log.h | 6 +++---
>  src/libcamera/log.cpp       | 2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/libcamera/include/log.h b/src/libcamera/include/log.h
> index c1af3741ffee..cc3f9404a3d4 100644
> --- a/src/libcamera/include/log.h
> +++ b/src/libcamera/include/log.h
> @@ -23,11 +23,11 @@ class LogMessage
>  {
>  public:
>  	LogMessage(const char *fileName, unsigned int line,
> -		  LogSeverity severity);
> -	LogMessage(const LogMessage&) = delete;
> +		   LogSeverity severity);
> +	LogMessage(const LogMessage &) = delete;
>  	~LogMessage();
>  
> -	std::ostream& stream() { return msgStream; }
> +	std::ostream &stream() { return msgStream; }
>  
>  private:
>  	std::ostringstream msgStream;
> diff --git a/src/libcamera/log.cpp b/src/libcamera/log.cpp
> index 9b2ae1bac8c8..74cba383363d 100644
> --- a/src/libcamera/log.cpp
> +++ b/src/libcamera/log.cpp
> @@ -66,7 +66,7 @@ namespace libcamera {
>  
>  static const char *log_severity_name(LogSeverity severity)
>  {
> -	static const char * const names[] = {
> +	static const char *const names[] = {

I'm not too sure about this one, but if it helps, let's change it.

>  		"  DBG",
>  		" INFO",
>  		" WARN",
Kieran Bingham Jan. 17, 2019, 9:43 p.m. UTC | #2
Hi Laurent,

On 17/01/2019 20:42, Laurent Pinchart wrote:
> Hi Kieran,
> 
> Thank you for the patch.
> 
> On Thu, Jan 17, 2019 at 08:20:42PM +0000, Kieran Bingham wrote:
>> The checkstyle utility highlights some minor warnings against the logger
>> implementation.
>>
>> Fix these up.
>>
>> Fixes: edbd2059d8a4 ("libcamera: Add initial logger")
>> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
>> ---
>>  src/libcamera/include/log.h | 6 +++---
>>  src/libcamera/log.cpp       | 2 +-
>>  2 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/libcamera/include/log.h b/src/libcamera/include/log.h
>> index c1af3741ffee..cc3f9404a3d4 100644
>> --- a/src/libcamera/include/log.h
>> +++ b/src/libcamera/include/log.h
>> @@ -23,11 +23,11 @@ class LogMessage
>>  {
>>  public:
>>  	LogMessage(const char *fileName, unsigned int line,
>> -		  LogSeverity severity);
>> -	LogMessage(const LogMessage&) = delete;
>> +		   LogSeverity severity);
>> +	LogMessage(const LogMessage &) = delete;
>>  	~LogMessage();
>>  
>> -	std::ostream& stream() { return msgStream; }
>> +	std::ostream &stream() { return msgStream; }
>>  
>>  private:
>>  	std::ostringstream msgStream;
>> diff --git a/src/libcamera/log.cpp b/src/libcamera/log.cpp
>> index 9b2ae1bac8c8..74cba383363d 100644
>> --- a/src/libcamera/log.cpp
>> +++ b/src/libcamera/log.cpp
>> @@ -66,7 +66,7 @@ namespace libcamera {
>>  
>>  static const char *log_severity_name(LogSeverity severity)
>>  {
>> -	static const char * const names[] = {
>> +	static const char *const names[] = {
> 
> I'm not too sure about this one, but if it helps, let's change it.

I had to go back and think about this... but I think I do prefer it.

> 
>>  		"  DBG",
>>  		" INFO",
>>  		" WARN",
>
Niklas Söderlund Jan. 17, 2019, 10:02 p.m. UTC | #3
Hi Kieran,

Thanks for your work.

On 2019-01-17 20:20:42 +0000, Kieran Bingham wrote:
> The checkstyle utility highlights some minor warnings against the logger
> implementation.
> 
> Fix these up.
> 
> Fixes: edbd2059d8a4 ("libcamera: Add initial logger")
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
>  src/libcamera/include/log.h | 6 +++---
>  src/libcamera/log.cpp       | 2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/libcamera/include/log.h b/src/libcamera/include/log.h
> index c1af3741ffee..cc3f9404a3d4 100644
> --- a/src/libcamera/include/log.h
> +++ b/src/libcamera/include/log.h
> @@ -23,11 +23,11 @@ class LogMessage
>  {
>  public:
>  	LogMessage(const char *fileName, unsigned int line,
> -		  LogSeverity severity);
> -	LogMessage(const LogMessage&) = delete;
> +		   LogSeverity severity);
> +	LogMessage(const LogMessage &) = delete;
>  	~LogMessage();
>  
> -	std::ostream& stream() { return msgStream; }
> +	std::ostream &stream() { return msgStream; }
>  
>  private:
>  	std::ostringstream msgStream;
> diff --git a/src/libcamera/log.cpp b/src/libcamera/log.cpp
> index 9b2ae1bac8c8..74cba383363d 100644
> --- a/src/libcamera/log.cpp
> +++ b/src/libcamera/log.cpp
> @@ -66,7 +66,7 @@ namespace libcamera {
>  
>  static const char *log_severity_name(LogSeverity severity)
>  {
> -	static const char * const names[] = {
> +	static const char *const names[] = {
>  		"  DBG",
>  		" INFO",
>  		" WARN",
> -- 
> 2.17.1
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch

diff --git a/src/libcamera/include/log.h b/src/libcamera/include/log.h
index c1af3741ffee..cc3f9404a3d4 100644
--- a/src/libcamera/include/log.h
+++ b/src/libcamera/include/log.h
@@ -23,11 +23,11 @@  class LogMessage
 {
 public:
 	LogMessage(const char *fileName, unsigned int line,
-		  LogSeverity severity);
-	LogMessage(const LogMessage&) = delete;
+		   LogSeverity severity);
+	LogMessage(const LogMessage &) = delete;
 	~LogMessage();
 
-	std::ostream& stream() { return msgStream; }
+	std::ostream &stream() { return msgStream; }
 
 private:
 	std::ostringstream msgStream;
diff --git a/src/libcamera/log.cpp b/src/libcamera/log.cpp
index 9b2ae1bac8c8..74cba383363d 100644
--- a/src/libcamera/log.cpp
+++ b/src/libcamera/log.cpp
@@ -66,7 +66,7 @@  namespace libcamera {
 
 static const char *log_severity_name(LogSeverity severity)
 {
-	static const char * const names[] = {
+	static const char *const names[] = {
 		"  DBG",
 		" INFO",
 		" WARN",