Fixed warnings building 64-bit with Visual Studio
authorSam Lantinga <slouken@libsdl.org>
Sun, 22 Oct 2017 14:40:31 -0700
changeset 5378959a43f5590
parent 536 67bee066575d
child 538 a57da139d196
Fixed warnings building 64-bit with Visual Studio
IMG_jpg.c
IMG_png.c
IMG_svg.c
IMG_tif.c
IMG_webp.c
IMG_xcf.c
IMG_xpm.c
     1.1 --- a/IMG_jpg.c	Sun Oct 22 14:40:08 2017 -0700
     1.2 +++ b/IMG_jpg.c	Sun Oct 22 14:40:31 2017 -0700
     1.3 @@ -68,125 +68,39 @@
     1.4  } lib;
     1.5  
     1.6  #ifdef LOAD_JPG_DYNAMIC
     1.7 +#define FUNCTION_LOADER(FUNC, SIG) \
     1.8 +    lib.FUNC = (SIG) SDL_LoadFunction(lib.handle, #FUNC); \
     1.9 +    if (lib.FUNC == NULL) { SDL_UnloadObject(lib.handle); return -1; }
    1.10 +#else
    1.11 +#define FUNCTION_LOADER(FUNC, SIG) \
    1.12 +    lib.FUNC = FUNC;
    1.13 +#endif
    1.14 +
    1.15  int IMG_InitJPG()
    1.16  {
    1.17      if ( lib.loaded == 0 ) {
    1.18 +#ifdef LOAD_JPG_DYNAMIC
    1.19          lib.handle = SDL_LoadObject(LOAD_JPG_DYNAMIC);
    1.20          if ( lib.handle == NULL ) {
    1.21              return -1;
    1.22          }
    1.23 -        lib.jpeg_calc_output_dimensions =
    1.24 -            (void (*) (j_decompress_ptr))
    1.25 -            SDL_LoadFunction(lib.handle, "jpeg_calc_output_dimensions");
    1.26 -        if ( lib.jpeg_calc_output_dimensions == NULL ) {
    1.27 -            SDL_UnloadObject(lib.handle);
    1.28 -            return -1;
    1.29 -        }
    1.30 -        lib.jpeg_CreateDecompress =
    1.31 -            (void (*) (j_decompress_ptr, int, size_t))
    1.32 -            SDL_LoadFunction(lib.handle, "jpeg_CreateDecompress");
    1.33 -        if ( lib.jpeg_CreateDecompress == NULL ) {
    1.34 -            SDL_UnloadObject(lib.handle);
    1.35 -            return -1;
    1.36 -        }
    1.37 -        lib.jpeg_destroy_decompress =
    1.38 -            (void (*) (j_decompress_ptr))
    1.39 -            SDL_LoadFunction(lib.handle, "jpeg_destroy_decompress");
    1.40 -        if ( lib.jpeg_destroy_decompress == NULL ) {
    1.41 -            SDL_UnloadObject(lib.handle);
    1.42 -            return -1;
    1.43 -        }
    1.44 -        lib.jpeg_finish_decompress =
    1.45 -            (boolean (*) (j_decompress_ptr))
    1.46 -            SDL_LoadFunction(lib.handle, "jpeg_finish_decompress");
    1.47 -        if ( lib.jpeg_finish_decompress == NULL ) {
    1.48 -            SDL_UnloadObject(lib.handle);
    1.49 -            return -1;
    1.50 -        }
    1.51 -        lib.jpeg_read_header =
    1.52 -            (int (*) (j_decompress_ptr, boolean))
    1.53 -            SDL_LoadFunction(lib.handle, "jpeg_read_header");
    1.54 -        if ( lib.jpeg_read_header == NULL ) {
    1.55 -            SDL_UnloadObject(lib.handle);
    1.56 -            return -1;
    1.57 -        }
    1.58 -        lib.jpeg_read_scanlines =
    1.59 -            (JDIMENSION (*) (j_decompress_ptr, JSAMPARRAY, JDIMENSION))
    1.60 -            SDL_LoadFunction(lib.handle, "jpeg_read_scanlines");
    1.61 -        if ( lib.jpeg_read_scanlines == NULL ) {
    1.62 -            SDL_UnloadObject(lib.handle);
    1.63 -            return -1;
    1.64 -        }
    1.65 -        lib.jpeg_resync_to_restart =
    1.66 -            (boolean (*) (j_decompress_ptr, int))
    1.67 -            SDL_LoadFunction(lib.handle, "jpeg_resync_to_restart");
    1.68 -        if ( lib.jpeg_resync_to_restart == NULL ) {
    1.69 -            SDL_UnloadObject(lib.handle);
    1.70 -            return -1;
    1.71 -        }
    1.72 -        lib.jpeg_start_decompress =
    1.73 -            (boolean (*) (j_decompress_ptr))
    1.74 -            SDL_LoadFunction(lib.handle, "jpeg_start_decompress");
    1.75 -        if ( lib.jpeg_start_decompress == NULL ) {
    1.76 -            SDL_UnloadObject(lib.handle);
    1.77 -            return -1;
    1.78 -        }
    1.79 -        lib.jpeg_CreateCompress =
    1.80 -            (void (*) (j_compress_ptr, int, size_t))
    1.81 -            SDL_LoadFunction(lib.handle, "jpeg_CreateCompress");
    1.82 -        if ( lib.jpeg_CreateCompress == NULL ) {
    1.83 -            SDL_UnloadObject(lib.handle);
    1.84 -            return -1;
    1.85 -        }
    1.86 -        lib.jpeg_start_compress =
    1.87 -            (void (*) (j_compress_ptr cinfo, boolean write_all_tables))
    1.88 -            SDL_LoadFunction(lib.handle, "jpeg_start_compress");
    1.89 -        if ( lib.jpeg_start_compress == NULL ) {
    1.90 -            SDL_UnloadObject(lib.handle);
    1.91 -            return -1;
    1.92 -        }
    1.93 -        lib.jpeg_set_quality =
    1.94 -            (void(*) (j_compress_ptr cinfo, int quality, boolean force_baseline))
    1.95 -            SDL_LoadFunction(lib.handle, "jpeg_set_quality");
    1.96 -        if ( lib.jpeg_set_quality == NULL ) {
    1.97 -            SDL_UnloadObject(lib.handle);
    1.98 -            return -1;
    1.99 -        }
   1.100 -        lib.jpeg_set_defaults =
   1.101 -            (void(*) (j_compress_ptr cinfo))
   1.102 -            SDL_LoadFunction(lib.handle, "jpeg_set_defaults");
   1.103 -        if ( lib.jpeg_set_defaults == NULL ) {
   1.104 -            SDL_UnloadObject(lib.handle);
   1.105 -            return -1;
   1.106 -        }
   1.107 -        lib.jpeg_write_scanlines = 
   1.108 -            (JDIMENSION (*) (j_compress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION num_lines))
   1.109 -            SDL_LoadFunction(lib.handle, "jpeg_write_scanlines");
   1.110 -        if ( lib.jpeg_write_scanlines == NULL ) {
   1.111 -            SDL_UnloadObject(lib.handle);
   1.112 -            return -1;
   1.113 -        }
   1.114 -        lib.jpeg_finish_compress =
   1.115 -            (void (*) (j_compress_ptr cinfo))
   1.116 -            SDL_LoadFunction(lib.handle, "jpeg_finish_compress");
   1.117 -        if ( lib.jpeg_finish_compress == NULL ) {
   1.118 -            SDL_UnloadObject(lib.handle);
   1.119 -            return -1;
   1.120 -        }
   1.121 -        lib.jpeg_destroy_compress = 
   1.122 -            (void (*) (j_compress_ptr cinfo))
   1.123 -            SDL_LoadFunction(lib.handle, "jpeg_destroy_compress");
   1.124 -        if ( lib.jpeg_destroy_compress == NULL ) {
   1.125 -            SDL_UnloadObject(lib.handle);
   1.126 -            return -1;
   1.127 -        }
   1.128 -        lib.jpeg_std_error =
   1.129 -            (struct jpeg_error_mgr * (*) (struct jpeg_error_mgr *))
   1.130 -            SDL_LoadFunction(lib.handle, "jpeg_std_error");
   1.131 -        if ( lib.jpeg_std_error == NULL ) {
   1.132 -            SDL_UnloadObject(lib.handle);
   1.133 -            return -1;
   1.134 -        }
   1.135 +#endif
   1.136 +        FUNCTION_LOADER(jpeg_calc_output_dimensions, void (*) (j_decompress_ptr cinfo))
   1.137 +        FUNCTION_LOADER(jpeg_CreateDecompress, void (*) (j_decompress_ptr cinfo, int version, size_t structsize))
   1.138 +        FUNCTION_LOADER(jpeg_destroy_decompress, void (*) (j_decompress_ptr cinfo))
   1.139 +        FUNCTION_LOADER(jpeg_finish_decompress, boolean (*) (j_decompress_ptr cinfo))
   1.140 +        FUNCTION_LOADER(jpeg_read_header, int (*) (j_decompress_ptr cinfo, boolean require_image))
   1.141 +        FUNCTION_LOADER(jpeg_read_scanlines, JDIMENSION (*) (j_decompress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION max_lines))
   1.142 +        FUNCTION_LOADER(jpeg_resync_to_restart, boolean (*) (j_decompress_ptr cinfo, int desired))
   1.143 +        FUNCTION_LOADER(jpeg_start_decompress, boolean (*) (j_decompress_ptr cinfo))
   1.144 +        FUNCTION_LOADER(jpeg_CreateCompress, void (*) (j_compress_ptr cinfo, int version, size_t structsize))
   1.145 +        FUNCTION_LOADER(jpeg_start_compress, void (*) (j_compress_ptr cinfo, boolean write_all_tables))
   1.146 +        FUNCTION_LOADER(jpeg_set_quality, void (*) (j_compress_ptr cinfo, int quality, boolean force_baseline))
   1.147 +        FUNCTION_LOADER(jpeg_set_defaults, void (*) (j_compress_ptr cinfo))
   1.148 +        FUNCTION_LOADER(jpeg_write_scanlines, JDIMENSION (*) (j_compress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION num_lines))
   1.149 +        FUNCTION_LOADER(jpeg_finish_compress, void (*) (j_compress_ptr cinfo))
   1.150 +        FUNCTION_LOADER(jpeg_destroy_compress, void (*) (j_compress_ptr cinfo))
   1.151 +        FUNCTION_LOADER(jpeg_std_error, struct jpeg_error_mgr * (*) (struct jpeg_error_mgr * err))
   1.152      }
   1.153      ++lib.loaded;
   1.154  
   1.155 @@ -198,45 +112,12 @@
   1.156          return;
   1.157      }
   1.158      if ( lib.loaded == 1 ) {
   1.159 +#ifdef LOAD_JPG_DYNAMIC
   1.160          SDL_UnloadObject(lib.handle);
   1.161 +#endif
   1.162      }
   1.163      --lib.loaded;
   1.164  }
   1.165 -#else
   1.166 -int IMG_InitJPG()
   1.167 -{
   1.168 -    if ( lib.loaded == 0 ) {
   1.169 -        lib.jpeg_calc_output_dimensions = jpeg_calc_output_dimensions;
   1.170 -        lib.jpeg_CreateDecompress = jpeg_CreateDecompress;
   1.171 -        lib.jpeg_destroy_decompress = jpeg_destroy_decompress;
   1.172 -        lib.jpeg_finish_decompress = jpeg_finish_decompress;
   1.173 -        lib.jpeg_read_header = jpeg_read_header;
   1.174 -        lib.jpeg_read_scanlines = jpeg_read_scanlines;
   1.175 -        lib.jpeg_resync_to_restart = jpeg_resync_to_restart;
   1.176 -        lib.jpeg_start_decompress = jpeg_start_decompress;
   1.177 -        lib.jpeg_CreateCompress = jpeg_CreateCompress;
   1.178 -        lib.jpeg_start_compress = jpeg_start_compress;
   1.179 -        lib.jpeg_set_quality = jpeg_set_quality;
   1.180 -        lib.jpeg_set_defaults = jpeg_set_defaults;
   1.181 -        lib.jpeg_write_scanlines = jpeg_write_scanlines;
   1.182 -        lib.jpeg_finish_compress = jpeg_finish_compress;
   1.183 -        lib.jpeg_destroy_compress = jpeg_destroy_compress;
   1.184 -        lib.jpeg_std_error = jpeg_std_error;
   1.185 -    }
   1.186 -    ++lib.loaded;
   1.187 -
   1.188 -    return 0;
   1.189 -}
   1.190 -void IMG_QuitJPG()
   1.191 -{
   1.192 -    if ( lib.loaded == 0 ) {
   1.193 -        return;
   1.194 -    }
   1.195 -    if ( lib.loaded == 1 ) {
   1.196 -    }
   1.197 -    --lib.loaded;
   1.198 -}
   1.199 -#endif /* LOAD_JPG_DYNAMIC */
   1.200  
   1.201  /* See if an image is contained in a data source */
   1.202  int IMG_isJPG(SDL_RWops *src)
   1.203 @@ -329,7 +210,7 @@
   1.204      my_source_mgr * src = (my_source_mgr *) cinfo->src;
   1.205      int nbytes;
   1.206  
   1.207 -    nbytes = SDL_RWread(src->ctx, src->buffer, 1, INPUT_BUFFER_SIZE);
   1.208 +    nbytes = (int)SDL_RWread(src->ctx, src->buffer, 1, INPUT_BUFFER_SIZE);
   1.209      if (nbytes <= 0) {
   1.210          /* Insert a fake EOI marker */
   1.211          src->buffer[0] = (Uint8) 0xFF;
     2.1 --- a/IMG_png.c	Sun Oct 22 14:40:08 2017 -0700
     2.2 +++ b/IMG_png.c	Sun Oct 22 14:40:31 2017 -0700
     2.3 @@ -116,204 +116,52 @@
     2.4  } lib;
     2.5  
     2.6  #ifdef LOAD_PNG_DYNAMIC
     2.7 +#define FUNCTION_LOADER(FUNC, SIG) \
     2.8 +    lib.FUNC = (SIG) SDL_LoadFunction(lib.handle, #FUNC); \
     2.9 +    if (lib.FUNC == NULL) { SDL_UnloadObject(lib.handle); return -1; }
    2.10 +#else
    2.11 +#define FUNCTION_LOADER(FUNC, SIG) \
    2.12 +    lib.FUNC = FUNC;
    2.13 +#endif
    2.14 +
    2.15  int IMG_InitPNG()
    2.16  {
    2.17      if ( lib.loaded == 0 ) {
    2.18 +#ifdef LOAD_PNG_DYNAMIC
    2.19          lib.handle = SDL_LoadObject(LOAD_PNG_DYNAMIC);
    2.20          if ( lib.handle == NULL ) {
    2.21              return -1;
    2.22          }
    2.23 -        lib.png_create_info_struct =
    2.24 -            (png_infop (*) (png_const_structrp))
    2.25 -            SDL_LoadFunction(lib.handle, "png_create_info_struct");
    2.26 -        if ( lib.png_create_info_struct == NULL ) {
    2.27 -            SDL_UnloadObject(lib.handle);
    2.28 -            return -1;
    2.29 -        }
    2.30 -        lib.png_create_read_struct =
    2.31 -            (png_structrp (*) (png_const_charp, png_voidp, png_error_ptr, png_error_ptr))
    2.32 -            SDL_LoadFunction(lib.handle, "png_create_read_struct");
    2.33 -        if ( lib.png_create_read_struct == NULL ) {
    2.34 -            SDL_UnloadObject(lib.handle);
    2.35 -            return -1;
    2.36 -        }
    2.37 -        lib.png_destroy_read_struct =
    2.38 -            (void (*) (png_structpp, png_infopp, png_infopp))
    2.39 -            SDL_LoadFunction(lib.handle, "png_destroy_read_struct");
    2.40 -        if ( lib.png_destroy_read_struct == NULL ) {
    2.41 -            SDL_UnloadObject(lib.handle);
    2.42 -            return -1;
    2.43 -        }
    2.44 -        lib.png_get_IHDR =
    2.45 -            (png_uint_32 (*) (png_const_structrp, png_const_inforp, png_uint_32 *, png_uint_32 *, int *, int *, int *, int *, int *))
    2.46 -            SDL_LoadFunction(lib.handle, "png_get_IHDR");
    2.47 -        if ( lib.png_get_IHDR == NULL ) {
    2.48 -            SDL_UnloadObject(lib.handle);
    2.49 -            return -1;
    2.50 -        }
    2.51 -        lib.png_get_channels =
    2.52 -            (png_byte (*) (png_const_structrp, png_const_inforp))
    2.53 -            SDL_LoadFunction(lib.handle, "png_get_channels");
    2.54 -        if ( lib.png_get_channels == NULL ) {
    2.55 -            SDL_UnloadObject(lib.handle);
    2.56 -            return -1;
    2.57 -        }
    2.58 -        lib.png_get_io_ptr =
    2.59 -            (png_voidp (*) (png_const_structrp))
    2.60 -            SDL_LoadFunction(lib.handle, "png_get_io_ptr");
    2.61 -        if ( lib.png_get_io_ptr == NULL ) {
    2.62 -            SDL_UnloadObject(lib.handle);
    2.63 -            return -1;
    2.64 -        }
    2.65 -        lib.png_get_PLTE =
    2.66 -            (png_uint_32 (*) (png_const_structrp, png_inforp, png_colorp *, int *))
    2.67 -            SDL_LoadFunction(lib.handle, "png_get_PLTE");
    2.68 -        if ( lib.png_get_PLTE == NULL ) {
    2.69 -            SDL_UnloadObject(lib.handle);
    2.70 -            return -1;
    2.71 -        }
    2.72 -        lib.png_get_tRNS =
    2.73 -            (png_uint_32 (*) (png_const_structrp, png_inforp, png_bytep *, int *, png_color_16p *))
    2.74 -            SDL_LoadFunction(lib.handle, "png_get_tRNS");
    2.75 -        if ( lib.png_get_tRNS == NULL ) {
    2.76 -            SDL_UnloadObject(lib.handle);
    2.77 -            return -1;
    2.78 -        }
    2.79 -        lib.png_get_valid =
    2.80 -            (png_uint_32 (*) (png_const_structrp, png_const_inforp, png_uint_32))
    2.81 -            SDL_LoadFunction(lib.handle, "png_get_valid");
    2.82 -        if ( lib.png_get_valid == NULL ) {
    2.83 -            SDL_UnloadObject(lib.handle);
    2.84 -            return -1;
    2.85 -        }
    2.86 -        lib.png_read_image =
    2.87 -            (void (*) (png_structrp, png_bytepp))
    2.88 -            SDL_LoadFunction(lib.handle, "png_read_image");
    2.89 -        if ( lib.png_read_image == NULL ) {
    2.90 -            SDL_UnloadObject(lib.handle);
    2.91 -            return -1;
    2.92 -        }
    2.93 -        lib.png_read_info =
    2.94 -            (void (*) (png_structrp, png_inforp))
    2.95 -            SDL_LoadFunction(lib.handle, "png_read_info");
    2.96 -        if ( lib.png_read_info == NULL ) {
    2.97 -            SDL_UnloadObject(lib.handle);
    2.98 -            return -1;
    2.99 -        }
   2.100 -        lib.png_read_update_info =
   2.101 -            (void (*) (png_structrp, png_inforp))
   2.102 -            SDL_LoadFunction(lib.handle, "png_read_update_info");
   2.103 -        if ( lib.png_read_update_info == NULL ) {
   2.104 -            SDL_UnloadObject(lib.handle);
   2.105 -            return -1;
   2.106 -        }
   2.107 -        lib.png_set_expand =
   2.108 -            (void (*) (png_structrp))
   2.109 -            SDL_LoadFunction(lib.handle, "png_set_expand");
   2.110 -        if ( lib.png_set_expand == NULL ) {
   2.111 -            SDL_UnloadObject(lib.handle);
   2.112 -            return -1;
   2.113 -        }
   2.114 -        lib.png_set_gray_to_rgb =
   2.115 -            (void (*) (png_structrp))
   2.116 -            SDL_LoadFunction(lib.handle, "png_set_gray_to_rgb");
   2.117 -        if ( lib.png_set_gray_to_rgb == NULL ) {
   2.118 -            SDL_UnloadObject(lib.handle);
   2.119 -            return -1;
   2.120 -        }
   2.121 -        lib.png_set_packing =
   2.122 -            (void (*) (png_structrp))
   2.123 -            SDL_LoadFunction(lib.handle, "png_set_packing");
   2.124 -        if ( lib.png_set_packing == NULL ) {
   2.125 -            SDL_UnloadObject(lib.handle);
   2.126 -            return -1;
   2.127 -        }
   2.128 -        lib.png_set_read_fn =
   2.129 -            (void (*) (png_structrp, png_voidp, png_rw_ptr))
   2.130 -            SDL_LoadFunction(lib.handle, "png_set_read_fn");
   2.131 -        if ( lib.png_set_read_fn == NULL ) {
   2.132 -            SDL_UnloadObject(lib.handle);
   2.133 -            return -1;
   2.134 -        }
   2.135 -        lib.png_set_strip_16 =
   2.136 -            (void (*) (png_structrp))
   2.137 -            SDL_LoadFunction(lib.handle, "png_set_strip_16");
   2.138 -        if ( lib.png_set_strip_16 == NULL ) {
   2.139 -            SDL_UnloadObject(lib.handle);
   2.140 -            return -1;
   2.141 -        }
   2.142 -        lib.png_sig_cmp =
   2.143 -            (int (*) (png_const_bytep, png_size_t, png_size_t))
   2.144 -            SDL_LoadFunction(lib.handle, "png_sig_cmp");
   2.145 -        if ( lib.png_sig_cmp == NULL ) {
   2.146 -            SDL_UnloadObject(lib.handle);
   2.147 -            return -1;
   2.148 -        }
   2.149 +#endif
   2.150 +        FUNCTION_LOADER(png_create_info_struct, png_infop (*) (png_const_structrp png_ptr))
   2.151 +        FUNCTION_LOADER(png_create_read_struct, png_structp (*) (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn))
   2.152 +        FUNCTION_LOADER(png_destroy_read_struct, void (*) (png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr))
   2.153 +        FUNCTION_LOADER(png_get_IHDR, png_uint_32 (*) (png_const_structrp png_ptr, png_const_inforp info_ptr, png_uint_32 *width, png_uint_32 *height, int *bit_depth, int *color_type, int *interlace_method, int *compression_method, int *filter_method))
   2.154 +        FUNCTION_LOADER(png_get_io_ptr, png_voidp (*) (png_const_structrp png_ptr))
   2.155 +        FUNCTION_LOADER(png_get_channels, png_byte (*) (png_const_structrp png_ptr, png_const_inforp info_ptr))
   2.156 +        FUNCTION_LOADER(png_get_PLTE, png_uint_32 (*) (png_const_structrp png_ptr, png_inforp info_ptr, png_colorp *palette, int *num_palette))
   2.157 +        FUNCTION_LOADER(png_get_tRNS, png_uint_32 (*) (png_const_structrp png_ptr, png_inforp info_ptr, png_bytep *trans, int *num_trans, png_color_16p *trans_values))
   2.158 +        FUNCTION_LOADER(png_get_valid, png_uint_32 (*) (png_const_structrp png_ptr, png_const_inforp info_ptr, png_uint_32 flag))
   2.159 +        FUNCTION_LOADER(png_read_image, void (*) (png_structrp png_ptr, png_bytepp image))
   2.160 +        FUNCTION_LOADER(png_read_info, void (*) (png_structrp png_ptr, png_inforp info_ptr))
   2.161 +        FUNCTION_LOADER(png_read_update_info, void (*) (png_structrp png_ptr, png_inforp info_ptr))
   2.162 +        FUNCTION_LOADER(png_set_expand, void (*) (png_structrp png_ptr))
   2.163 +        FUNCTION_LOADER(png_set_gray_to_rgb, void (*) (png_structrp png_ptr))
   2.164 +        FUNCTION_LOADER(png_set_packing, void (*) (png_structrp png_ptr))
   2.165 +        FUNCTION_LOADER(png_set_read_fn, void (*) (png_structrp png_ptr, png_voidp io_ptr, png_rw_ptr read_data_fn))
   2.166 +        FUNCTION_LOADER(png_set_strip_16, void (*) (png_structrp png_ptr))
   2.167 +        FUNCTION_LOADER(png_sig_cmp, int (*) (png_const_bytep sig, png_size_t start, png_size_t num_to_check))
   2.168  #ifndef LIBPNG_VERSION_12
   2.169 -        lib.png_set_longjmp_fn =
   2.170 -            (jmp_buf * (*) (png_structrp, png_longjmp_ptr, size_t))
   2.171 -            SDL_LoadFunction(lib.handle, "png_set_longjmp_fn");
   2.172 -        if ( lib.png_set_longjmp_fn == NULL ) {
   2.173 -            SDL_UnloadObject(lib.handle);
   2.174 -            return -1;
   2.175 -        }
   2.176 +        FUNCTION_LOADER(png_set_longjmp_fn, jmp_buf* (*) (png_structrp, png_longjmp_ptr, size_t))
   2.177  #endif
   2.178 -        lib.png_create_write_struct =
   2.179 -            (png_structp (*) (png_const_charp, png_voidp, png_error_ptr, png_error_ptr))
   2.180 -            SDL_LoadFunction(lib.handle, "png_create_write_struct");
   2.181 -        if ( lib.png_create_write_struct == NULL ) {
   2.182 -            SDL_UnloadObject(lib.handle);
   2.183 -            return -1;
   2.184 -        }
   2.185 -        lib.png_destroy_write_struct =
   2.186 -            (void (*) (png_structpp, png_infopp))
   2.187 -            SDL_LoadFunction(lib.handle, "png_destroy_write_struct");
   2.188 -        if ( lib.png_destroy_write_struct == NULL ) {
   2.189 -            SDL_UnloadObject(lib.handle);
   2.190 -            return -1;
   2.191 -        }
   2.192 -        lib.png_set_write_fn =
   2.193 -            (void (*) (png_structp, png_voidp, png_rw_ptr, png_flush_ptr))
   2.194 -            SDL_LoadFunction(lib.handle, "png_set_write_fn");
   2.195 -        if ( lib.png_set_write_fn == NULL ) {
   2.196 -            SDL_UnloadObject(lib.handle);
   2.197 -            return -1;
   2.198 -        }
   2.199 -        lib.png_set_IHDR =
   2.200 -            (void (*) (png_structp, png_infop, png_uint_32, png_uint_32, int, int, int, int, int))
   2.201 -            SDL_LoadFunction(lib.handle, "png_set_IHDR");
   2.202 -        if ( lib.png_set_IHDR == NULL ) {
   2.203 -            SDL_UnloadObject(lib.handle);
   2.204 -            return -1;
   2.205 -        }
   2.206 -        lib.png_write_info =
   2.207 -            (void (*) (png_structp, png_infop))
   2.208 -            SDL_LoadFunction(lib.handle, "png_write_info");
   2.209 -        if ( lib.png_write_info == NULL ) {
   2.210 -            SDL_UnloadObject(lib.handle);
   2.211 -            return -1;
   2.212 -        }
   2.213 -        lib.png_set_rows =
   2.214 -            (void (*) (png_structp, png_infop, png_bytepp))
   2.215 -            SDL_LoadFunction(lib.handle, "png_set_rows");
   2.216 -        if ( lib.png_set_rows == NULL ) {
   2.217 -            SDL_UnloadObject(lib.handle);
   2.218 -            return -1;
   2.219 -        }
   2.220 -        lib.png_write_png =
   2.221 -            (void (*) (png_structp, png_infop, int, png_voidp))
   2.222 -            SDL_LoadFunction(lib.handle, "png_write_png");
   2.223 -        if ( lib.png_write_png == NULL ) {
   2.224 -            SDL_UnloadObject(lib.handle);
   2.225 -            return -1;
   2.226 -        }
   2.227 -        lib.png_set_PLTE =
   2.228 -            (void (*) (png_structp, png_infop, png_colorp, int))
   2.229 -            SDL_LoadFunction(lib.handle, "png_set_PLTE");
   2.230 -        if ( lib.png_set_PLTE == NULL ) {
   2.231 -            SDL_UnloadObject(lib.handle);
   2.232 -            return -1;
   2.233 -        }
   2.234 +        FUNCTION_LOADER(png_create_write_struct, png_structp (*) (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn))
   2.235 +        FUNCTION_LOADER(png_destroy_write_struct, void (*) (png_structpp png_ptr_ptr, png_infopp info_ptr_ptr))
   2.236 +        FUNCTION_LOADER(png_set_write_fn, void (*) (png_structrp png_ptr, png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn))
   2.237 +        FUNCTION_LOADER(png_set_IHDR, void (*) (png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth, int color_type, int interlace_type, int compression_type, int filter_type))
   2.238 +        FUNCTION_LOADER(png_write_info, void (*) (png_structrp png_ptr, png_const_inforp info_ptr))
   2.239 +        FUNCTION_LOADER(png_set_rows, void (*) (png_const_structrp png_ptr, png_inforp info_ptr, png_bytepp row_pointers))
   2.240 +        FUNCTION_LOADER(png_write_png, void (*) (png_structrp png_ptr, png_inforp info_ptr, int transforms, png_voidp params))
   2.241 +        FUNCTION_LOADER(png_set_PLTE, void (*) (png_structrp png_ptr, png_inforp info_ptr, png_const_colorp palette, int num_palette))
   2.242      }
   2.243      ++lib.loaded;
   2.244  
   2.245 @@ -325,58 +173,12 @@
   2.246          return;
   2.247      }
   2.248      if ( lib.loaded == 1 ) {
   2.249 +#ifdef LOAD_PNG_DYNAMIC
   2.250          SDL_UnloadObject(lib.handle);
   2.251 +#endif
   2.252      }
   2.253      --lib.loaded;
   2.254  }
   2.255 -#else
   2.256 -int IMG_InitPNG()
   2.257 -{
   2.258 -    if ( lib.loaded == 0 ) {
   2.259 -        lib.png_create_info_struct = png_create_info_struct;
   2.260 -        lib.png_create_read_struct = png_create_read_struct;
   2.261 -        lib.png_destroy_read_struct = png_destroy_read_struct;
   2.262 -        lib.png_get_IHDR = png_get_IHDR;
   2.263 -        lib.png_get_channels = png_get_channels;
   2.264 -        lib.png_get_io_ptr = png_get_io_ptr;
   2.265 -        lib.png_get_PLTE = png_get_PLTE;
   2.266 -        lib.png_get_tRNS = png_get_tRNS;
   2.267 -        lib.png_get_valid = png_get_valid;
   2.268 -        lib.png_read_image = png_read_image;
   2.269 -        lib.png_read_info = png_read_info;
   2.270 -        lib.png_read_update_info = png_read_update_info;
   2.271 -        lib.png_set_expand = png_set_expand;
   2.272 -        lib.png_set_gray_to_rgb = png_set_gray_to_rgb;
   2.273 -        lib.png_set_packing = png_set_packing;
   2.274 -        lib.png_set_read_fn = png_set_read_fn;
   2.275 -        lib.png_set_strip_16 = png_set_strip_16;
   2.276 -        lib.png_sig_cmp = png_sig_cmp;
   2.277 -#ifndef LIBPNG_VERSION_12
   2.278 -        lib.png_set_longjmp_fn = png_set_longjmp_fn;
   2.279 -#endif
   2.280 -        lib.png_create_write_struct = png_create_write_struct;
   2.281 -        lib.png_destroy_write_struct = png_destroy_write_struct;
   2.282 -        lib.png_set_write_fn = png_set_write_fn;
   2.283 -        lib.png_set_IHDR = png_set_IHDR;
   2.284 -        lib.png_write_info = png_write_info;
   2.285 -        lib.png_set_rows = png_set_rows;
   2.286 -        lib.png_write_png = png_write_png;
   2.287 -        lib.png_set_PLTE = png_set_PLTE;
   2.288 -    }
   2.289 -    ++lib.loaded;
   2.290 -
   2.291 -    return 0;
   2.292 -}
   2.293 -void IMG_QuitPNG()
   2.294 -{
   2.295 -    if ( lib.loaded == 0 ) {
   2.296 -        return;
   2.297 -    }
   2.298 -    if ( lib.loaded == 1 ) {
   2.299 -    }
   2.300 -    --lib.loaded;
   2.301 -}
   2.302 -#endif /* LOAD_PNG_DYNAMIC */
   2.303  
   2.304  /* See if an image is contained in a data source */
   2.305  int IMG_isPNG(SDL_RWops *src)
     3.1 --- a/IMG_svg.c	Sun Oct 22 14:40:08 2017 -0700
     3.2 +++ b/IMG_svg.c	Sun Oct 22 14:40:31 2017 -0700
     3.3 @@ -28,8 +28,8 @@
     3.4  #ifdef LOAD_SVG
     3.5  
     3.6  /* Replace C runtime functions with SDL C runtime functions for building on Windows */
     3.7 -#define strtoll	SDL_strtoll
     3.8 -#define sscanf	SDL_sscanf
     3.9 +#define strtoll SDL_strtoll
    3.10 +#define sscanf  SDL_sscanf
    3.11  #ifndef FLT_MAX
    3.12  #define FLT_MAX     3.402823466e+38F
    3.13  #endif
     4.1 --- a/IMG_tif.c	Sun Oct 22 14:40:08 2017 -0700
     4.2 +++ b/IMG_tif.c	Sun Oct 22 14:40:31 2017 -0700
     4.3 @@ -40,48 +40,28 @@
     4.4  } lib;
     4.5  
     4.6  #ifdef LOAD_TIF_DYNAMIC
     4.7 +#define FUNCTION_LOADER(FUNC, SIG) \
     4.8 +    lib.FUNC = (SIG) SDL_LoadFunction(lib.handle, #FUNC); \
     4.9 +    if (lib.FUNC == NULL) { SDL_UnloadObject(lib.handle); return -1; }
    4.10 +#else
    4.11 +#define FUNCTION_LOADER(FUNC, SIG) \
    4.12 +    lib.FUNC = FUNC;
    4.13 +#endif
    4.14 +
    4.15  int IMG_InitTIF()
    4.16  {
    4.17      if ( lib.loaded == 0 ) {
    4.18 +#ifdef LOAD_TIF_DYNAMIC
    4.19          lib.handle = SDL_LoadObject(LOAD_TIF_DYNAMIC);
    4.20          if ( lib.handle == NULL ) {
    4.21              return -1;
    4.22          }
    4.23 -        lib.TIFFClientOpen =
    4.24 -            (TIFF* (*)(const char*, const char*, thandle_t, TIFFReadWriteProc, TIFFReadWriteProc, TIFFSeekProc, TIFFCloseProc, TIFFSizeProc, TIFFMapFileProc, TIFFUnmapFileProc))
    4.25 -            SDL_LoadFunction(lib.handle, "TIFFClientOpen");
    4.26 -        if ( lib.TIFFClientOpen == NULL ) {
    4.27 -            SDL_UnloadObject(lib.handle);
    4.28 -            return -1;
    4.29 -        }
    4.30 -        lib.TIFFClose =
    4.31 -            (void (*)(TIFF*))
    4.32 -            SDL_LoadFunction(lib.handle, "TIFFClose");
    4.33 -        if ( lib.TIFFClose == NULL ) {
    4.34 -            SDL_UnloadObject(lib.handle);
    4.35 -            return -1;
    4.36 -        }
    4.37 -        lib.TIFFGetField =
    4.38 -            (int (*)(TIFF*, ttag_t, ...))
    4.39 -            SDL_LoadFunction(lib.handle, "TIFFGetField");
    4.40 -        if ( lib.TIFFGetField == NULL ) {
    4.41 -            SDL_UnloadObject(lib.handle);
    4.42 -            return -1;
    4.43 -        }
    4.44 -        lib.TIFFReadRGBAImageOriented =
    4.45 -            (int (*)(TIFF*, uint32, uint32, uint32*, int, int))
    4.46 -            SDL_LoadFunction(lib.handle, "TIFFReadRGBAImageOriented");
    4.47 -        if ( lib.TIFFReadRGBAImageOriented == NULL ) {
    4.48 -            SDL_UnloadObject(lib.handle);
    4.49 -            return -1;
    4.50 -        }
    4.51 -        lib.TIFFSetErrorHandler =
    4.52 -            (TIFFErrorHandler (*)(TIFFErrorHandler))
    4.53 -            SDL_LoadFunction(lib.handle, "TIFFSetErrorHandler");
    4.54 -        if ( lib.TIFFSetErrorHandler == NULL ) {
    4.55 -            SDL_UnloadObject(lib.handle);
    4.56 -            return -1;
    4.57 -        }
    4.58 +#endif
    4.59 +        FUNCTION_LOADER(TIFFClientOpen, TIFF * (*)(const char*, const char*, thandle_t, TIFFReadWriteProc, TIFFReadWriteProc, TIFFSeekProc, TIFFCloseProc, TIFFSizeProc, TIFFMapFileProc, TIFFUnmapFileProc))
    4.60 +        FUNCTION_LOADER(TIFFClose, void (*)(TIFF*))
    4.61 +        FUNCTION_LOADER(TIFFGetField, int (*)(TIFF*, ttag_t, ...))
    4.62 +        FUNCTION_LOADER(TIFFReadRGBAImageOriented, int (*)(TIFF*, uint32, uint32, uint32*, int, int))
    4.63 +        FUNCTION_LOADER(TIFFSetErrorHandler, TIFFErrorHandler (*)(TIFFErrorHandler))
    4.64      }
    4.65      ++lib.loaded;
    4.66  
    4.67 @@ -93,34 +73,12 @@
    4.68          return;
    4.69      }
    4.70      if ( lib.loaded == 1 ) {
    4.71 +#ifdef LOAD_TIF_DYNAMIC
    4.72          SDL_UnloadObject(lib.handle);
    4.73 +#endif
    4.74      }
    4.75      --lib.loaded;
    4.76  }
    4.77 -#else
    4.78 -int IMG_InitTIF()
    4.79 -{
    4.80 -    if ( lib.loaded == 0 ) {
    4.81 -        lib.TIFFClientOpen = TIFFClientOpen;
    4.82 -        lib.TIFFClose = TIFFClose;
    4.83 -        lib.TIFFGetField = TIFFGetField;
    4.84 -        lib.TIFFReadRGBAImageOriented = TIFFReadRGBAImageOriented;
    4.85 -        lib.TIFFSetErrorHandler = TIFFSetErrorHandler;
    4.86 -    }
    4.87 -    ++lib.loaded;
    4.88 -
    4.89 -    return 0;
    4.90 -}
    4.91 -void IMG_QuitTIF()
    4.92 -{
    4.93 -    if ( lib.loaded == 0 ) {
    4.94 -        return;
    4.95 -    }
    4.96 -    if ( lib.loaded == 1 ) {
    4.97 -    }
    4.98 -    --lib.loaded;
    4.99 -}
   4.100 -#endif /* LOAD_TIF_DYNAMIC */
   4.101  
   4.102  /*
   4.103   * These are the thunking routine to use the SDL_RWops* routines from
   4.104 @@ -129,7 +87,7 @@
   4.105  
   4.106  static tsize_t tiff_read(thandle_t fd, tdata_t buf, tsize_t size)
   4.107  {
   4.108 -    return SDL_RWread((SDL_RWops*)fd, buf, 1, size);
   4.109 +    return (tsize_t)SDL_RWread((SDL_RWops*)fd, buf, 1, size);
   4.110  }
   4.111  
   4.112  static toff_t tiff_seek(thandle_t fd, toff_t offset, int origin)
   4.113 @@ -139,7 +97,7 @@
   4.114  
   4.115  static tsize_t tiff_write(thandle_t fd, tdata_t buf, tsize_t size)
   4.116  {
   4.117 -    return SDL_RWwrite((SDL_RWops*)fd, buf, 1, size);
   4.118 +    return (tsize_t)SDL_RWwrite((SDL_RWops*)fd, buf, 1, size);
   4.119  }
   4.120  
   4.121  static int tiff_close(thandle_t fd)
     5.1 --- a/IMG_webp.c	Sun Oct 22 14:40:08 2017 -0700
     5.2 +++ b/IMG_webp.c	Sun Oct 22 14:40:31 2017 -0700
     5.3 @@ -44,43 +44,32 @@
     5.4  static struct {
     5.5      int loaded;
     5.6      void *handle;
     5.7 -    VP8StatusCode (*webp_get_features_internal) (const uint8_t *data, size_t data_size, WebPBitstreamFeatures* features, int decoder_abi_version);
     5.8 -    uint8_t*    (*webp_decode_rgb_into) (const uint8_t* data, size_t data_size, uint8_t* output_buffer, size_t output_buffer_size, int output_stride);
     5.9 -    uint8_t*    (*webp_decode_rgba_into) (const uint8_t* data, size_t data_size, uint8_t* output_buffer, size_t output_buffer_size, int output_stride);
    5.10 +    VP8StatusCode (*WebPGetFeaturesInternal) (const uint8_t *data, size_t data_size, WebPBitstreamFeatures* features, int decoder_abi_version);
    5.11 +    uint8_t*    (*WebPDecodeRGBInto) (const uint8_t* data, size_t data_size, uint8_t* output_buffer, size_t output_buffer_size, int output_stride);
    5.12 +    uint8_t*    (*WebPDecodeRGBAInto) (const uint8_t* data, size_t data_size, uint8_t* output_buffer, size_t output_buffer_size, int output_stride);
    5.13  } lib;
    5.14  
    5.15  #ifdef LOAD_WEBP_DYNAMIC
    5.16 +#define FUNCTION_LOADER(FUNC, SIG) \
    5.17 +    lib.FUNC = (SIG) SDL_LoadFunction(lib.handle, #FUNC); \
    5.18 +    if (lib.FUNC == NULL) { SDL_UnloadObject(lib.handle); return -1; }
    5.19 +#else
    5.20 +#define FUNCTION_LOADER(FUNC, SIG) \
    5.21 +    lib.FUNC = FUNC;
    5.22 +#endif
    5.23 +
    5.24  int IMG_InitWEBP()
    5.25  {
    5.26      if ( lib.loaded == 0 ) {
    5.27 +#ifdef LOAD_WEBP_DYNAMIC
    5.28          lib.handle = SDL_LoadObject(LOAD_WEBP_DYNAMIC);
    5.29          if ( lib.handle == NULL ) {
    5.30              return -1;
    5.31          }
    5.32 -
    5.33 -        lib.webp_get_features_internal =
    5.34 -            ( VP8StatusCode (*) (const uint8_t *, size_t, WebPBitstreamFeatures*, int) )
    5.35 -            SDL_LoadFunction(lib.handle, "WebPGetFeaturesInternal" );
    5.36 -        if ( lib.webp_get_features_internal == NULL ) {
    5.37 -            SDL_UnloadObject(lib.handle);
    5.38 -            return -1;
    5.39 -        }
    5.40 -
    5.41 -        lib.webp_decode_rgb_into =
    5.42 -            ( uint8_t* (*) (const uint8_t*, size_t, uint8_t*, size_t, int ) )
    5.43 -            SDL_LoadFunction(lib.handle, "WebPDecodeRGBInto" );
    5.44 -        if ( lib.webp_decode_rgb_into == NULL ) {
    5.45 -            SDL_UnloadObject(lib.handle);
    5.46 -            return -1;
    5.47 -        }
    5.48 -
    5.49 -        lib.webp_decode_rgba_into =
    5.50 -            ( uint8_t* (*) (const uint8_t*, size_t, uint8_t*, size_t, int ) )
    5.51 -            SDL_LoadFunction(lib.handle, "WebPDecodeRGBAInto" );
    5.52 -        if ( lib.webp_decode_rgba_into == NULL ) {
    5.53 -            SDL_UnloadObject(lib.handle);
    5.54 -            return -1;
    5.55 -        }
    5.56 +#endif
    5.57 +        FUNCTION_LOADER(WebPGetFeaturesInternal, VP8StatusCode (*) (const uint8_t *data, size_t data_size, WebPBitstreamFeatures* features, int decoder_abi_version))
    5.58 +        FUNCTION_LOADER(WebPDecodeRGBInto, uint8_t * (*) (const uint8_t* data, size_t data_size, uint8_t* output_buffer, size_t output_buffer_size, int output_stride))
    5.59 +        FUNCTION_LOADER(WebPDecodeRGBAInto, uint8_t * (*) (const uint8_t* data, size_t data_size, uint8_t* output_buffer, size_t output_buffer_size, int output_stride))
    5.60      }
    5.61      ++lib.loaded;
    5.62  
    5.63 @@ -92,42 +81,12 @@
    5.64          return;
    5.65      }
    5.66      if ( lib.loaded == 1 ) {
    5.67 +#ifdef LOAD_WEBP_DYNAMIC
    5.68          SDL_UnloadObject(lib.handle);
    5.69 +#endif
    5.70      }
    5.71      --lib.loaded;
    5.72  }
    5.73 -#else
    5.74 -int IMG_InitWEBP()
    5.75 -{
    5.76 -    if ( lib.loaded == 0 ) {
    5.77 -#ifdef __MACOSX__
    5.78 -        extern VP8StatusCode WebPGetFeaturesInternal(const uint8_t*, size_t, WebPBitstreamFeatures*, int) __attribute__((weak_import));
    5.79 -        if ( WebPGetFeaturesInternal == NULL )
    5.80 -        {
    5.81 -            /* Missing weakly linked framework */
    5.82 -            IMG_SetError("Missing webp.framework");
    5.83 -            return -1;
    5.84 -        }
    5.85 -#endif // __MACOSX__
    5.86 -
    5.87 -        lib.webp_get_features_internal = WebPGetFeaturesInternal;
    5.88 -        lib.webp_decode_rgb_into = WebPDecodeRGBInto;
    5.89 -        lib.webp_decode_rgba_into = WebPDecodeRGBAInto;
    5.90 -    }
    5.91 -    ++lib.loaded;
    5.92 -
    5.93 -    return 0;
    5.94 -}
    5.95 -void IMG_QuitWEBP()
    5.96 -{
    5.97 -    if ( lib.loaded == 0 ) {
    5.98 -        return;
    5.99 -    }
   5.100 -    if ( lib.loaded == 1 ) {
   5.101 -    }
   5.102 -    --lib.loaded;
   5.103 -}
   5.104 -#endif /* LOAD_WEBP_DYNAMIC */
   5.105  
   5.106  static int webp_getinfo( SDL_RWops *src, int *datasize ) {
   5.107      Sint64 start;
   5.108 @@ -157,7 +116,7 @@
   5.109  #endif
   5.110              is_WEBP = 1;
   5.111              if ( datasize ) {
   5.112 -                *datasize = (int)SDL_RWseek(src, 0, RW_SEEK_END) - start;
   5.113 +                *datasize = (int)(SDL_RWseek(src, 0, RW_SEEK_END) - start);
   5.114              }
   5.115          }
   5.116      }
   5.117 @@ -205,11 +164,11 @@
   5.118  
   5.119      raw_data = (uint8_t*) SDL_malloc( raw_data_size );
   5.120      if ( raw_data == NULL ) {
   5.121 -        error = "Failed to allocate enought buffer for WEBP";
   5.122 +        error = "Failed to allocate enough buffer for WEBP";
   5.123          goto error;
   5.124      }
   5.125  
   5.126 -    r = SDL_RWread(src, raw_data, 1, raw_data_size );
   5.127 +    r = (int)SDL_RWread(src, raw_data, 1, raw_data_size );
   5.128      if ( r != raw_data_size ) {
   5.129          error = "Failed to read WEBP";
   5.130          goto error;
   5.131 @@ -224,7 +183,7 @@
   5.132      }
   5.133  #endif
   5.134  
   5.135 -    if ( lib.webp_get_features_internal( raw_data, raw_data_size, &features, WEBP_DECODER_ABI_VERSION ) != VP8_STATUS_OK ) {
   5.136 +    if ( lib.WebPGetFeaturesInternal( raw_data, raw_data_size, &features, WEBP_DECODER_ABI_VERSION ) != VP8_STATUS_OK ) {
   5.137          error = "WebPGetFeatures has failed";
   5.138          goto error;
   5.139      }
   5.140 @@ -255,9 +214,9 @@
   5.141      }
   5.142  
   5.143      if ( features.has_alpha ) {
   5.144 -        ret = lib.webp_decode_rgba_into( raw_data, raw_data_size, (uint8_t *)surface->pixels, surface->pitch * surface->h,  surface->pitch );
   5.145 +        ret = lib.WebPDecodeRGBAInto( raw_data, raw_data_size, (uint8_t *)surface->pixels, surface->pitch * surface->h,  surface->pitch );
   5.146      } else {
   5.147 -        ret = lib.webp_decode_rgb_into( raw_data, raw_data_size, (uint8_t *)surface->pixels, surface->pitch * surface->h,  surface->pitch );
   5.148 +        ret = lib.WebPDecodeRGBInto( raw_data, raw_data_size, (uint8_t *)surface->pixels, surface->pitch * surface->h,  surface->pitch );
   5.149      }
   5.150  
   5.151      if ( !ret ) {
     6.1 --- a/IMG_xcf.c	Sun Oct 22 14:40:08 2017 -0700
     6.2 +++ b/IMG_xcf.c	Sun Oct 22 14:40:31 2017 -0700
     6.3 @@ -647,7 +647,7 @@
     6.4                      break;
     6.5                  case 1:
     6.6                      /* Indexed / Greyscale */
     6.7 -					switch (head->image_type) {
     6.8 +                    switch (head->image_type) {
     6.9                      case IMAGE_INDEXED:
    6.10                          for (x = tx; x < tx + ox; x++) {
    6.11                              *row++ = 0xFF000000
     7.1 --- a/IMG_xpm.c	Sun Oct 22 14:40:08 2017 -0700
     7.2 +++ b/IMG_xpm.c	Sun Oct 22 14:40:31 2017 -0700
     7.3 @@ -1083,7 +1083,7 @@
     7.4              if (nametype == 's')
     7.5                  continue;      /* skip symbolic colour names */
     7.6  
     7.7 -            if (!color_to_rgb(colname, p - colname, &rgb))
     7.8 +            if (!color_to_rgb(colname, (int)(p - colname), &rgb))
     7.9                  continue;
    7.10  
    7.11              SDL_memcpy(nextkey, line, cpp);