From a7f7ffe0619fc89b83091411882f8108dd8aa041 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Tue, 22 Sep 2026 02:10:20 +0300
Subject: [PATCH] fix 'missing initializer' warnings from old gcc versions
(cherry picked from commit 0b6d09e99be72c077844f298a891628f6ddc56c0)
---
examples/showgpuimage.c | 3 ++-
src/IMG_gif.c | 4 ++--
src/IMG_gpu.c | 14 +++++++++-----
3 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/examples/showgpuimage.c b/examples/showgpuimage.c
index 7bdbb3633..df4679d1b 100644
--- a/examples/showgpuimage.c
+++ b/examples/showgpuimage.c
@@ -70,7 +70,7 @@ int main(int argc, char *argv[])
SDL_GPUTexture *swapchain_texture = NULL;
Uint32 swapchain_width = 0;
Uint32 swapchain_height = 0;
- SDL_GPUBlitInfo blit_info = {0};
+ SDL_GPUBlitInfo blit_info;
if (!SDL_Init(SDL_INIT_VIDEO)) {
SDL_Log("SDL_Init(SDL_INIT_VIDEO) failed: %s", SDL_GetError());
@@ -146,6 +146,7 @@ int main(int argc, char *argv[])
}
if (texture) {
+ SDL_zero(blit_info);
blit_info.source.texture = texture;
blit_info.source.w = texture_width;
blit_info.source.h = texture_height;
diff --git a/src/IMG_gif.c b/src/IMG_gif.c
index 46555383e..7f2b4f477 100644
--- a/src/IMG_gif.c
+++ b/src/IMG_gif.c
@@ -780,7 +780,7 @@ static bool IMG_AnimationDecoderReset_Internal(IMG_AnimationDecoder *decoder)
ctx->got_header = false;
ctx->got_eof = false;
ctx->last_disposal = GIF_DISPOSE_NONE;
- SDL_Rect r = {0};
+ SDL_Rect r = {0,0,0,0};
ctx->restore_area = r;
// We don't care about metadata when resetting to re-read.
@@ -1011,7 +1011,7 @@ bool IMG_CreateGIFAnimationDecoder(IMG_AnimationDecoder *decoder, SDL_Properties
ctx->current_delay = 100;
ctx->current_disposal = GIF_DISPOSE_NA;
ctx->last_disposal = GIF_DISPOSE_NONE;
- SDL_Rect r = {0};
+ SDL_Rect r = {0,0,0,0};
ctx->restore_area = r;
ctx->single_frame = SDL_GetBooleanProperty(props, IMG_PROP_ANIMATION_DECODER_CREATE_GIF_SINGLE_IMAGE_BOOLEAN, false);
diff --git a/src/IMG_gpu.c b/src/IMG_gpu.c
index e0ae2333c..b0daa32c1 100644
--- a/src/IMG_gpu.c
+++ b/src/IMG_gpu.c
@@ -42,7 +42,8 @@ static SDL_GPUTexture * LoadGPUTexture(SDL_GPUDevice *device, SDL_GPUCopyPass *c
}
}
- SDL_GPUTextureCreateInfo texture_create_info = {0};
+ SDL_GPUTextureCreateInfo texture_create_info;
+ SDL_zero(texture_create_info);
texture_create_info.format = SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM;
texture_create_info.type = SDL_GPU_TEXTURETYPE_2D;
texture_create_info.layer_count_or_depth = 1;
@@ -50,13 +51,14 @@ static SDL_GPUTexture * LoadGPUTexture(SDL_GPUDevice *device, SDL_GPUCopyPass *c
texture_create_info.usage = SDL_GPU_TEXTUREUSAGE_SAMPLER | SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ;
texture_create_info.width = surface->w;
texture_create_info.height = surface->h;
- SDL_GPUTexture *texture = SDL_CreateGPUTexture(device, &texture_create_info);
+ SDL_GPUTexture *texture = SDL_CreateGPUTexture(device, &texture_create_info);
if (!texture) {
SDL_DestroySurface(surface);
return NULL;
}
- SDL_GPUTransferBufferCreateInfo transfer_buffer_create_info = {0};
+ SDL_GPUTransferBufferCreateInfo transfer_buffer_create_info;
+ SDL_zero(transfer_buffer_create_info);
transfer_buffer_create_info.size = surface->w * surface->h * 4;
transfer_buffer_create_info.usage = SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD;
SDL_GPUTransferBuffer *transfer_buffer = SDL_CreateGPUTransferBuffer(device, &transfer_buffer_create_info);
@@ -84,8 +86,10 @@ static SDL_GPUTexture * LoadGPUTexture(SDL_GPUDevice *device, SDL_GPUCopyPass *c
}
SDL_UnmapGPUTransferBuffer(device, transfer_buffer);
- SDL_GPUTextureTransferInfo texture_transfer_info = {0};
- SDL_GPUTextureRegion texture_region = {0};
+ SDL_GPUTextureTransferInfo texture_transfer_info;
+ SDL_GPUTextureRegion texture_region;
+ SDL_zero(texture_transfer_info);
+ SDL_zero(texture_region);
texture_transfer_info.transfer_buffer = transfer_buffer;
texture_region.texture = texture;
texture_region.w = surface->w;