Skip to content

Commit f0453bd

Browse files
committed
build: eliminate warning
warning: 'layout.channel_layout::gchan' may be used uninitialized in this function [-Wmaybe-uninitialized]
1 parent 116c8d0 commit f0453bd

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

modules/imgcodecs/src/grfmt_pam.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ bool PAMDecoder::readData( Mat& img )
487487
bool res = false, funcout;
488488
PaletteEntry palette[256];
489489
const struct pam_format *fmt = NULL;
490-
struct channel_layout layout;
490+
struct channel_layout layout = { 0, 0, 0, 0 }; // normalized to 1-channel grey format
491491

492492
/* setting buffer to max data size so scaling up is possible */
493493
AutoBuffer<uchar> _src(src_elems_per_row * 2);
@@ -506,9 +506,7 @@ bool PAMDecoder::readData( Mat& img )
506506
layout.bchan = 0;
507507
layout.gchan = 1;
508508
layout.rchan = 2;
509-
} else
510-
layout.bchan = layout.gchan = layout.rchan = 0;
511-
layout.graychan = 0;
509+
}
512510
}
513511

514512
CV_TRY

0 commit comments

Comments
 (0)