SDL: sdlprocdump: become C90 compatible

From 18c9bd21b5c225b98226e3730948ef86e41cc4d8 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Sun, 7 Jul 2024 21:18:16 +0200
Subject: [PATCH] sdlprocdump: become C90 compatible

---
 test/CMakeLists.txt      |  1 +
 test/win32/sdlprocdump.c | 13 ++++++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 202599efa301b..e98f4c954da12 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -41,6 +41,7 @@ file(GLOB RESOURCE_FILES *.bmp *.wav *.hex moose.dat utf8.txt)
 if(WIN32 AND NOT WINDOWS_STORE)
     option(SDLTEST_PROCDUMP "Run tests using sdlprocdump for minidump generation" OFF)
     add_executable(sdlprocdump win32/sdlprocdump.c)
+    set_property(TARGET sdlprocdump PROPERTY C_STANDARD "90")
     SDL_AddCommonCompilerFlags(sdlprocdump)
     if(SDLTEST_PROCDUMP)
         set(CMAKE_TEST_LAUNCHER "$<TARGET_FILE:sdlprocdump>")
diff --git a/test/win32/sdlprocdump.c b/test/win32/sdlprocdump.c
index 7034297bee43c..edcb1369b7861 100644
--- a/test/win32/sdlprocdump.c
+++ b/test/win32/sdlprocdump.c
@@ -37,6 +37,8 @@ static void printf_message(const char *format, ...) {
 static void printf_windows_message(const char *format, ...) {
     va_list ap;
     char win_msg[512];
+    size_t win_msg_len;
+
     FormatMessageA(
         FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
         NULL,
@@ -44,7 +46,7 @@ static void printf_windows_message(const char *format, ...) {
         MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
         win_msg, sizeof(win_msg)/sizeof(*win_msg),
         NULL);
-    size_t win_msg_len = strlen(win_msg);
+    win_msg_len = strlen(win_msg);
     while (win_msg[win_msg_len-1] == '\r' || win_msg[win_msg_len-1] == '\n' || win_msg[win_msg_len-1] == ' ') {
         win_msg[win_msg_len-1] = '\0';
         win_msg_len--;
@@ -250,6 +252,7 @@ static void write_minidump(const char *child_file_path, const LPPROCESS_INFORMAT
 
 static void print_stacktrace(const LPPROCESS_INFORMATION process_information, PCONTEXT context, LPVOID address) {
     STACKFRAME64 stack_frame;
+    DWORD machine_type;
 
     if (!context) {
         printf_message("Cannot create a stacktrace without a context");
@@ -291,22 +294,22 @@ static void print_stacktrace(const LPPROCESS_INFORMATION process_information, PC
     stack_frame.AddrStack.Mode = AddrModeFlat;
 
 #if defined(SDLPROCDUMP_CPU_X86)
-    DWORD machine_type = IMAGE_FILE_MACHINE_I386;
+    machine_type = IMAGE_FILE_MACHINE_I386;
     stack_frame.AddrFrame.Offset = context->Ebp;
     stack_frame.AddrStack.Offset = context->Esp;
     stack_frame.AddrPC.Offset = context->Eip;
 #elif defined(SDLPROCDUMP_CPU_X64)
-    DWORD machine_type = IMAGE_FILE_MACHINE_AMD64;
+    machine_type = IMAGE_FILE_MACHINE_AMD64;
     stack_frame.AddrFrame.Offset = context->Rbp;
     stack_frame.AddrStack.Offset = context->Rsp;
     stack_frame.AddrPC.Offset = context->Rip;
 #elif defined(SDLPROCDUMP_CPU_ARM32)
-    DWORD machine_type = IMAGE_FILE_MACHINE_ARM;
+    machine_type = IMAGE_FILE_MACHINE_ARM;
     stack_frame.AddrFrame.Offset = context->Lr;
     stack_frame.AddrStack.Offset = context->Sp;
     stack_frame.AddrPC.Offset = context->Pc;
 #elif defined(SDLPROCDUMP_CPU_ARM64)
-    DWORD machine_type = IMAGE_FILE_MACHINE_ARM64;
+    machine_type = IMAGE_FILE_MACHINE_ARM64;
     stack_frame.AddrFrame.Offset = context->Fp;
     stack_frame.AddrStack.Offset = context->Sp;
     stack_frame.AddrPC.Offset = context->Pc;