Skip to content

Commit

Permalink
Fixed some MSVC compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Oct 9, 2019
1 parent d94e8de commit 4943e48
Show file tree
Hide file tree
Showing 17 changed files with 64 additions and 11 deletions.
3 changes: 3 additions & 0 deletions IMG_bmp.c
Expand Up @@ -425,6 +425,9 @@ SDL_Surface *IMG_LoadCUR_RW(SDL_RWops *src)
}

#else
#if _MSC_VER >= 1300
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
#endif

/* See if an image is contained in a data source */
int IMG_isBMP(SDL_RWops *src)
Expand Down
7 changes: 5 additions & 2 deletions IMG_gif.c
Expand Up @@ -615,7 +615,7 @@ LWZReadByte(SDL_RWops *src, int flag, int input_code_size, State_t * state)
static Image *
ReadImage(SDL_RWops * src, int len, int height, int cmapSize,
unsigned char cmap[3][MAXCOLORMAPSIZE],
int gray, int interlace, int ignore, State_t * state)
int /*gray*/, int interlace, int ignore, State_t * state)
{
Image *image;
unsigned char c;
Expand Down Expand Up @@ -648,7 +648,7 @@ ReadImage(SDL_RWops * src, int len, int height, int cmapSize,
cmap[CM_GREEN][i], cmap[CM_BLUE][i]);

while ((v = LWZReadByte(src, FALSE, c, state)) >= 0) {
((Uint8 *)image->pixels)[xpos + ypos * image->pitch] = v;
((Uint8 *)image->pixels)[xpos + ypos * image->pitch] = (Uint8)v;
++xpos;
if (xpos == len) {
xpos = 0;
Expand Down Expand Up @@ -781,6 +781,9 @@ SDL_Surface *IMG_LoadGIF_RW(SDL_RWops *src)
}

#else
#if _MSC_VER >= 1300
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
#endif

/* See if an image is contained in a data source */
int IMG_isGIF(SDL_RWops *src)
Expand Down
3 changes: 3 additions & 0 deletions IMG_jpg.c
Expand Up @@ -535,6 +535,9 @@ static int IMG_SaveJPG_RW_jpeglib(SDL_Surface *surface, SDL_RWops *dst, int free
}

#else
#if _MSC_VER >= 1300
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
#endif

int IMG_InitJPG()
{
Expand Down
3 changes: 3 additions & 0 deletions IMG_lbm.c
Expand Up @@ -484,6 +484,9 @@ SDL_Surface *IMG_LoadLBM_RW( SDL_RWops *src )
}

#else /* LOAD_LBM */
#if _MSC_VER >= 1300
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
#endif

/* See if an image is contained in a data source */
int IMG_isLBM(SDL_RWops *src)
Expand Down
3 changes: 3 additions & 0 deletions IMG_pcx.c
Expand Up @@ -283,6 +283,9 @@ SDL_Surface *IMG_LoadPCX_RW(SDL_RWops *src)
}

#else
#if _MSC_VER >= 1300
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
#endif

/* See if an image is contained in a data source */
int IMG_isPCX(SDL_RWops *src)
Expand Down
3 changes: 3 additions & 0 deletions IMG_png.c
Expand Up @@ -474,6 +474,9 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src)
}

#else
#if _MSC_VER >= 1300
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
#endif

int IMG_InitPNG()
{
Expand Down
3 changes: 3 additions & 0 deletions IMG_pnm.c
Expand Up @@ -244,6 +244,9 @@ SDL_Surface *IMG_LoadPNM_RW(SDL_RWops *src)
}

#else
#if _MSC_VER >= 1300
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
#endif

/* See if an image is contained in a data source */
int IMG_isPNM(SDL_RWops *src)
Expand Down
3 changes: 3 additions & 0 deletions IMG_svg.c
Expand Up @@ -145,6 +145,9 @@ SDL_Surface *IMG_LoadSVG_RW(SDL_RWops *src)
}

#else
#if _MSC_VER >= 1300
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
#endif

/* See if an image is contained in a data source */
int IMG_isSVG(SDL_RWops *src)
Expand Down
3 changes: 3 additions & 0 deletions IMG_tga.c
Expand Up @@ -323,6 +323,9 @@ SDL_Surface *IMG_LoadTGA_RW(SDL_RWops *src)
}

#else
#if _MSC_VER >= 1300
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
#endif

/* dummy TGA load routine */
SDL_Surface *IMG_LoadTGA_RW(SDL_RWops *src)
Expand Down
3 changes: 3 additions & 0 deletions IMG_tif.c
Expand Up @@ -213,6 +213,9 @@ SDL_Surface* IMG_LoadTIF_RW(SDL_RWops* src)
}

#else
#if _MSC_VER >= 1300
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
#endif

int IMG_InitTIF()
{
Expand Down
3 changes: 3 additions & 0 deletions IMG_webp.c
Expand Up @@ -265,6 +265,9 @@ SDL_Surface *IMG_LoadWEBP_RW(SDL_RWops *src)
}

