SDL: Fix SDL_EnumerateDirectory(/) failing on POSIX and Windows.

From 09a2283b53d541c57ded373a0954b1e2f8a8428a Mon Sep 17 00:00:00 2001
From: Edgar J San Martin <[EMAIL REDACTED]>
Date: Mon, 15 Dec 2025 18:33:03 -0500
Subject: [PATCH] Fix SDL_EnumerateDirectory(/) failing on POSIX and Windows.

---
 src/filesystem/posix/SDL_sysfsops.c   | 2 +-
 src/filesystem/windows/SDL_sysfsops.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/filesystem/posix/SDL_sysfsops.c b/src/filesystem/posix/SDL_sysfsops.c
index 07539ad95b7de..581ee2ee07942 100644
--- a/src/filesystem/posix/SDL_sysfsops.c
+++ b/src/filesystem/posix/SDL_sysfsops.c
@@ -85,7 +85,7 @@ bool SDL_SYS_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback
 
     // trim down to a single path separator at the end, in case the caller added one or more.
     pathwithseplen--;
-    while ((pathwithseplen >= 0) && (pathwithsep[pathwithseplen] == '/')) {
+    while ((pathwithseplen > 0) && (pathwithsep[pathwithseplen] == '/')) {
         pathwithsep[pathwithseplen--] = '\0';
     }
 
diff --git a/src/filesystem/windows/SDL_sysfsops.c b/src/filesystem/windows/SDL_sysfsops.c
index 91394ed7ee93f..a5756525e8095 100644
--- a/src/filesystem/windows/SDL_sysfsops.c
+++ b/src/filesystem/windows/SDL_sysfsops.c
@@ -57,7 +57,7 @@ bool SDL_SYS_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback
 
         // trim down to a single path separator at the end, in case the caller added one or more.
         patternlen--;
-        while ((patternlen >= 0) && ((pattern[patternlen] == '\\') || (pattern[patternlen] == '/'))) {
+        while ((patternlen > 0) && ((pattern[patternlen] == '\\') || (pattern[patternlen] == '/'))) {
             pattern[patternlen--] ='\0';
         }
         pattern[++patternlen] = '\\';