From e4735af50dadb80dd1014dbf58fcc953c61bd750 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Sun, 18 Jun 2023 12:30:06 +0200
Subject: [PATCH] png: fix -Wclobber warning
Co-authored-by: Ozkan Sezer <sezeroz@gmail.com>
---
src/IMG_png.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/IMG_png.c b/src/IMG_png.c
index 589fa523..c8ba8635 100644
--- a/src/IMG_png.c
+++ b/src/IMG_png.c
@@ -242,11 +242,11 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src)
png_infop info_ptr;
png_uint_32 width, height;
int bit_depth, color_type, interlace_type, num_channels;
- Uint32 format = SDL_PIXELFORMAT_UNKNOWN;
+ Uint32 format;
SDL_Palette *palette;
png_bytep *row_pointers;
int row, i;
- int ckey = -1;
+ int ckey;
png_color_16 *transv;
if ( !src ) {
@@ -323,6 +323,7 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src)
/* For images with a single "transparent colour", set colour key;
if more than one index has transparency, or if partially transparent
entries exist, use full alpha channel */
+ ckey = -1;
if (lib.png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
int num_trans;
Uint8 *trans;
@@ -362,7 +363,8 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src)
/* Allocate the SDL surface to hold the image */
num_channels = lib.png_get_channels(png_ptr, info_ptr);
-
+
+ format = SDL_PIXELFORMAT_UNKNOWN;
if (num_channels == 3) {
format = SDL_PIXELFORMAT_RGB24;
} else if (num_channels == 4) {