diff options
author | Paul Elder <paul.elder@ideasonboard.com> | 2024-01-24 16:56:04 +0900 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2024-01-24 17:29:24 +0200 |
commit | 64502c8d4a3c0f440bf265a5ad03be00653957ba (patch) | |
tree | 70e55140a588ca61afea9e666f5fb5bd36813966 /src | |
parent | 4d9eac1a681fc7ea88c7cd4eef74c470cb0628dd (diff) |
apps: common: dng_writer: Add a default case for switch-case on a modulo
Clearly all cases in the switch are already satisfied, but some
compilers fail to realize this and spit out an error:
Compiler version: gcc 11.2.0 "aarch64-buildroot-linux-gnu-gcc.br_real (Buildroot 2021.11) 11.2.0"
../../src/apps/common/dng_writer.cpp: In function ‘void thumbScanlineIPU3(const FormatInfo&, void*, const void*, unsigned int, unsigned int)’:
../../src/apps/common/dng_writer.cpp:277:55: error: ‘val4’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
277 | uint8_t value = (val1 + val2 + val3 + val4) >> 10;
| ^~~~
../../src/apps/common/dng_writer.cpp:277:48: error: ‘val3’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
277 | uint8_t value = (val1 + val2 + val3 + val4) >> 10;
| ^~~~
../../src/apps/common/dng_writer.cpp:277:41: error: ‘val2’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
277 | uint8_t value = (val1 + val2 + val3 + val4) >> 10;
| ^~~~
../../src/apps/common/dng_writer.cpp:277:34: error: ‘val1’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
277 | uint8_t value = (val1 + val2 + val3 + val4) >> 10;
| ^~~~
Add a default case for the switch-case on a modulo to silence this.
Bug: https://bugs.libcamera.org/show_bug.cgi?id=207
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/apps/common/dng_writer.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/apps/common/dng_writer.cpp b/src/apps/common/dng_writer.cpp index c945edce..82bc065a 100644 --- a/src/apps/common/dng_writer.cpp +++ b/src/apps/common/dng_writer.cpp @@ -248,6 +248,7 @@ void thumbScanlineIPU3([[maybe_unused]] const FormatInfo &info, void *output, uint16_t val1, val2, val3, val4; switch (pixelInBlock % 4) { + default: case 0: val1 = (in[1] & 0x03) << 14 | (in[0] & 0xff) << 6; val2 = (in[2] & 0x0f) << 12 | (in[1] & 0xfc) << 4; |