From patchwork Wed Jan 7 19:36:06 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 25686 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 049CFC3274 for ; Wed, 7 Jan 2026 19:36:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 04DF361FC9; Wed, 7 Jan 2026 20:36:18 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="kbAbHakn"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1198761FBC for ; Wed, 7 Jan 2026 20:36:14 +0100 (CET) Received: from pb-laptop.local (185.221.143.114.nat.pool.zt.hu [185.221.143.114]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 3A24C18BF; Wed, 7 Jan 2026 20:35:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1767814552; bh=aj3Bd2OUFxoU+9pT4+J6qP/cg33JDnlUWxFbFuGHhqY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kbAbHaknP06fB/SDNUY8/fnhdjgT3nBj9yaraO6kkKpw9IBoYvlhtFth9UWL96N17 JOxkpX9Lx/Md3GzwbRcEEhZGwIa4m+PMEjiGL7jbIIrnXS1i21DR3O209/N836zlcv upx8u0BB6ftzxWL0ugq5nIc7Hdpvv6wUzz2ffMWU= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck Subject: [RFC PATCH v1 4/5] treewide: Use character literal instead of string in some cases Date: Wed, 7 Jan 2026 20:36:06 +0100 Message-ID: <20260107193607.2168539-5-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260107193607.2168539-1-barnabas.pocze@ideasonboard.com> References: <20260107193607.2168539-1-barnabas.pocze@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Use character literals instead of single character long strings. The main purpose of this change is to work around a GCC (libstdc++) bug that results in `-Wrestrict` warnings at certain optimization levels in C++20. Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105329 Signed-off-by: Barnabás Pőcze Reviewed-by: Laurent Pinchart Reviewed-by: Naushir Patuck --- src/libcamera/base/log.cpp | 12 ++++++------ src/libcamera/media_pipeline.cpp | 6 +++--- src/libcamera/pipeline/simple/simple.cpp | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/libcamera/base/log.cpp b/src/libcamera/base/log.cpp index b28217750..946bdebf0 100644 --- a/src/libcamera/base/log.cpp +++ b/src/libcamera/base/log.cpp @@ -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(); diff --git a/src/libcamera/media_pipeline.cpp b/src/libcamera/media_pipeline.cpp index 3c5517314..26c60c36b 100644 --- a/src/libcamera/media_pipeline.cpp +++ b/src/libcamera/media_pipeline.cpp @@ -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; }); diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index b30b0a122..d37b76a48 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -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; }); }