Patch Detail
Show a patch.
GET /api/patches/22326/?format=api
{ "id": 22326, "url": "https://patchwork.libcamera.org/api/patches/22326/?format=api", "web_url": "https://patchwork.libcamera.org/patch/22326/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/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": "<20241215230206.11002-7-laurent.pinchart@ideasonboard.com>", "date": "2024-12-15T23:02:04", "name": "[RFC,6/8] libcamera: Update string usage in internal APIs", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "29a0bdcdf3f73f3b64d4e51971d44fe3513a9b79", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/22326/mbox/", "series": [ { "id": 4889, "url": "https://patchwork.libcamera.org/api/series/4889/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4889", "date": "2024-12-15T23:01:58", "name": "libcamera: Use std::string_view", "version": 1, "mbox": "https://patchwork.libcamera.org/series/4889/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/22326/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/22326/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 D339BC32F6\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 15 Dec 2024 23:02:40 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3960867F42;\n\tMon, 16 Dec 2024 00:02:40 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0E6D367F3C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Dec 2024 00:02:31 +0100 (CET)", "from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A91E22C6;\n\tMon, 16 Dec 2024 00:01:54 +0100 (CET)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"cxGMXoSw\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1734303715;\n\tbh=tCzOv7ynYDErg4/AoDhNXCoBUptU08pA90XBObCwPJ4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=cxGMXoSwHdIym1o0+5+uy2VQOPitPvT8S3Qf4mvdBRixgMEXGUuJRUfo+U5I3ajeO\n\tv1m+HjCn/ec2IByvxR+Zi6wPcM2Encrkc6pX+eD6zBNV4rPGAZo6YPv2CwG+sgfz8J\n\tE8MZ864d5FaImFKycSLYy3kelA8KiTxZJ76lLdzo=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>", "Subject": "[RFC PATCH 6/8] libcamera: Update string usage in internal APIs", "Date": "Mon, 16 Dec 2024 01:02:04 +0200", "Message-ID": "<20241215230206.11002-7-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.45.2", "In-Reply-To": "<20241215230206.11002-1-laurent.pinchart@ideasonboard.com>", "References": "<20241215230206.11002-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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": "Follow the string usage guidelines documented in the libcamera coding\nstyle in most of the internal APIs. This showcases usage of\nstd::string_view where applicable. The rationale is explained in the\nguidelines.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n .../internal/camera_sensor_properties.h | 4 ++--\n include/libcamera/internal/converter.h | 3 ++-\n .../internal/converter/converter_v4l2_m2m.h | 3 +--\n include/libcamera/internal/device_enumerator.h | 8 ++++----\n include/libcamera/internal/formats.h | 3 ++-\n include/libcamera/internal/ipa_module.h | 3 ++-\n include/libcamera/internal/ipa_proxy.h | 7 ++++---\n include/libcamera/internal/media_device.h | 9 +++++----\n include/libcamera/internal/pipeline_handler.h | 7 ++++---\n .../internal/software_isp/software_isp.h | 4 ++--\n include/libcamera/internal/sysfs.h | 3 ++-\n include/libcamera/internal/v4l2_device.h | 3 ++-\n include/libcamera/internal/v4l2_subdevice.h | 3 ++-\n include/libcamera/internal/v4l2_videodevice.h | 7 ++++---\n src/libcamera/device_enumerator.cpp | 10 +++++-----\n src/libcamera/formats.cpp | 2 +-\n src/libcamera/ipa_module.cpp | 2 +-\n src/libcamera/ipa_proxy.cpp | 8 ++++----\n src/libcamera/media_device.cpp | 16 ++++++++--------\n src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 3 ++-\n src/libcamera/pipeline_handler.cpp | 6 +++---\n .../sensor/camera_sensor_properties.cpp | 4 ++--\n src/libcamera/software_isp/software_isp.cpp | 3 ++-\n src/libcamera/sysfs.cpp | 8 +++++---\n src/libcamera/v4l2_device.cpp | 2 +-\n src/libcamera/v4l2_subdevice.cpp | 3 +--\n src/libcamera/v4l2_videodevice.cpp | 7 +++----\n 27 files changed, 76 insertions(+), 65 deletions(-)", "diff": "diff --git a/include/libcamera/internal/camera_sensor_properties.h b/include/libcamera/internal/camera_sensor_properties.h\nindex d7d4dab626df7b82..b44093906d6390c0 100644\n--- a/include/libcamera/internal/camera_sensor_properties.h\n+++ b/include/libcamera/internal/camera_sensor_properties.h\n@@ -9,7 +9,7 @@\n \n #include <map>\n #include <stdint.h>\n-#include <string>\n+#include <string_view>\n \n #include <libcamera/control_ids.h>\n #include <libcamera/geometry.h>\n@@ -24,7 +24,7 @@ struct CameraSensorProperties {\n \t\tuint8_t hblankDelay;\n \t};\n \n-\tstatic const CameraSensorProperties *get(const std::string &sensor);\n+\tstatic const CameraSensorProperties *get(std::string_view sensor);\n \n \tSize unitCellSize;\n \tstd::map<controls::draft::TestPatternModeEnum, int32_t> testPatternModes;\ndiff --git a/include/libcamera/internal/converter.h b/include/libcamera/internal/converter.h\nindex ffbb6f345cd5ed4f..fb8d81898e90bcb8 100644\n--- a/include/libcamera/internal/converter.h\n+++ b/include/libcamera/internal/converter.h\n@@ -13,6 +13,7 @@\n #include <map>\n #include <memory>\n #include <string>\n+#include <string_view>\n #include <tuple>\n #include <utility>\n #include <vector>\n@@ -44,7 +45,7 @@ public:\n \tConverter(MediaDevice *media, Features features = Feature::None);\n \tvirtual ~Converter();\n \n-\tvirtual int loadConfiguration(const std::string &filename) = 0;\n+\tvirtual int loadConfiguration(std::string_view filename) = 0;\n \n \tvirtual bool isValid() const = 0;\n \ndiff --git a/include/libcamera/internal/converter/converter_v4l2_m2m.h b/include/libcamera/internal/converter/converter_v4l2_m2m.h\nindex 0bc0d053e2c47d3a..5475cc6b3ac58b30 100644\n--- a/include/libcamera/internal/converter/converter_v4l2_m2m.h\n+++ b/include/libcamera/internal/converter/converter_v4l2_m2m.h\n@@ -11,7 +11,6 @@\n #include <functional>\n #include <map>\n #include <memory>\n-#include <string>\n #include <tuple>\n #include <vector>\n \n@@ -38,7 +37,7 @@ class V4L2M2MConverter : public Converter\n public:\n \tV4L2M2MConverter(MediaDevice *media);\n \n-\tint loadConfiguration([[maybe_unused]] const std::string &filename) { return 0; }\n+\tint loadConfiguration([[maybe_unused]] std::string_view filename) { return 0; }\n \tbool isValid() const { return m2m_ != nullptr; }\n \n \tstd::vector<PixelFormat> formats(PixelFormat input);\ndiff --git a/include/libcamera/internal/device_enumerator.h b/include/libcamera/internal/device_enumerator.h\nindex db3532a9887af913..c3a09f03433729c4 100644\n--- a/include/libcamera/internal/device_enumerator.h\n+++ b/include/libcamera/internal/device_enumerator.h\n@@ -20,9 +20,9 @@ class MediaDevice;\n class DeviceMatch\n {\n public:\n-\tDeviceMatch(const std::string &driver);\n+\tDeviceMatch(std::string_view driver);\n \n-\tvoid add(const std::string &entity);\n+\tvoid add(std::string_view entity);\n \n \tbool match(const MediaDevice *device) const;\n \n@@ -46,9 +46,9 @@ public:\n \tSignal<> devicesAdded;\n \n protected:\n-\tstd::unique_ptr<MediaDevice> createDevice(const std::string &deviceNode);\n+\tstd::unique_ptr<MediaDevice> createDevice(std::string_view deviceNode);\n \tvoid addDevice(std::unique_ptr<MediaDevice> media);\n-\tvoid removeDevice(const std::string &deviceNode);\n+\tvoid removeDevice(std::string_view deviceNode);\n \n private:\n \tstd::vector<std::shared_ptr<MediaDevice>> devices_;\ndiff --git a/include/libcamera/internal/formats.h b/include/libcamera/internal/formats.h\nindex 6a3e9c16a873e969..bd7ac6ed128f594b 100644\n--- a/include/libcamera/internal/formats.h\n+++ b/include/libcamera/internal/formats.h\n@@ -8,6 +8,7 @@\n #pragma once\n \n #include <array>\n+#include <string_view>\n #include <vector>\n \n #include <libcamera/geometry.h>\n@@ -35,7 +36,7 @@ public:\n \n \tstatic const PixelFormatInfo &info(const PixelFormat &format);\n \tstatic const PixelFormatInfo &info(const V4L2PixelFormat &format);\n-\tstatic const PixelFormatInfo &info(const std::string &name);\n+\tstatic const PixelFormatInfo &info(std::string_view name);\n \n \tunsigned int stride(unsigned int width, unsigned int plane,\n \t\t\t unsigned int align = 1) const;\ndiff --git a/include/libcamera/internal/ipa_module.h b/include/libcamera/internal/ipa_module.h\nindex 7c49d3f342e5055c..5f7c7e6e9f6987a0 100644\n--- a/include/libcamera/internal/ipa_module.h\n+++ b/include/libcamera/internal/ipa_module.h\n@@ -9,6 +9,7 @@\n \n #include <stdint.h>\n #include <string>\n+#include <string_view>\n #include <vector>\n \n #include <libcamera/base/log.h>\n@@ -23,7 +24,7 @@ namespace libcamera {\n class IPAModule : public Loggable\n {\n public:\n-\texplicit IPAModule(const std::string &libPath);\n+\texplicit IPAModule(std::string_view libPath);\n \t~IPAModule();\n \n \tbool isValid() const;\ndiff --git a/include/libcamera/internal/ipa_proxy.h b/include/libcamera/internal/ipa_proxy.h\nindex 983bcc5faa4bab3b..93b3b991f8d4b80e 100644\n--- a/include/libcamera/internal/ipa_proxy.h\n+++ b/include/libcamera/internal/ipa_proxy.h\n@@ -8,6 +8,7 @@\n #pragma once\n \n #include <string>\n+#include <string_view>\n \n #include <libcamera/ipa/ipa_interface.h>\n \n@@ -29,11 +30,11 @@ public:\n \n \tbool isValid() const { return valid_; }\n \n-\tstd::string configurationFile(const std::string &name,\n-\t\t\t\t const std::string &fallbackName = std::string()) const;\n+\tstd::string configurationFile(std::string_view name,\n+\t\t\t\t std::string_view fallbackName = {}) const;\n \n protected:\n-\tstd::string resolvePath(const std::string &file) const;\n+\tstd::string resolvePath(std::string_view file) const;\n \n \tbool valid_;\n \tProxyState state_;\ndiff --git a/include/libcamera/internal/media_device.h b/include/libcamera/internal/media_device.h\nindex e412d3a0b7e38cd3..1882b9aeb87f533a 100644\n--- a/include/libcamera/internal/media_device.h\n+++ b/include/libcamera/internal/media_device.h\n@@ -9,6 +9,7 @@\n \n #include <map>\n #include <string>\n+#include <string_view>\n #include <vector>\n \n #include <linux/media.h>\n@@ -24,7 +25,7 @@ namespace libcamera {\n class MediaDevice : protected Loggable\n {\n public:\n-\tMediaDevice(const std::string &deviceNode);\n+\tMediaDevice(std::string_view deviceNode);\n \t~MediaDevice();\n \n \tbool acquire();\n@@ -44,10 +45,10 @@ public:\n \tunsigned int hwRevision() const { return hwRevision_; }\n \n \tconst std::vector<MediaEntity *> &entities() const { return entities_; }\n-\tMediaEntity *getEntityByName(const std::string &name) const;\n+\tMediaEntity *getEntityByName(std::string_view name) const;\n \n-\tMediaLink *link(const std::string &sourceName, unsigned int sourceIdx,\n-\t\t\tconst std::string &sinkName, unsigned int sinkIdx);\n+\tMediaLink *link(std::string_view sourceName, unsigned int sourceIdx,\n+\t\t\tstd::string_view sinkName, unsigned int sinkIdx);\n \tMediaLink *link(const MediaEntity *source, unsigned int sourceIdx,\n \t\t\tconst MediaEntity *sink, unsigned int sinkIdx);\n \tMediaLink *link(const MediaPad *source, const MediaPad *sink);\ndiff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h\nindex fb28a18d0f4668ab..f91d1c6cba842f49 100644\n--- a/include/libcamera/internal/pipeline_handler.h\n+++ b/include/libcamera/internal/pipeline_handler.h\n@@ -10,6 +10,7 @@\n #include <memory>\n #include <queue>\n #include <string>\n+#include <string_view>\n #include <sys/types.h>\n #include <vector>\n \n@@ -62,8 +63,8 @@ public:\n \tvoid completeRequest(Request *request);\n \tvoid cancelRequest(Request *request);\n \n-\tstd::string configurationFile(const std::string &subdir,\n-\t\t\t\t const std::string &name) const;\n+\tstd::string configurationFile(std::string_view subdir,\n+\t\t\t\t std::string_view name) const;\n \n \tconst char *name() const { return name_; }\n \n@@ -112,7 +113,7 @@ public:\n \tconst std::string &name() const { return name_; }\n \n \tstatic std::vector<PipelineHandlerFactoryBase *> &factories();\n-\tstatic const PipelineHandlerFactoryBase *getFactoryByName(const std::string &name);\n+\tstatic const PipelineHandlerFactoryBase *getFactoryByName(std::string_view name);\n \n private:\n \tstatic void registerType(PipelineHandlerFactoryBase *factory);\ndiff --git a/include/libcamera/internal/software_isp/software_isp.h b/include/libcamera/internal/software_isp/software_isp.h\nindex d51b03fd6cd71fce..bc4eb36260e93fbc 100644\n--- a/include/libcamera/internal/software_isp/software_isp.h\n+++ b/include/libcamera/internal/software_isp/software_isp.h\n@@ -12,7 +12,7 @@\n #include <map>\n #include <memory>\n #include <stdint.h>\n-#include <string>\n+#include <string_view>\n #include <tuple>\n #include <vector>\n \n@@ -50,7 +50,7 @@ public:\n \t\t ControlInfoMap *ipaControls);\n \t~SoftwareIsp();\n \n-\tint loadConfiguration([[maybe_unused]] const std::string &filename) { return 0; }\n+\tint loadConfiguration([[maybe_unused]] std::string_view filename) { return 0; }\n \n \tbool isValid() const;\n \ndiff --git a/include/libcamera/internal/sysfs.h b/include/libcamera/internal/sysfs.h\nindex aca60fb6c8ab9a2c..db78d790f3ff23bd 100644\n--- a/include/libcamera/internal/sysfs.h\n+++ b/include/libcamera/internal/sysfs.h\n@@ -8,6 +8,7 @@\n #pragma once\n \n #include <string>\n+#include <string_view>\n \n namespace libcamera {\n \n@@ -15,7 +16,7 @@ namespace sysfs {\n \n std::string charDevPath(const std::string &deviceNode);\n \n-std::string firmwareNodePath(const std::string &device);\n+std::string firmwareNodePath(std::string_view device);\n \n } /* namespace sysfs */\n \ndiff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h\nindex f5aa502482017325..623403dc615ea604 100644\n--- a/include/libcamera/internal/v4l2_device.h\n+++ b/include/libcamera/internal/v4l2_device.h\n@@ -10,6 +10,7 @@\n #include <map>\n #include <memory>\n #include <optional>\n+#include <string_view>\n #include <vector>\n \n #include <linux/videodev2.h>\n@@ -50,7 +51,7 @@ public:\n \tvoid updateControlInfo();\n \n protected:\n-\tV4L2Device(const std::string &deviceNode);\n+\tV4L2Device(std::string_view deviceNode);\n \t~V4L2Device();\n \n \tint open(unsigned int flags);\ndiff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h\nindex 194382f84d97fbbc..d17365e14a231df3 100644\n--- a/include/libcamera/internal/v4l2_subdevice.h\n+++ b/include/libcamera/internal/v4l2_subdevice.h\n@@ -11,6 +11,7 @@\n #include <optional>\n #include <ostream>\n #include <string>\n+#include <string_view>\n #include <vector>\n \n #include <linux/v4l2-subdev.h>\n@@ -161,7 +162,7 @@ public:\n \tconst V4L2SubdeviceCapability &caps() const { return caps_; }\n \n \tstatic std::unique_ptr<V4L2Subdevice>\n-\tfromEntityName(const MediaDevice *media, const std::string &entity);\n+\tfromEntityName(const MediaDevice *media, std::string_view entity);\n \n protected:\n \tstd::string logPrefix() const override;\ndiff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\nindex f021c2a0177b4512..45443ed716d7f6f2 100644\n--- a/include/libcamera/internal/v4l2_videodevice.h\n+++ b/include/libcamera/internal/v4l2_videodevice.h\n@@ -14,6 +14,7 @@\n #include <ostream>\n #include <stdint.h>\n #include <string>\n+#include <string_view>\n #include <unordered_set>\n #include <vector>\n \n@@ -189,7 +190,7 @@ class V4L2VideoDevice : public V4L2Device\n public:\n \tusing Formats = std::map<V4L2PixelFormat, std::vector<SizeRange>>;\n \n-\texplicit V4L2VideoDevice(const std::string &deviceNode);\n+\texplicit V4L2VideoDevice(std::string_view deviceNode);\n \texplicit V4L2VideoDevice(const MediaEntity *entity);\n \t~V4L2VideoDevice();\n \n@@ -228,7 +229,7 @@ public:\n \tSignal<> dequeueTimeout;\n \n \tstatic std::unique_ptr<V4L2VideoDevice>\n-\tfromEntityName(const MediaDevice *media, const std::string &entity);\n+\tfromEntityName(const MediaDevice *media, std::string_view entity);\n \n \tV4L2PixelFormat toV4L2PixelFormat(const PixelFormat &pixelFormat) const;\n \n@@ -295,7 +296,7 @@ private:\n class V4L2M2MDevice\n {\n public:\n-\tV4L2M2MDevice(const std::string &deviceNode);\n+\tV4L2M2MDevice(std::string_view deviceNode);\n \t~V4L2M2MDevice();\n \n \tint open();\ndiff --git a/src/libcamera/device_enumerator.cpp b/src/libcamera/device_enumerator.cpp\nindex ae17862f676310ef..1efc5b33639f6af8 100644\n--- a/src/libcamera/device_enumerator.cpp\n+++ b/src/libcamera/device_enumerator.cpp\n@@ -67,7 +67,7 @@ LOG_DEFINE_CATEGORY(DeviceEnumerator)\n * \\brief Construct a media device search pattern\n * \\param[in] driver The Linux device driver name that created the media device\n */\n-DeviceMatch::DeviceMatch(const std::string &driver)\n+DeviceMatch::DeviceMatch(std::string_view driver)\n \t: driver_(driver)\n {\n }\n@@ -76,9 +76,9 @@ DeviceMatch::DeviceMatch(const std::string &driver)\n * \\brief Add a media entity name to the search pattern\n * \\param[in] entity The name of the entity in the media graph\n */\n-void DeviceMatch::add(const std::string &entity)\n+void DeviceMatch::add(std::string_view entity)\n {\n-\tentities_.push_back(entity);\n+\tentities_.push_back(std::string(entity));\n }\n \n /**\n@@ -215,7 +215,7 @@ DeviceEnumerator::~DeviceEnumerator()\n *\n * \\return Created media device instance on success, or nullptr otherwise\n */\n-std::unique_ptr<MediaDevice> DeviceEnumerator::createDevice(const std::string &deviceNode)\n+std::unique_ptr<MediaDevice> DeviceEnumerator::createDevice(std::string_view deviceNode)\n {\n \tstd::unique_ptr<MediaDevice> media = std::make_unique<MediaDevice>(deviceNode);\n \n@@ -272,7 +272,7 @@ void DeviceEnumerator::addDevice(std::unique_ptr<MediaDevice> media)\n * enumerator with addDevice(). The media device's MediaDevice::disconnected\n * signal is emitted.\n */\n-void DeviceEnumerator::removeDevice(const std::string &deviceNode)\n+void DeviceEnumerator::removeDevice(std::string_view deviceNode)\n {\n \tstd::shared_ptr<MediaDevice> media;\n \ndiff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp\nindex bfcdfc08960dbbad..112dfe66b4747516 100644\n--- a/src/libcamera/formats.cpp\n+++ b/src/libcamera/formats.cpp\n@@ -1037,7 +1037,7 @@ const PixelFormatInfo &PixelFormatInfo::info(const V4L2PixelFormat &format)\n * \\return The PixelFormatInfo describing the PixelFormat matching the\n * \\a name if known, or an invalid PixelFormatInfo otherwise\n */\n-const PixelFormatInfo &PixelFormatInfo::info(const std::string &name)\n+const PixelFormatInfo &PixelFormatInfo::info(std::string_view name)\n {\n \tfor (const auto &info : pixelFormatInfo) {\n \t\tif (info.second.name == name)\ndiff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp\nindex 9ca74be6e100a8fa..90e3148d236f3a3c 100644\n--- a/src/libcamera/ipa_module.cpp\n+++ b/src/libcamera/ipa_module.cpp\n@@ -254,7 +254,7 @@ Span<const uint8_t> elfLoadSymbol(Span<const uint8_t> elf, const char *symbol)\n * The caller shall call the isValid() function after constructing an\n * IPAModule instance to verify the validity of the IPAModule.\n */\n-IPAModule::IPAModule(const std::string &libPath)\n+IPAModule::IPAModule(std::string_view libPath)\n \t: libPath_(libPath), valid_(false), loaded_(false),\n \t dlHandle_(nullptr), ipaCreate_(nullptr)\n {\ndiff --git a/src/libcamera/ipa_proxy.cpp b/src/libcamera/ipa_proxy.cpp\nindex 85004737c17100bf..a06bd94ff435021e 100644\n--- a/src/libcamera/ipa_proxy.cpp\n+++ b/src/libcamera/ipa_proxy.cpp\n@@ -95,8 +95,8 @@ IPAProxy::~IPAProxy()\n * \\return The full path to the IPA configuration file, or an empty string if\n * no configuration file can be found\n */\n-std::string IPAProxy::configurationFile(const std::string &name,\n-\t\t\t\t\tconst std::string &fallbackName) const\n+std::string IPAProxy::configurationFile(std::string_view name,\n+\t\t\t\t\tstd::string_view fallbackName) const\n {\n \tstruct stat statbuf;\n \tint ret;\n@@ -178,9 +178,9 @@ std::string IPAProxy::configurationFile(const std::string &name,\n * \\return The full path to the proxy worker executable, or an empty string if\n * no valid executable path\n */\n-std::string IPAProxy::resolvePath(const std::string &file) const\n+std::string IPAProxy::resolvePath(std::string_view file) const\n {\n-\tstd::string proxyFile = \"/\" + file;\n+\tstd::string proxyFile = std::string(\"/\") + file;\n \n \t/* Check env variable first. */\n \tconst char *execPaths = utils::secure_getenv(\"LIBCAMERA_IPA_PROXY_PATH\");\ndiff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp\nindex d71dad74df70d1fc..34f2a78fcc287066 100644\n--- a/src/libcamera/media_device.cpp\n+++ b/src/libcamera/media_device.cpp\n@@ -62,7 +62,7 @@ LOG_DEFINE_CATEGORY(MediaDevice)\n * Once constructed the media device is invalid, and must be populated with\n * populate() before the media graph can be queried.\n */\n-MediaDevice::MediaDevice(const std::string &deviceNode)\n+MediaDevice::MediaDevice(std::string_view deviceNode)\n \t: deviceNode_(deviceNode), valid_(false), acquired_(false)\n {\n }\n@@ -331,7 +331,7 @@ done:\n * \\param[in] name The entity name\n * \\return The entity with \\a name, or nullptr if no such entity is found\n */\n-MediaEntity *MediaDevice::getEntityByName(const std::string &name) const\n+MediaEntity *MediaDevice::getEntityByName(std::string_view name) const\n {\n \tfor (MediaEntity *e : entities_)\n \t\tif (e->name() == name)\n@@ -359,8 +359,8 @@ MediaEntity *MediaDevice::getEntityByName(const std::string &name) const\n * \\return The link that connects the two pads, or nullptr if no such a link\n * exists\n */\n-MediaLink *MediaDevice::link(const std::string &sourceName, unsigned int sourceIdx,\n-\t\t\t const std::string &sinkName, unsigned int sinkIdx)\n+MediaLink *MediaDevice::link(std::string_view sourceName, unsigned int sourceIdx,\n+\t\t\t std::string_view sinkName, unsigned int sinkIdx)\n {\n \tconst MediaEntity *source = getEntityByName(sourceName);\n \tconst MediaEntity *sink = getEntityByName(sinkName);\n@@ -382,8 +382,8 @@ MediaLink *MediaDevice::link(const std::string &sourceName, unsigned int sourceI\n * entity \\a source, to the pad at index \\a sinkIdx of the sink entity \\a\n * sink, if any.\n *\n- * \\sa link(const std::string &sourceName, unsigned int sourceIdx,\n- * const std::string &sinkName, unsigned int sinkIdx)\n+ * \\sa link(std::string_view sourceName, unsigned int sourceIdx,\n+ * std::string_view sinkName, unsigned int sinkIdx)\n * \\sa link(const MediaPad *source, const MediaPad *sink)\n *\n * \\return The link that connects the two pads, or nullptr if no such a link\n@@ -406,8 +406,8 @@ MediaLink *MediaDevice::link(const MediaEntity *source, unsigned int sourceIdx,\n * \\param[in] source The source pad\n * \\param[in] sink The sink pad\n *\n- * \\sa link(const std::string &sourceName, unsigned int sourceIdx,\n- * const std::string &sinkName, unsigned int sinkIdx)\n+ * \\sa link(std::string_view sourceName, unsigned int sourceIdx,\n+ * std::string_view sinkName, unsigned int sinkIdx)\n * \\sa link(const MediaEntity *source, unsigned int sourceIdx,\n * const MediaEntity *sink, unsigned int sinkIdx)\n *\ndiff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\nindex 8c2c6baf35751d64..51a32316b7008790 100644\n--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n@@ -12,6 +12,7 @@\n #include <memory>\n #include <set>\n #include <string>\n+#include <string_view>\n #include <vector>\n \n #include <libcamera/base/log.h>\n@@ -571,7 +572,7 @@ bool UVCCameraData::generateId()\n \n \t/* Create a controller ID from first device described in firmware. */\n \tstd::string controllerId;\n-\tstd::string searchPath = path;\n+\tstd::string_view searchPath{ path };\n \twhile (true) {\n \t\tstd::string::size_type pos = searchPath.rfind('/');\n \t\tif (pos <= 1) {\ndiff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\nindex caa5c20e74836956..4cf9e8256503efac 100644\n--- a/src/libcamera/pipeline_handler.cpp\n+++ b/src/libcamera/pipeline_handler.cpp\n@@ -595,8 +595,8 @@ void PipelineHandler::cancelRequest(Request *request)\n * \\return The full path to the pipeline handler configuration file, or an empty\n * string if no configuration file can be found\n */\n-std::string PipelineHandler::configurationFile(const std::string &subdir,\n-\t\t\t\t\t const std::string &name) const\n+std::string PipelineHandler::configurationFile(std::string_view subdir,\n+\t\t\t\t\t std::string_view name) const\n {\n \tstd::string confPath;\n \tstruct stat statbuf;\n@@ -852,7 +852,7 @@ std::vector<PipelineHandlerFactoryBase *> &PipelineHandlerFactoryBase::factories\n * \\param[in] name The pipeline handler name\n * \\return The factory of the pipeline with name \\a name, or nullptr if not found\n */\n-const PipelineHandlerFactoryBase *PipelineHandlerFactoryBase::getFactoryByName(const std::string &name)\n+const PipelineHandlerFactoryBase *PipelineHandlerFactoryBase::getFactoryByName(std::string_view name)\n {\n \tconst std::vector<PipelineHandlerFactoryBase *> &factories =\n \t\tPipelineHandlerFactoryBase::factories();\ndiff --git a/src/libcamera/sensor/camera_sensor_properties.cpp b/src/libcamera/sensor/camera_sensor_properties.cpp\nindex 2b06c5a1a5d15abd..4283cacfa5e0b44a 100644\n--- a/src/libcamera/sensor/camera_sensor_properties.cpp\n+++ b/src/libcamera/sensor/camera_sensor_properties.cpp\n@@ -78,9 +78,9 @@ LOG_DEFINE_CATEGORY(CameraSensorProperties)\n * \\return A pointer to the CameraSensorProperties instance associated with a sensor\n * or nullptr if the sensor is not supported\n */\n-const CameraSensorProperties *CameraSensorProperties::get(const std::string &sensor)\n+const CameraSensorProperties *CameraSensorProperties::get(std::string_view sensor)\n {\n-\tstatic const std::map<std::string, const CameraSensorProperties> sensorProps = {\n+\tstatic const std::map<std::string_view, const CameraSensorProperties> sensorProps = {\n \t\t{ \"ar0144\", {\n \t\t\t.unitCellSize = { 3000, 3000 },\n \t\t\t.testPatternModes = {\ndiff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp\nindex 2bea64d9f9947e09..5ca215ed4d5c6abc 100644\n--- a/src/libcamera/software_isp/software_isp.cpp\n+++ b/src/libcamera/software_isp/software_isp.cpp\n@@ -9,6 +9,7 @@\n \n #include <cmath>\n #include <stdint.h>\n+#include <string>\n #include <sys/mman.h>\n #include <sys/types.h>\n #include <unistd.h>\n@@ -148,7 +149,7 @@ SoftwareIsp::~SoftwareIsp()\n }\n \n /**\n- * \\fn int SoftwareIsp::loadConfiguration([[maybe_unused]] const std::string &filename)\n+ * \\fn int SoftwareIsp::loadConfiguration([[maybe_unused]] std::string_view filename)\n * \\brief Load a configuration from a file\n * \\param[in] filename The file to load the configuration data from\n *\ndiff --git a/src/libcamera/sysfs.cpp b/src/libcamera/sysfs.cpp\nindex cbde72d86fd62b41..c1e2b0494e35d6bb 100644\n--- a/src/libcamera/sysfs.cpp\n+++ b/src/libcamera/sysfs.cpp\n@@ -15,6 +15,8 @@\n #include <libcamera/base/file.h>\n #include <libcamera/base/log.h>\n \n+using namespace std::literals::string_literals;\n+\n /**\n * \\file sysfs.h\n * \\brief Miscellaneous utility functions to access sysfs\n@@ -67,13 +69,13 @@ std::string charDevPath(const std::string &deviceNode)\n *\n * \\return The firmware node path on success or an empty string on failure\n */\n-std::string firmwareNodePath(const std::string &device)\n+std::string firmwareNodePath(std::string_view device)\n {\n \tstd::string fwPath, node;\n \tstruct stat st;\n \n \t/* Lookup for DT-based systems */\n-\tnode = device + \"/of_node\";\n+\tnode = device + \"/of_node\"s;\n \tif (!stat(node.c_str(), &st)) {\n \t\tchar *ofPath = realpath(node.c_str(), nullptr);\n \t\tif (!ofPath)\n@@ -91,7 +93,7 @@ std::string firmwareNodePath(const std::string &device)\n \t}\n \n \t/* Lookup for ACPI-based systems */\n-\tnode = device + \"/firmware_node/path\";\n+\tnode = device + \"/firmware_node/path\"s;\n \tif (File::exists(node.c_str())) {\n \t\tstd::ifstream file(node);\n \t\tif (!file.is_open())\ndiff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 664b74afe6a12757..a8eda2d84357d355 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -56,7 +56,7 @@ LOG_DEFINE_CATEGORY(V4L2)\n * Initialize the file descriptor to -1 and store the \\a deviceNode to be used\n * at open() time, and the \\a logTag to prefix log messages with.\n */\n-V4L2Device::V4L2Device(const std::string &deviceNode)\n+V4L2Device::V4L2Device(std::string_view deviceNode)\n \t: deviceNode_(deviceNode), fdEventNotifier_(nullptr),\n \t frameStartEnabled_(false)\n {\ndiff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\nindex 3a0d075f93c457d1..fece69e575b718e1 100644\n--- a/src/libcamera/v4l2_subdevice.cpp\n+++ b/src/libcamera/v4l2_subdevice.cpp\n@@ -1687,8 +1687,7 @@ const std::string &V4L2Subdevice::model()\n * \\return A newly created V4L2Subdevice on success, nullptr otherwise\n */\n std::unique_ptr<V4L2Subdevice>\n-V4L2Subdevice::fromEntityName(const MediaDevice *media,\n-\t\t\t const std::string &entity)\n+V4L2Subdevice::fromEntityName(const MediaDevice *media, std::string_view entity)\n {\n \tMediaEntity *mediaEntity = media->getEntityByName(entity);\n \tif (!mediaEntity)\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex a5cf67845ce3600b..91891ffb1590d5b0 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -531,7 +531,7 @@ std::ostream &operator<<(std::ostream &out, const V4L2DeviceFormat &f)\n * \\brief Construct a V4L2VideoDevice\n * \\param[in] deviceNode The file-system path to the video device node\n */\n-V4L2VideoDevice::V4L2VideoDevice(const std::string &deviceNode)\n+V4L2VideoDevice::V4L2VideoDevice(std::string_view deviceNode)\n \t: V4L2Device(deviceNode), formatInfo_(nullptr), cache_(nullptr),\n \t fdBufferNotifier_(nullptr), state_(State::Stopped),\n \t watchdogDuration_(0.0)\n@@ -2076,8 +2076,7 @@ void V4L2VideoDevice::watchdogExpired()\n * \\return A newly created V4L2VideoDevice on success, nullptr otherwise\n */\n std::unique_ptr<V4L2VideoDevice>\n-V4L2VideoDevice::fromEntityName(const MediaDevice *media,\n-\t\t\t\tconst std::string &entity)\n+V4L2VideoDevice::fromEntityName(const MediaDevice *media, std::string_view entity)\n {\n \tMediaEntity *mediaEntity = media->getEntityByName(entity);\n \tif (!mediaEntity)\n@@ -2160,7 +2159,7 @@ V4L2PixelFormat V4L2VideoDevice::toV4L2PixelFormat(const PixelFormat &pixelForma\n * \\brief Create a new V4L2M2MDevice from the \\a deviceNode\n * \\param[in] deviceNode The file-system path to the video device node\n */\n-V4L2M2MDevice::V4L2M2MDevice(const std::string &deviceNode)\n+V4L2M2MDevice::V4L2M2MDevice(std::string_view deviceNode)\n \t: deviceNode_(deviceNode)\n {\n \toutput_ = new V4L2VideoDevice(deviceNode);\n", "prefixes": [ "RFC", "6/8" ] }