Removed SDL_bool in favor of plain bool

We require stdbool.h in the build environment, so we might as well use the plain bool type.

If your environment doesn't have stdbool.h, this simple replacement will suffice:
typedef signed char bool;
This commit is contained in:
Sam Lantinga
2024-09-18 07:52:28 -07:00
parent 9dd8859240
commit a90ad3b0e2
258 changed files with 4052 additions and 4057 deletions

View File

@@ -64,34 +64,34 @@ typedef struct SDL_StorageInterface
Uint32 version;
/* Called when the storage is closed */
SDL_bool (SDLCALL *close)(void *userdata);
bool (SDLCALL *close)(void *userdata);
/* Optional, returns whether the storage is currently ready for access */
SDL_bool (SDLCALL *ready)(void *userdata);
bool (SDLCALL *ready)(void *userdata);
/* Enumerate a directory, optional for write-only storage */
SDL_bool (SDLCALL *enumerate)(void *userdata, const char *path, SDL_EnumerateDirectoryCallback callback, void *callback_userdata);
bool (SDLCALL *enumerate)(void *userdata, const char *path, SDL_EnumerateDirectoryCallback callback, void *callback_userdata);
/* Get path information, optional for write-only storage */
SDL_bool (SDLCALL *info)(void *userdata, const char *path, SDL_PathInfo *info);
bool (SDLCALL *info)(void *userdata, const char *path, SDL_PathInfo *info);
/* Read a file from storage, optional for write-only storage */
SDL_bool (SDLCALL *read_file)(void *userdata, const char *path, void *destination, Uint64 length);
bool (SDLCALL *read_file)(void *userdata, const char *path, void *destination, Uint64 length);
/* Write a file to storage, optional for read-only storage */
SDL_bool (SDLCALL *write_file)(void *userdata, const char *path, const void *source, Uint64 length);
bool (SDLCALL *write_file)(void *userdata, const char *path, const void *source, Uint64 length);
/* Create a directory, optional for read-only storage */
SDL_bool (SDLCALL *mkdir)(void *userdata, const char *path);
bool (SDLCALL *mkdir)(void *userdata, const char *path);
/* Remove a file or empty directory, optional for read-only storage */
SDL_bool (SDLCALL *remove)(void *userdata, const char *path);
bool (SDLCALL *remove)(void *userdata, const char *path);
/* Rename a path, optional for read-only storage */
SDL_bool (SDLCALL *rename)(void *userdata, const char *oldpath, const char *newpath);
bool (SDLCALL *rename)(void *userdata, const char *oldpath, const char *newpath);
/* Copy a file, optional for read-only storage */
SDL_bool (SDLCALL *copy)(void *userdata, const char *oldpath, const char *newpath);
bool (SDLCALL *copy)(void *userdata, const char *oldpath, const char *newpath);
/* Get the space remaining, optional for read-only storage */
Uint64 (SDLCALL *space_remaining)(void *userdata);
@@ -218,7 +218,7 @@ extern SDL_DECLSPEC SDL_Storage * SDLCALL SDL_OpenStorage(const SDL_StorageInter
* Closes and frees a storage container.
*
* \param storage a storage container to close.
* \returns SDL_TRUE if the container was freed with no errors, SDL_FALSE
* \returns true if the container was freed with no errors, false
* otherwise; call SDL_GetError() for more information. Even if the
* function returns an error, the container data will be freed; the
* error is only for informational purposes.
@@ -230,21 +230,21 @@ extern SDL_DECLSPEC SDL_Storage * SDLCALL SDL_OpenStorage(const SDL_StorageInter
* \sa SDL_OpenTitleStorage
* \sa SDL_OpenUserStorage
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CloseStorage(SDL_Storage *storage);
extern SDL_DECLSPEC bool SDLCALL SDL_CloseStorage(SDL_Storage *storage);
/**
* Checks if the storage container is ready to use.
*
* This function should be called in regular intervals until it returns
* SDL_TRUE - however, it is not recommended to spinwait on this call, as the
* true - however, it is not recommended to spinwait on this call, as the
* backend may depend on a synchronous message loop.
*
* \param storage a storage container to query.
* \returns SDL_TRUE if the container is ready, SDL_FALSE otherwise.
* \returns true if the container is ready, false otherwise.
*
* \since This function is available since SDL 3.0.0.
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_StorageReady(SDL_Storage *storage);
extern SDL_DECLSPEC bool SDLCALL SDL_StorageReady(SDL_Storage *storage);
/**
* Query the size of a file within a storage container.
@@ -252,7 +252,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_StorageReady(SDL_Storage *storage);
* \param storage a storage container to query.
* \param path the relative path of the file to query.
* \param length a pointer to be filled with the file's length.
* \returns SDL_TRUE if the file could be queried or SDL_FALSE on failure;
* \returns true if the file could be queried or false on failure;
* call SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
@@ -260,7 +260,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_StorageReady(SDL_Storage *storage);
* \sa SDL_ReadStorageFile
* \sa SDL_StorageReady
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetStorageFileSize(SDL_Storage *storage, const char *path, Uint64 *length);
extern SDL_DECLSPEC bool SDLCALL SDL_GetStorageFileSize(SDL_Storage *storage, const char *path, Uint64 *length);
/**
* Synchronously read a file from a storage container into a client-provided
@@ -270,7 +270,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetStorageFileSize(SDL_Storage *storage
* \param path the relative path of the file to read.
* \param destination a client-provided buffer to read the file into.
* \param length the length of the destination buffer.
* \returns SDL_TRUE if the file was read or SDL_FALSE on failure; call
* \returns true if the file was read or false on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
@@ -279,7 +279,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetStorageFileSize(SDL_Storage *storage
* \sa SDL_StorageReady
* \sa SDL_WriteStorageFile
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadStorageFile(SDL_Storage *storage, const char *path, void *destination, Uint64 length);
extern SDL_DECLSPEC bool SDLCALL SDL_ReadStorageFile(SDL_Storage *storage, const char *path, void *destination, Uint64 length);
/**
* Synchronously write a file from client memory into a storage container.
@@ -288,7 +288,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadStorageFile(SDL_Storage *storage, c
* \param path the relative path of the file to write.
* \param source a client-provided buffer to write from.
* \param length the length of the source buffer.
* \returns SDL_TRUE if the file was written or SDL_FALSE on failure; call
* \returns true if the file was written or false on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
@@ -297,21 +297,21 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadStorageFile(SDL_Storage *storage, c
* \sa SDL_ReadStorageFile
* \sa SDL_StorageReady
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteStorageFile(SDL_Storage *storage, const char *path, const void *source, Uint64 length);
extern SDL_DECLSPEC bool SDLCALL SDL_WriteStorageFile(SDL_Storage *storage, const char *path, const void *source, Uint64 length);
/**
* Create a directory in a writable storage container.
*
* \param storage a storage container.
* \param path the path of the directory to create.
* \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
* \returns true on success or false on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_StorageReady
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CreateStorageDirectory(SDL_Storage *storage, const char *path);
extern SDL_DECLSPEC bool SDLCALL SDL_CreateStorageDirectory(SDL_Storage *storage, const char *path);
/**
* Enumerate a directory in a storage container through a callback function.
@@ -324,28 +324,28 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CreateStorageDirectory(SDL_Storage *sto
* \param path the path of the directory to enumerate.
* \param callback a function that is called for each entry in the directory.
* \param userdata a pointer that is passed to `callback`.
* \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
* \returns true on success or false on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_StorageReady
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_EnumerateStorageDirectory(SDL_Storage *storage, const char *path, SDL_EnumerateDirectoryCallback callback, void *userdata);
extern SDL_DECLSPEC bool SDLCALL SDL_EnumerateStorageDirectory(SDL_Storage *storage, const char *path, SDL_EnumerateDirectoryCallback callback, void *userdata);
/**
* Remove a file or an empty directory in a writable storage container.
*
* \param storage a storage container.
* \param path the path of the directory to enumerate.
* \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
* \returns true on success or false on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_StorageReady
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RemoveStoragePath(SDL_Storage *storage, const char *path);
extern SDL_DECLSPEC bool SDLCALL SDL_RemoveStoragePath(SDL_Storage *storage, const char *path);
/**
* Rename a file or directory in a writable storage container.
@@ -353,14 +353,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RemoveStoragePath(SDL_Storage *storage,
* \param storage a storage container.
* \param oldpath the old path.
* \param newpath the new path.
* \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
* \returns true on success or false on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_StorageReady
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenameStoragePath(SDL_Storage *storage, const char *oldpath, const char *newpath);
extern SDL_DECLSPEC bool SDLCALL SDL_RenameStoragePath(SDL_Storage *storage, const char *oldpath, const char *newpath);
/**
* Copy a file in a writable storage container.
@@ -368,14 +368,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenameStoragePath(SDL_Storage *storage,
* \param storage a storage container.
* \param oldpath the old path.
* \param newpath the new path.
* \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
* \returns true on success or false on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_StorageReady
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CopyStorageFile(SDL_Storage *storage, const char *oldpath, const char *newpath);
extern SDL_DECLSPEC bool SDLCALL SDL_CopyStorageFile(SDL_Storage *storage, const char *oldpath, const char *newpath);
/**
* Get information about a filesystem path in a storage container.
@@ -384,14 +384,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CopyStorageFile(SDL_Storage *storage, c
* \param path the path to query.
* \param info a pointer filled in with information about the path, or NULL to
* check for the existence of a file.
* \returns SDL_TRUE on success or SDL_FALSE if the file doesn't exist, or
* \returns true on success or false if the file doesn't exist, or
* another failure; call SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_StorageReady
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetStoragePathInfo(SDL_Storage *storage, const char *path, SDL_PathInfo *info);
extern SDL_DECLSPEC bool SDLCALL SDL_GetStoragePathInfo(SDL_Storage *storage, const char *path, SDL_PathInfo *info);
/**
* Queries the remaining space in a storage container.