Fixed some MSVC compiler warnings
authorSam Lantinga <slouken@libsdl.org>
Wed, 09 Oct 2019 09:29:59 -0700
changeset 719a1fd4472ed6b
parent 718 a1e9c987a73d
child 720 58e4a9ae8cd2
Fixed some MSVC compiler warnings
IMG_bmp.c
IMG_gif.c
IMG_jpg.c
IMG_lbm.c
IMG_pcx.c
IMG_png.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
miniz.h
nanosvg.h
     1.1 --- a/IMG_bmp.c	Mon Oct 07 10:37:37 2019 -0700
     1.2 +++ b/IMG_bmp.c	Wed Oct 09 09:29:59 2019 -0700
     1.3 @@ -425,6 +425,9 @@
     1.4  }
     1.5  
     1.6  #else
     1.7 +#if _MSC_VER >= 1300
     1.8 +#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
     1.9 +#endif
    1.10  
    1.11  /* See if an image is contained in a data source */
    1.12  int IMG_isBMP(SDL_RWops *src)
     2.1 --- a/IMG_gif.c	Mon Oct 07 10:37:37 2019 -0700
     2.2 +++ b/IMG_gif.c	Wed Oct 09 09:29:59 2019 -0700
     2.3 @@ -615,7 +615,7 @@
     2.4  static Image *
     2.5  ReadImage(SDL_RWops * src, int len, int height, int cmapSize,
     2.6            unsigned char cmap[3][MAXCOLORMAPSIZE],
     2.7 -          int gray, int interlace, int ignore, State_t * state)
     2.8 +          int /*gray*/, int interlace, int ignore, State_t * state)
     2.9  {
    2.10      Image *image;
    2.11      unsigned char c;
    2.12 @@ -648,7 +648,7 @@
    2.13                       cmap[CM_GREEN][i], cmap[CM_BLUE][i]);
    2.14  
    2.15      while ((v = LWZReadByte(src, FALSE, c, state)) >= 0) {
    2.16 -        ((Uint8 *)image->pixels)[xpos + ypos * image->pitch] = v;
    2.17 +        ((Uint8 *)image->pixels)[xpos + ypos * image->pitch] = (Uint8)v;
    2.18          ++xpos;
    2.19          if (xpos == len) {
    2.20              xpos = 0;
    2.21 @@ -781,6 +781,9 @@
    2.22  }
    2.23  
    2.24  #else
    2.25 +#if _MSC_VER >= 1300
    2.26 +#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
    2.27 +#endif
    2.28  
    2.29  /* See if an image is contained in a data source */
    2.30  int IMG_isGIF(SDL_RWops *src)
     3.1 --- a/IMG_jpg.c	Mon Oct 07 10:37:37 2019 -0700
     3.2 +++ b/IMG_jpg.c	Wed Oct 09 09:29:59 2019 -0700
     3.3 @@ -535,6 +535,9 @@
     3.4  }
     3.5  
     3.6  #else
     3.7 +#if _MSC_VER >= 1300
     3.8 +#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
     3.9 +#endif
    3.10  
    3.11  int IMG_InitJPG()
    3.12  {
     4.1 --- a/IMG_lbm.c	Mon Oct 07 10:37:37 2019 -0700
     4.2 +++ b/IMG_lbm.c	Wed Oct 09 09:29:59 2019 -0700
     4.3 @@ -484,6 +484,9 @@
     4.4  }
     4.5  
     4.6  #else /* LOAD_LBM */
     4.7 +#if _MSC_VER >= 1300
     4.8 +#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
     4.9 +#endif
    4.10  
    4.11  /* See if an image is contained in a data source */
    4.12  int IMG_isLBM(SDL_RWops *src)
     5.1 --- a/IMG_pcx.c	Mon Oct 07 10:37:37 2019 -0700
     5.2 +++ b/IMG_pcx.c	Wed Oct 09 09:29:59 2019 -0700
     5.3 @@ -283,6 +283,9 @@
     5.4  }
     5.5  
     5.6  #else
     5.7 +#if _MSC_VER >= 1300
     5.8 +#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
     5.9 +#endif
    5.10  
    5.11  /* See if an image is contained in a data source */
    5.12  int IMG_isPCX(SDL_RWops *src)
     6.1 --- a/IMG_png.c	Mon Oct 07 10:37:37 2019 -0700
     6.2 +++ b/IMG_png.c	Wed Oct 09 09:29:59 2019 -0700
     6.3 @@ -474,6 +474,9 @@
     6.4  }
     6.5  
     6.6  #else
     6.7 +#if _MSC_VER >= 1300
     6.8 +#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
     6.9 +#endif
    6.10  
    6.11  int IMG_InitPNG()
    6.12  {
     7.1 --- a/IMG_pnm.c	Mon Oct 07 10:37:37 2019 -0700
     7.2 +++ b/IMG_pnm.c	Wed Oct 09 09:29:59 2019 -0700
     7.3 @@ -244,6 +244,9 @@
     7.4  }
     7.5  
     7.6  #else
     7.7 +#if _MSC_VER >= 1300
     7.8 +#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
     7.9 +#endif
    7.10  
    7.11  /* See if an image is contained in a data source */
    7.12  int IMG_isPNM(SDL_RWops *src)
     8.1 --- a/IMG_svg.c	Mon Oct 07 10:37:37 2019 -0700
     8.2 +++ b/IMG_svg.c	Wed Oct 09 09:29:59 2019 -0700
     8.3 @@ -145,6 +145,9 @@
     8.4  }
     8.5  
     8.6  #else
     8.7 +#if _MSC_VER >= 1300
     8.8 +#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
     8.9 +#endif
    8.10  
    8.11  /* See if an image is contained in a data source */
    8.12  int IMG_isSVG(SDL_RWops *src)
     9.1 --- a/IMG_tga.c	Mon Oct 07 10:37:37 2019 -0700
     9.2 +++ b/IMG_tga.c	Wed Oct 09 09:29:59 2019 -0700
     9.3 @@ -323,6 +323,9 @@
     9.4  }
     9.5  
     9.6  #else
     9.7 +#if _MSC_VER >= 1300
     9.8 +#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
     9.9 +#endif
    9.10  
    9.11  /* dummy TGA load routine */
    9.12  SDL_Surface *IMG_LoadTGA_RW(SDL_RWops *src)
    10.1 --- a/IMG_tif.c	Mon Oct 07 10:37:37 2019 -0700
    10.2 +++ b/IMG_tif.c	Wed Oct 09 09:29:59 2019 -0700
    10.3 @@ -213,6 +213,9 @@
    10.4  }
    10.5  
    10.6  #else
    10.7 +#if _MSC_VER >= 1300
    10.8 +#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
    10.9 +#endif
   10.10  
   10.11  int IMG_InitTIF()
   10.12  {
    11.1 --- a/IMG_webp.c	Mon Oct 07 10:37:37 2019 -0700
    11.2 +++ b/IMG_webp.c	Wed Oct 09 09:29:59 2019 -0700
    11.3 @@ -265,6 +265,9 @@
    11.4  }
    11.5  
    11.6  #else
    11.7 +#if _MSC_VER >= 1300
    11.8 +#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
    11.9 +#endif
   11.10  
   11.11  int IMG_InitWEBP()
   11.12  {
    12.1 --- a/IMG_xcf.c	Mon Oct 07 10:37:37 2019 -0700
    12.2 +++ b/IMG_xcf.c	Wed Oct 09 09:29:59 2019 -0700
    12.3 @@ -932,6 +932,9 @@
    12.4  }
    12.5  
    12.6  #else
    12.7 +#if _MSC_VER >= 1300
    12.8 +#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
    12.9 +#endif
   12.10  
   12.11  /* See if an image is contained in a data source */
   12.12  int IMG_isXCF(SDL_RWops *src)
    13.1 --- a/IMG_xpm.c	Mon Oct 07 10:37:37 2019 -0700
    13.2 +++ b/IMG_xpm.c	Wed Oct 09 09:29:59 2019 -0700
    13.3 @@ -1189,6 +1189,9 @@
    13.4  }
    13.5  
    13.6  #else  /* not LOAD_XPM */
    13.7 +#if _MSC_VER >= 1300
    13.8 +#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
    13.9 +#endif
   13.10  
   13.11  /* See if an image is contained in a data source */
   13.12  int IMG_isXPM(SDL_RWops *src)
    14.1 --- a/IMG_xv.c	Mon Oct 07 10:37:37 2019 -0700
    14.2 +++ b/IMG_xv.c	Wed Oct 09 09:29:59 2019 -0700
    14.3 @@ -146,6 +146,9 @@
    14.4  }
    14.5  
    14.6  #else
    14.7 +#if _MSC_VER >= 1300
    14.8 +#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
    14.9 +#endif
   14.10  
   14.11  /* See if an image is contained in a data source */
   14.12  int IMG_isXV(SDL_RWops *src)
    15.1 --- a/IMG_xxx.c	Mon Oct 07 10:37:37 2019 -0700
    15.2 +++ b/IMG_xxx.c	Wed Oct 09 09:29:59 2019 -0700
    15.3 @@ -69,6 +69,9 @@
    15.4  }
    15.5  
    15.6  #else
    15.7 +#if _MSC_VER >= 1300
    15.8 +#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
    15.9 +#endif
   15.10  
   15.11  /* See if an image is contained in a data source */
   15.12  int IMG_isXXX(SDL_RWops *src)
    16.1 --- a/miniz.h	Mon Oct 07 10:37:37 2019 -0700
    16.2 +++ b/miniz.h	Wed Oct 09 09:29:59 2019 -0700
    16.3 @@ -940,6 +940,11 @@
    16.4  
    16.5  #ifndef MINIZ_HEADER_FILE_ONLY
    16.6  
    16.7 +#ifdef _MSC_VER
    16.8 +#pragma warning (push)
    16.9 +#pragma warning (disable:4505) // unreferenced local function has been removed
   16.10 +#endif
   16.11 +
   16.12  typedef unsigned char mz_validate_uint16[sizeof(mz_uint16)==2 ? 1 : -1];
   16.13  typedef unsigned char mz_validate_uint32[sizeof(mz_uint32)==4 ? 1 : -1];
   16.14  typedef unsigned char mz_validate_uint64[sizeof(mz_uint64)==8 ? 1 : -1];
   16.15 @@ -4912,6 +4917,10 @@
   16.16  }
   16.17  #endif
   16.18  
   16.19 +#ifdef _MSC_VER
   16.20 +#pragma warning (pop)
   16.21 +#endif
   16.22 +
   16.23  #endif // MINIZ_HEADER_FILE_ONLY
   16.24  
   16.25  /*
    17.1 --- a/nanosvg.h	Mon Oct 07 10:37:37 2019 -0700
    17.2 +++ b/nanosvg.h	Wed Oct 09 09:29:59 2019 -0700
    17.3 @@ -285,8 +285,8 @@
    17.4  
    17.5  	// Get attribs
    17.6  	while (!end && *s && nattr < NSVG_XML_MAX_ATTRIBS-3) {
    17.7 -		char* name = NULL;
    17.8 -		char* value = NULL;
    17.9 +		char* attr_name = NULL;
   17.10 +		char* attr_value = NULL;
   17.11  
   17.12  		// Skip white space before the attrib name
   17.13  		while (*s && nsvg__isspace(*s)) s++;
   17.14 @@ -295,7 +295,7 @@
   17.15  			end = 1;
   17.16  			break;
   17.17  		}
   17.18 -		name = s;
   17.19 +		attr_name = s;
   17.20  		// Find end of the attrib name.
   17.21  		while (*s && !nsvg__isspace(*s) && *s != '=') s++;
   17.22  		if (*s) { *s++ = '\0'; }
   17.23 @@ -305,14 +305,14 @@
   17.24  		quote = *s;
   17.25  		s++;
   17.26  		// Store value and find the end of it.
   17.27 -		value = s;
   17.28 +		attr_value = s;
   17.29  		while (*s && *s != quote) s++;
   17.30  		if (*s) { *s++ = '\0'; }
   17.31  
   17.32  		// Store only well formed attributes
   17.33 -		if (name && value) {
   17.34 -			attr[nattr++] = name;
   17.35 -			attr[nattr++] = value;
   17.36 +		if (attr_name && attr_value) {
   17.37 +			attr[nattr++] = attr_name;
   17.38 +			attr[nattr++] = attr_value;
   17.39  		}
   17.40  	}
   17.41  
   17.42 @@ -822,7 +822,6 @@
   17.43  		case NSVG_UNITS_PERCENT:	return orig + c.value / 100.0f * length;
   17.44  		default:					return c.value;
   17.45  	}
   17.46 -	return c.value;
   17.47  }
   17.48  
   17.49  static NSVGgradientData* nsvg__findGradientData(NSVGparser* p, const char* id)
   17.50 @@ -2782,7 +2781,7 @@
   17.51  	if (p->styleFlag) {
   17.52  
   17.53  		int state = 0;
   17.54 -		const char* start;		
   17.55 +		const char* start = s;		
   17.56  		while (*s) {
   17.57  			char c = *s;
   17.58  			if (nsvg__isspace(c) || c == '{') {