mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-10-02 16:23:57 +08:00
Fix SDL_EnumerateDirectory(/) failing on POSIX and Windows.
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled
(cherry picked from commit 09a2283b53)
This commit is contained in:
committed by
Sam Lantinga
parent
e8fbb7e820
commit
99cbedd662
@@ -45,7 +45,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';
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,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] = '\\';
|
||||
|
||||
Reference in New Issue
Block a user