Skip to content

Commit

Permalink
fix maybe-uninitialized warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Karry committed Dec 18, 2020
1 parent 90deeb6 commit a073edc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/pipeline_cpt_v4l.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ namespace timelapse {
frmsize.pixel_format = fmt.pixelformat;
frmsize.index = 0;
while (v4l2_ioctl(fd, VIDIOC_ENUM_FRAMESIZES, &frmsize) >= 0) {
uint32_t w;
uint32_t h;
uint32_t w = 0;
uint32_t h = 0;
if (frmsize.type == V4L2_FRMSIZE_TYPE_DISCRETE) {
w = frmsize.discrete.width;
h = frmsize.discrete.height;
Expand All @@ -172,7 +172,10 @@ namespace timelapse {
h = frmsize.stepwise.max_height;
}

if ((w > v4lfmt.fmt.pix.width && h > v4lfmt.fmt.pix.height && fmt.pixelformat == V4L2_PIX_FMT_RGB24)) {
if (w > v4lfmt.fmt.pix.width &&
h > v4lfmt.fmt.pix.height &&
fmt.pixelformat == V4L2_PIX_FMT_RGB24) {

v4lfmt.fmt.pix.width = w;
v4lfmt.fmt.pix.height = h;
v4lfmt.fmt.pix.pixelformat = fmt.pixelformat;
Expand Down

0 comments on commit a073edc

Please sign in to comment.