Fixed building with Visual Studio 2017
authorSam Lantinga
Wed, 04 Mar 2020 16:07:27 -0800
changeset 75159a4c1ea96f3
parent 750 082214c629d1
child 752 15197772b7a5
Fixed building with Visual Studio 2017
IMG_jpg.c
IMG_png.c
     1.1 --- a/IMG_jpg.c	Wed Jan 29 20:32:29 2020 +0000
     1.2 +++ b/IMG_jpg.c	Wed Mar 04 16:07:27 2020 -0800
     1.3 @@ -199,6 +199,7 @@
     1.4  static void init_source (j_decompress_ptr cinfo)
     1.5  {
     1.6      /* We don't actually need to do anything */
     1.7 +    (void)cinfo;
     1.8      return;
     1.9  }
    1.10  
    1.11 @@ -263,6 +264,7 @@
    1.12  static void term_source (j_decompress_ptr cinfo)
    1.13  {
    1.14      /* We don't actually need to do anything */
    1.15 +    (void)cinfo;
    1.16      return;
    1.17  }
    1.18  
    1.19 @@ -314,6 +316,7 @@
    1.20  static void output_no_message(j_common_ptr cinfo)
    1.21  {
    1.22      /* do nothing */
    1.23 +    (void)cinfo;
    1.24  }
    1.25  
    1.26  /* Load a JPEG type image from an SDL datasource */
    1.27 @@ -339,6 +342,9 @@
    1.28      cinfo.err = lib.jpeg_std_error(&jerr.errmgr);
    1.29      jerr.errmgr.error_exit = my_error_exit;
    1.30      jerr.errmgr.output_message = output_no_message;
    1.31 +#ifdef _MSC_VER
    1.32 +#pragma warning(disable:4611)   /* warning C4611: interaction between '_setjmp' and C++ object destruction is non-portable */
    1.33 +#endif
    1.34      if(setjmp(jerr.escape)) {
    1.35          /* If we get here, libjpeg found an error */
    1.36          lib.jpeg_destroy_decompress(&cinfo);
    1.37 @@ -422,6 +428,7 @@
    1.38  static void init_destination(j_compress_ptr cinfo)
    1.39  {
    1.40      /* We don't actually need to do anything */
    1.41 +    (void)cinfo;
    1.42      return;
    1.43  }
    1.44  
     2.1 --- a/IMG_png.c	Wed Jan 29 20:32:29 2020 +0000
     2.2 +++ b/IMG_png.c	Wed Mar 04 16:07:27 2020 -0800
     2.3 @@ -269,6 +269,9 @@
     2.4       */
     2.5  
     2.6  #ifdef PNG_SETJMP_SUPPORTED
     2.7 +#ifdef _MSC_VER
     2.8 +#pragma warning(disable:4611)   /* warning C4611: interaction between '_setjmp' and C++ object destruction is non-portable */
     2.9 +#endif
    2.10  #ifndef LIBPNG_VERSION_12
    2.11      if ( setjmp(*lib.png_set_longjmp_fn(png_ptr, longjmp, sizeof (jmp_buf))) )
    2.12  #else
    2.13 @@ -501,6 +504,7 @@
    2.14  
    2.15  static void png_flush_data(png_structp png_ptr)
    2.16  {
    2.17 +    (void)png_ptr;
    2.18  }
    2.19  
    2.20  static int IMG_SavePNG_RW_libpng(SDL_Surface *surface, SDL_RWops *dst, int freedst)
    2.21 @@ -543,7 +547,7 @@
    2.22              const int ncolors = palette->ncolors;
    2.23              int i;
    2.24  
    2.25 -            color_ptr = SDL_malloc(sizeof(png_colorp) * ncolors);
    2.26 +            color_ptr = (png_colorp)SDL_malloc(sizeof(png_colorp) * ncolors);
    2.27              if (color_ptr == NULL)
    2.28              {
    2.29                  lib.png_destroy_write_struct(&png_ptr, &info_ptr);