From 16949203f984f6d96e2b51eacf97cd9db6295833 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Thu, 11 Jul 2019 01:10:28 +0300 Subject: [PATCH] consistently use IMG_SetError() instead of SDL_SetError. --- IMG_bmp.c | 4 ++-- IMG_jpg.c | 2 +- IMG_png.c | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/IMG_bmp.c b/IMG_bmp.c index b1702a04..dc54f8ab 100644 --- a/IMG_bmp.c +++ b/IMG_bmp.c @@ -376,7 +376,7 @@ static SDL_Surface *LoadBMP_RW (SDL_RWops *src, int freesrc) case 5: case 6: case 7: - SDL_SetError("%d-bpp BMP images are not supported", biBitCount); + IMG_SetError("%d-bpp BMP images are not supported", biBitCount); was_error = SDL_TRUE; goto done; default: @@ -543,7 +543,7 @@ static SDL_Surface *LoadBMP_RW (SDL_RWops *src, int freesrc) if (biBitCount == 8 && palette && biClrUsed < (1 << biBitCount)) { for (i = 0; i < surface->w; ++i) { if (bits[i] >= biClrUsed) { - SDL_SetError("A BMP image contains a pixel with a color out of the palette"); + IMG_SetError("A BMP image contains a pixel with a color out of the palette"); was_error = SDL_TRUE; goto done; } diff --git a/IMG_jpg.c b/IMG_jpg.c index c4471b79..032224a9 100644 --- a/IMG_jpg.c +++ b/IMG_jpg.c @@ -479,7 +479,7 @@ static int IMG_SaveJPG_RW_jpeglib(SDL_Surface *surface, SDL_RWops *dst, int free int result = -1; if (!dst) { - SDL_SetError("Passed NULL dst"); + IMG_SetError("Passed NULL dst"); goto done; } diff --git a/IMG_png.c b/IMG_png.c index e636426a..9ff6dfd0 100644 --- a/IMG_png.c +++ b/IMG_png.c @@ -543,14 +543,14 @@ static int IMG_SavePNG_RW_libpng(SDL_Surface *surface, SDL_RWops *dst, int freed png_ptr = lib.png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (png_ptr == NULL) { - SDL_SetError("Couldn't allocate memory for PNG file or incompatible PNG dll"); + IMG_SetError("Couldn't allocate memory for PNG file or incompatible PNG dll"); return -1; } info_ptr = lib.png_create_info_struct(png_ptr); if (info_ptr == NULL) { lib.png_destroy_write_struct(&png_ptr, NULL); - SDL_SetError("Couldn't create image information for PNG file"); + IMG_SetError("Couldn't create image information for PNG file"); return -1; } #ifdef PNG_SETJMP_SUPPORTED @@ -562,7 +562,7 @@ static int IMG_SavePNG_RW_libpng(SDL_Surface *surface, SDL_RWops *dst, int freed #endif { lib.png_destroy_write_struct(&png_ptr, &info_ptr); - SDL_SetError("Error writing the PNG file."); + IMG_SetError("Error writing the PNG file."); return -1; } @@ -575,7 +575,7 @@ static int IMG_SavePNG_RW_libpng(SDL_Surface *surface, SDL_RWops *dst, int freed if (color_ptr == NULL) { lib.png_destroy_write_struct(&png_ptr, &info_ptr); - SDL_SetError("Couldn't create palette for PNG file"); + IMG_SetError("Couldn't create palette for PNG file"); return -1; } for (i = 0; i < ncolors; i++) { @@ -603,7 +603,7 @@ static int IMG_SavePNG_RW_libpng(SDL_Surface *surface, SDL_RWops *dst, int freed row_pointers = (png_bytep *) SDL_malloc(sizeof(png_bytep) * source->h); if (!row_pointers) { lib.png_destroy_write_struct(&png_ptr, &info_ptr); - SDL_SetError("Out of memory"); + IMG_SetError("Out of memory"); return -1; } for (row = 0; row < (int)source->h; row++) { @@ -626,7 +626,7 @@ static int IMG_SavePNG_RW_libpng(SDL_Surface *surface, SDL_RWops *dst, int freed SDL_RWclose(dst); } } else { - SDL_SetError("Passed NULL dst"); + IMG_SetError("Passed NULL dst"); return -1; } return 0; @@ -670,13 +670,13 @@ static int IMG_SavePNG_RW_miniz(SDL_Surface *surface, SDL_RWops *dst, int freeds } SDL_free(png); } else { - SDL_SetError("Failed to convert and save image"); + IMG_SetError("Failed to convert and save image"); } if (freedst) { SDL_RWclose(dst); } } else { - SDL_SetError("Passed NULL dst"); + IMG_SetError("Passed NULL dst"); } return result; }