[libcamera-devel,v3,3/7] libcamera: V4L2BufferCache: Mark Entry::operator==() as const

Message ID 20200304232246.325384-4-niklas.soderlund@ragnatech.se
State Accepted
Headers show
Series
  • libcamera: V4L2BufferCache: Improve cache
Related show

Commit Message

Niklas Söderlund March 4, 2020, 11:22 p.m. UTC
The comparison operator does not change any state, mark it as const.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
---
 src/libcamera/include/v4l2_videodevice.h | 2 +-
 src/libcamera/v4l2_videodevice.cpp       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Laurent Pinchart March 4, 2020, 11:27 p.m. UTC | #1
Hi Niklas,

Thank you for the patch.

On Thu, Mar 05, 2020 at 12:22:42AM +0100, Niklas Söderlund wrote:
> The comparison operator does not change any state, mark it as const.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  src/libcamera/include/v4l2_videodevice.h | 2 +-
>  src/libcamera/v4l2_videodevice.cpp       | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/libcamera/include/v4l2_videodevice.h b/src/libcamera/include/v4l2_videodevice.h
> index fcf072641420dacf..359b366454e4e782 100644
> --- a/src/libcamera/include/v4l2_videodevice.h
> +++ b/src/libcamera/include/v4l2_videodevice.h
> @@ -122,7 +122,7 @@ private:
>  		Entry();
>  		Entry(bool free, const FrameBuffer &buffer);
>  
> -		bool operator==(const FrameBuffer &buffer);
> +		bool operator==(const FrameBuffer &buffer) const;
>  
>  		bool free;
>  
> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
> index 99470ce11421c77c..d88cb0bd0771e545 100644
> --- a/src/libcamera/v4l2_videodevice.cpp
> +++ b/src/libcamera/v4l2_videodevice.cpp
> @@ -256,7 +256,7 @@ V4L2BufferCache::Entry::Entry(bool free, const FrameBuffer &buffer)
>  		planes_.emplace_back(plane);
>  }
>  
> -bool V4L2BufferCache::Entry::operator==(const FrameBuffer &buffer)
> +bool V4L2BufferCache::Entry::operator==(const FrameBuffer &buffer) const
>  {
>  	const std::vector<FrameBuffer::Plane> &planes = buffer.planes();
>

Patch

diff --git a/src/libcamera/include/v4l2_videodevice.h b/src/libcamera/include/v4l2_videodevice.h
index fcf072641420dacf..359b366454e4e782 100644
--- a/src/libcamera/include/v4l2_videodevice.h
+++ b/src/libcamera/include/v4l2_videodevice.h
@@ -122,7 +122,7 @@  private:
 		Entry();
 		Entry(bool free, const FrameBuffer &buffer);
 
-		bool operator==(const FrameBuffer &buffer);
+		bool operator==(const FrameBuffer &buffer) const;
 
 		bool free;
 
diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
index 99470ce11421c77c..d88cb0bd0771e545 100644
--- a/src/libcamera/v4l2_videodevice.cpp
+++ b/src/libcamera/v4l2_videodevice.cpp
@@ -256,7 +256,7 @@  V4L2BufferCache::Entry::Entry(bool free, const FrameBuffer &buffer)
 		planes_.emplace_back(plane);
 }
 
-bool V4L2BufferCache::Entry::operator==(const FrameBuffer &buffer)
+bool V4L2BufferCache::Entry::operator==(const FrameBuffer &buffer) const
 {
 	const std::vector<FrameBuffer::Plane> &planes = buffer.planes();