Skip to content

Commit

Permalink
Fixed building with Visual Studio 2017
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Mar 5, 2020
1 parent c977495 commit 58756f1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions IMG_jpg.c
Expand Up @@ -199,6 +199,7 @@ typedef struct {
static void init_source (j_decompress_ptr cinfo)
{
/* We don't actually need to do anything */
(void)cinfo;
return;
}

Expand Down Expand Up @@ -263,6 +264,7 @@ static void skip_input_data (j_decompress_ptr cinfo, long num_bytes)
static void term_source (j_decompress_ptr cinfo)
{
/* We don't actually need to do anything */
(void)cinfo;
return;
}

Expand Down Expand Up @@ -314,6 +316,7 @@ static void my_error_exit(j_common_ptr cinfo)
static void output_no_message(j_common_ptr cinfo)
{
/* do nothing */
(void)cinfo;
}

/* Load a JPEG type image from an SDL datasource */
Expand All @@ -339,6 +342,9 @@ SDL_Surface *IMG_LoadJPG_RW(SDL_RWops *src)
cinfo.err = lib.jpeg_std_error(&jerr.errmgr);
jerr.errmgr.error_exit = my_error_exit;
jerr.errmgr.output_message = output_no_message;
#ifdef _MSC_VER
#pragma warning(disable:4611) /* warning C4611: interaction between '_setjmp' and C++ object destruction is non-portable */
#endif
if(setjmp(jerr.escape)) {
/* If we get here, libjpeg found an error */
lib.jpeg_destroy_decompress(&cinfo);
Expand Down Expand Up @@ -422,6 +428,7 @@ typedef struct {
static void init_destination(j_compress_ptr cinfo)
{
/* We don't actually need to do anything */
(void)cinfo;
return;
}

Expand Down
6 changes: 5 additions & 1 deletion IMG_png.c
Expand Up @@ -269,6 +269,9 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src)
*/

#ifdef PNG_SETJMP_SUPPORTED
#ifdef _MSC_VER
#pragma warning(disable:4611) /* warning C4611: interaction between '_setjmp' and C++ object destruction is non-portable */
#endif
#ifndef LIBPNG_VERSION_12
if ( setjmp(*lib.png_set_longjmp_fn(png_ptr, longjmp, sizeof (jmp_buf))) )
#else
Expand Down Expand Up @@ -501,6 +504,7 @@ static void png_write_data(png_structp png_ptr, png_bytep src, png_size_t size)

static void png_flush_data(png_structp png_ptr)
{
(void)png_ptr;
}

static int IMG_SavePNG_RW_libpng(SDL_Surface *surface, SDL_RWops *dst, int freedst)
Expand Down Expand Up @@ -543,7 +547,7 @@ static int IMG_SavePNG_RW_libpng(SDL_Surface *surface, SDL_RWops *dst, int freed
const int ncolors = palette->ncolors;
int i;

color_ptr = SDL_malloc(sizeof(png_colorp) * ncolors);
color_ptr = (png_colorp)SDL_malloc(sizeof(png_colorp) * ncolors);
if (color_ptr == NULL)
{
lib.png_destroy_write_struct(&png_ptr, &info_ptr);
Expand Down

0 comments on commit 58756f1

Please sign in to comment.