[libcamera-devel] [PATCH] libcamera: log: Fix unknown log level representation

Kieran Bingham kieran.bingham at ideasonboard.com
Mon Jan 14 11:02:56 CET 2019


Commit 99a3e7bcfb38 ("libcamera: log: Add a LogFatal log level")
expanded the text representation of the log levels to support the FATAL
string, but left the default unknown match at four characters.

This code should never expect to be executed, but for completeness match
the string lengths by adding an extra character to the result.

Fixes: 99a3e7bcfb38 ("libcamera: log: Add a LogFatal log level")
Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
---
 src/libcamera/log.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libcamera/log.cpp b/src/libcamera/log.cpp
index 281e31d963f5..9b2ae1bac8c8 100644
--- a/src/libcamera/log.cpp
+++ b/src/libcamera/log.cpp
@@ -77,7 +77,7 @@ static const char *log_severity_name(LogSeverity severity)
 	if (static_cast<unsigned int>(severity) < ARRAY_SIZE(names))
 		return names[severity];
 	else
-		return "UNKN";
+		return "UNKWN";
 }
 
 /**
-- 
2.17.1



More information about the libcamera-devel mailing list