Skip to content

Commit

Permalink
consistently use IMG_SetError() instead of SDL_SetError.
Browse files Browse the repository at this point in the history
  • Loading branch information
sezero committed Jul 10, 2019
1 parent 84ab9a3 commit 1694920
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions IMG_bmp.c
Expand Up @@ -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:
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion IMG_jpg.c
Expand Up @@ -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;
}

Expand Down
16 changes: 8 additions & 8 deletions IMG_png.c
Expand Up @@ -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
Expand All @@ -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;
}

Expand All @@ -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++) {
Expand Down Expand Up @@ -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++) {
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 1694920

Please sign in to comment.