diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-11-04 09:06:43 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-11-07 20:24:31 +0200 |
commit | 2d43b8bcd8571dbce1969fa1fd50c655585f780b (patch) | |
tree | 2962b4cbd675c35813eb5cf54e2b4492e0bc277d /test/stream/stream_formats.cpp | |
parent | 9e10811bb5ec1cdace2041714f3235e94446738c (diff) |
libcamera: v4l2_videodevice: Zero-initialize planes in V4L2DeviceFormat
The V4L2DeviceFormat class doesn't have a default constructor, neither
does it specifies default member initializers for the plane-related
members. This results in the planes array and planesCount members being
uninitialized by default, leading to undefined behaviour if the user of
the class doesn't initialize it explicitly.
Most users initialize V4L2DeviceFormat instances, but some don't. We
could fix them, but that would likely turn into a game of whack-a-mole.
As there's no use case for instantiating a large number of
V4L2DeviceFormat instances in a performance-critical code path, let's
instead add default initializers to avoid future issues.
While at it, define a type of the structures containing plane
information, and use an std::array.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'test/stream/stream_formats.cpp')
0 files changed, 0 insertions, 0 deletions