[libcamera-devel] [PATCH] test: byte-stream-buffer: Initialize data array

Niklas Söderlund niklas.soderlund at ragnatech.se
Sat May 22 17:21:32 CEST 2021


Fix compiler warning about variable use before being initialized that
appears with gcc 11.1.0.

    test/byte-stream-buffer.cpp:31:63: error: ‘data’ may be used uninitialized [-Werror=maybe-uninitialized]

Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
---
 test/byte-stream-buffer.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/byte-stream-buffer.cpp b/test/byte-stream-buffer.cpp
index d606f146f6ef04ed..c911a863d27122ae 100644
--- a/test/byte-stream-buffer.cpp
+++ b/test/byte-stream-buffer.cpp
@@ -20,7 +20,7 @@ class ByteStreamBufferTest : public Test
 protected:
 	int run()
 	{
-		std::array<uint8_t, 100> data;
+		std::array<uint8_t, 100> data = {};
 		unsigned int i;
 		uint32_t value;
 		int ret;
-- 
2.31.1



More information about the libcamera-devel mailing list