From b078122c5301fab82a8ac99554a1bae17fb5ef96 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 30 Mar 2023 14:02:02 -0700
Subject: [PATCH] Fixed Visual Studio warning 4701
---
src/render/SDL_render.c | 2 ++
src/stdlib/SDL_string.c | 10 ++--------
src/video/SDL_RLEaccel.c | 2 +-
src/video/SDL_vulkan_utils.c | 2 +-
4 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index 7db0398b5fae..7437db8e255a 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -3680,6 +3680,8 @@ static int SDLCALL SDL_SW_RenderGeometryRaw(SDL_Renderer *renderer,
s.y = uv0_[1] * texh;
s.w = uv1_[0] * texw - s.x;
s.h = uv1_[1] * texh - s.y;
+ } else {
+ s.x = s.y = s.w = s.h = 0;
}
d.x = xy0_[0];
diff --git a/src/stdlib/SDL_string.c b/src/stdlib/SDL_string.c
index dc47d60d6d45..6b838714579e 100644
--- a/src/stdlib/SDL_string.c
+++ b/src/stdlib/SDL_string.c
@@ -1050,7 +1050,7 @@ int SDL_strncmp(const char *str1, const char *str2, size_t maxlen)
#if defined(HAVE_STRNCMP)
return strncmp(str1, str2, maxlen);
#else
- int result;
+ int result = 0;
while (maxlen) {
result = (int)(unsigned char)*str1 - (unsigned char)*str2;
@@ -1061,9 +1061,6 @@ int SDL_strncmp(const char *str1, const char *str2, size_t maxlen)
++str2;
--maxlen;
}
- if (!maxlen) {
- result = 0;
- }
return result;
#endif /* HAVE_STRNCMP */
}
@@ -1098,7 +1095,7 @@ int SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen)
#elif defined(HAVE__STRNICMP)
return _strnicmp(str1, str2, maxlen);
#else
- int a, b, result;
+ int a, b, result = 0;
while (maxlen) {
a = SDL_tolower((unsigned char)*str1);
@@ -1111,9 +1108,6 @@ int SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen)
++str2;
--maxlen;
}
- if (maxlen == 0) {
- result = 0;
- }
return result;
#endif /* HAVE_STRNCASECMP */
}
diff --git a/src/video/SDL_RLEaccel.c b/src/video/SDL_RLEaccel.c
index d9c81f38819d..1a3ee4a0e4ef 100644
--- a/src/video/SDL_RLEaccel.c
+++ b/src/video/SDL_RLEaccel.c
@@ -175,7 +175,7 @@
Uint8 *src = from; \
Uint8 *dst = to; \
for (i = 0; i < (int)(length); i++) { \
- Uint32 s, d; \
+ Uint32 s = 0, d = 0; \
unsigned rs, gs, bs, rd, gd, bd; \
switch (bpp) { \
case 2: \
diff --git a/src/video/SDL_vulkan_utils.c b/src/video/SDL_vulkan_utils.c
index d2f5599ea1ff..2993fc7991a8 100644
--- a/src/video/SDL_vulkan_utils.c
+++ b/src/video/SDL_vulkan_utils.c
@@ -273,7 +273,7 @@ SDL_bool SDL_Vulkan_Display_CreateSurface(void *vkGetInstanceProcAddr_,
VkDisplayKHR display;
VkDisplayPlanePropertiesKHR *displayPlaneProperties = NULL;
VkExtent2D extent;
- VkDisplayPlaneCapabilitiesKHR planeCaps;
+ VkDisplayPlaneCapabilitiesKHR planeCaps = { 0 };
/* Get information about the physical displays */
result = vkGetPhysicalDeviceDisplayPropertiesKHR(physicalDevice, &displayPropertiesCount, NULL);