filesystem: SDL_EnumerateDirectory should return -1 or 0.

The callback requesting a non-error stop should not return a special value.
This commit is contained in:
Ryan C. Gordon committed 2024-04-04 09:40:13 -04:00
1 parent a8ed32c5f7
commit 9192485746
2 files changed
+5 -2

No files matched your search

+4 -1
View File
@@ -265,7 +265,10 @@ typedef struct SDL_PathInfo
*/
extern DECLSPEC int SDLCALL SDL_CreateDirectory(const char *path);
/* Callback for directory enumeration. Return 1 to keep enumerating, 0 to stop enumerating (no error), -1 to stop enumerating and report an error. `dirname` is the directory being enumerated, `fname` is the enumerated entry. */
/* Callback for directory enumeration. Return 1 to keep enumerating,
0 to stop enumerating (no error), -1 to stop enumerating and
report an error. `dirname` is the directory being enumerated,
`fname` is the enumerated entry. */
typedef int (SDLCALL *SDL_EnumerateDirectoryCallback)(void *userdata, const char *dirname, const char *fname);
/**
+1 -1
View File
@@ -56,7 +56,7 @@ int SDL_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback call
} else if (!callback) {
return SDL_InvalidParamError("callback");
}
return SDL_SYS_EnumerateDirectory(path, path, callback, userdata);
return (SDL_SYS_EnumerateDirectory(path, path, callback, userdata) < 0) ? -1 : 0;
}
int SDL_GetPathInfo(const char *path, SDL_PathInfo *info)