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

Laurent Pinchart laurent.pinchart at ideasonboard.com
Fri Jun 5 23:42:52 CEST 2020


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 at 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 at jmondi.org>

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

> >  {
> >  }
> >

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list