#else
#if _MSC_VER >= 1300
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
#endif

int IMG_InitWEBP()
{
Expand Down
3 changes: 3 additions & 0 deletions IMG_xcf.c
Expand Up @@ -932,6 +932,9 @@ SDL_Surface *IMG_LoadXCF_RW(SDL_RWops *src)
}

#else
#if _MSC_VER >= 1300
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
#endif

/* See if an image is contained in a data source */
int IMG_isXCF(SDL_RWops *src)
Expand Down
3 changes: 3 additions & 0 deletions IMG_xpm.c
Expand Up @@ -1189,6 +1189,9 @@ SDL_Surface *IMG_ReadXPMFromArray(char **xpm)
}

#else /* not LOAD_XPM */
#if _MSC_VER >= 1300
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
#endif

/* See if an image is contained in a data source */
int IMG_isXPM(SDL_RWops *src)
Expand Down
3 changes: 3 additions & 0 deletions IMG_xv.c
Expand Up @@ -146,6 +146,9 @@ SDL_Surface *IMG_LoadXV_RW(SDL_RWops *src)
}

#else
#if _MSC_VER >= 1300
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
#endif

/* See if an image is contained in a data source */
int IMG_isXV(SDL_RWops *src)
Expand Down
3 changes: 3 additions & 0 deletions IMG_xxx.c
Expand Up @@ -69,6 +69,9 @@ SDL_Surface *IMG_LoadXXX_RW(SDL_RWops *src)
}

#else
#if _MSC_VER >= 1300
#pragma warning(disable : 4100) /* warning C4100: 'op' : unreferenced formal parameter */
#endif

/* See if an image is contained in a data source */
int IMG_isXXX(SDL_RWops *src)
Expand Down
9 changes: 9 additions & 0 deletions miniz.h
Expand Up @@ -940,6 +940,11 @@ MINIZ_STATIC mz_uint tdefl_create_comp_flags_from_zip_params(int level, int wind

#ifndef MINIZ_HEADER_FILE_ONLY

#ifdef _MSC_VER
#pragma warning (push)
#pragma warning (disable:4505) // unreferenced local function has been removed
#endif

typedef unsigned char mz_validate_uint16[sizeof(mz_uint16)==2 ? 1 : -1];
typedef unsigned char mz_validate_uint32[sizeof(mz_uint32)==4 ? 1 : -1];
typedef unsigned char mz_validate_uint64[sizeof(mz_uint64)==8 ? 1 : -1];
Expand Down Expand Up @@ -4912,6 +4917,10 @@ void *mz_zip_extract_archive_file_to_heap(const char *pZip_filename, const char
}
#endif

#ifdef _MSC_VER
#pragma warning (pop)
#endif

#endif // MINIZ_HEADER_FILE_ONLY

/*
Expand Down
17 changes: 8 additions & 9 deletions nanosvg.h
Expand Up @@ -285,8 +285,8 @@ static void nsvg__parseElement(char* s,

// Get attribs
while (!end && *s && nattr < NSVG_XML_MAX_ATTRIBS-3) {
char* name = NULL;
char* value = NULL;
char* attr_name = NULL;
char* attr_value = NULL;

// Skip white space before the attrib name
while (*s && nsvg__isspace(*s)) s++;
Expand All @@ -295,7 +295,7 @@ static void nsvg__parseElement(char* s,
end = 1;
break;
}
name = s;
attr_name = s;
// Find end of the attrib name.
while (*s && !nsvg__isspace(*s) && *s != '=') s++;
if (*s) { *s++ = '\0'; }
Expand All @@ -305,14 +305,14 @@ static void nsvg__parseElement(char* s,
quote = *s;
s++;
// Store value and find the end of it.
value = s;
attr_value = s;
while (*s && *s != quote) s++;
if (*s) { *s++ = '\0'; }

// Store only well formed attributes
if (name && value) {
attr[nattr++] = name;
attr[nattr++] = value;
if (attr_name && attr_value) {
attr[nattr++] = attr_name;
attr[nattr++] = attr_value;
}
}

Expand Down Expand Up @@ -822,7 +822,6 @@ static float nsvg__convertToPixels(NSVGparser* p, NSVGcoordinate c, float orig,
case NSVG_UNITS_PERCENT: return orig + c.value / 100.0f * length;
default: return c.value;
}
return c.value;
}

static NSVGgradientData* nsvg__findGradientData(NSVGparser* p, const char* id)
Expand Down Expand Up @@ -2782,7 +2781,7 @@ static void nsvg__content(void* ud, const char* s)
if (p->styleFlag) {

int state = 0;
const char* start;
const char* start = s;
while (*s) {
char c = *s;
if (nsvg__isspace(c) || c == '{') {
Expand Down

0 comments on commit 4943e48

Please sign in to comment.