From 9d261cbb55f64d4041d1a7e44b39e2d63082a218 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 7 Jul 2012 13:27:47 +0000 Subject: [PATCH] Avoid warnings about uninitialized variables in TGA loading code. Initialize the variables containing the colour components: even though they should normally be always filled by Palette_GetRGB() call below, this presumably might not happen for a corrupted image with invalid palette table entries and g++ correctly complains about it. See #14459. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71975 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/imagtga.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/common/imagtga.cpp b/src/common/imagtga.cpp index e7203f3065..9a5c4ccd87 100644 --- a/src/common/imagtga.cpp +++ b/src/common/imagtga.cpp @@ -292,9 +292,9 @@ int ReadTGA(wxImage* image, wxInputStream& stream) case 1: { - unsigned char r; - unsigned char g; - unsigned char b; + unsigned char r = 0; + unsigned char g = 0; + unsigned char b = 0; // No compression read the data directly to imageData. @@ -486,9 +486,9 @@ int ReadTGA(wxImage* image, wxInputStream& stream) case 9: { - unsigned char r; - unsigned char g; - unsigned char b; + unsigned char r = 0; + unsigned char g = 0; + unsigned char b = 0; // Decode the RLE data. -- 2.45.2