From 54ca1d190e02aa524d1dbaa18b1280ab54089820 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Fri, 27 Aug 2021 07:44:03 +0200 Subject: [PATCH] SW_RenderGeometry: add a redundant check to clear static analysis (see bug #4600) --- src/render/direct3d/SDL_render_d3d.c | 1 + src/render/direct3d11/SDL_render_d3d11.c | 1 + src/render/metal/SDL_render_metal.m | 1 + src/render/opengl/SDL_render_gl.c | 1 + src/render/opengles/SDL_render_gles.c | 1 + src/render/opengles2/SDL_render_gles2.c | 1 + src/render/software/SDL_render_sw.c | 1 + 7 files changed, 7 insertions(+) diff --git a/src/render/direct3d/SDL_render_d3d.c b/src/render/direct3d/SDL_render_d3d.c index f57598bd0..a847631df 100644 --- a/src/render/direct3d/SDL_render_d3d.c +++ b/src/render/direct3d/SDL_render_d3d.c @@ -1036,6 +1036,7 @@ D3D_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *t } cmd->data.draw.count = count; + size_indices = indices ? size_indices : 0; for (i = 0; i < count; i++) { int j; diff --git a/src/render/direct3d11/SDL_render_d3d11.c b/src/render/direct3d11/SDL_render_d3d11.c index 436881be6..979296b6a 100644 --- a/src/render/direct3d11/SDL_render_d3d11.c +++ b/src/render/direct3d11/SDL_render_d3d11.c @@ -1881,6 +1881,7 @@ D3D11_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture } cmd->data.draw.count = count; + size_indices = indices ? size_indices : 0; for (i = 0; i < count; i++) { int j; diff --git a/src/render/metal/SDL_render_metal.m b/src/render/metal/SDL_render_metal.m index 48312c3e8..217ffdce4 100644 --- a/src/render/metal/SDL_render_metal.m +++ b/src/render/metal/SDL_render_metal.m @@ -1333,6 +1333,7 @@ METAL_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture } cmd->data.draw.count = count; + size_indices = indices ? size_indices : 0; for (int i = 0; i < count; i++) { int j; diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index a8453308a..c267267c5 100644 --- a/src/render/opengl/SDL_render_gl.c +++ b/src/render/opengl/SDL_render_gl.c @@ -1074,6 +1074,7 @@ GL_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *te } cmd->data.draw.count = count; + size_indices = indices ? size_indices : 0; for (i = 0; i < count; i++) { int j; diff --git a/src/render/opengles/SDL_render_gles.c b/src/render/opengles/SDL_render_gles.c index 7ffc34984..93480140c 100644 --- a/src/render/opengles/SDL_render_gles.c +++ b/src/render/opengles/SDL_render_gles.c @@ -778,6 +778,7 @@ GLES_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture * } cmd->data.draw.count = count; + size_indices = indices ? size_indices : 0; for (i = 0; i < count; i++) { int j; diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c index 835da419b..f342dc309 100644 --- a/src/render/opengles2/SDL_render_gles2.c +++ b/src/render/opengles2/SDL_render_gles2.c @@ -955,6 +955,7 @@ GLES2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture } cmd->data.draw.count = count; + size_indices = indices ? size_indices : 0; for (i = 0; i < count; i++) { int j; diff --git a/src/render/software/SDL_render_sw.c b/src/render/software/SDL_render_sw.c index 233b79279..fd1c2dc55 100644 --- a/src/render/software/SDL_render_sw.c +++ b/src/render/software/SDL_render_sw.c @@ -593,6 +593,7 @@ SW_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *te } cmd->data.draw.count = count; + size_indices = indices ? size_indices : 0; if (texture) { GeometryCopyData *ptr = (GeometryCopyData *) verts;