From 5b4a3e26b3f560a60c30d7477134dff4f187107e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 18 Sep 2024 10:51:42 -0700 Subject: [PATCH] Updated to the latest version of SDL --- examples/showimage.c | 4 +- external/SDL | 2 +- include/SDL3_image/SDL_image.h | 114 ++++++++++----------- src/IMG.c | 20 ++-- src/IMG_ImageIO.m | 22 ++-- src/IMG_WIC.c | 46 ++++----- src/IMG_avif.c | 48 ++++----- src/IMG_bmp.c | 50 ++++----- src/IMG_gif.c | 30 +++--- src/IMG_jpg.c | 78 +++++++-------- src/IMG_jxl.c | 18 ++-- src/IMG_lbm.c | 16 +-- src/IMG_pcx.c | 14 +-- src/IMG_png.c | 60 +++++------ src/IMG_pnm.c | 14 +-- src/IMG_qoi.c | 16 +-- src/IMG_stb.c | 14 +-- src/IMG_svg.c | 16 +-- src/IMG_tga.c | 2 +- src/IMG_tif.c | 14 +-- src/IMG_webp.c | 16 +-- src/IMG_xcf.c | 10 +- src/IMG_xpm.c | 22 ++-- src/IMG_xv.c | 14 +-- src/IMG_xxx.c | 12 +-- test/main.c | 178 ++++++++++++++++----------------- 26 files changed, 425 insertions(+), 425 deletions(-) diff --git a/examples/showimage.c b/examples/showimage.c index caf339d5..504b419e 100644 --- a/examples/showimage.c +++ b/examples/showimage.c @@ -95,7 +95,7 @@ int main(int argc, char *argv[]) goto done; } - if (SDL_GetBooleanProperty(SDL_GetDisplayProperties(SDL_GetPrimaryDisplay()), SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN, SDL_FALSE)) { + if (SDL_GetBooleanProperty(SDL_GetDisplayProperties(SDL_GetPrimaryDisplay()), SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN, false)) { SDL_PropertiesID props = SDL_CreateProperties(); SDL_SetPointerProperty(props, SDL_PROP_RENDERER_CREATE_WINDOW_POINTER, window); @@ -173,7 +173,7 @@ int main(int argc, char *argv[]) SDL_Surface *surface = IMG_Load(argv[i]); if (surface) { const char *ext = SDL_strrchr(saveFile, '.'); - SDL_bool saved = SDL_FALSE; + bool saved = false; if (ext && SDL_strcasecmp(ext, ".avif") == 0) { saved = IMG_SaveAVIF(surface, saveFile, 90); } else if (ext && SDL_strcasecmp(ext, ".bmp") == 0) { diff --git a/external/SDL b/external/SDL index 03ae792d..23f855a9 160000 --- a/external/SDL +++ b/external/SDL @@ -1 +1 @@ -Subproject commit 03ae792df35a15e80e16a41ea2cf19971fc8d8f6 +Subproject commit 23f855a9703ba74d174d1c5ea90b1debc39b52a9 diff --git a/include/SDL3_image/SDL_image.h b/include/SDL3_image/SDL_image.h index 359b305c..3aab6ec1 100644 --- a/include/SDL3_image/SDL_image.h +++ b/include/SDL3_image/SDL_image.h @@ -189,7 +189,7 @@ extern SDL_DECLSPEC void SDLCALL IMG_Quit(void); * by calling: SDL_SetSurfaceColorKey(image, SDL_RLEACCEL, * image->format->colorkey); * - * If `closeio` is SDL_TRUE, `src` will be closed before returning, whether + * If `closeio` is true, `src` will be closed before returning, whether * this function succeeds or not. SDL_image reads everything it needs from * `src` during this call in any case. * @@ -216,8 +216,8 @@ extern SDL_DECLSPEC void SDLCALL IMG_Quit(void); * call to SDL_DestroySurface(). * * \param src an SDL_IOStream that data will be read from. - * \param closeio SDL_TRUE to close/free the SDL_IOStream before returning, - * SDL_FALSE to leave it open. + * \param closeio true to close/free the SDL_IOStream before returning, + * false to leave it open. * \param type a filename extension that represent this data ("BMP", "GIF", * "PNG", etc). * \returns a new SDL surface, or NULL on error. @@ -228,7 +228,7 @@ extern SDL_DECLSPEC void SDLCALL IMG_Quit(void); * \sa IMG_Load_IO * \sa SDL_DestroySurface */ -extern SDL_DECLSPEC SDL_Surface * SDLCALL IMG_LoadTyped_IO(SDL_IOStream *src, SDL_bool closeio, const char *type); +extern SDL_DECLSPEC SDL_Surface * SDLCALL IMG_LoadTyped_IO(SDL_IOStream *src, bool closeio, const char *type); /** * Load an image from a filesystem path into a software surface. @@ -296,7 +296,7 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL IMG_Load(const char *file); * by calling: SDL_SetSurfaceColorKey(image, SDL_RLEACCEL, * image->format->colorkey); * - * If `closeio` is SDL_TRUE, `src` will be closed before returning, whether + * If `closeio` is true, `src` will be closed before returning, whether * this function succeeds or not. SDL_image reads everything it needs from * `src` during this call in any case. * @@ -317,8 +317,8 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL IMG_Load(const char *file); * call to SDL_DestroySurface(). * * \param src an SDL_IOStream that data will be read from. - * \param closeio SDL_TRUE to close/free the SDL_IOStream before returning, - * SDL_FALSE to leave it open. + * \param closeio true to close/free the SDL_IOStream before returning, + * false to leave it open. * \returns a new SDL surface, or NULL on error. * * \since This function is available since SDL_image 3.0.0. @@ -327,7 +327,7 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL IMG_Load(const char *file); * \sa IMG_LoadTyped_IO * \sa SDL_DestroySurface */ -extern SDL_DECLSPEC SDL_Surface * SDLCALL IMG_Load_IO(SDL_IOStream *src, SDL_bool closeio); +extern SDL_DECLSPEC SDL_Surface * SDLCALL IMG_Load_IO(SDL_IOStream *src, bool closeio); #if SDL_VERSION_ATLEAST(2,0,0) @@ -380,7 +380,7 @@ extern SDL_DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture(SDL_Renderer *renderer * data (but in many cases, this will just end up being 32-bit RGB or 32-bit * RGBA). * - * If `closeio` is SDL_TRUE, `src` will be closed before returning, whether + * If `closeio` is true, `src` will be closed before returning, whether * this function succeeds or not. SDL_image reads everything it needs from * `src` during this call in any case. * @@ -401,8 +401,8 @@ extern SDL_DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture(SDL_Renderer *renderer * * \param renderer the SDL_Renderer to use to create the GPU texture. * \param src an SDL_IOStream that data will be read from. - * \param closeio SDL_TRUE to close/free the SDL_IOStream before returning, - * SDL_FALSE to leave it open. + * \param closeio true to close/free the SDL_IOStream before returning, + * false to leave it open. * \returns a new texture, or NULL on error. * * \since This function is available since SDL_image 3.0.0. @@ -411,7 +411,7 @@ extern SDL_DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture(SDL_Renderer *renderer * \sa IMG_LoadTextureTyped_IO * \sa SDL_DestroyTexture */ -extern SDL_DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture_IO(SDL_Renderer *renderer, SDL_IOStream *src, SDL_bool closeio); +extern SDL_DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture_IO(SDL_Renderer *renderer, SDL_IOStream *src, bool closeio); /** * Load an image from an SDL data source into a GPU texture. @@ -427,7 +427,7 @@ extern SDL_DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture_IO(SDL_Renderer *rende * data (but in many cases, this will just end up being 32-bit RGB or 32-bit * RGBA). * - * If `closeio` is SDL_TRUE, `src` will be closed before returning, whether + * If `closeio` is true, `src` will be closed before returning, whether * this function succeeds or not. SDL_image reads everything it needs from * `src` during this call in any case. * @@ -454,8 +454,8 @@ extern SDL_DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture_IO(SDL_Renderer *rende * * \param renderer the SDL_Renderer to use to create the GPU texture. * \param src an SDL_IOStream that data will be read from. - * \param closeio SDL_TRUE to close/free the SDL_IOStream before returning, - * SDL_FALSE to leave it open. + * \param closeio true to close/free the SDL_IOStream before returning, + * false to leave it open. * \param type a filename extension that represent this data ("BMP", "GIF", * "PNG", etc). * \returns a new texture, or NULL on error. @@ -466,7 +466,7 @@ extern SDL_DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture_IO(SDL_Renderer *rende * \sa IMG_LoadTexture_IO * \sa SDL_DestroyTexture */ -extern SDL_DECLSPEC SDL_Texture * SDLCALL IMG_LoadTextureTyped_IO(SDL_Renderer *renderer, SDL_IOStream *src, SDL_bool closeio, const char *type); +extern SDL_DECLSPEC SDL_Texture * SDLCALL IMG_LoadTextureTyped_IO(SDL_Renderer *renderer, SDL_IOStream *src, bool closeio, const char *type); #endif /* SDL 2.0 */ /** @@ -511,7 +511,7 @@ extern SDL_DECLSPEC SDL_Texture * SDLCALL IMG_LoadTextureTyped_IO(SDL_Renderer * * \sa IMG_isXV * \sa IMG_isWEBP */ -extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isAVIF(SDL_IOStream *src); +extern SDL_DECLSPEC bool SDLCALL IMG_isAVIF(SDL_IOStream *src); /** * Detect ICO image data on a readable/seekable SDL_IOStream. @@ -554,7 +554,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isAVIF(SDL_IOStream *src); * \sa IMG_isXV * \sa IMG_isWEBP */ -extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isICO(SDL_IOStream *src); +extern SDL_DECLSPEC bool SDLCALL IMG_isICO(SDL_IOStream *src); /** * Detect CUR image data on a readable/seekable SDL_IOStream. @@ -597,7 +597,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isICO(SDL_IOStream *src); * \sa IMG_isXV * \sa IMG_isWEBP */ -extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isCUR(SDL_IOStream *src); +extern SDL_DECLSPEC bool SDLCALL IMG_isCUR(SDL_IOStream *src); /** * Detect BMP image data on a readable/seekable SDL_IOStream. @@ -640,7 +640,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isCUR(SDL_IOStream *src); * \sa IMG_isXV * \sa IMG_isWEBP */ -extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isBMP(SDL_IOStream *src); +extern SDL_DECLSPEC bool SDLCALL IMG_isBMP(SDL_IOStream *src); /** * Detect GIF image data on a readable/seekable SDL_IOStream. @@ -683,7 +683,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isBMP(SDL_IOStream *src); * \sa IMG_isXV * \sa IMG_isWEBP */ -extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isGIF(SDL_IOStream *src); +extern SDL_DECLSPEC bool SDLCALL IMG_isGIF(SDL_IOStream *src); /** * Detect JPG image data on a readable/seekable SDL_IOStream. @@ -726,7 +726,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isGIF(SDL_IOStream *src); * \sa IMG_isXV * \sa IMG_isWEBP */ -extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isJPG(SDL_IOStream *src); +extern SDL_DECLSPEC bool SDLCALL IMG_isJPG(SDL_IOStream *src); /** * Detect JXL image data on a readable/seekable SDL_IOStream. @@ -769,7 +769,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isJPG(SDL_IOStream *src); * \sa IMG_isXV * \sa IMG_isWEBP */ -extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isJXL(SDL_IOStream *src); +extern SDL_DECLSPEC bool SDLCALL IMG_isJXL(SDL_IOStream *src); /** * Detect LBM image data on a readable/seekable SDL_IOStream. @@ -812,7 +812,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isJXL(SDL_IOStream *src); * \sa IMG_isXV * \sa IMG_isWEBP */ -extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isLBM(SDL_IOStream *src); +extern SDL_DECLSPEC bool SDLCALL IMG_isLBM(SDL_IOStream *src); /** * Detect PCX image data on a readable/seekable SDL_IOStream. @@ -855,7 +855,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isLBM(SDL_IOStream *src); * \sa IMG_isXV * \sa IMG_isWEBP */ -extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isPCX(SDL_IOStream *src); +extern SDL_DECLSPEC bool SDLCALL IMG_isPCX(SDL_IOStream *src); /** * Detect PNG image data on a readable/seekable SDL_IOStream. @@ -898,7 +898,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isPCX(SDL_IOStream *src); * \sa IMG_isXV * \sa IMG_isWEBP */ -extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isPNG(SDL_IOStream *src); +extern SDL_DECLSPEC bool SDLCALL IMG_isPNG(SDL_IOStream *src); /** * Detect PNM image data on a readable/seekable SDL_IOStream. @@ -941,7 +941,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isPNG(SDL_IOStream *src); * \sa IMG_isXV * \sa IMG_isWEBP */ -extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isPNM(SDL_IOStream *src); +extern SDL_DECLSPEC bool SDLCALL IMG_isPNM(SDL_IOStream *src); /** * Detect SVG image data on a readable/seekable SDL_IOStream. @@ -984,7 +984,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isPNM(SDL_IOStream *src); * \sa IMG_isXV * \sa IMG_isWEBP */ -extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isSVG(SDL_IOStream *src); +extern SDL_DECLSPEC bool SDLCALL IMG_isSVG(SDL_IOStream *src); /** * Detect QOI image data on a readable/seekable SDL_IOStream. @@ -1027,7 +1027,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isSVG(SDL_IOStream *src); * \sa IMG_isXV * \sa IMG_isWEBP */ -extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isQOI(SDL_IOStream *src); +extern SDL_DECLSPEC bool SDLCALL IMG_isQOI(SDL_IOStream *src); /** * Detect TIFF image data on a readable/seekable SDL_IOStream. @@ -1070,7 +1070,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isQOI(SDL_IOStream *src); * \sa IMG_isXV * \sa IMG_isWEBP */ -extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isTIF(SDL_IOStream *src); +extern SDL_DECLSPEC bool SDLCALL IMG_isTIF(SDL_IOStream *src); /** * Detect XCF image data on a readable/seekable SDL_IOStream. @@ -1113,7 +1113,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isTIF(SDL_IOStream *src); * \sa IMG_isXV * \sa IMG_isWEBP */ -extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isXCF(SDL_IOStream *src); +extern SDL_DECLSPEC bool SDLCALL IMG_isXCF(SDL_IOStream *src); /** * Detect XPM image data on a readable/seekable SDL_IOStream. @@ -1156,7 +1156,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isXCF(SDL_IOStream *src); * \sa IMG_isXV * \sa IMG_isWEBP */ -extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isXPM(SDL_IOStream *src); +extern SDL_DECLSPEC bool SDLCALL IMG_isXPM(SDL_IOStream *src); /** * Detect XV image data on a readable/seekable SDL_IOStream. @@ -1199,7 +1199,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isXPM(SDL_IOStream *src); * \sa IMG_isXPM * \sa IMG_isWEBP */ -extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isXV(SDL_IOStream *src); +extern SDL_DECLSPEC bool SDLCALL IMG_isXV(SDL_IOStream *src); /** * Detect WEBP image data on a readable/seekable SDL_IOStream. @@ -1242,7 +1242,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isXV(SDL_IOStream *src); * \sa IMG_isXPM * \sa IMG_isXV */ -extern SDL_DECLSPEC SDL_bool SDLCALL IMG_isWEBP(SDL_IOStream *src); +extern SDL_DECLSPEC bool SDLCALL IMG_isWEBP(SDL_IOStream *src); /** * Load a AVIF image directly. @@ -1964,20 +1964,20 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL IMG_ReadXPMFromArrayToRGB888(char **xp * * \sa IMG_SaveAVIF_IO */ -extern SDL_DECLSPEC SDL_bool SDLCALL IMG_SaveAVIF(SDL_Surface *surface, const char *file, int quality); +extern SDL_DECLSPEC bool SDLCALL IMG_SaveAVIF(SDL_Surface *surface, const char *file, int quality); /** * Save an SDL_Surface into AVIF image data, via an SDL_IOStream. * * If you just want to save to a filename, you can use IMG_SaveAVIF() instead. * - * If `closeio` is SDL_TRUE, `dst` will be closed before returning, whether + * If `closeio` is true, `dst` will be closed before returning, whether * this function succeeds or not. * * \param surface the SDL surface to save. * \param dst the SDL_IOStream to save the image data to. - * \param closeio SDL_TRUE to close/free the SDL_IOStream before returning, - * SDL_FALSE to leave it open. + * \param closeio true to close/free the SDL_IOStream before returning, + * false to leave it open. * \param quality the desired quality, ranging between 0 (lowest) and 100 * (highest). * \returns 0 if successful, -1 on error. @@ -1986,7 +1986,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL IMG_SaveAVIF(SDL_Surface *surface, const ch * * \sa IMG_SaveAVIF */ -extern SDL_DECLSPEC SDL_bool SDLCALL IMG_SaveAVIF_IO(SDL_Surface *surface, SDL_IOStream *dst, int closeio, int quality); +extern SDL_DECLSPEC bool SDLCALL IMG_SaveAVIF_IO(SDL_Surface *surface, SDL_IOStream *dst, int closeio, int quality); /** * Save an SDL_Surface into a PNG image file. @@ -2001,27 +2001,27 @@ extern SDL_DECLSPEC SDL_bool SDLCALL IMG_SaveAVIF_IO(SDL_Surface *surface, SDL_I * * \sa IMG_SavePNG_IO */ -extern SDL_DECLSPEC SDL_bool SDLCALL IMG_SavePNG(SDL_Surface *surface, const char *file); +extern SDL_DECLSPEC bool SDLCALL IMG_SavePNG(SDL_Surface *surface, const char *file); /** * Save an SDL_Surface into PNG image data, via an SDL_IOStream. * * If you just want to save to a filename, you can use IMG_SavePNG() instead. * - * If `closeio` is SDL_TRUE, `dst` will be closed before returning, whether + * If `closeio` is true, `dst` will be closed before returning, whether * this function succeeds or not. * * \param surface the SDL surface to save. * \param dst the SDL_IOStream to save the image data to. - * \param closeio SDL_TRUE to close/free the SDL_IOStream before returning, - * SDL_FALSE to leave it open. + * \param closeio true to close/free the SDL_IOStream before returning, + * false to leave it open. * \returns 0 if successful, -1 on error. * * \since This function is available since SDL_image 3.0.0. * * \sa IMG_SavePNG */ -extern SDL_DECLSPEC SDL_bool SDLCALL IMG_SavePNG_IO(SDL_Surface *surface, SDL_IOStream *dst, int closeio); +extern SDL_DECLSPEC bool SDLCALL IMG_SavePNG_IO(SDL_Surface *surface, SDL_IOStream *dst, int closeio); /** * Save an SDL_Surface into a JPEG image file. @@ -2038,20 +2038,20 @@ extern SDL_DECLSPEC SDL_bool SDLCALL IMG_SavePNG_IO(SDL_Surface *surface, SDL_IO * * \sa IMG_SaveJPG_IO */ -extern SDL_DECLSPEC SDL_bool SDLCALL IMG_SaveJPG(SDL_Surface *surface, const char *file, int quality); +extern SDL_DECLSPEC bool SDLCALL IMG_SaveJPG(SDL_Surface *surface, const char *file, int quality); /** * Save an SDL_Surface into JPEG image data, via an SDL_IOStream. * * If you just want to save to a filename, you can use IMG_SaveJPG() instead. * - * If `closeio` is SDL_TRUE, `dst` will be closed before returning, whether + * If `closeio` is true, `dst` will be closed before returning, whether * this function succeeds or not. * * \param surface the SDL surface to save. * \param dst the SDL_IOStream to save the image data to. - * \param closeio SDL_TRUE to close/free the SDL_IOStream before returning, - * SDL_FALSE to leave it open. + * \param closeio true to close/free the SDL_IOStream before returning, + * false to leave it open. * \param quality [0; 33] is Lowest quality, [34; 66] is Middle quality, [67; * 100] is Highest quality. * \returns 0 if successful, -1 on error. @@ -2060,7 +2060,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL IMG_SaveJPG(SDL_Surface *surface, const cha * * \sa IMG_SaveJPG */ -extern SDL_DECLSPEC SDL_bool SDLCALL IMG_SaveJPG_IO(SDL_Surface *surface, SDL_IOStream *dst, int closeio, int quality); +extern SDL_DECLSPEC bool SDLCALL IMG_SaveJPG_IO(SDL_Surface *surface, SDL_IOStream *dst, int closeio, int quality); /** * Animated image support Currently only animated GIFs are supported. @@ -2091,7 +2091,7 @@ extern SDL_DECLSPEC IMG_Animation * SDLCALL IMG_LoadAnimation(const char *file); /** * Load an animation from an SDL_IOStream. * - * If `closeio` is SDL_TRUE, `src` will be closed before returning, whether + * If `closeio` is true, `src` will be closed before returning, whether * this function succeeds or not. SDL_image reads everything it needs from * `src` during this call in any case. * @@ -2099,15 +2099,15 @@ extern SDL_DECLSPEC IMG_Animation * SDLCALL IMG_LoadAnimation(const char *file); * call to IMG_FreeAnimation(). * * \param src an SDL_IOStream that data will be read from. - * \param closeio SDL_TRUE to close/free the SDL_IOStream before returning, - * SDL_FALSE to leave it open. + * \param closeio true to close/free the SDL_IOStream before returning, + * false to leave it open. * \returns a new IMG_Animation, or NULL on error. * * \since This function is available since SDL_image 3.0.0. * * \sa IMG_FreeAnimation */ -extern SDL_DECLSPEC IMG_Animation * SDLCALL IMG_LoadAnimation_IO(SDL_IOStream *src, SDL_bool closeio); +extern SDL_DECLSPEC IMG_Animation * SDLCALL IMG_LoadAnimation_IO(SDL_IOStream *src, bool closeio); /** * Load an animation from an SDL datasource @@ -2118,7 +2118,7 @@ extern SDL_DECLSPEC IMG_Animation * SDLCALL IMG_LoadAnimation_IO(SDL_IOStream *s * that it cannot autodetect. If `type` is NULL, SDL_image will rely solely on * its ability to guess the format. * - * If `closeio` is SDL_TRUE, `src` will be closed before returning, whether + * If `closeio` is true, `src` will be closed before returning, whether * this function succeeds or not. SDL_image reads everything it needs from * `src` during this call in any case. * @@ -2126,8 +2126,8 @@ extern SDL_DECLSPEC IMG_Animation * SDLCALL IMG_LoadAnimation_IO(SDL_IOStream *s * call to IMG_FreeAnimation(). * * \param src an SDL_IOStream that data will be read from. - * \param closeio SDL_TRUE to close/free the SDL_IOStream before returning, - * SDL_FALSE to leave it open. + * \param closeio true to close/free the SDL_IOStream before returning, + * false to leave it open. * \param type a filename extension that represent this data ("GIF", etc). * \returns a new IMG_Animation, or NULL on error. * @@ -2137,7 +2137,7 @@ extern SDL_DECLSPEC IMG_Animation * SDLCALL IMG_LoadAnimation_IO(SDL_IOStream *s * \sa IMG_LoadAnimation_IO * \sa IMG_FreeAnimation */ -extern SDL_DECLSPEC IMG_Animation * SDLCALL IMG_LoadAnimationTyped_IO(SDL_IOStream *src, SDL_bool closeio, const char *type); +extern SDL_DECLSPEC IMG_Animation * SDLCALL IMG_LoadAnimationTyped_IO(SDL_IOStream *src, bool closeio, const char *type); /** * Dispose of an IMG_Animation and free its resources. diff --git a/src/IMG.c b/src/IMG.c index b7451559..28bd83b1 100644 --- a/src/IMG.c +++ b/src/IMG.c @@ -48,7 +48,7 @@ SDL_COMPILE_TIME_ASSERT(SDL_IMAGE_MICRO_VERSION_max, SDL_IMAGE_MICRO_VERSION <= /* Table of image detection and loading functions */ static struct { const char *type; - SDL_bool (SDLCALL *is)(SDL_IOStream *src); + bool (SDLCALL *is)(SDL_IOStream *src); SDL_Surface *(SDLCALL *load)(SDL_IOStream *src); } supported[] = { /* keep magicless formats first */ @@ -76,7 +76,7 @@ static struct { /* Table of animation detection and loading functions */ static struct { const char *type; - SDL_bool (SDLCALL *is)(SDL_IOStream *src); + bool (SDLCALL *is)(SDL_IOStream *src); IMG_Animation *(SDLCALL *load)(SDL_IOStream *src); } supported_anims[] = { /* keep magicless formats first */ @@ -182,18 +182,18 @@ SDL_Surface *IMG_Load(const char *file) /* The error message has been set in SDL_IOFromFile */ return NULL; } - return IMG_LoadTyped_IO(src, SDL_TRUE, ext); + return IMG_LoadTyped_IO(src, true, ext); } #endif /* Load an image from an SDL datasource (for compatibility) */ -SDL_Surface *IMG_Load_IO(SDL_IOStream *src, SDL_bool closeio) +SDL_Surface *IMG_Load_IO(SDL_IOStream *src, bool closeio) { return IMG_LoadTyped_IO(src, closeio, NULL); } /* Load an image from an SDL datasource, optionally specifying the type */ -SDL_Surface *IMG_LoadTyped_IO(SDL_IOStream *src, SDL_bool closeio, const char *type) +SDL_Surface *IMG_LoadTyped_IO(SDL_IOStream *src, bool closeio, const char *type) { size_t i; SDL_Surface *image; @@ -276,7 +276,7 @@ SDL_Texture *IMG_LoadTexture(SDL_Renderer *renderer, const char *file) return texture; } -SDL_Texture *IMG_LoadTexture_IO(SDL_Renderer *renderer, SDL_IOStream *src, SDL_bool closeio) +SDL_Texture *IMG_LoadTexture_IO(SDL_Renderer *renderer, SDL_IOStream *src, bool closeio) { SDL_Texture *texture = NULL; SDL_Surface *surface = IMG_Load_IO(src, closeio); @@ -287,7 +287,7 @@ SDL_Texture *IMG_LoadTexture_IO(SDL_Renderer *renderer, SDL_IOStream *src, SDL_b return texture; } -SDL_Texture *IMG_LoadTextureTyped_IO(SDL_Renderer *renderer, SDL_IOStream *src, SDL_bool closeio, const char *type) +SDL_Texture *IMG_LoadTextureTyped_IO(SDL_Renderer *renderer, SDL_IOStream *src, bool closeio, const char *type) { SDL_Texture *texture = NULL; SDL_Surface *surface = IMG_LoadTyped_IO(src, closeio, type); @@ -311,17 +311,17 @@ IMG_Animation *IMG_LoadAnimation(const char *file) /* The error message has been set in SDL_IOFromFile */ return NULL; } - return IMG_LoadAnimationTyped_IO(src, SDL_TRUE, ext); + return IMG_LoadAnimationTyped_IO(src, true, ext); } /* Load an animation from an SDL datasource (for compatibility) */ -IMG_Animation *IMG_LoadAnimation_IO(SDL_IOStream *src, SDL_bool closeio) +IMG_Animation *IMG_LoadAnimation_IO(SDL_IOStream *src, bool closeio) { return IMG_LoadAnimationTyped_IO(src, closeio, NULL); } /* Load an animation from an SDL datasource, optionally specifying the type */ -IMG_Animation *IMG_LoadAnimationTyped_IO(SDL_IOStream *src, SDL_bool closeio, const char *type) +IMG_Animation *IMG_LoadAnimationTyped_IO(SDL_IOStream *src, bool closeio, const char *type) { size_t i; IMG_Animation *anim; diff --git a/src/IMG_ImageIO.m b/src/IMG_ImageIO.m index 8c4bd0bc..2d6eef01 100644 --- a/src/IMG_ImageIO.m +++ b/src/IMG_ImageIO.m @@ -391,12 +391,12 @@ void IMG_QuitTIF(void) { } -static SDL_bool Internal_isType (SDL_IOStream *rw_ops, CFStringRef uti_string_to_test) +static bool Internal_isType (SDL_IOStream *rw_ops, CFStringRef uti_string_to_test) { - SDL_bool is_type = SDL_FALSE; + bool is_type = false; if (rw_ops == NULL) { - return SDL_FALSE; + return false; } Sint64 start = SDL_TellIO(rw_ops); @@ -433,25 +433,25 @@ static SDL_bool Internal_isType (SDL_IOStream *rw_ops, CFStringRef uti_string_to #ifdef BMP_USES_IMAGEIO -SDL_bool IMG_isCUR(SDL_IOStream *src) +bool IMG_isCUR(SDL_IOStream *src) { /* FIXME: Is this a supported type? */ return Internal_isType(src, CFSTR("com.microsoft.cur")); } -SDL_bool IMG_isICO(SDL_IOStream *src) +bool IMG_isICO(SDL_IOStream *src) { return Internal_isType(src, kUTTypeICO); } -SDL_bool IMG_isBMP(SDL_IOStream *src) +bool IMG_isBMP(SDL_IOStream *src) { return Internal_isType(src, kUTTypeBMP); } #endif /* BMP_USES_IMAGEIO */ -SDL_bool IMG_isGIF(SDL_IOStream *src) +bool IMG_isGIF(SDL_IOStream *src) { return Internal_isType(src, kUTTypeGIF); } @@ -459,7 +459,7 @@ SDL_bool IMG_isGIF(SDL_IOStream *src) #ifdef JPG_USES_IMAGEIO // Note: JPEG 2000 is kUTTypeJPEG2000 -SDL_bool IMG_isJPG(SDL_IOStream *src) +bool IMG_isJPG(SDL_IOStream *src) { return Internal_isType(src, kUTTypeJPEG); } @@ -468,7 +468,7 @@ SDL_bool IMG_isJPG(SDL_IOStream *src) #ifdef PNG_USES_IMAGEIO -SDL_bool IMG_isPNG(SDL_IOStream *src) +bool IMG_isPNG(SDL_IOStream *src) { return Internal_isType(src, kUTTypePNG); } @@ -476,12 +476,12 @@ SDL_bool IMG_isPNG(SDL_IOStream *src) #endif /* PNG_USES_IMAGEIO */ // This isn't a public API function. Apple seems to be able to identify tga's. -SDL_bool IMG_isTGA(SDL_IOStream *src) +bool IMG_isTGA(SDL_IOStream *src) { return Internal_isType(src, CFSTR("com.truevision.tga-image")); } -SDL_bool IMG_isTIF(SDL_IOStream *src) +bool IMG_isTIF(SDL_IOStream *src) { return Internal_isType(src, kUTTypeTIFF); } diff --git a/src/IMG_WIC.c b/src/IMG_WIC.c index d00fddcd..a4762144 100644 --- a/src/IMG_WIC.c +++ b/src/IMG_WIC.c @@ -84,35 +84,35 @@ void IMG_QuitTIF(void) WIC_Quit(); } -SDL_bool IMG_isPNG(SDL_IOStream *src) +bool IMG_isPNG(SDL_IOStream *src) { Sint64 start; - SDL_bool is_PNG; + bool is_PNG; Uint8 magic[4]; if (!src) { - return SDL_FALSE; + return false; } start = SDL_TellIO(src); - is_PNG = SDL_FALSE; + is_PNG = false; if (SDL_ReadIO(src, magic, sizeof(magic)) == sizeof(magic) ) { if ( magic[0] == 0x89 && magic[1] == 'P' && magic[2] == 'N' && magic[3] == 'G' ) { - is_PNG = SDL_TRUE; + is_PNG = true; } } SDL_SeekIO(src, start, SDL_IO_SEEK_SET); return is_PNG; } -SDL_bool IMG_isJPG(SDL_IOStream *src) +bool IMG_isJPG(SDL_IOStream *src) { Sint64 start; - SDL_bool is_JPG; - SDL_bool in_scan; + bool is_JPG; + bool in_scan; Uint8 magic[4]; /* This detection code is by Steaphan Greene */ @@ -120,20 +120,20 @@ SDL_bool IMG_isJPG(SDL_IOStream *src) /* And don't forget to report the problem to the the sdl list too! */ if (!src) { - return SDL_FALSE; + return false; } start = SDL_TellIO(src); - is_JPG = SDL_FALSE; - in_scan = SDL_FALSE; + is_JPG = false; + in_scan = false; if (SDL_ReadIO(src, magic, 2) == 2) { if ( (magic[0] == 0xFF) && (magic[1] == 0xD8) ) { - is_JPG = SDL_TRUE; + is_JPG = true; while (is_JPG) { if (SDL_ReadIO(src, magic, 2) != 2) { - is_JPG = SDL_FALSE; + is_JPG = false; } else if ( (magic[0] != 0xFF) && !in_scan ) { - is_JPG = SDL_FALSE; + is_JPG = false; } else if ( (magic[0] != 0xFF) || (magic[1] == 0xFF) ) { /* Extra padding in JPEG (legal) */ /* or this is data and we are scanning */ @@ -146,7 +146,7 @@ SDL_bool IMG_isJPG(SDL_IOStream *src) } else if ( (magic[1] >= 0xD0) && (magic[1] < 0xD9) ) { /* These have nothing else */ } else if (SDL_ReadIO(src, magic+2, 2) != 2) { - is_JPG = SDL_FALSE; + is_JPG = false; } else { /* Yes, it's big-endian */ Sint64 innerStart; @@ -156,7 +156,7 @@ SDL_bool IMG_isJPG(SDL_IOStream *src) size = (magic[2] << 8) + magic[3]; end = SDL_SeekIO(src, size-2, SDL_IO_SEEK_CUR); if ( end != innerStart + size - 2 ) { - is_JPG = SDL_FALSE; + is_JPG = false; } if ( magic[1] == 0xDA ) { /* Now comes the actual JPEG meat */ @@ -165,7 +165,7 @@ SDL_bool IMG_isJPG(SDL_IOStream *src) break; #else /* I'm not convinced. Prove it! */ - in_scan = SDL_TRUE; + in_scan = true; #endif } } @@ -176,18 +176,18 @@ SDL_bool IMG_isJPG(SDL_IOStream *src) return is_JPG; } -SDL_bool IMG_isTIF(SDL_IOStream * src) +bool IMG_isTIF(SDL_IOStream * src) { Sint64 start; - SDL_bool is_TIF; + bool is_TIF; Uint8 magic[4]; if (!src) { - return SDL_FALSE; + return false; } start = SDL_TellIO(src); - is_TIF = SDL_FALSE; + is_TIF = false; if (SDL_ReadIO(src, magic, sizeof(magic)) == sizeof(magic) ) { if ( (magic[0] == 'I' && magic[1] == 'I' && @@ -197,7 +197,7 @@ SDL_bool IMG_isTIF(SDL_IOStream * src) magic[1] == 'M' && magic[2] == 0x00 && magic[3] == 0x2a) ) { - is_TIF = SDL_TRUE; + is_TIF = true; } } SDL_SeekIO(src, start, SDL_IO_SEEK_SET); @@ -220,7 +220,7 @@ static SDL_Surface* WIC_LoadImage(SDL_IOStream *src) } size_t fileSize; - Uint8 *memoryBuffer = (Uint8 *)SDL_LoadFile_IO(src, &fileSize, SDL_FALSE); + Uint8 *memoryBuffer = (Uint8 *)SDL_LoadFile_IO(src, &fileSize, false); if (!memoryBuffer) { return NULL; } diff --git a/src/IMG_avif.c b/src/IMG_avif.c index 2adb3adb..76484193 100644 --- a/src/IMG_avif.c +++ b/src/IMG_avif.c @@ -132,7 +132,7 @@ void IMG_QuitAVIF(void) --lib.loaded; } -static SDL_bool ReadAVIFHeader(SDL_IOStream *src, Uint8 **header_data, size_t *header_size) +static bool ReadAVIFHeader(SDL_IOStream *src, Uint8 **header_data, size_t *header_size) { Uint8 magic[16]; Uint64 size; @@ -143,12 +143,12 @@ static SDL_bool ReadAVIFHeader(SDL_IOStream *src, Uint8 **header_data, size_t *h *header_size = 0; if (SDL_ReadIO(src, magic, 8) != 8) { - return SDL_FALSE; + return false; } read += 8; if (SDL_memcmp(&magic[4], "ftyp", 4) != 0) { - return SDL_FALSE; + return false; } size = (((Uint64)magic[0] << 24) | @@ -158,7 +158,7 @@ static SDL_bool ReadAVIFHeader(SDL_IOStream *src, Uint8 **header_data, size_t *h if (size == 1) { /* 64-bit header size */ if (SDL_ReadIO(src, &magic[8], 8) != 8) { - return SDL_FALSE; + return false; } read += 8; @@ -173,38 +173,38 @@ static SDL_bool ReadAVIFHeader(SDL_IOStream *src, Uint8 **header_data, size_t *h } if (size > SDL_SIZE_MAX) { - return SDL_FALSE; + return false; } if (size <= read) { - return SDL_FALSE; + return false; } /* Read in the header */ data = (Uint8 *)SDL_malloc((size_t)size); if (!data) { - return SDL_FALSE; + return false; } SDL_memcpy(data, magic, (size_t)read); if (SDL_ReadIO(src, &data[read], (size_t)(size - read)) != (size_t)(size - read)) { SDL_free(data); - return SDL_FALSE; + return false; } *header_data = data; *header_size = (size_t)size; - return SDL_TRUE; + return true; } /* See if an image is contained in a data source */ -SDL_bool IMG_isAVIF(SDL_IOStream *src) +bool IMG_isAVIF(SDL_IOStream *src) { Sint64 start; - SDL_bool is_AVIF; + bool is_AVIF; Uint8 *data; size_t size; if (!src) { - return SDL_FALSE; + return false; } start = SDL_TellIO(src); @@ -520,7 +520,7 @@ SDL_Surface *IMG_LoadAVIF_IO(SDL_IOStream *src) return surface; } -static SDL_bool IMG_SaveAVIF_IO_libavif(SDL_Surface *surface, SDL_IOStream *dst, int quality) +static bool IMG_SaveAVIF_IO_libavif(SDL_Surface *surface, SDL_IOStream *dst, int quality) { avifImage *image = NULL; avifRGBImage rgb; @@ -530,10 +530,10 @@ static SDL_bool IMG_SaveAVIF_IO_libavif(SDL_Surface *surface, SDL_IOStream *dst, SDL_Colorspace colorspace; Uint16 maxCLL, maxFALL; SDL_PropertiesID props; - SDL_bool result = SDL_FALSE; + bool result = false; if (!IMG_Init(IMG_INIT_AVIF)) { - return SDL_FALSE; + return false; } /* Get the colorspace and light level properties, if any */ @@ -576,7 +576,7 @@ static SDL_bool IMG_SaveAVIF_IO_libavif(SDL_Surface *surface, SDL_IOStream *dst, } else { rgb.format = AVIF_RGB_FORMAT_BGRA; } - rgb.ignoreAlpha = SDL_ISPIXELFORMAT_ALPHA(surface->format) ? SDL_FALSE : SDL_TRUE; + rgb.ignoreAlpha = SDL_ISPIXELFORMAT_ALPHA(surface->format) ? false : true; rgb.depth = 10; rgb.rowBytes = (uint32_t)image->width * 4 * sizeof(Uint16); rgb.pixels = (uint8_t *)SDL_malloc(image->height * rgb.rowBytes); @@ -645,7 +645,7 @@ static SDL_bool IMG_SaveAVIF_IO_libavif(SDL_Surface *surface, SDL_IOStream *dst, } break; } - rgb.ignoreAlpha = SDL_ISPIXELFORMAT_ALPHA(surface->format) ? SDL_FALSE : SDL_TRUE; + rgb.ignoreAlpha = SDL_ISPIXELFORMAT_ALPHA(surface->format) ? false : true; rgb.pixels = (uint8_t *)temp->pixels; rgb.rowBytes = (uint32_t)temp->pitch; @@ -683,7 +683,7 @@ static SDL_bool IMG_SaveAVIF_IO_libavif(SDL_Surface *surface, SDL_IOStream *dst, } if (SDL_WriteIO(dst, avifOutput.data, avifOutput.size) == avifOutput.size) { - result = SDL_TRUE; + result = true; } done: @@ -721,10 +721,10 @@ void IMG_QuitAVIF(void) } /* See if an image is contained in a data source */ -SDL_bool IMG_isAVIF(SDL_IOStream *src) +bool IMG_isAVIF(SDL_IOStream *src) { (void)src; - return SDL_FALSE; + return false; } /* Load a AVIF type image from an SDL datasource */ @@ -736,19 +736,19 @@ SDL_Surface *IMG_LoadAVIF_IO(SDL_IOStream *src) #endif /* LOAD_AVIF */ -SDL_bool IMG_SaveAVIF(SDL_Surface *surface, const char *file, int quality) +bool IMG_SaveAVIF(SDL_Surface *surface, const char *file, int quality) { SDL_IOStream *dst = SDL_IOFromFile(file, "wb"); if (dst) { return IMG_SaveAVIF_IO(surface, dst, 1, quality); } else { - return SDL_FALSE; + return false; } } -SDL_bool IMG_SaveAVIF_IO(SDL_Surface *surface, SDL_IOStream *dst, int closeio, int quality) +bool IMG_SaveAVIF_IO(SDL_Surface *surface, SDL_IOStream *dst, int closeio, int quality) { - SDL_bool result = SDL_FALSE; + bool result = false; if (!dst) { return SDL_SetError("Passed NULL dst"); diff --git a/src/IMG_bmp.c b/src/IMG_bmp.c index 2dbb55c0..4386896a 100644 --- a/src/IMG_bmp.c +++ b/src/IMG_bmp.c @@ -36,31 +36,31 @@ #ifdef LOAD_BMP /* See if an image is contained in a data source */ -SDL_bool IMG_isBMP(SDL_IOStream *src) +bool IMG_isBMP(SDL_IOStream *src) { Sint64 start; - SDL_bool is_BMP; + bool is_BMP; char magic[2]; if (!src) { - return SDL_FALSE; + return false; } start = SDL_TellIO(src); - is_BMP = SDL_FALSE; + is_BMP = false; if (SDL_ReadIO(src, magic, sizeof(magic)) == sizeof(magic)) { if (SDL_strncmp(magic, "BM", 2) == 0) { - is_BMP = SDL_TRUE; + is_BMP = true; } } SDL_SeekIO(src, start, SDL_IO_SEEK_SET); return is_BMP; } -static SDL_bool IMG_isICOCUR(SDL_IOStream *src, int type) +static bool IMG_isICOCUR(SDL_IOStream *src, int type) { Sint64 start; - SDL_bool is_ICOCUR; + bool is_ICOCUR; /* The Win32 ICO file header (14 bytes) */ Uint16 bfReserved; @@ -68,28 +68,28 @@ static SDL_bool IMG_isICOCUR(SDL_IOStream *src, int type) Uint16 bfCount; if (!src) { - return SDL_FALSE; + return false; } start = SDL_TellIO(src); - is_ICOCUR = SDL_FALSE; + is_ICOCUR = false; if (SDL_ReadU16LE(src, &bfReserved) && SDL_ReadU16LE(src, &bfType) && SDL_ReadU16LE(src, &bfCount) && (bfReserved == 0) && (bfType == type) && (bfCount != 0)) { - is_ICOCUR = SDL_TRUE; + is_ICOCUR = true; } SDL_SeekIO(src, start, SDL_IO_SEEK_SET); return is_ICOCUR; } -SDL_bool IMG_isICO(SDL_IOStream *src) +bool IMG_isICO(SDL_IOStream *src) { return IMG_isICOCUR(src, 1); } -SDL_bool IMG_isCUR(SDL_IOStream *src) +bool IMG_isCUR(SDL_IOStream *src) { return IMG_isICOCUR(src, 2); } @@ -106,15 +106,15 @@ SDL_bool IMG_isCUR(SDL_IOStream *src) #define BI_BITFIELDS 3 #endif -static SDL_Surface *LoadBMP_IO (SDL_IOStream *src, SDL_bool closeio) +static SDL_Surface *LoadBMP_IO (SDL_IOStream *src, bool closeio) { return SDL_LoadBMP_IO(src, closeio); } static SDL_Surface * -LoadICOCUR_IO(SDL_IOStream * src, int type, SDL_bool closeio) +LoadICOCUR_IO(SDL_IOStream * src, int type, bool closeio) { - SDL_bool was_error = SDL_TRUE; + bool was_error = true; Sint64 fp_offset = 0; int bmpPitch; int i,j, pad; @@ -418,7 +418,7 @@ LoadICOCUR_IO(SDL_IOStream * src, int type, SDL_bool closeio) } } - was_error = SDL_FALSE; + was_error = false; done: if (closeio && src) { @@ -439,19 +439,19 @@ LoadICOCUR_IO(SDL_IOStream * src, int type, SDL_bool closeio) /* Load a BMP type image from an SDL datasource */ SDL_Surface *IMG_LoadBMP_IO(SDL_IOStream *src) { - return LoadBMP_IO(src, SDL_FALSE); + return LoadBMP_IO(src, false); } /* Load a ICO type image from an SDL datasource */ SDL_Surface *IMG_LoadICO_IO(SDL_IOStream *src) { - return LoadICOCUR_IO(src, 1, SDL_FALSE); + return LoadICOCUR_IO(src, 1, false); } /* Load a CUR type image from an SDL datasource */ SDL_Surface *IMG_LoadCUR_IO(SDL_IOStream *src) { - return LoadICOCUR_IO(src, 2, SDL_FALSE); + return LoadICOCUR_IO(src, 2, false); } #else @@ -461,19 +461,19 @@ SDL_Surface *IMG_LoadCUR_IO(SDL_IOStream *src) #endif /* See if an image is contained in a data source */ -SDL_bool IMG_isBMP(SDL_IOStream *src) +bool IMG_isBMP(SDL_IOStream *src) { - return SDL_FALSE; + return false; } -SDL_bool IMG_isICO(SDL_IOStream *src) +bool IMG_isICO(SDL_IOStream *src) { - return SDL_FALSE; + return false; } -SDL_bool IMG_isCUR(SDL_IOStream *src) +bool IMG_isCUR(SDL_IOStream *src) { - return SDL_FALSE; + return false; } /* Load a BMP type image from an SDL datasource */ diff --git a/src/IMG_gif.c b/src/IMG_gif.c index e16bf521..4825eec9 100644 --- a/src/IMG_gif.c +++ b/src/IMG_gif.c @@ -138,7 +138,7 @@ static Image *ReadImage(SDL_IOStream * src, int len, int height, int, unsigned char cmap[3][MAXCOLORMAPSIZE], int gray, int interlace, int ignore, State_t * state); -static SDL_bool NormalizeFrames(Frame_t *frames, int count) +static bool NormalizeFrames(Frame_t *frames, int count) { SDL_Surface *image; int i; @@ -154,7 +154,7 @@ static SDL_bool NormalizeFrames(Frame_t *frames, int count) image = SDL_ConvertSurface(frames[0].image, SDL_PIXELFORMAT_XRGB8888); } if (!image) { - return SDL_FALSE; + return false; } fill = SDL_MapSurfaceRGBA(image, 0, 0, 0, SDL_ALPHA_TRANSPARENT); @@ -189,7 +189,7 @@ static SDL_bool NormalizeFrames(Frame_t *frames, int count) SDL_DestroySurface(frames[i].image); frames[i].image = SDL_DuplicateSurface(image); if (!frames[i].image) { - return SDL_FALSE; + return false; } lastDispose = frames[i].disposal; @@ -197,11 +197,11 @@ static SDL_bool NormalizeFrames(Frame_t *frames, int count) SDL_DestroySurface( image ); - return SDL_TRUE; + return true; } static Anim_t * -IMG_LoadGIF_IO_Internal(SDL_IOStream *src, SDL_bool load_anim) +IMG_LoadGIF_IO_Internal(SDL_IOStream *src, bool load_anim) { unsigned char buf[16]; unsigned char c; @@ -314,7 +314,7 @@ IMG_LoadGIF_IO_Internal(SDL_IOStream *src, SDL_bool load_anim) if (image) { if (state->Gif89.transparent >= 0) { - SDL_SetSurfaceColorKey(image, SDL_TRUE, state->Gif89.transparent); + SDL_SetSurfaceColorKey(image, true, state->Gif89.transparent); } frames = (Frame_t *)SDL_realloc(anim->frames, (anim->count + 1) * sizeof(*anim->frames)); @@ -708,7 +708,7 @@ ReadImage(SDL_IOStream * src, int len, int height, int cmapSize, /* Load a GIF type animation from an SDL datasource */ IMG_Animation *IMG_LoadGIFAnimation_IO(SDL_IOStream *src) { - Anim_t *internal = IMG_LoadGIF_IO_Internal(src, SDL_TRUE); + Anim_t *internal = IMG_LoadGIF_IO_Internal(src, true); if (internal) { IMG_Animation *anim = (IMG_Animation *)SDL_malloc(sizeof(*anim)); if (anim) { @@ -753,23 +753,23 @@ IMG_Animation *IMG_LoadGIFAnimation_IO(SDL_IOStream *src) #ifdef LOAD_GIF /* See if an image is contained in a data source */ -SDL_bool IMG_isGIF(SDL_IOStream *src) +bool IMG_isGIF(SDL_IOStream *src) { Sint64 start; - SDL_bool is_GIF; + bool is_GIF; char magic[6]; if (!src) { - return SDL_FALSE; + return false; } start = SDL_TellIO(src); - is_GIF = SDL_FALSE; + is_GIF = false; if (SDL_ReadIO(src, magic, sizeof(magic)) == sizeof(magic) ) { if ( (SDL_strncmp(magic, "GIF", 3) == 0) && ((SDL_memcmp(magic + 3, "87a", 3) == 0) || (SDL_memcmp(magic + 3, "89a", 3) == 0)) ) { - is_GIF = SDL_TRUE; + is_GIF = true; } } SDL_SeekIO(src, start, SDL_IO_SEEK_SET); @@ -780,7 +780,7 @@ SDL_bool IMG_isGIF(SDL_IOStream *src) SDL_Surface *IMG_LoadGIF_IO(SDL_IOStream *src) { SDL_Surface *image = NULL; - Anim_t *internal = IMG_LoadGIF_IO_Internal(src, SDL_FALSE); + Anim_t *internal = IMG_LoadGIF_IO_Internal(src, false); if (internal) { image = internal->frames[0].image; SDL_free(internal->frames); @@ -795,9 +795,9 @@ SDL_Surface *IMG_LoadGIF_IO(SDL_IOStream *src) #endif /* See if an image is contained in a data source */ -SDL_bool IMG_isGIF(SDL_IOStream *src) +bool IMG_isGIF(SDL_IOStream *src) { - return SDL_FALSE; + return false; } /* Load a GIF type image from an SDL datasource */ diff --git a/src/IMG_jpg.c b/src/IMG_jpg.c index ebca1a29..d7a3e05f 100644 --- a/src/IMG_jpg.c +++ b/src/IMG_jpg.c @@ -139,11 +139,11 @@ void IMG_QuitJPG(void) } /* See if an image is contained in a data source */ -SDL_bool IMG_isJPG(SDL_IOStream *src) +bool IMG_isJPG(SDL_IOStream *src) { Sint64 start; - SDL_bool is_JPG; - SDL_bool in_scan; + bool is_JPG; + bool in_scan; Uint8 magic[4]; /* This detection code is by Steaphan Greene */ @@ -151,20 +151,20 @@ SDL_bool IMG_isJPG(SDL_IOStream *src) /* And don't forget to report the problem to the the sdl list too! */ if (!src) { - return SDL_FALSE; + return false; } start = SDL_TellIO(src); - is_JPG = SDL_FALSE; - in_scan = SDL_FALSE; + is_JPG = false; + in_scan = false; if (SDL_ReadIO(src, magic, 2) == 2) { if ( (magic[0] == 0xFF) && (magic[1] == 0xD8) ) { - is_JPG = SDL_TRUE; + is_JPG = true; while (is_JPG) { if (SDL_ReadIO(src, magic, 2) != 2) { - is_JPG = SDL_FALSE; + is_JPG = false; } else if ( (magic[0] != 0xFF) && !in_scan ) { - is_JPG = SDL_FALSE; + is_JPG = false; } else if ( (magic[0] != 0xFF) || (magic[1] == 0xFF) ) { /* Extra padding in JPEG (legal) */ /* or this is data and we are scanning */ @@ -177,7 +177,7 @@ SDL_bool IMG_isJPG(SDL_IOStream *src) } else if ( (magic[1] >= 0xD0) && (magic[1] < 0xD9) ) { /* These have nothing else */ } else if (SDL_ReadIO(src, magic+2, 2) != 2) { - is_JPG = SDL_FALSE; + is_JPG = false; } else { /* Yes, it's big-endian */ Sint64 innerStart; @@ -187,7 +187,7 @@ SDL_bool IMG_isJPG(SDL_IOStream *src) size = (magic[2] << 8) + magic[3]; end = SDL_SeekIO(src, size-2, SDL_IO_SEEK_CUR); if ( end != innerStart + size - 2 ) { - is_JPG = SDL_FALSE; + is_JPG = false; } if ( magic[1] == 0xDA ) { /* Now comes the actual JPEG meat */ @@ -196,7 +196,7 @@ SDL_bool IMG_isJPG(SDL_IOStream *src) break; #else /* I'm not convinced. Prove it! */ - in_scan = SDL_TRUE; + in_scan = true; #endif } } @@ -489,7 +489,7 @@ struct savejpeg_vars Sint64 original_offset; }; -static SDL_bool JPEG_SaveJPEG_IO(struct savejpeg_vars *vars, SDL_Surface *jpeg_surface, SDL_IOStream *dst, int quality) +static bool JPEG_SaveJPEG_IO(struct savejpeg_vars *vars, SDL_Surface *jpeg_surface, SDL_IOStream *dst, int quality) { /* Create a compression structure and load the JPEG header */ vars->cinfo.err = lib.jpeg_std_error(&vars->jerr.errmgr); @@ -526,27 +526,27 @@ static SDL_bool JPEG_SaveJPEG_IO(struct savejpeg_vars *vars, SDL_Surface *jpeg_s lib.jpeg_finish_compress(&vars->cinfo); lib.jpeg_destroy_compress(&vars->cinfo); - return SDL_TRUE; + return true; } -static SDL_bool IMG_SaveJPG_IO_jpeglib(SDL_Surface *surface, SDL_IOStream *dst, int quality) +static bool IMG_SaveJPG_IO_jpeglib(SDL_Surface *surface, SDL_IOStream *dst, int quality) { /* The JPEG library reads bytes in R,G,B order, so this is the right * encoding for either endianness */ struct savejpeg_vars vars; static const Uint32 jpg_format = SDL_PIXELFORMAT_RGB24; SDL_Surface* jpeg_surface = surface; - SDL_bool result; + bool result; if (!IMG_Init(IMG_INIT_JPG)) { - return SDL_FALSE; + return false; } /* Convert surface to format we can save */ if (surface->format != jpg_format) { jpeg_surface = SDL_ConvertSurface(surface, jpg_format); if (!jpeg_surface) { - return SDL_FALSE; + return false; } } @@ -578,11 +578,11 @@ void IMG_QuitJPG(void) /* Define this for quicker (but less perfect) JPEG identification */ #define FAST_IS_JPEG /* See if an image is contained in a data source */ -SDL_bool IMG_isJPG(SDL_IOStream *src) +bool IMG_isJPG(SDL_IOStream *src) { Sint64 start; - SDL_bool is_JPG; - SDL_bool in_scan; + bool is_JPG; + bool in_scan; Uint8 magic[4]; /* This detection code is by Steaphan Greene */ @@ -590,20 +590,20 @@ SDL_bool IMG_isJPG(SDL_IOStream *src) /* And don't forget to report the problem to the the sdl list too! */ if (!src) { - return SDL_FALSE; + return false; } start = SDL_TellIO(src); - is_JPG = SDL_FALSE; - in_scan = SDL_FALSE; + is_JPG = false; + in_scan = false; if (SDL_ReadIO(src, magic, 2) == 2) { if ( (magic[0] == 0xFF) && (magic[1] == 0xD8) ) { - is_JPG = SDL_TRUE; + is_JPG = true; while (is_JPG) { if (SDL_ReadIO(src, magic, 2) != 2) { - is_JPG = SDL_FALSE; + is_JPG = false; } else if ( (magic[0] != 0xFF) && !in_scan ) { - is_JPG = SDL_FALSE; + is_JPG = false; } else if ( (magic[0] != 0xFF) || (magic[1] == 0xFF) ) { /* Extra padding in JPEG (legal) */ /* or this is data and we are scanning */ @@ -616,7 +616,7 @@ SDL_bool IMG_isJPG(SDL_IOStream *src) } else if ( (magic[1] >= 0xD0) && (magic[1] < 0xD9) ) { /* These have nothing else */ } else if (SDL_ReadIO(src, magic+2, 2) != 2) { - is_JPG = SDL_FALSE; + is_JPG = false; } else { /* Yes, it's big-endian */ Sint64 innerStart; @@ -626,7 +626,7 @@ SDL_bool IMG_isJPG(SDL_IOStream *src) size = (magic[2] << 8) + magic[3]; end = SDL_SeekIO(src, size-2, SDL_IO_SEEK_CUR); if ( end != innerStart + size - 2 ) { - is_JPG = SDL_FALSE; + is_JPG = false; } if ( magic[1] == 0xDA ) { /* Now comes the actual JPEG meat */ @@ -635,7 +635,7 @@ SDL_bool IMG_isJPG(SDL_IOStream *src) break; #else /* I'm not convinced. Prove it! */ - in_scan = SDL_TRUE; + in_scan = true; #endif } } @@ -670,10 +670,10 @@ void IMG_QuitJPG(void) } /* See if an image is contained in a data source */ -SDL_bool IMG_isJPG(SDL_IOStream *src) +bool IMG_isJPG(SDL_IOStream *src) { (void)src; - return SDL_FALSE; + return false; } /* Load a JPEG type image from an SDL datasource */ @@ -714,19 +714,19 @@ static void IMG_SaveJPG_IO_tinyjpeg_callback(void* context, void* data, int size SDL_WriteIO((SDL_IOStream*) context, data, size); } -static SDL_bool IMG_SaveJPG_IO_tinyjpeg(SDL_Surface *surface, SDL_IOStream *dst, int quality) +static bool IMG_SaveJPG_IO_tinyjpeg(SDL_Surface *surface, SDL_IOStream *dst, int quality) { /* The JPEG library reads bytes in R,G,B order, so this is the right * encoding for either endianness */ static const Uint32 jpg_format = SDL_PIXELFORMAT_RGB24; SDL_Surface* jpeg_surface = surface; - SDL_bool result = SDL_FALSE; + bool result = false; /* Convert surface to format we can save */ if (surface->format != jpg_format) { jpeg_surface = SDL_ConvertSurface(surface, jpg_format); if (!jpeg_surface) { - return SDL_FALSE; + return false; } } @@ -762,19 +762,19 @@ static SDL_bool IMG_SaveJPG_IO_tinyjpeg(SDL_Surface *surface, SDL_IOStream *dst, #endif /* SDL_IMAGE_SAVE_JPG && (defined(LOAD_JPG_DYNAMIC) || !defined(WANT_JPEGLIB)) */ -SDL_bool IMG_SaveJPG(SDL_Surface *surface, const char *file, int quality) +bool IMG_SaveJPG(SDL_Surface *surface, const char *file, int quality) { SDL_IOStream *dst = SDL_IOFromFile(file, "wb"); if (dst) { return IMG_SaveJPG_IO(surface, dst, 1, quality); } else { - return SDL_FALSE; + return false; } } -SDL_bool IMG_SaveJPG_IO(SDL_Surface *surface, SDL_IOStream *dst, int closeio, int quality) +bool IMG_SaveJPG_IO(SDL_Surface *surface, SDL_IOStream *dst, int closeio, int quality) { - SDL_bool result = SDL_FALSE; + bool result = false; (void)surface; (void)quality; diff --git a/src/IMG_jxl.c b/src/IMG_jxl.c index fb9425ad..0c5c91c1 100644 --- a/src/IMG_jxl.c +++ b/src/IMG_jxl.c @@ -92,22 +92,22 @@ void IMG_QuitJXL(void) } /* See if an image is contained in a data source */ -SDL_bool IMG_isJXL(SDL_IOStream *src) +bool IMG_isJXL(SDL_IOStream *src) { Sint64 start; - SDL_bool is_JXL; + bool is_JXL; Uint8 magic[12]; if (!src) { - return SDL_FALSE; + return false; } start = SDL_TellIO(src); - is_JXL = SDL_FALSE; + is_JXL = false; if (SDL_ReadIO(src, magic, 2) == 2 ) { if ( magic[0] == 0xFF && magic[1] == 0x0A ) { /* This is a JXL codestream */ - is_JXL = SDL_TRUE; + is_JXL = true; } else { if (SDL_ReadIO(src, &magic[2], sizeof(magic) - 2) == (sizeof(magic) - 2) ) { if ( magic[0] == 0x00 && magic[1] == 0x00 && @@ -117,7 +117,7 @@ SDL_bool IMG_isJXL(SDL_IOStream *src) magic[8] == 0x0D && magic[9] == 0x0A && magic[10] == 0x87 && magic[11] == 0x0A ) { /* This is a JXL container */ - is_JXL = SDL_TRUE; + is_JXL = true; } } } @@ -150,7 +150,7 @@ SDL_Surface *IMG_LoadJXL_IO(SDL_IOStream *src) return NULL; } - data = (unsigned char *)SDL_LoadFile_IO(src, &datasize, SDL_FALSE); + data = (unsigned char *)SDL_LoadFile_IO(src, &datasize, false); if (!data) { return NULL; } @@ -265,10 +265,10 @@ void IMG_QuitJXL(void) } /* See if an image is contained in a data source */ -SDL_bool IMG_isJXL(SDL_IOStream *src) +bool IMG_isJXL(SDL_IOStream *src) { (void)src; - return SDL_FALSE; + return false; } /* Load a JXL type image from an SDL datasource */ diff --git a/src/IMG_lbm.c b/src/IMG_lbm.c index 44418201..5031fa0e 100644 --- a/src/IMG_lbm.c +++ b/src/IMG_lbm.c @@ -56,25 +56,25 @@ typedef struct Sint16 Hpage; /* height of the screen in pixels */ } BMHD; -SDL_bool IMG_isLBM(SDL_IOStream *src ) +bool IMG_isLBM(SDL_IOStream *src ) { Sint64 start; - SDL_bool is_LBM; + bool is_LBM; Uint8 magic[4+4+4]; if (!src) { - return SDL_FALSE; + return false; } start = SDL_TellIO(src); - is_LBM = SDL_FALSE; + is_LBM = false; if (SDL_ReadIO( src, magic, sizeof(magic) ) == sizeof(magic) ) { if ( !SDL_memcmp( magic, "FORM", 4 ) && ( !SDL_memcmp( magic + 8, "PBM ", 4 ) || !SDL_memcmp( magic + 8, "ILBM", 4 ) ) ) { - is_LBM = SDL_TRUE; + is_LBM = true; } } SDL_SeekIO(src, start, SDL_IO_SEEK_SET); @@ -268,7 +268,7 @@ SDL_Surface *IMG_LoadLBM_IO(SDL_IOStream *src ) } if ( bmhd.mask & 2 ) /* There is a transparent color */ - SDL_SetSurfaceColorKey( Image, SDL_TRUE, bmhd.tcolor ); + SDL_SetSurfaceColorKey( Image, true, bmhd.tcolor ); /* Update palette information */ @@ -509,9 +509,9 @@ SDL_Surface *IMG_LoadLBM_IO(SDL_IOStream *src ) #endif /* See if an image is contained in a data source */ -SDL_bool IMG_isLBM(SDL_IOStream *src) +bool IMG_isLBM(SDL_IOStream *src) { - return SDL_FALSE; + return false; } /* Load an IFF type image from an SDL datasource */ diff --git a/src/IMG_pcx.c b/src/IMG_pcx.c index 21d69220..8cfe8db0 100644 --- a/src/IMG_pcx.c +++ b/src/IMG_pcx.c @@ -58,10 +58,10 @@ struct PCXheader { }; /* See if an image is contained in a data source */ -SDL_bool IMG_isPCX(SDL_IOStream *src) +bool IMG_isPCX(SDL_IOStream *src) { Sint64 start; - SDL_bool is_PCX; + bool is_PCX; const int ZSoft_Manufacturer = 10; const int PC_Paintbrush_Version = 5; const int PCX_Uncompressed_Encoding = 0; @@ -69,17 +69,17 @@ SDL_bool IMG_isPCX(SDL_IOStream *src) struct PCXheader pcxh; if (!src) { - return SDL_FALSE; + return false; } start = SDL_TellIO(src); - is_PCX = SDL_FALSE; + is_PCX = false; if (SDL_ReadIO(src, &pcxh, sizeof(pcxh)) == sizeof(pcxh) ) { if ( (pcxh.Manufacturer == ZSoft_Manufacturer) && (pcxh.Version == PC_Paintbrush_Version) && (pcxh.Encoding == PCX_RunLength_Encoding || pcxh.Encoding == PCX_Uncompressed_Encoding) ) { - is_PCX = SDL_TRUE; + is_PCX = true; } } SDL_SeekIO(src, start, SDL_IO_SEEK_SET); @@ -299,9 +299,9 @@ SDL_Surface *IMG_LoadPCX_IO(SDL_IOStream *src) #endif /* See if an image is contained in a data source */ -SDL_bool IMG_isPCX(SDL_IOStream *src) +bool IMG_isPCX(SDL_IOStream *src) { - return SDL_FALSE; + return false; } /* Load a PCX type image from an SDL datasource */ diff --git a/src/IMG_png.c b/src/IMG_png.c index 37545d2d..dbebcfa3 100644 --- a/src/IMG_png.c +++ b/src/IMG_png.c @@ -201,24 +201,24 @@ void IMG_QuitPNG(void) } /* See if an image is contained in a data source */ -SDL_bool IMG_isPNG(SDL_IOStream *src) +bool IMG_isPNG(SDL_IOStream *src) { Sint64 start; - SDL_bool is_PNG; + bool is_PNG; Uint8 magic[4]; if (!src) { - return SDL_FALSE; + return false; } start = SDL_TellIO(src); - is_PNG = SDL_FALSE; + is_PNG = false; if (SDL_ReadIO(src, magic, sizeof(magic)) == sizeof(magic) ) { if ( magic[0] == 0x89 && magic[1] == 'P' && magic[2] == 'N' && magic[3] == 'G' ) { - is_PNG = SDL_TRUE; + is_PNG = true; } } SDL_SeekIO(src, start, SDL_IO_SEEK_SET); @@ -398,7 +398,7 @@ static void LIBPNG_LoadPNG_IO(SDL_IOStream *src, struct loadpng_vars *vars) (Uint8)transv->green, (Uint8)transv->blue); } - SDL_SetSurfaceColorKey(vars->surface, SDL_TRUE, ckey); + SDL_SetSurfaceColorKey(vars->surface, true, ckey); } /* Create the array of pointers to image data */ @@ -516,24 +516,24 @@ void IMG_QuitPNG(void) /* FIXME: This is a copypaste from LIBPNG! Pull that out of the ifdefs */ /* See if an image is contained in a data source */ -SDL_bool IMG_isPNG(SDL_IOStream *src) +bool IMG_isPNG(SDL_IOStream *src) { Sint64 start; - SDL_bool is_PNG; + bool is_PNG; Uint8 magic[4]; if (!src) { - return SDL_FALSE; + return false; } start = SDL_TellIO(src); - is_PNG = SDL_FALSE; + is_PNG = false; if (SDL_ReadIO(src, magic, sizeof(magic)) == sizeof(magic) ) { if ( magic[0] == 0x89 && magic[1] == 'P' && magic[2] == 'N' && magic[3] == 'G' ) { - is_PNG = SDL_TRUE; + is_PNG = true; } } SDL_SeekIO(src, start, SDL_IO_SEEK_SET); @@ -564,9 +564,9 @@ void IMG_QuitPNG(void) } /* See if an image is contained in a data source */ -SDL_bool IMG_isPNG(SDL_IOStream *src) +bool IMG_isPNG(SDL_IOStream *src) { - return SDL_FALSE; + return false; } /* Load a PNG type image from an SDL datasource */ @@ -603,7 +603,7 @@ struct savepng_vars { SDL_Surface *source; }; -static SDL_bool LIBPNG_SavePNG_IO(struct savepng_vars *vars, SDL_Surface *surface, SDL_IOStream *dst) +static bool LIBPNG_SavePNG_IO(struct savepng_vars *vars, SDL_Surface *surface, SDL_IOStream *dst) { Uint8 transparent_table[256]; SDL_Palette *palette; @@ -614,13 +614,13 @@ static SDL_bool LIBPNG_SavePNG_IO(struct savepng_vars *vars, SDL_Surface *surfac vars->png_ptr = lib.png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (vars->png_ptr == NULL) { vars->error = "Couldn't allocate memory for PNG file or incompatible PNG dll"; - return SDL_FALSE; + return false; } vars->info_ptr = lib.png_create_info_struct(vars->png_ptr); if (vars->info_ptr == NULL) { vars->error = "Couldn't create image information for PNG file"; - return SDL_FALSE; + return false; } #ifdef PNG_SETJMP_SUPPORTED #ifndef LIBPNG_VERSION_12 @@ -631,7 +631,7 @@ static SDL_bool LIBPNG_SavePNG_IO(struct savepng_vars *vars, SDL_Surface *surfac #endif { vars->error = "Error writing the PNG file."; - return SDL_FALSE; + return false; } palette = SDL_GetSurfacePalette(surface); @@ -643,7 +643,7 @@ static SDL_bool LIBPNG_SavePNG_IO(struct savepng_vars *vars, SDL_Surface *surfac vars->color_ptr = (png_colorp)SDL_malloc(sizeof(png_color) * ncolors); if (vars->color_ptr == NULL) { vars->error = "Couldn't create palette for PNG file"; - return SDL_FALSE; + return false; } for (i = 0; i < ncolors; i++) { vars->color_ptr[i].red = palette->colors[i].r; @@ -693,7 +693,7 @@ static SDL_bool LIBPNG_SavePNG_IO(struct savepng_vars *vars, SDL_Surface *surfac vars->row_pointers = (png_bytep *) SDL_malloc(sizeof(png_bytep) * vars->source->h); if (!vars->row_pointers) { vars->error = "Out of memory"; - return SDL_FALSE; + return false; } for (row = 0; row < (int)vars->source->h; row++) { vars->row_pointers[row] = (png_bytep) (Uint8 *) vars->source->pixels + row * vars->source->pitch; @@ -703,16 +703,16 @@ static SDL_bool LIBPNG_SavePNG_IO(struct savepng_vars *vars, SDL_Surface *surfac lib.png_write_png(vars->png_ptr, vars->info_ptr, PNG_TRANSFORM_IDENTITY, NULL); } - return SDL_TRUE; + return true; } -static SDL_bool IMG_SavePNG_IO_libpng(SDL_Surface *surface, SDL_IOStream *dst) +static bool IMG_SavePNG_IO_libpng(SDL_Surface *surface, SDL_IOStream *dst) { struct savepng_vars vars; - SDL_bool result; + bool result; if (!IMG_Init(IMG_INIT_PNG)) { - return SDL_FALSE; + return false; } SDL_zero(vars); @@ -762,11 +762,11 @@ static SDL_bool IMG_SavePNG_IO_libpng(SDL_Surface *surface, SDL_IOStream *dst) #define MINIZ_SDL_NOUNUSED #include "miniz.h" -static SDL_bool IMG_SavePNG_IO_miniz(SDL_Surface *surface, SDL_IOStream *dst) +static bool IMG_SavePNG_IO_miniz(SDL_Surface *surface, SDL_IOStream *dst) { size_t size = 0; void *png = NULL; - SDL_bool result = SDL_FALSE; + bool result = false; if (!dst) { return SDL_SetError("Passed NULL dst"); @@ -783,7 +783,7 @@ static SDL_bool IMG_SavePNG_IO_miniz(SDL_Surface *surface, SDL_IOStream *dst) } if (png) { if (SDL_WriteIO(dst, png, size)) { - result = SDL_TRUE; + result = true; } mz_free(png); /* calls SDL_free() */ } else { @@ -795,19 +795,19 @@ static SDL_bool IMG_SavePNG_IO_miniz(SDL_Surface *surface, SDL_IOStream *dst) #endif /* SDL_IMAGE_SAVE_PNG */ -SDL_bool IMG_SavePNG(SDL_Surface *surface, const char *file) +bool IMG_SavePNG(SDL_Surface *surface, const char *file) { SDL_IOStream *dst = SDL_IOFromFile(file, "wb"); if (dst) { return IMG_SavePNG_IO(surface, dst, 1); } else { - return SDL_FALSE; + return false; } } -SDL_bool IMG_SavePNG_IO(SDL_Surface *surface, SDL_IOStream *dst, int closeio) +bool IMG_SavePNG_IO(SDL_Surface *surface, SDL_IOStream *dst, int closeio) { - SDL_bool result = SDL_FALSE; + bool result = false; if (!dst) { return SDL_SetError("Passed NULL dst"); diff --git a/src/IMG_pnm.c b/src/IMG_pnm.c index d40076e2..21b0fbf9 100644 --- a/src/IMG_pnm.c +++ b/src/IMG_pnm.c @@ -33,18 +33,18 @@ #ifdef LOAD_PNM /* See if an image is contained in a data source */ -SDL_bool IMG_isPNM(SDL_IOStream *src) +bool IMG_isPNM(SDL_IOStream *src) { Sint64 start; - SDL_bool is_PNM; + bool is_PNM; char magic[2]; if (!src) { - return SDL_FALSE; + return false; } start = SDL_TellIO(src); - is_PNM = SDL_FALSE; + is_PNM = false; if (SDL_ReadIO(src, magic, sizeof(magic)) == sizeof(magic) ) { /* * PNM magic signatures: @@ -57,7 +57,7 @@ SDL_bool IMG_isPNM(SDL_IOStream *src) * P7 PAM, a general wrapper for PNM data */ if ( magic[0] == 'P' && magic[1] >= '1' && magic[1] <= '6' ) { - is_PNM = SDL_TRUE; + is_PNM = true; } } SDL_SeekIO(src, start, SDL_IO_SEEK_SET); @@ -259,9 +259,9 @@ SDL_Surface *IMG_LoadPNM_IO(SDL_IOStream *src) #endif /* See if an image is contained in a data source */ -SDL_bool IMG_isPNM(SDL_IOStream *src) +bool IMG_isPNM(SDL_IOStream *src) { - return SDL_FALSE; + return false; } /* Load a PNM type image from an SDL datasource */ diff --git a/src/IMG_qoi.c b/src/IMG_qoi.c index 8fa9e06a..3c0ba314 100644 --- a/src/IMG_qoi.c +++ b/src/IMG_qoi.c @@ -43,21 +43,21 @@ #include "qoi.h" /* See if an image is contained in a data source */ -SDL_bool IMG_isQOI(SDL_IOStream *src) +bool IMG_isQOI(SDL_IOStream *src) { Sint64 start; - SDL_bool is_QOI; + bool is_QOI; char magic[4]; if (!src) { - return SDL_FALSE; + return false; } start = SDL_TellIO(src); - is_QOI = SDL_FALSE; + is_QOI = false; if (SDL_ReadIO(src, magic, sizeof(magic)) == sizeof(magic) ) { if ( SDL_strncmp(magic, "qoif", 4) == 0 ) { - is_QOI = SDL_TRUE; + is_QOI = true; } } SDL_SeekIO(src, start, SDL_IO_SEEK_SET); @@ -73,7 +73,7 @@ SDL_Surface *IMG_LoadQOI_IO(SDL_IOStream *src) qoi_desc image_info; SDL_Surface *surface = NULL; - data = (void *)SDL_LoadFile_IO(src, &size, SDL_FALSE); + data = (void *)SDL_LoadFile_IO(src, &size, false); if ( !data ) { return NULL; } @@ -114,9 +114,9 @@ SDL_Surface *IMG_LoadQOI_IO(SDL_IOStream *src) #endif /* See if an image is contained in a data source */ -SDL_bool IMG_isQOI(SDL_IOStream *src) +bool IMG_isQOI(SDL_IOStream *src) { - return SDL_FALSE; + return false; } /* Load a QOI type image from an SDL datasource */ diff --git a/src/IMG_stb.c b/src/IMG_stb.c index 8a1ea45a..ff8cab4c 100644 --- a/src/IMG_stb.c +++ b/src/IMG_stb.c @@ -82,7 +82,7 @@ SDL_Surface *IMG_LoadSTB_IO(SDL_IOStream *src) stbi_uc *pixels; stbi_io_callbacks rw_callbacks; SDL_Surface *surface = NULL; - SDL_bool use_palette = SDL_FALSE; + bool use_palette = false; unsigned int palette_colors[256]; if (!src) { @@ -102,7 +102,7 @@ SDL_Surface *IMG_LoadSTB_IO(SDL_IOStream *src) magic[14] == 'D' && magic[15] == 'R' && magic[25] == PNG_COLOR_INDEXED) { - use_palette = SDL_TRUE; + use_palette = true; } } SDL_SeekIO(src, start, SDL_IO_SEEK_SET); @@ -148,9 +148,9 @@ SDL_Surface *IMG_LoadSTB_IO(SDL_IOStream *src) w ); if (surface) { - SDL_bool has_colorkey = SDL_FALSE; + bool has_colorkey = false; int colorkey_index = -1; - SDL_bool has_alpha = SDL_FALSE; + bool has_alpha = false; SDL_Palette *palette = SDL_CreateSurfacePalette(surface); if (palette) { int i; @@ -163,11 +163,11 @@ SDL_Surface *IMG_LoadSTB_IO(SDL_IOStream *src) palette->colors[i].a = *palette_bytes++; if (palette->colors[i].a != SDL_ALPHA_OPAQUE) { if (palette->colors[i].a == SDL_ALPHA_TRANSPARENT && !has_colorkey) { - has_colorkey = SDL_TRUE; + has_colorkey = true; colorkey_index = i; } else { /* Partial opacity or multiple colorkeys */ - has_alpha = SDL_TRUE; + has_alpha = true; } } } @@ -175,7 +175,7 @@ SDL_Surface *IMG_LoadSTB_IO(SDL_IOStream *src) if (has_alpha) { SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_BLEND); } else if (has_colorkey) { - SDL_SetSurfaceColorKey(surface, SDL_TRUE, colorkey_index); + SDL_SetSurfaceColorKey(surface, true, colorkey_index); } /* FIXME: This sucks. It'd be better to allocate the surface first, then diff --git a/src/IMG_svg.c b/src/IMG_svg.c index 0fb08e93..9ba4ddef 100644 --- a/src/IMG_svg.c +++ b/src/IMG_svg.c @@ -85,24 +85,24 @@ static float SDLCALL SDL_roundf(float x) #include "nanosvgrast.h" /* See if an image is contained in a data source */ -SDL_bool IMG_isSVG(SDL_IOStream *src) +bool IMG_isSVG(SDL_IOStream *src) { Sint64 start; - SDL_bool is_SVG; + bool is_SVG; char magic[4096]; size_t magic_len; if (!src) { - return SDL_FALSE; + return false; } start = SDL_TellIO(src); - is_SVG = SDL_FALSE; + is_SVG = false; magic_len = SDL_ReadIO(src, magic, sizeof(magic) - 1); if (magic_len > 0) { magic[magic_len] = '\0'; if (SDL_strstr(magic, "= 0) - SDL_SetSurfaceColorKey(img, SDL_TRUE, ckey); + SDL_SetSurfaceColorKey(img, true, ckey); } else { /* skip unneeded colormap */ SDL_SeekIO(src, palsiz, SDL_IO_SEEK_CUR); diff --git a/src/IMG_tif.c b/src/IMG_tif.c index 4b6dbed9..a405c7cc 100644 --- a/src/IMG_tif.c +++ b/src/IMG_tif.c @@ -139,18 +139,18 @@ static toff_t tiff_size(thandle_t fd) return size; } -SDL_bool IMG_isTIF(SDL_IOStream * src) +bool IMG_isTIF(SDL_IOStream * src) { Sint64 start; - SDL_bool is_TIF; + bool is_TIF; Uint8 magic[4]; if (!src) { - return SDL_FALSE; + return false; } start = SDL_TellIO(src); - is_TIF = SDL_FALSE; + is_TIF = false; if (SDL_ReadIO(src, magic, sizeof(magic)) == sizeof(magic) ) { if ( (magic[0] == 'I' && magic[1] == 'I' && @@ -160,7 +160,7 @@ SDL_bool IMG_isTIF(SDL_IOStream * src) magic[1] == 'M' && magic[2] == 0x00 && magic[3] == 0x2a) ) { - is_TIF = SDL_TRUE; + is_TIF = true; } } SDL_SeekIO(src, start, SDL_IO_SEEK_SET); @@ -232,11 +232,11 @@ void IMG_QuitTIF(void) } /* See if an image is contained in a data source */ -SDL_bool IMG_isTIF(SDL_IOStream *src) +bool IMG_isTIF(SDL_IOStream *src) { (void)src; - return SDL_FALSE; + return false; } /* Load a TIFF type image from an SDL datasource */ diff --git a/src/IMG_webp.c b/src/IMG_webp.c index 13768bf3..0b2bbfea 100644 --- a/src/IMG_webp.c +++ b/src/IMG_webp.c @@ -115,18 +115,18 @@ void IMG_QuitWEBP(void) --lib.loaded; } -static SDL_bool webp_getinfo(SDL_IOStream *src, size_t *datasize) +static bool webp_getinfo(SDL_IOStream *src, size_t *datasize) { Sint64 start, size; - SDL_bool is_WEBP; + bool is_WEBP; Uint8 magic[20]; if (!src) { - return SDL_FALSE; + return false; } start = SDL_TellIO(src); - is_WEBP = SDL_FALSE; + is_WEBP = false; if (SDL_ReadIO(src, magic, sizeof(magic)) == sizeof(magic)) { if (magic[ 0] == 'R' && magic[ 1] == 'I' && @@ -140,7 +140,7 @@ static SDL_bool webp_getinfo(SDL_IOStream *src, size_t *datasize) magic[13] == 'P' && magic[14] == '8' && (magic[15] == ' ' || magic[15] == 'X' || magic[15] == 'L')) { - is_WEBP = SDL_TRUE; + is_WEBP = true; if (datasize) { size = SDL_GetIOSize(src); if (size > 0) { @@ -156,7 +156,7 @@ static SDL_bool webp_getinfo(SDL_IOStream *src, size_t *datasize) } /* See if an image is contained in a data source */ -SDL_bool IMG_isWEBP(SDL_IOStream *src) +bool IMG_isWEBP(SDL_IOStream *src) { return webp_getinfo(src, NULL); } @@ -396,11 +396,11 @@ void IMG_QuitWEBP(void) } /* See if an image is contained in a data source */ -SDL_bool IMG_isWEBP(SDL_IOStream *src) +bool IMG_isWEBP(SDL_IOStream *src) { (void)src; - return SDL_FALSE; + return false; } /* Load a WEBP type image from an SDL datasource */ diff --git a/src/IMG_xcf.c b/src/IMG_xcf.c index 233fa21f..cd9912a8 100644 --- a/src/IMG_xcf.c +++ b/src/IMG_xcf.c @@ -213,17 +213,17 @@ typedef unsigned char *(*load_tile_type)(SDL_IOStream *, size_t, int, int, int); /* See if an image is contained in a data source */ -SDL_bool IMG_isXCF(SDL_IOStream *src) +bool IMG_isXCF(SDL_IOStream *src) { Sint64 start; - SDL_bool is_XCF = SDL_FALSE; + bool is_XCF = false; char magic[14]; if (src) { start = SDL_TellIO(src); if (SDL_ReadIO(src, magic, sizeof(magic)) == sizeof(magic)) { if (SDL_strncmp(magic, "gimp xcf ", 9) == 0) { - is_XCF = SDL_TRUE; + is_XCF = true; } } SDL_SeekIO(src, start, SDL_IO_SEEK_SET); @@ -1035,9 +1035,9 @@ SDL_Surface *IMG_LoadXCF_IO(SDL_IOStream *src) #endif /* See if an image is contained in a data source */ -SDL_bool IMG_isXCF(SDL_IOStream *src) +bool IMG_isXCF(SDL_IOStream *src) { - return SDL_FALSE; + return false; } /* Load a XCF type image from an SDL datasource */ diff --git a/src/IMG_xpm.c b/src/IMG_xpm.c index 1752f0bd..11193ce2 100644 --- a/src/IMG_xpm.c +++ b/src/IMG_xpm.c @@ -51,21 +51,21 @@ #ifdef LOAD_XPM /* See if an image is contained in a data source */ -SDL_bool IMG_isXPM(SDL_IOStream *src) +bool IMG_isXPM(SDL_IOStream *src) { Sint64 start; - SDL_bool is_XPM; + bool is_XPM; char magic[9]; if (!src) { - return SDL_FALSE; + return false; } start = SDL_TellIO(src); - is_XPM = SDL_FALSE; + is_XPM = false; if (SDL_ReadIO(src, magic, sizeof(magic)) == sizeof(magic) ) { if ( SDL_memcmp(magic, "/* XPM */", sizeof(magic)) == 0 ) { - is_XPM = SDL_TRUE; + is_XPM = true; } } SDL_SeekIO(src, start, SDL_IO_SEEK_SET); @@ -997,7 +997,7 @@ do { \ } while (0) /* read XPM from either array or IOStream */ -static SDL_Surface *load_xpm(char **xpm, SDL_IOStream *src, SDL_bool force_32bit) +static SDL_Surface *load_xpm(char **xpm, SDL_IOStream *src, bool force_32bit) { Sint64 start = 0; SDL_Surface *image = NULL; @@ -1123,7 +1123,7 @@ static SDL_Surface *load_xpm(char **xpm, SDL_IOStream *src, SDL_bool force_32bit c->b = (Uint8)(argb); pixel = index; if (argb == 0x00000000) { - SDL_SetSurfaceColorKey(image, SDL_TRUE, pixel); + SDL_SetSurfaceColorKey(image, true, pixel); } } else { pixel = argb; @@ -1196,7 +1196,7 @@ SDL_Surface *IMG_ReadXPMFromArray(char **xpm) SDL_SetError("array is NULL"); return NULL; } - return load_xpm(xpm, NULL, SDL_FALSE); + return load_xpm(xpm, NULL, false); } SDL_Surface *IMG_ReadXPMFromArrayToRGB888(char **xpm) @@ -1205,7 +1205,7 @@ SDL_Surface *IMG_ReadXPMFromArrayToRGB888(char **xpm) SDL_SetError("array is NULL"); return NULL; } - return load_xpm(xpm, NULL, SDL_TRUE); + return load_xpm(xpm, NULL, true); } #else /* not LOAD_XPM */ @@ -1214,9 +1214,9 @@ SDL_Surface *IMG_ReadXPMFromArrayToRGB888(char **xpm) #endif /* See if an image is contained in a data source */ -SDL_bool IMG_isXPM(SDL_IOStream *src) +bool IMG_isXPM(SDL_IOStream *src) { - return SDL_FALSE; + return false; } diff --git a/src/IMG_xv.c b/src/IMG_xv.c index adba9b11..8cedc3ee 100644 --- a/src/IMG_xv.c +++ b/src/IMG_xv.c @@ -80,20 +80,20 @@ static int get_header(SDL_IOStream *src, int *w, int *h) } /* See if an image is contained in a data source */ -SDL_bool IMG_isXV(SDL_IOStream *src) +bool IMG_isXV(SDL_IOStream *src) { Sint64 start; - SDL_bool is_XV; + bool is_XV; int w, h; if (!src) { - return SDL_FALSE; + return false; } start = SDL_TellIO(src); - is_XV = SDL_FALSE; + is_XV = false; if ( get_header(src, &w, &h) == 0 ) { - is_XV = SDL_TRUE; + is_XV = true; } SDL_SeekIO(src, start, SDL_IO_SEEK_SET); return is_XV; @@ -154,9 +154,9 @@ SDL_Surface *IMG_LoadXV_IO(SDL_IOStream *src) #endif /* See if an image is contained in a data source */ -SDL_bool IMG_isXV(SDL_IOStream *src) +bool IMG_isXV(SDL_IOStream *src) { - return SDL_FALSE; + return false; } /* Load a XXX type image from an SDL datasource */ diff --git a/src/IMG_xxx.c b/src/IMG_xxx.c index e5d1fceb..889c45d9 100644 --- a/src/IMG_xxx.c +++ b/src/IMG_xxx.c @@ -28,17 +28,17 @@ /* See if an image is contained in a data source */ /* Remember to declare this procedure in IMG.h . */ -SDL_bool IMG_isXXX(SDL_IOStream *src) +bool IMG_isXXX(SDL_IOStream *src) { int start; - SDL_bool is_XXX; + bool is_XXX; if (!src) { - return SDL_FALSE; + return false; } start = SDL_TellIO(src); - is_XXX = SDL_FALSE; + is_XXX = false; /* Detect the image here */ @@ -81,10 +81,10 @@ SDL_Surface *IMG_LoadXXX_IO(SDL_IOStream *src) #pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */ #endif -SDL_bool IMG_isXXX(SDL_IOStream *src) +bool IMG_isXXX(SDL_IOStream *src) { (void) src; - return SDL_FALSE; + return false; } SDL_Surface *IMG_LoadXXX_IO(SDL_IOStream *src) diff --git a/test/main.c b/test/main.c index 59790f42..4a89769a 100644 --- a/test/main.c +++ b/test/main.c @@ -36,16 +36,16 @@ typedef enum TEST_FILE_BUILT } TestFileType; -static SDL_bool -GetStringBoolean(const char *value, SDL_bool default_value) +static bool +GetStringBoolean(const char *value, bool default_value) { if (!value || !*value) { return default_value; } if (*value == '0' || SDL_strcasecmp(value, "false") == 0) { - return SDL_FALSE; + return false; } - return SDL_TRUE; + return true; } /* @@ -65,7 +65,7 @@ GetTestFilename(TestFileType type, const char *file) { const char *base; char *path = NULL; - SDL_bool needPathSep = SDL_TRUE; + bool needPathSep = true; if (type == TEST_FILE_DIST) { base = SDL_getenv("SDL_TEST_SRCDIR"); @@ -76,7 +76,7 @@ GetTestFilename(TestFileType type, const char *file) if (base == NULL) { base = SDL_GetBasePath(); /* SDL_GetBasePath() guarantees a trailing path separator */ - needPathSep = SDL_FALSE; + needPathSep = false; } if (base != NULL) { @@ -113,9 +113,9 @@ typedef struct int h; int tolerance; int initFlag; - SDL_bool canLoad; - SDL_bool canSave; - SDL_bool (SDLCALL * checkFunction)(SDL_IOStream *src); + bool canLoad; + bool canSave; + bool (SDLCALL * checkFunction)(SDL_IOStream *src); SDL_Surface *(SDLCALL * loadFunction)(SDL_IOStream *src); } Format; @@ -130,9 +130,9 @@ static const Format formats[] = 300, IMG_INIT_AVIF, #ifdef LOAD_AVIF - SDL_TRUE, + true, #else - SDL_FALSE, + false, #endif SDL_IMAGE_SAVE_AVIF, IMG_isAVIF, @@ -147,11 +147,11 @@ static const Format formats[] = 0, /* lossless */ 0, /* no initialization */ #ifdef LOAD_BMP - SDL_TRUE, + true, #else - SDL_FALSE, + false, #endif - SDL_FALSE, /* can save */ + false, /* can save */ IMG_isBMP, IMG_LoadBMP_IO, }, @@ -164,11 +164,11 @@ static const Format formats[] = 0, /* lossless */ 0, /* no initialization */ #ifdef LOAD_BMP - SDL_TRUE, + true, #else - SDL_FALSE, + false, #endif - SDL_FALSE, /* can save */ + false, /* can save */ IMG_isCUR, IMG_LoadCUR_IO, }, @@ -181,11 +181,11 @@ static const Format formats[] = 0, /* lossless */ 0, /* no initialization */ #if USING_IMAGEIO || defined(LOAD_GIF) - SDL_TRUE, + true, #else - SDL_FALSE, + false, #endif - SDL_FALSE, /* can save */ + false, /* can save */ IMG_isGIF, IMG_LoadGIF_IO, }, @@ -198,11 +198,11 @@ static const Format formats[] = 0, /* lossless */ 0, /* no initialization */ #ifdef LOAD_BMP - SDL_TRUE, + true, #else - SDL_FALSE, + false, #endif - SDL_FALSE, /* can save */ + false, /* can save */ IMG_isICO, IMG_LoadICO_IO, }, @@ -215,9 +215,9 @@ static const Format formats[] = 100, IMG_INIT_JPG, #if (USING_IMAGEIO && defined(JPG_USES_IMAGEIO)) || defined(SDL_IMAGE_USE_WIC_BACKEND) || defined(LOAD_JPG) - SDL_TRUE, + true, #else - SDL_FALSE, + false, #endif SDL_IMAGE_SAVE_JPG, IMG_isJPG, @@ -232,11 +232,11 @@ static const Format formats[] = 300, IMG_INIT_JXL, #ifdef LOAD_JXL - SDL_TRUE, + true, #else - SDL_FALSE, + false, #endif - SDL_FALSE, /* can save */ + false, /* can save */ IMG_isJXL, IMG_LoadJXL_IO, }, @@ -250,11 +250,11 @@ static const Format formats[] = 0, /* lossless? */ 0, /* no initialization */ #ifdef LOAD_LBM - SDL_TRUE, + true, #else - SDL_FALSE, + false, #endif - SDL_FALSE, /* can save */ + false, /* can save */ IMG_isLBM, IMG_LoadLBM_IO, }, @@ -268,11 +268,11 @@ static const Format formats[] = 0, /* lossless? */ 0, /* no initialization */ #ifdef LOAD_PCX - SDL_TRUE, + true, #else - SDL_FALSE, + false, #endif - SDL_FALSE, /* can save */ + false, /* can save */ IMG_isPCX, IMG_LoadPCX_IO, }, @@ -285,9 +285,9 @@ static const Format formats[] = 0, /* lossless */ IMG_INIT_PNG, #if (USING_IMAGEIO && defined(PNG_USES_IMAGEIO)) || defined(SDL_IMAGE_USE_WIC_BACKEND) || defined(LOAD_PNG) - SDL_TRUE, + true, #else - SDL_FALSE, + false, #endif SDL_IMAGE_SAVE_PNG, IMG_isPNG, @@ -302,11 +302,11 @@ static const Format formats[] = 0, /* lossless */ 0, /* no initialization */ #ifdef LOAD_PNM - SDL_TRUE, + true, #else - SDL_FALSE, + false, #endif - SDL_FALSE, /* can save */ + false, /* can save */ IMG_isPNM, IMG_LoadPNM_IO, }, @@ -319,11 +319,11 @@ static const Format formats[] = 0, /* lossless */ 0, /* no initialization */ #ifdef LOAD_QOI - SDL_TRUE, + true, #else - SDL_FALSE, + false, #endif - SDL_FALSE, /* can save */ + false, /* can save */ IMG_isQOI, IMG_LoadQOI_IO, }, @@ -336,11 +336,11 @@ static const Format formats[] = 100, 0, /* no initialization */ #ifdef LOAD_SVG - SDL_TRUE, + true, #else - SDL_FALSE, + false, #endif - SDL_FALSE, /* can save */ + false, /* can save */ IMG_isSVG, IMG_LoadSVG_IO, }, @@ -353,11 +353,11 @@ static const Format formats[] = 100, 0, /* no initialization */ #ifdef LOAD_SVG - SDL_TRUE, + true, #else - SDL_FALSE, + false, #endif - SDL_FALSE, /* can save */ + false, /* can save */ IMG_isSVG, IMG_LoadSVG_IO, }, @@ -370,11 +370,11 @@ static const Format formats[] = 0, /* lossless? */ 0, /* no initialization */ #ifdef LOAD_SVG - SDL_TRUE, + true, #else - SDL_FALSE, + false, #endif - SDL_FALSE, /* can save */ + false, /* can save */ IMG_isSVG, IMG_LoadSVG_IO, }, @@ -387,11 +387,11 @@ static const Format formats[] = 0, /* lossless? */ 0, /* no initialization */ #if USING_IMAGEIO || defined(LOAD_TGA) - SDL_TRUE, + true, #else - SDL_FALSE, + false, #endif - SDL_FALSE, /* can save */ + false, /* can save */ NULL, IMG_LoadTGA_IO, }, @@ -404,11 +404,11 @@ static const Format formats[] = 0, /* lossless */ IMG_INIT_TIF, #if USING_IMAGEIO || defined(SDL_IMAGE_USE_WIC_BACKEND) || defined(LOAD_TIF) - SDL_TRUE, + true, #else - SDL_FALSE, + false, #endif - SDL_FALSE, /* can save */ + false, /* can save */ IMG_isTIF, IMG_LoadTIF_IO, }, @@ -421,11 +421,11 @@ static const Format formats[] = 0, /* lossless */ IMG_INIT_WEBP, #ifdef LOAD_WEBP - SDL_TRUE, + true, #else - SDL_FALSE, + false, #endif - SDL_FALSE, /* can save */ + false, /* can save */ IMG_isWEBP, IMG_LoadWEBP_IO, }, @@ -438,11 +438,11 @@ static const Format formats[] = 0, /* lossless */ 0, /* no initialization */ #ifdef LOAD_XCF - SDL_TRUE, + true, #else - SDL_FALSE, + false, #endif - SDL_FALSE, /* can save */ + false, /* can save */ IMG_isXCF, IMG_LoadXCF_IO, }, @@ -455,11 +455,11 @@ static const Format formats[] = 0, /* lossless */ 0, /* no initialization */ #ifdef LOAD_XPM - SDL_TRUE, + true, #else - SDL_FALSE, + false, #endif - SDL_FALSE, /* can save */ + false, /* can save */ IMG_isXPM, IMG_LoadXPM_IO, }, @@ -473,18 +473,18 @@ static const Format formats[] = 0, /* lossless? */ 0, /* no initialization */ #ifdef LOAD_XV - SDL_TRUE, + true, #else - SDL_FALSE, + false, #endif - SDL_FALSE, /* can save */ + false, /* can save */ IMG_isXV, IMG_LoadXV_IO, }, #endif }; -static SDL_bool +static bool StrHasSuffix(const char *str, const char *suffix) { size_t str_len = SDL_strlen(str); @@ -504,7 +504,7 @@ typedef enum } LoadMode; /* Convert to RGBA for comparison, if necessary */ -static SDL_bool +static bool ConvertToRgba32(SDL_Surface **surface_p) { if ((*surface_p)->format != SDL_PIXELFORMAT_RGBA32) { @@ -516,12 +516,12 @@ ConvertToRgba32(SDL_Surface **surface_p) "Converting to RGBA should succeed (%s)", SDL_GetError()); if (temp == NULL) { - return SDL_FALSE; + return false; } SDL_DestroySurface(*surface_p); *surface_p = temp; } - return SDL_TRUE; + return true; } static void @@ -718,12 +718,12 @@ FormatLoadTest(const Format *format, } SDL_ClearError(); - surface = IMG_Load_IO(src, SDL_TRUE); + surface = IMG_Load_IO(src, true); src = NULL; /* ownership taken */ break; case LOAD_TYPED_IO: - surface = IMG_LoadTyped_IO(src, SDL_TRUE, format->name); + surface = IMG_LoadTyped_IO(src, true, format->name); src = NULL; /* ownership taken */ break; @@ -750,7 +750,7 @@ FormatLoadTest(const Format *format, "Expected height %d px, got %d", format->h, surface->h); - if (GetStringBoolean(SDL_getenv("SDL_IMAGE_TEST_DEBUG"), SDL_FALSE)) { + if (GetStringBoolean(SDL_getenv("SDL_IMAGE_TEST_DEBUG"), false)) { DumpPixels(filename, surface); } @@ -761,7 +761,7 @@ FormatLoadTest(const Format *format, SDLTest_AssertCheck(diff == 0, "Surface differed from reference by at most %d in %d pixels", format->tolerance, diff); - if (diff != 0 || GetStringBoolean(SDL_getenv("SDL_IMAGE_TEST_DEBUG"), SDL_FALSE)) { + if (diff != 0 || GetStringBoolean(SDL_getenv("SDL_IMAGE_TEST_DEBUG"), false)) { DumpPixels(filename, surface); DumpPixels(refFilename, reference); } @@ -790,7 +790,7 @@ FormatLoadTest(const Format *format, static void FormatSaveTest(const Format *format, - SDL_bool rw) + bool rw) { char *refFilename = NULL; char filename[64] = { 0 }; @@ -799,7 +799,7 @@ FormatSaveTest(const Format *format, SDL_IOStream *dest = NULL; int initResult = 0; int diff; - SDL_bool result; + bool result; SDL_snprintf(filename, sizeof(filename), "save%s.%s", @@ -839,7 +839,7 @@ FormatSaveTest(const Format *format, if (SDL_strcmp (format->name, "AVIF") == 0) { if (rw) { dest = SDL_IOFromFile(filename, "wb"); - result = IMG_SaveAVIF_IO(reference, dest, SDL_FALSE, 90); + result = IMG_SaveAVIF_IO(reference, dest, false, 90); SDL_CloseIO(dest); } else { result = IMG_SaveAVIF(reference, filename, 90); @@ -847,7 +847,7 @@ FormatSaveTest(const Format *format, } else if (SDL_strcmp(format->name, "JPG") == 0) { if (rw) { dest = SDL_IOFromFile(filename, "wb"); - result = IMG_SaveJPG_IO(reference, dest, SDL_FALSE, 90); + result = IMG_SaveJPG_IO(reference, dest, false, 90); SDL_CloseIO(dest); } else { result = IMG_SaveJPG(reference, filename, 90); @@ -855,13 +855,13 @@ FormatSaveTest(const Format *format, } else if (SDL_strcmp (format->name, "PNG") == 0) { if (rw) { dest = SDL_IOFromFile(filename, "wb"); - result = IMG_SavePNG_IO(reference, dest, SDL_FALSE); + result = IMG_SavePNG_IO(reference, dest, false); SDL_CloseIO(dest); } else { result = IMG_SavePNG(reference, filename); } } else { - SDLTest_AssertCheck(SDL_FALSE, "How do I save %s?", format->name); + SDLTest_AssertCheck(false, "How do I save %s?", format->name); goto out; } @@ -890,7 +890,7 @@ FormatSaveTest(const Format *format, SDLTest_AssertCheck(diff == 0, "Surface differed from reference by at most %d in %d pixels", format->tolerance, diff); - if (diff != 0 || GetStringBoolean(SDL_getenv("SDL_IMAGE_TEST_DEBUG"), SDL_FALSE)) { + if (diff != 0 || GetStringBoolean(SDL_getenv("SDL_IMAGE_TEST_DEBUG"), false)) { DumpPixels(filename, surface); DumpPixels(refFilename, reference); } @@ -914,13 +914,13 @@ FormatSaveTest(const Format *format, static void FormatTest(const Format *format) { - SDL_bool forced; + bool forced; char envVar[64] = { 0 }; SDL_snprintf(envVar, sizeof(envVar), "SDL_IMAGE_TEST_REQUIRE_LOAD_%s", format->name); - forced = GetStringBoolean(SDL_getenv(envVar), SDL_FALSE); + forced = GetStringBoolean(SDL_getenv(envVar), false); if (forced) { SDLTest_AssertCheck(format->canLoad, "%s loading should be enabled", format->name); @@ -953,7 +953,7 @@ FormatTest(const Format *format) SDL_snprintf(envVar, sizeof(envVar), "SDL_IMAGE_TEST_REQUIRE_SAVE_%s", format->name); - forced = GetStringBoolean(SDL_getenv(envVar), SDL_FALSE); + forced = GetStringBoolean(SDL_getenv(envVar), false); if (forced) { SDLTest_AssertCheck(format->canSave, "%s saving should be enabled", format->name); @@ -961,8 +961,8 @@ FormatTest(const Format *format) if (format->canSave || forced) { SDLTest_Log("Testing ability to save format %s", format->name); - FormatSaveTest(format, SDL_FALSE); - FormatSaveTest(format, SDL_TRUE); + FormatSaveTest(format, false); + FormatSaveTest(format, true); } else { SDLTest_Log("Saving format %s is not supported", format->name); }