Patch Detail
Show a patch.
GET /api/1.1/patches/14050/?format=api
{ "id": 14050, "url": "https://patchwork.libcamera.org/api/1.1/patches/14050/?format=api", "web_url": "https://patchwork.libcamera.org/patch/14050/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20211005073114.3997303-7-hiroh@chromium.org>", "date": "2021-10-05T07:31:14", "name": "[libcamera-devel,RFC,6/6] test: Remove using namespace in header files", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "8c5dbb0d64afd5755574cafc21f849c152a89e15", "submitter": { "id": 63, "url": "https://patchwork.libcamera.org/api/1.1/people/63/?format=api", "name": "Hirokazu Honda", "email": "hiroh@chromium.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/14050/mbox/", "series": [ { "id": 2602, "url": "https://patchwork.libcamera.org/api/1.1/series/2602/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2602", "date": "2021-10-05T07:31:08", "name": "Remove using namespace in header files", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2602/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/14050/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/14050/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id E3843BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 5 Oct 2021 07:31:37 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A2B96691BE;\n\tTue, 5 Oct 2021 09:31:37 +0200 (CEST)", "from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com\n\t[IPv6:2607:f8b0:4864:20::52b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C195B691AD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 5 Oct 2021 09:31:35 +0200 (CEST)", "by mail-pg1-x52b.google.com with SMTP id e7so18994520pgk.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 05 Oct 2021 00:31:35 -0700 (PDT)", "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:debc:d0db:3bd8:f961])\n\tby smtp.gmail.com with ESMTPSA id\n\to14sm16761812pfh.145.2021.10.05.00.31.32\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 05 Oct 2021 00:31:33 -0700 (PDT)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"MNr7jyIz\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=F1tp93JtwZl0N6lNbF8v2MAO1RuA4bBN2LbhDqet+bs=;\n\tb=MNr7jyIz2iJNrdwl8xlrrDS0wYbBY5MHq7jOQA/N8UeeUbiuOlWHkZG0PD9CZwWkgh\n\tYom0aA4pmUyjoEDlmq5oHwKu/lIHx4ph64GWtidvxQMBZ6+1Ju+x14hQDdUrzrlR+4JX\n\tJcKABKeO2aC+9BSWJcw3EfjbluMsk9CR7Sq+Y=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=F1tp93JtwZl0N6lNbF8v2MAO1RuA4bBN2LbhDqet+bs=;\n\tb=WkPWGheJztdIWVJB0D6gGLKPMa7dtvZqmupl5/aKqS08nRpuITIaop6QWofTLwi1Nl\n\tNrYorWIpsjdeT5uB+FQaW9ZYNS1/zC93Tf3ejpwtKJ2gGGD+DgjzDSzwFFKW48+9ccRE\n\t7uLeoSntGMSXrv2bcmhPrqDfAeDaHNwEoiRrN26DMnQNx9VsFymTcn9R0uvyVarcvbgl\n\tTOqwycSxpK1Nc9DEMsZmoi/e6ZqHalOJG+3MAZuuD8pgYfFfuE01/IZaV6Kui335wej0\n\t9oBt3fDInVa8lZMVf21pri+9WlT66/PI1pG4qovthnRjR6I/sO+eLvAET+phtAVwdULe\n\tx9hg==", "X-Gm-Message-State": "AOAM533vmgLf5jbdOTzbUd+GSgkBc80r/LmwR00bUxbZvRA4h5uCcKNc\n\t9I+QkrhotS5g7cAC6YkhWzwa7b5PU3v9Kg==", "X-Google-Smtp-Source": "ABdhPJzi2Sc5jvknd/TrAQBgI92t7EhJkNMpbIViAqHSuxS4/5DpFYEPtC3apgKzOOjqUMsXcEDSKw==", "X-Received": "by 2002:aa7:8f12:0:b0:44c:833f:9dad with SMTP id\n\tx18-20020aa78f12000000b0044c833f9dadmr1355864pfr.35.1633419093936; \n\tTue, 05 Oct 2021 00:31:33 -0700 (PDT)", "From": "Hirokazu Honda <hiroh@chromium.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 5 Oct 2021 16:31:14 +0900", "Message-Id": "<20211005073114.3997303-7-hiroh@chromium.org>", "X-Mailer": "git-send-email 2.33.0.800.g4c38ced690-goog", "In-Reply-To": "<20211005073114.3997303-1-hiroh@chromium.org>", "References": "<20211005073114.3997303-1-hiroh@chromium.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [RFC PATCH 6/6] test: Remove using namespace in\n\theader files", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "\"using namespace\" in a header file propagates the namespace to\nthe files including the header file. So it should be avoided.\nThis removes \"using namespace\" in header files in test.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n test/camera/camera_reconfigure.cpp | 1 +\n test/camera/capture.cpp | 1 +\n test/camera/configuration_default.cpp | 1 +\n test/camera/configuration_set.cpp | 1 +\n test/camera/statemachine.cpp | 1 +\n test/gstreamer/gstreamer_test.h | 2 --\n test/libtest/buffer_source.cpp | 2 ++\n test/libtest/buffer_source.h | 10 ++++------\n test/libtest/camera_test.h | 6 ++----\n test/mapped-buffer.cpp | 1 +\n test/media_device/media_device_test.h | 6 ++----\n test/serialization/serialization_test.h | 10 ++++------\n test/v4l2_subdevice/v4l2_subdevice_test.h | 8 +++-----\n test/v4l2_videodevice/buffer_sharing.cpp | 2 ++\n test/v4l2_videodevice/capture_async.cpp | 2 ++\n test/v4l2_videodevice/v4l2_videodevice_test.h | 14 ++++++--------\n 16 files changed, 33 insertions(+), 35 deletions(-)", "diff": "diff --git a/test/camera/camera_reconfigure.cpp b/test/camera/camera_reconfigure.cpp\nindex 48d61c00..0fd8ab70 100644\n--- a/test/camera/camera_reconfigure.cpp\n+++ b/test/camera/camera_reconfigure.cpp\n@@ -21,6 +21,7 @@\n #include \"camera_test.h\"\n #include \"test.h\"\n \n+using namespace libcamera;\n using namespace std;\n \n namespace {\ndiff --git a/test/camera/capture.cpp b/test/camera/capture.cpp\nindex 238d98db..41ae00d7 100644\n--- a/test/camera/capture.cpp\n+++ b/test/camera/capture.cpp\n@@ -16,6 +16,7 @@\n #include \"camera_test.h\"\n #include \"test.h\"\n \n+using namespace libcamera;\n using namespace std;\n \n namespace {\ndiff --git a/test/camera/configuration_default.cpp b/test/camera/configuration_default.cpp\nindex c2b20194..209eb6a5 100644\n--- a/test/camera/configuration_default.cpp\n+++ b/test/camera/configuration_default.cpp\n@@ -10,6 +10,7 @@\n #include \"camera_test.h\"\n #include \"test.h\"\n \n+using namespace libcamera;\n using namespace std;\n \n namespace {\ndiff --git a/test/camera/configuration_set.cpp b/test/camera/configuration_set.cpp\nindex a1dc446a..4281a1c4 100644\n--- a/test/camera/configuration_set.cpp\n+++ b/test/camera/configuration_set.cpp\n@@ -10,6 +10,7 @@\n #include \"camera_test.h\"\n #include \"test.h\"\n \n+using namespace libcamera;\n using namespace std;\n \n namespace {\ndiff --git a/test/camera/statemachine.cpp b/test/camera/statemachine.cpp\nindex 26fb5ca1..9c2b0c6a 100644\n--- a/test/camera/statemachine.cpp\n+++ b/test/camera/statemachine.cpp\n@@ -12,6 +12,7 @@\n #include \"camera_test.h\"\n #include \"test.h\"\n \n+using namespace libcamera;\n using namespace std;\n \n namespace {\ndiff --git a/test/gstreamer/gstreamer_test.h b/test/gstreamer/gstreamer_test.h\nindex 9c50e288..ccfe0b92 100644\n--- a/test/gstreamer/gstreamer_test.h\n+++ b/test/gstreamer/gstreamer_test.h\n@@ -17,8 +17,6 @@\n \n #include <gst/gst.h>\n \n-using namespace std;\n-\n class GstreamerTest\n {\n public:\ndiff --git a/test/libtest/buffer_source.cpp b/test/libtest/buffer_source.cpp\nindex 64e7376a..1b261697 100644\n--- a/test/libtest/buffer_source.cpp\n+++ b/test/libtest/buffer_source.cpp\n@@ -14,6 +14,8 @@\n \n #include \"test.h\"\n \n+using namespace libcamera;\n+\n BufferSource::BufferSource()\n {\n }\ndiff --git a/test/libtest/buffer_source.h b/test/libtest/buffer_source.h\nindex 14b4770e..84e2fa8f 100644\n--- a/test/libtest/buffer_source.h\n+++ b/test/libtest/buffer_source.h\n@@ -12,20 +12,18 @@\n #include \"libcamera/internal/media_device.h\"\n #include \"libcamera/internal/v4l2_videodevice.h\"\n \n-using namespace libcamera;\n-\n class BufferSource\n {\n public:\n \tBufferSource();\n \t~BufferSource();\n \n-\tint allocate(const StreamConfiguration &config);\n-\tconst std::vector<std::unique_ptr<FrameBuffer>> &buffers();\n+\tint allocate(const libcamera::StreamConfiguration &config);\n+\tconst std::vector<std::unique_ptr<libcamera::FrameBuffer>> &buffers();\n \n private:\n-\tstd::shared_ptr<MediaDevice> media_;\n-\tstd::vector<std::unique_ptr<FrameBuffer>> buffers_;\n+\tstd::shared_ptr<libcamera::MediaDevice> media_;\n+\tstd::vector<std::unique_ptr<libcamera::FrameBuffer>> buffers_;\n };\n \n #endif /* __LIBCAMERA_BUFFER_SOURCE_TEST_H__ */\ndiff --git a/test/libtest/camera_test.h b/test/libtest/camera_test.h\nindex f56e343e..23122245 100644\n--- a/test/libtest/camera_test.h\n+++ b/test/libtest/camera_test.h\n@@ -12,8 +12,6 @@\n #include <libcamera/camera.h>\n #include <libcamera/camera_manager.h>\n \n-using namespace libcamera;\n-\n class CameraTest\n {\n public:\n@@ -21,8 +19,8 @@ public:\n \t~CameraTest();\n \n protected:\n-\tCameraManager *cm_;\n-\tstd::shared_ptr<Camera> camera_;\n+\tlibcamera::CameraManager *cm_;\n+\tstd::shared_ptr<libcamera::Camera> camera_;\n \tint status_;\n };\n \ndiff --git a/test/mapped-buffer.cpp b/test/mapped-buffer.cpp\nindex 97571945..b4422f7d 100644\n--- a/test/mapped-buffer.cpp\n+++ b/test/mapped-buffer.cpp\n@@ -14,6 +14,7 @@\n #include \"camera_test.h\"\n #include \"test.h\"\n \n+using namespace libcamera;\n using namespace std;\n \n namespace {\ndiff --git a/test/media_device/media_device_test.h b/test/media_device/media_device_test.h\nindex 0c8bf9f2..a88de56c 100644\n--- a/test/media_device/media_device_test.h\n+++ b/test/media_device/media_device_test.h\n@@ -14,8 +14,6 @@\n \n #include \"test.h\"\n \n-using namespace libcamera;\n-\n class MediaDeviceTest : public Test\n {\n public:\n@@ -25,10 +23,10 @@ public:\n protected:\n \tint init();\n \n-\tstd::shared_ptr<MediaDevice> media_;\n+\tstd::shared_ptr<libcamera::MediaDevice> media_;\n \n private:\n-\tstd::unique_ptr<DeviceEnumerator> enumerator_;\n+\tstd::unique_ptr<libcamera::DeviceEnumerator> enumerator_;\n };\n \n #endif /* __LIBCAMERA_MEDIADEVICE_TEST_H__ */\ndiff --git a/test/serialization/serialization_test.h b/test/serialization/serialization_test.h\nindex f51ae546..d654c7bf 100644\n--- a/test/serialization/serialization_test.h\n+++ b/test/serialization/serialization_test.h\n@@ -14,8 +14,6 @@\n #include \"camera_test.h\"\n #include \"test.h\"\n \n-using namespace libcamera;\n-\n class SerializationTest : public CameraTest, public Test\n {\n public:\n@@ -24,10 +22,10 @@ public:\n \t{\n \t}\n \n-\tstatic bool equals(const ControlInfoMap &lhs,\n-\t\t\t const ControlInfoMap &rhs);\n-\tstatic bool equals(const ControlList &lhs,\n-\t\t\t const ControlList &rhs);\n+\tstatic bool equals(const libcamera::ControlInfoMap &lhs,\n+\t\t\t const libcamera::ControlInfoMap &rhs);\n+\tstatic bool equals(const libcamera::ControlList &lhs,\n+\t\t\t const libcamera::ControlList &rhs);\n };\n \n #endif /* __LIBCAMERA_SERIALIZATION_TEST_H__ */\ndiff --git a/test/v4l2_subdevice/v4l2_subdevice_test.h b/test/v4l2_subdevice/v4l2_subdevice_test.h\nindex e981abf7..83beb6a2 100644\n--- a/test/v4l2_subdevice/v4l2_subdevice_test.h\n+++ b/test/v4l2_subdevice/v4l2_subdevice_test.h\n@@ -16,8 +16,6 @@\n \n #include \"test.h\"\n \n-using namespace libcamera;\n-\n class V4L2SubdeviceTest : public Test\n {\n public:\n@@ -30,9 +28,9 @@ protected:\n \tint init() override;\n \tvoid cleanup() override;\n \n-\tstd::unique_ptr<DeviceEnumerator> enumerator_;\n-\tstd::shared_ptr<MediaDevice> media_;\n-\tV4L2Subdevice *scaler_;\n+\tstd::unique_ptr<libcamera::DeviceEnumerator> enumerator_;\n+\tstd::shared_ptr<libcamera::MediaDevice> media_;\n+\tlibcamera::V4L2Subdevice *scaler_;\n };\n \n #endif /* __LIBCAMERA_V4L2_SUBDEVICE_TEST_H__ */\ndiff --git a/test/v4l2_videodevice/buffer_sharing.cpp b/test/v4l2_videodevice/buffer_sharing.cpp\nindex 6af96a98..75ee93ce 100644\n--- a/test/v4l2_videodevice/buffer_sharing.cpp\n+++ b/test/v4l2_videodevice/buffer_sharing.cpp\n@@ -20,6 +20,8 @@\n \n #include \"v4l2_videodevice_test.h\"\n \n+using namespace libcamera;\n+\n class BufferSharingTest : public V4L2VideoDeviceTest\n {\n public:\ndiff --git a/test/v4l2_videodevice/capture_async.cpp b/test/v4l2_videodevice/capture_async.cpp\nindex 805cb610..3aa4ca0b 100644\n--- a/test/v4l2_videodevice/capture_async.cpp\n+++ b/test/v4l2_videodevice/capture_async.cpp\n@@ -15,6 +15,8 @@\n \n #include \"v4l2_videodevice_test.h\"\n \n+using namespace libcamera;\n+\n class CaptureAsyncTest : public V4L2VideoDeviceTest\n {\n public:\ndiff --git a/test/v4l2_videodevice/v4l2_videodevice_test.h b/test/v4l2_videodevice/v4l2_videodevice_test.h\nindex d46540d4..e7762294 100644\n--- a/test/v4l2_videodevice/v4l2_videodevice_test.h\n+++ b/test/v4l2_videodevice/v4l2_videodevice_test.h\n@@ -19,8 +19,6 @@\n \n #include \"test.h\"\n \n-using namespace libcamera;\n-\n class V4L2VideoDeviceTest : public Test\n {\n public:\n@@ -36,12 +34,12 @@ protected:\n \n \tstd::string driver_;\n \tstd::string entity_;\n-\tstd::unique_ptr<DeviceEnumerator> enumerator_;\n-\tstd::shared_ptr<MediaDevice> media_;\n-\tCameraSensor *sensor_;\n-\tV4L2Subdevice *debayer_;\n-\tV4L2VideoDevice *capture_;\n-\tstd::vector<std::unique_ptr<FrameBuffer>> buffers_;\n+\tstd::unique_ptr<libcamera::DeviceEnumerator> enumerator_;\n+\tstd::shared_ptr<libcamera::MediaDevice> media_;\n+\tlibcamera::CameraSensor *sensor_;\n+\tlibcamera::V4L2Subdevice *debayer_;\n+\tlibcamera::V4L2VideoDevice *capture_;\n+\tstd::vector<std::unique_ptr<libcamera::FrameBuffer>> buffers_;\n };\n \n #endif /* __LIBCAMERA_V4L2_DEVICE_TEST_H_ */\n", "prefixes": [ "libcamera-devel", "RFC", "6/6" ] }