[libcamera-devel] [PATCH v2 6/8] libcamera: device_enumerator: Don't mark the search() function as const
Niklas Söderlund
niklas.soderlund at ragnatech.se
Tue Jan 15 23:29:10 CET 2019
Hi Laurent,
Thanks for your patch.
On 2019-01-15 17:18:47 +0200, Laurent Pinchart wrote:
> 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>
Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> ---
> 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
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
--
Regards,
Niklas Söderlund
More information about the libcamera-devel
mailing list