Removed some dependencies on C runtime for building on Windows
authorSam Lantinga <slouken@libsdl.org>
Sun, 22 Oct 2017 01:23:38 -0700
changeset 5287f9e88f4b45e
parent 527 a26235cc1970
child 529 ace61a625208
Removed some dependencies on C runtime for building on Windows
IMG.c
IMG_bmp.c
IMG_gif.c
IMG_jpg.c
IMG_lbm.c
IMG_pcx.c
IMG_pnm.c
IMG_svg.c
IMG_tga.c
IMG_tif.c
IMG_webp.c
IMG_xcf.c
IMG_xpm.c
IMG_xv.c
IMG_xxx.c
nanosvg.h
     1.1 --- a/IMG.c	Sun Oct 22 00:46:52 2017 -0700
     1.2 +++ b/IMG.c	Sun Oct 22 01:23:38 2017 -0700
     1.3 @@ -21,10 +21,6 @@
     1.4  
     1.5  /* A simple library to load images of various formats as SDL surfaces */
     1.6  
     1.7 -#include <stdio.h>
     1.8 -#include <string.h>
     1.9 -#include <ctype.h>
    1.10 -
    1.11  #include "SDL_image.h"
    1.12  
    1.13  #define ARRAYSIZE(a) (sizeof(a) / sizeof((a)[0]))
     2.1 --- a/IMG_bmp.c	Sun Oct 22 00:46:52 2017 -0700
     2.2 +++ b/IMG_bmp.c	Sun Oct 22 01:23:38 2017 -0700
     2.3 @@ -30,9 +30,6 @@
     2.4   * http://entropymine.com/jason/bmpsuite/bmpsuite/html/bmpsuite.html
     2.5   */
     2.6  
     2.7 -#include <stdio.h>
     2.8 -#include <string.h>
     2.9 -
    2.10  #include "SDL_image.h"
    2.11  
    2.12  #ifdef LOAD_BMP
     3.1 --- a/IMG_gif.c	Sun Oct 22 00:46:52 2017 -0700
     3.2 +++ b/IMG_gif.c	Sun Oct 22 01:23:38 2017 -0700
     3.3 @@ -23,9 +23,6 @@
     3.4  
     3.5  /* This is a GIF image file loading framework */
     3.6  
     3.7 -#include <stdio.h>
     3.8 -#include <string.h>
     3.9 -
    3.10  #include "SDL_image.h"
    3.11  
    3.12  #ifdef LOAD_GIF
     4.1 --- a/IMG_jpg.c	Sun Oct 22 00:46:52 2017 -0700
     4.2 +++ b/IMG_jpg.c	Sun Oct 22 01:23:38 2017 -0700
     4.3 @@ -22,7 +22,6 @@
     4.4  /* This is a JPEG image file loading framework */
     4.5  
     4.6  #include <stdio.h>
     4.7 -#include <string.h>
     4.8  #include <setjmp.h>
     4.9  
    4.10  #include "SDL_image.h"
     5.1 --- a/IMG_lbm.c	Sun Oct 22 00:46:52 2017 -0700
     5.2 +++ b/IMG_lbm.c	Sun Oct 22 01:23:38 2017 -0700
     5.3 @@ -30,10 +30,6 @@
     5.4     Buffer overflow fix in RLE decompression by David Raulo in January 2008.
     5.5  */
     5.6  
     5.7 -#include <stdio.h>
     5.8 -#include <stdlib.h>
     5.9 -#include <string.h>
    5.10 -
    5.11  #include "SDL_endian.h"
    5.12  #include "SDL_image.h"
    5.13  
     6.1 --- a/IMG_pcx.c	Sun Oct 22 00:46:52 2017 -0700
     6.2 +++ b/IMG_pcx.c	Sun Oct 22 01:23:38 2017 -0700
     6.3 @@ -32,8 +32,6 @@
     6.4   *  single-planar packed-pixel formats other than 8bpp
     6.5   *  4-plane 32bpp format with a fourth "intensity" plane
     6.6   */
     6.7 -#include <stdio.h>
     6.8 -#include <stdlib.h>
     6.9  
    6.10  #include "SDL_endian.h"
    6.11  
     7.1 --- a/IMG_pnm.c	Sun Oct 22 00:46:52 2017 -0700
     7.2 +++ b/IMG_pnm.c	Sun Oct 22 01:23:38 2017 -0700
     7.3 @@ -27,11 +27,6 @@
     7.4   * Does not support: maximum component value > 255
     7.5   */
     7.6  
     7.7 -#include <stdio.h>
     7.8 -#include <stdlib.h>
     7.9 -#include <ctype.h>
    7.10 -#include <string.h>
    7.11 -
    7.12  #include "SDL_image.h"
    7.13  
    7.14  #ifdef LOAD_PNM
     8.1 --- a/IMG_svg.c	Sun Oct 22 00:46:52 2017 -0700
     8.2 +++ b/IMG_svg.c	Sun Oct 22 01:23:38 2017 -0700
     8.3 @@ -27,13 +27,12 @@
     8.4  
     8.5  #ifdef LOAD_SVG
     8.6  
     8.7 -#include <stdio.h>
     8.8 -#include <stdlib.h>
     8.9 -#include <math.h>
    8.10 -#include <float.h>
    8.11 -
    8.12  /* Replace C runtime functions with SDL C runtime functions for building on Windows */
    8.13  #define strtoll	SDL_strtoll
    8.14 +#define sscanf	SDL_sscanf
    8.15 +#ifndef FLT_MAX
    8.16 +#define FLT_MAX     3.402823466e+38F
    8.17 +#endif
    8.18  
    8.19  #define NANOSVG_IMPLEMENTATION
    8.20  #include "nanosvg.h"
     9.1 --- a/IMG_tga.c	Sun Oct 22 00:46:52 2017 -0700
     9.2 +++ b/IMG_tga.c	Sun Oct 22 01:23:38 2017 -0700
     9.3 @@ -23,10 +23,6 @@
     9.4  
     9.5  /* This is a Targa image file loading framework */
     9.6  
     9.7 -#include <stdlib.h>
     9.8 -#include <stdio.h>
     9.9 -#include <string.h>
    9.10 -
    9.11  #include "SDL_endian.h"
    9.12  
    9.13  #include "SDL_image.h"
    10.1 --- a/IMG_tif.c	Sun Oct 22 00:46:52 2017 -0700
    10.2 +++ b/IMG_tif.c	Sun Oct 22 01:23:38 2017 -0700
    10.3 @@ -23,8 +23,6 @@
    10.4  
    10.5  /* This is a TIFF image file loading framework */
    10.6  
    10.7 -#include <stdio.h>
    10.8 -
    10.9  #include "SDL_image.h"
   10.10  
   10.11  #ifdef LOAD_TIF
   10.12 @@ -208,8 +206,6 @@
   10.13      SDL_Surface* surface = NULL;
   10.14      Uint32 img_width, img_height;
   10.15      Uint32 Rmask, Gmask, Bmask, Amask;
   10.16 -    Uint32 x, y;
   10.17 -    Uint32 half;
   10.18  
   10.19      if ( !src ) {
   10.20          /* The error message has been set in SDL_RWFromFile */
    11.1 --- a/IMG_webp.c	Sun Oct 22 00:46:52 2017 -0700
    11.2 +++ b/IMG_webp.c	Sun Oct 22 01:23:38 2017 -0700
    11.3 @@ -21,9 +21,6 @@
    11.4  
    11.5  /* This is a WEBP image file loading framework */
    11.6  
    11.7 -#include <stdlib.h>
    11.8 -#include <stdio.h>
    11.9 -
   11.10  #include "SDL_image.h"
   11.11  
   11.12  #ifdef LOAD_WEBP
   11.13 @@ -160,7 +157,7 @@
   11.14  #endif
   11.15              is_WEBP = 1;
   11.16              if ( datasize ) {
   11.17 -                *datasize = (int)SDL_RWseek(src, 0, SEEK_END);
   11.18 +                *datasize = (int)SDL_RWseek(src, 0, RW_SEEK_END);
   11.19              }
   11.20          }
   11.21      }
    12.1 --- a/IMG_xcf.c	Sun Oct 22 00:46:52 2017 -0700
    12.2 +++ b/IMG_xcf.c	Sun Oct 22 01:23:38 2017 -0700
    12.3 @@ -21,11 +21,6 @@
    12.4  
    12.5  /* This is a XCF image file loading framework */
    12.6  
    12.7 -#include <stdio.h>
    12.8 -#include <ctype.h>
    12.9 -#include <string.h>
   12.10 -#include <stdlib.h>
   12.11 -
   12.12  #include "SDL_endian.h"
   12.13  #include "SDL_image.h"
   12.14  
    13.1 --- a/IMG_xpm.c	Sun Oct 22 00:46:52 2017 -0700
    13.2 +++ b/IMG_xpm.c	Sun Oct 22 01:23:38 2017 -0700
    13.3 @@ -42,11 +42,6 @@
    13.4   * requires about 13K in binary form.
    13.5   */
    13.6  
    13.7 -#include <stdlib.h>
    13.8 -#include <stdio.h>
    13.9 -#include <string.h>
   13.10 -#include <ctype.h>
   13.11 -
   13.12  #include "SDL_image.h"
   13.13  
   13.14  #ifdef LOAD_XPM
    14.1 --- a/IMG_xv.c	Sun Oct 22 00:46:52 2017 -0700
    14.2 +++ b/IMG_xv.c	Sun Oct 22 01:23:38 2017 -0700
    14.3 @@ -21,9 +21,6 @@
    14.4  
    14.5  /* This is a XV thumbnail image file loading framework */
    14.6  
    14.7 -#include <stdio.h>
    14.8 -#include <string.h>
    14.9 -
   14.10  #include "SDL_image.h"
   14.11  
   14.12  #ifdef LOAD_XV
    15.1 --- a/IMG_xxx.c	Sun Oct 22 00:46:52 2017 -0700
    15.2 +++ b/IMG_xxx.c	Sun Oct 22 01:23:38 2017 -0700
    15.3 @@ -21,8 +21,6 @@
    15.4  
    15.5  /* This is a generic "format not supported" image framework */
    15.6  
    15.7 -#include <stdio.h>
    15.8 -
    15.9  #include "SDL_image.h"
   15.10  
   15.11  #ifdef LOAD_XXX
    16.1 --- a/nanosvg.h	Sun Oct 22 00:46:52 2017 -0700
    16.2 +++ b/nanosvg.h	Sun Oct 22 01:23:38 2017 -0700
    16.3 @@ -2981,6 +2981,7 @@
    16.4  	return ret;
    16.5  }
    16.6  
    16.7 +#ifdef HAVE_STDIO_H
    16.8  NSVGimage* nsvgParseFromFile(const char* filename, const char* units, float dpi)
    16.9  {
   16.10  	FILE* fp = NULL;
   16.11 @@ -3009,6 +3010,7 @@
   16.12  	if (image) nsvgDelete(image);
   16.13  	return NULL;
   16.14  }
   16.15 +#endif /* HAVE_STDIO_H */
   16.16  
   16.17  void nsvgDelete(NSVGimage* image)
   16.18  {