From patchwork Mon Jun 24 19:29:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 20374 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 13B06BD87C for ; Mon, 24 Jun 2024 19:30:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C1B4D654A3; Mon, 24 Jun 2024 21:30:22 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="W9BEKz6w"; 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 81E47654AA for ; Mon, 24 Jun 2024 21:30:13 +0200 (CEST) Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 779BE1935; Mon, 24 Jun 2024 21:29:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1719257391; bh=sp/WPqVO9zetJYTYWRR9AGDR3MeZFbO9fzrm5MU26wI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W9BEKz6wqW2d+xwrezmkxncJmpJLCLTJE3WUxDOMSbuHFDHrCwABosu8aXiHnzHWF TlTEwGITWGTCOskIrKQfBGFf2iRQuiPtQZw9weaKAJsEe4hxEFrzLNI7lP7uJ01GaR QOBlUnu1Gi29JFsoG4cAX/JnNm8wJfUtq9J/cp9k= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Cc: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= Subject: [PATCH 07/10] apps: Define local functions in anonymous namespace Date: Mon, 24 Jun 2024 22:29:38 +0300 Message-ID: <20240624192941.22943-8-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20240624192941.22943-1-laurent.pinchart@ideasonboard.com> References: <20240624192941.22943-1-laurent.pinchart@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" Multiple local functions are defined in the global namespace without the static keyword. This compiles fine for now, but will cause a missing declaration warning when we enable thel. To prepare for that, move the function declaration to an anonymous namespace. While at it, for consistency, include an existing static function in the namespace and drop the static keyword. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/apps/cam/main.cpp | 4 ++++ src/apps/common/dng_writer.cpp | 6 +++++- src/apps/qcam/main.cpp | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/apps/cam/main.cpp b/src/apps/cam/main.cpp index 4f87f200db21..460dbc813060 100644 --- a/src/apps/cam/main.cpp +++ b/src/apps/cam/main.cpp @@ -344,12 +344,16 @@ std::string CamApp::cameraName(const Camera *camera) return name; } +namespace { + void signalHandler([[maybe_unused]] int signal) { std::cout << "Exiting" << std::endl; CamApp::instance()->quit(); } +} /* namespace */ + int main(int argc, char **argv) { CamApp app; diff --git a/src/apps/common/dng_writer.cpp b/src/apps/common/dng_writer.cpp index 59f1fa23543b..58e35f3f9e1b 100644 --- a/src/apps/common/dng_writer.cpp +++ b/src/apps/common/dng_writer.cpp @@ -126,6 +126,8 @@ struct Matrix3d { float m[9]; }; +namespace { + void packScanlineSBGGR8(void *output, const void *input, unsigned int width) { const uint8_t *in = static_cast(input); @@ -282,7 +284,7 @@ void thumbScanlineIPU3([[maybe_unused]] const FormatInfo &info, void *output, } } -static const std::map formatInfo = { +const std::map formatInfo = { { formats::SBGGR8, { .bitsPerSample = 8, .pattern = { CFAPatternBlue, CFAPatternGreen, CFAPatternGreen, CFAPatternRed }, @@ -381,6 +383,8 @@ static const std::map formatInfo = { } }, }; +} /* namespace */ + int DNGWriter::write(const char *filename, const Camera *camera, const StreamConfiguration &config, const ControlList &metadata, diff --git a/src/apps/qcam/main.cpp b/src/apps/qcam/main.cpp index 9846fba58508..d0bde14130fb 100644 --- a/src/apps/qcam/main.cpp +++ b/src/apps/qcam/main.cpp @@ -21,6 +21,8 @@ using namespace libcamera; +namespace { + void signalHandler([[maybe_unused]] int signal) { qInfo() << "Exiting"; @@ -52,6 +54,8 @@ OptionsParser::Options parseOptions(int argc, char *argv[]) return options; } +} /* namespace */ + int main(int argc, char **argv) { QApplication app(argc, argv);