From 33e7c73dcfa8d5ff3fd5d5f498214761d4f16dc8 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Thu, 5 Jan 2023 19:33:32 +0100
Subject: [PATCH] Fix -Wunused-parameter warnings
---
IMG_avif.c | 4 +++-
IMG_jxl.c | 2 ++
IMG_tif.c | 7 +++++++
IMG_xcf.c | 10 +++++-----
IMG_xxx.c | 2 ++
stb_image.h | 1 +
test/main.c | 1 +
7 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/IMG_avif.c b/IMG_avif.c
index 53bd9dcf..825b1f0b 100644
--- a/IMG_avif.c
+++ b/IMG_avif.c
@@ -200,7 +200,7 @@ static avifResult ReadAVIFIO(struct avifIO * io, uint32_t readFlags, uint64_t of
return AVIF_RESULT_IO_ERROR;
}
context->data = data;
- context->size = size;
+ context->size = size;
}
out->data = context->data;
@@ -327,12 +327,14 @@ void IMG_QuitAVIF()
/* See if an image is contained in a data source */
int IMG_isAVIF(SDL_RWops *src)
{
+ (void)src;
return(0);
}
/* Load a AVIF type image from an SDL datasource */
SDL_Surface *IMG_LoadAVIF_RW(SDL_RWops *src)
{
+ (void)src;
return(NULL);
}
diff --git a/IMG_jxl.c b/IMG_jxl.c
index ad2efb74..6f581a13 100644
--- a/IMG_jxl.c
+++ b/IMG_jxl.c
@@ -261,12 +261,14 @@ void IMG_QuitJXL()
/* See if an image is contained in a data source */
int IMG_isJXL(SDL_RWops *src)
{
+ (void)src;
return(0);
}
/* Load a JXL type image from an SDL datasource */
SDL_Surface *IMG_LoadJXL_RW(SDL_RWops *src)
{
+ (void)src;
return(NULL);
}
diff --git a/IMG_tif.c b/IMG_tif.c
index dace9fbb..71d99059 100644
--- a/IMG_tif.c
+++ b/IMG_tif.c
@@ -106,6 +106,7 @@ static tsize_t tiff_write(thandle_t fd, tdata_t buf, tsize_t size)
static int tiff_close(thandle_t fd)
{
+ (void)fd;
/*
* We don't want libtiff closing our SDL_RWops*, but if it's not given
* a routine to try, and if the image isn't a TIFF, it'll segfault.
@@ -115,11 +116,17 @@ static int tiff_close(thandle_t fd)
static int tiff_map(thandle_t fd, tdata_t* pbase, toff_t* psize)
{
+ (void)fd;
+ (void)pbase;
+ (void)psize;
return (0);
}
static void tiff_unmap(thandle_t fd, tdata_t base, toff_t size)
{
+ (void)fd;
+ (void)base;
+ (void)size;
return;
}
diff --git a/IMG_xcf.c b/IMG_xcf.c
index 1271e525..af92e355 100644
--- a/IMG_xcf.c
+++ b/IMG_xcf.c
@@ -528,6 +528,9 @@ static void free_xcf_tile (unsigned char * t) {
static unsigned char * load_xcf_tile_none (SDL_RWops * src, Uint64 len, int bpp, int x, int y) {
unsigned char * load = NULL;
+ (void)bpp;
+ (void)x;
+ (void)y;
if (len <= (Uint64)SDL_SIZE_MAX) {
load = (unsigned char *) SDL_malloc ((size_t)len); // expect this is okay
@@ -543,7 +546,7 @@ static unsigned char * load_xcf_tile_none (SDL_RWops * src, Uint64 len, int bpp,
static unsigned char * load_xcf_tile_rle (SDL_RWops * src, Uint64 len, int bpp, int x, int y) {
unsigned char * load, * t, * data, * d;
- int i, size, count, j, length;
+ int i, size, j, length;
unsigned char val;
if (len == 0 || len > (Uint64)SDL_SIZE_MAX) { /* probably bogus data. */
@@ -563,7 +566,6 @@ static unsigned char * load_xcf_tile_rle (SDL_RWops * src, Uint64 len, int bpp,
for (i = 0; i < bpp; i++) {
d = data + i;
size = x*y;
- count = 0;
while (size > 0) {
val = *t++;
@@ -582,7 +584,6 @@ static unsigned char * load_xcf_tile_rle (SDL_RWops * src, Uint64 len, int bpp,
break; /* bogus data */
}
- count += length;
size -= length;
while (length-- > 0) {
@@ -602,7 +603,6 @@ static unsigned char * load_xcf_tile_rle (SDL_RWops * src, Uint64 len, int bpp,
break; /* bogus data */
}
- count += length;
size -= length;
val = *t++;
@@ -648,7 +648,7 @@ static void create_channel_surface (SDL_Surface * surf, xcf_image_type itype, Ui
SDL_FillSurfaceRect (surf, NULL, c);
}
-static int
+static int
do_layer_surface(SDL_Surface * surface, SDL_RWops * src, xcf_header * head, xcf_layer * layer, load_tile_type load_tile)
{
xcf_hierarchy *hierarchy;
diff --git a/IMG_xxx.c b/IMG_xxx.c
index 0ab1bf04..75759dbd 100644
--- a/IMG_xxx.c
+++ b/IMG_xxx.c
@@ -76,12 +76,14 @@ SDL_Surface *IMG_LoadXXX_RW(SDL_RWops *src)
/* See if an image is contained in a data source */
int IMG_isXXX(SDL_RWops *src)
{
+ (void)src;
return(0);
}
/* Load a XXX type image from an SDL datasource */
SDL_Surface *IMG_LoadXXX_RW(SDL_RWops *src)
{
+ (void)src;
return(NULL);
}
diff --git a/stb_image.h b/stb_image.h
index c95d28f5..a6dc2285 100644
--- a/stb_image.h
+++ b/stb_image.h
@@ -5306,6 +5306,7 @@ static int stbi__parse_png_file(stbi__png *z, int scan, int req_comp)
invalid_chunk[1] = STBI__BYTECAST(c.type >> 16);
invalid_chunk[2] = STBI__BYTECAST(c.type >> 8);
invalid_chunk[3] = STBI__BYTECAST(c.type >> 0);
+ (void)invalid_chunk;
#endif
return stbi__err(invalid_chunk, "PNG not supported: unknown PNG chunk type");
}
diff --git a/test/main.c b/test/main.c
index 79a457d7..69fd97cd 100644
--- a/test/main.c
+++ b/test/main.c
@@ -961,6 +961,7 @@ static int
TestFormats(void *arg)
{
size_t i;
+ (void)arg;
for (i = 0; i < SDL_arraysize(formats); i++) {
FormatTest(&formats[i]);