[libcamera-devel] [PATCH v2 6/8] libcamera: device_enumerator: Don't mark the search() function as const
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Tue Jan 15 16:18:47 CET 2019
While the DeviceEnumerator::search() function doesn't modify the
instance directly, it returns a non-const pointer to a MediaEntity that
is owned by the DeviceEnumerator instance. This breaks the const
semantics. Don't mark the function as const.
Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
src/libcamera/device_enumerator.cpp | 2 +-
src/libcamera/include/device_enumerator.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/libcamera/device_enumerator.cpp b/src/libcamera/device_enumerator.cpp
index 1653e4f4651a..18d7e86843e8 100644
--- a/src/libcamera/device_enumerator.cpp
+++ b/src/libcamera/device_enumerator.cpp
@@ -245,7 +245,7 @@ int DeviceEnumerator::addDevice(const std::string &devnode)
*
* \return pointer to the matching MediaDevice, or nullptr if no match is found
*/
-MediaDevice *DeviceEnumerator::search(const DeviceMatch &dm) const
+MediaDevice *DeviceEnumerator::search(const DeviceMatch &dm)
{
for (MediaDevice *dev : devices_) {
if (dev->busy())
diff --git a/src/libcamera/include/device_enumerator.h b/src/libcamera/include/device_enumerator.h
index 29737da7a225..b68c815827dd 100644
--- a/src/libcamera/include/device_enumerator.h
+++ b/src/libcamera/include/device_enumerator.h
@@ -41,7 +41,7 @@ public:
virtual int init() = 0;
virtual int enumerate() = 0;
- MediaDevice *search(const DeviceMatch &dm) const;
+ MediaDevice *search(const DeviceMatch &dm);
protected:
int addDevice(const std::string &devnode);
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list