[libcamera-devel,01/10] libcamera: stream: Initialize stride and bufferCount

Message ID 20200602013909.3170593-2-niklas.soderlund@ragnatech.se
State Superseded
Headers show
Series
  • libcamera: ipu3: Allow zero-copy RAW stream
Related show

Commit Message

Niklas Söderlund June 2, 2020, 1:39 a.m. UTC
The two public unsigned integer fields of StreamConfiguration, stride
and bufferCount where not initialized, fix this to match other members
being initialized to their 'zero' state.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
---
 src/libcamera/stream.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Jacopo Mondi June 2, 2020, 8:30 a.m. UTC | #1
Hi Niklas,

On Tue, Jun 02, 2020 at 03:39:00AM +0200, Niklas Söderlund wrote:
> The two public unsigned integer fields of StreamConfiguration, stride
> and bufferCount where not initialized, fix this to match other members
> being initialized to their 'zero' state.
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> ---
>  src/libcamera/stream.cpp | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp
> index f34348f2aea022a0..3c4f64daf69d68a4 100644
> --- a/src/libcamera/stream.cpp
> +++ b/src/libcamera/stream.cpp
> @@ -279,7 +279,7 @@ SizeRange StreamFormats::range(const PixelFormat &pixelformat) const
>   * handlers provied StreamFormats.
>   */
>  StreamConfiguration::StreamConfiguration()
> -	: pixelFormat(0), stream_(nullptr)
> +	: pixelFormat(0), stride(0), bufferCount(0), stream_(nullptr)
>  {
>  }
>
> @@ -287,7 +287,8 @@ StreamConfiguration::StreamConfiguration()
>   * \brief Construct a configuration with stream formats
>   */
>  StreamConfiguration::StreamConfiguration(const StreamFormats &formats)
> -	: pixelFormat(0), stream_(nullptr), formats_(formats)
> +	: pixelFormat(0), stride(0), bufferCount(0), stream_(nullptr),
> +	  formats_(formats)

No need to initialize size as well ?

(this could be a good occasion to re-order StreamConfiguration
declaration in stream.h as fields are declared before functions
there).

Anyway,
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
  j

>  {
>  }
>
> --
> 2.26.2
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Laurent Pinchart June 5, 2020, 9:42 p.m. UTC | #2
On Tue, Jun 02, 2020 at 10:30:29AM +0200, Jacopo Mondi wrote:
> Hi Niklas,
> 
> On Tue, Jun 02, 2020 at 03:39:00AM +0200, Niklas Söderlund wrote:
> > The two public unsigned integer fields of StreamConfiguration, stride
> > and bufferCount where not initialized, fix this to match other members
> > being initialized to their 'zero' state.
> >
> > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> > ---
> >  src/libcamera/stream.cpp | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp
> > index f34348f2aea022a0..3c4f64daf69d68a4 100644
> > --- a/src/libcamera/stream.cpp
> > +++ b/src/libcamera/stream.cpp
> > @@ -279,7 +279,7 @@ SizeRange StreamFormats::range(const PixelFormat &pixelformat) const
> >   * handlers provied StreamFormats.
> >   */
> >  StreamConfiguration::StreamConfiguration()
> > -	: pixelFormat(0), stream_(nullptr)
> > +	: pixelFormat(0), stride(0), bufferCount(0), stream_(nullptr)
> >  {
> >  }
> >
> > @@ -287,7 +287,8 @@ StreamConfiguration::StreamConfiguration()
> >   * \brief Construct a configuration with stream formats
> >   */
> >  StreamConfiguration::StreamConfiguration(const StreamFormats &formats)
> > -	: pixelFormat(0), stream_(nullptr), formats_(formats)
> > +	: pixelFormat(0), stride(0), bufferCount(0), stream_(nullptr),
> > +	  formats_(formats)
> 
> No need to initialize size as well ?

size_ is of type Size, and the default constructor initializes the
values.

> (this could be a good occasion to re-order StreamConfiguration
> declaration in stream.h as fields are declared before functions
> there).
> 
> Anyway,
> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

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

> >  {
> >  }
> >

Patch

diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp
index f34348f2aea022a0..3c4f64daf69d68a4 100644
--- a/src/libcamera/stream.cpp
+++ b/src/libcamera/stream.cpp
@@ -279,7 +279,7 @@  SizeRange StreamFormats::range(const PixelFormat &pixelformat) const
  * handlers provied StreamFormats.
  */
 StreamConfiguration::StreamConfiguration()
-	: pixelFormat(0), stream_(nullptr)
+	: pixelFormat(0), stride(0), bufferCount(0), stream_(nullptr)
 {
 }
 
@@ -287,7 +287,8 @@  StreamConfiguration::StreamConfiguration()
  * \brief Construct a configuration with stream formats
  */
 StreamConfiguration::StreamConfiguration(const StreamFormats &formats)
-	: pixelFormat(0), stream_(nullptr), formats_(formats)
+	: pixelFormat(0), stride(0), bufferCount(0), stream_(nullptr),
+	  formats_(formats)
 {
 }