From patchwork Tue Apr 7 15:34:14 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 26469 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 C1ED7C331D for ; Tue, 7 Apr 2026 15:35:14 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 052B862E3D; Tue, 7 Apr 2026 17:35:14 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="AIf4hIJn"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 988A462E36 for ; Tue, 7 Apr 2026 17:35:08 +0200 (CEST) Received: from killaraus.ideasonboard.com (2001-14ba-703d-e500--2a1.rev.dnainternet.fi [IPv6:2001:14ba:703d:e500::2a1]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 11D55A30 for ; Tue, 7 Apr 2026 17:33:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1775576021; bh=E8G5dU8Wcu8VzDRpVpi+VQ97VML0mZ5vya9frb5Xnuc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=AIf4hIJnlMrZsoO8CEirgLVqNubq+fvKfGmQz8qPGCGojD/jU75El6YW489/zCihY S4Ced3Vap23cUtG1/KvW2AT9d4/su3zIrdx9ON2snxaUlkx3vPyLZU6pULfBsp+IpG +qPR1m+iKJo8yGoAX8UqHMkid7rK02RJUuHozsaY= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH v2 29/42] test: yaml-parser: Standardize on explicitly qualifying std namespace Date: Tue, 7 Apr 2026 18:34:14 +0300 Message-ID: <20260407153427.1825999-30-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260407153427.1825999-1-laurent.pinchart@ideasonboard.com> References: <20260407153427.1825999-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" yaml-parser.cpp mixes unqualified and qualified identifier in the std namespace. Standardize on qualified identifiers, and drop the "using namespace std" statement. Signed-off-by: Laurent Pinchart --- test/yaml-parser.cpp | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/test/yaml-parser.cpp b/test/yaml-parser.cpp index 0bbda3af8ea9..e8fd9ad61cd0 100644 --- a/test/yaml-parser.cpp +++ b/test/yaml-parser.cpp @@ -20,9 +20,8 @@ #include "test.h" using namespace libcamera; -using namespace std; -static const string testYaml = +static const std::string testYaml = "empty:\n" "value: 42\n" "list:\n" @@ -34,13 +33,13 @@ static const string testYaml = " - [1, 2]\n" " - {one: 1, two: 2}\n"; -static const string invalidYaml = +static const std::string invalidYaml = "Invalid : - YAML : - Content"; class YamlParserTest : public Test { protected: - bool createFile(const string &content, string &filename) + bool createFile(const std::string &content, std::string &filename) { filename = "/tmp/libcamera.test.XXXXXX"; int fd = mkstemp(&filename.front()); @@ -72,13 +71,13 @@ protected: /* Test parsing invalid YAML file. */ File file{ invalidYamlFile_ }; if (!file.open(File::OpenModeFlag::ReadOnly)) { - cerr << "Fail to open invalid YAML file" << std::endl; + std::cerr << "Fail to open invalid YAML file" << std::endl; return TestFail; } std::unique_ptr root = YamlParser::parse(file); if (root) { - cerr << "Invalid YAML file parse successfully" << std::endl; + std::cerr << "Invalid YAML file parse successfully" << std::endl; return TestFail; } @@ -86,20 +85,20 @@ protected: file.close(); file.setFileName(testYamlFile_); if (!file.open(File::OpenModeFlag::ReadOnly)) { - cerr << "Fail to open test YAML file" << std::endl; + std::cerr << "Fail to open test YAML file" << std::endl; return TestFail; } root = YamlParser::parse(file); if (!root) { - cerr << "Fail to parse test YAML file: " << std::endl; + std::cerr << "Fail to parse test YAML file: " << std::endl; return TestFail; } /* Test that the root dictionary node has been parsed correctly. */ if (!root->isDictionary()) { - cerr << "Dictionary node has wrong type" << std::endl; + std::cerr << "Dictionary node has wrong type" << std::endl; return TestFail; } @@ -138,7 +137,7 @@ protected: /* Test empty node. */ auto &emptyNode = (*root)["empty"]; - if (emptyNode.get("-") != "") { + if (emptyNode.get("-") != "") { std::cerr << "Empty node has incorrect content" << std::endl; return TestFail; } @@ -146,7 +145,7 @@ protected: /* Test value node. */ auto &valueNode = (*root)["value"]; - if (valueNode.get("") != "42") { + if (valueNode.get("") != "42") { std::cerr << "Value node has incorrect content" << std::endl; return TestFail; } @@ -161,7 +160,7 @@ protected: }; if (listObj.size() != listValues.size()) { - cerr << "List object parse with wrong size" << std::endl; + std::cerr << "List object parsed with wrong size" << std::endl; return TestFail; } @@ -192,7 +191,7 @@ protected: /* Ensure that empty list elements get parsed as empty strings. */ if (!listObj[2].isValue()) { - cerr << "Empty list element is not a value" << std::endl; + std::cerr << "Empty list element is not a value" << std::endl; return TestFail; } @@ -200,14 +199,14 @@ protected: auto &level1Obj = (*root)["level1"]; if (!level1Obj.isDictionary()) { - cerr << "level1 object fail to parse as Dictionary" << std::endl; + std::cerr << "level1 object fail to parse as Dictionary" << std::endl; return TestFail; } auto &level2Obj = level1Obj["level2"]; if (!level2Obj.isList() || level2Obj.size() != 2) { - cerr << "level2 object should be a 2 elements list" << std::endl; + std::cerr << "level2 object should be a 2 elements list" << std::endl; return TestFail; } @@ -216,13 +215,13 @@ protected: firstElement.size() != 2 || firstElement[0].get(0) != 1 || firstElement[1].get(0) != 2) { - cerr << "The first element of level2 object fail to parse as integer list" << std::endl; + std::cerr << "The first element of level2 object fail to parse as integer list" << std::endl; return TestFail; } const auto &values = firstElement.get>(); if (!values || values->size() != 2 || (*values)[0] != 1 || (*values)[1] != 2) { - cerr << "get() failed to return correct vector" << std::endl; + std::cerr << "get() failed to return correct vector" << std::endl; return TestFail; } @@ -232,7 +231,7 @@ protected: !secondElement.contains("two") || secondElement["one"].get(0) != 1 || secondElement["two"].get(0) != 2) { - cerr << "The second element of level2 object fail to parse as dictionary" << std::endl; + std::cerr << "The second element of level2 object fail to parse as dictionary" << std::endl; return TestFail; }