treewide: Use character literal instead of string in some cases
Use character literals instead of single character long strings. The main purpose of this change is to work around a GCC bug that results in `-Wrestrict` warnings at certain optimization levels in C++20. libstdc++ 13 has been adjusted to avoid triggering the compiler warning. Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105329 Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
This commit is contained in:
@@ -236,8 +236,8 @@ void LogOutput::write(const LogMessage &msg)
|
||||
|
||||
switch (target_) {
|
||||
case LoggingTargetSyslog:
|
||||
str = std::string(log_severity_name(severity)) + " "
|
||||
+ msg.category().name() + " " + msg.fileInfo() + " ";
|
||||
str = std::string(log_severity_name(severity)) + ' '
|
||||
+ msg.category().name() + ' ' + msg.fileInfo() + ' ';
|
||||
if (!msg.prefix().empty())
|
||||
str += msg.prefix() + ": ";
|
||||
str += msg.msg();
|
||||
@@ -245,11 +245,11 @@ void LogOutput::write(const LogMessage &msg)
|
||||
break;
|
||||
case LoggingTargetStream:
|
||||
case LoggingTargetFile:
|
||||
str = "[" + utils::time_point_to_string(msg.timestamp()) + "] ["
|
||||
str = '[' + utils::time_point_to_string(msg.timestamp()) + "] ["
|
||||
+ std::to_string(Thread::currentId()) + "] "
|
||||
+ severityColor + log_severity_name(severity) + " "
|
||||
+ categoryColor + msg.category().name() + " "
|
||||
+ fileColor + msg.fileInfo() + " ";
|
||||
+ severityColor + log_severity_name(severity) + ' '
|
||||
+ categoryColor + msg.category().name() + ' '
|
||||
+ fileColor + msg.fileInfo() + ' ';
|
||||
if (!msg.prefix().empty())
|
||||
str += prefixColor + msg.prefix() + ": ";
|
||||
str += resetColor + msg.msg();
|
||||
|
||||
@@ -243,11 +243,11 @@ int MediaPipeline::init(MediaEntity *source, std::string_view sink)
|
||||
[](const Entity &e) {
|
||||
std::string s = "[";
|
||||
if (e.sink)
|
||||
s += std::to_string(e.sink->index()) + "|";
|
||||
s += std::to_string(e.sink->index()) + '|';
|
||||
s += e.entity->name();
|
||||
if (e.source)
|
||||
s += "|" + std::to_string(e.source->index());
|
||||
s += "]";
|
||||
s += '|' + std::to_string(e.source->index());
|
||||
s += ']';
|
||||
return s;
|
||||
});
|
||||
|
||||
|
||||
@@ -578,11 +578,11 @@ SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe,
|
||||
[](const Entity &e) {
|
||||
std::string s = "[";
|
||||
if (e.sink)
|
||||
s += std::to_string(e.sink->index()) + "|";
|
||||
s += std::to_string(e.sink->index()) + '|';
|
||||
s += e.entity->name();
|
||||
if (e.source)
|
||||
s += "|" + std::to_string(e.source->index());
|
||||
s += "]";
|
||||
s += '|' + std::to_string(e.source->index());
|
||||
s += ']';
|
||||
return s;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user