From 89dbfe32db3b77a4de25dbc65cfe076a39add10c Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Wed, 5 Jun 2024 15:40:50 -0300 Subject: [PATCH 1/2] Disable -Wpedantic --- src/sdl/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index ee48fa2b1..99425108e 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -33,8 +33,6 @@ target_compile_options(SRB2SDL2 PRIVATE -Wall -Wno-trigraphs -W # Was controlled by RELAXWARNINGS - -pedantic - -Wpedantic -Wfloat-equal -Wundef -Wpointer-arith From a50d7f5db5876b5c9c7882b4f068d11e1fd2ed40 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Wed, 5 Jun 2024 17:01:48 -0300 Subject: [PATCH 2/2] Fix code that emits -Wcalloc-transposed-args warnings --- src/apng.c | 2 +- src/d_main.c | 2 +- src/deh_soc.c | 2 +- src/filesrch.c | 2 +- src/sdl/i_video.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/apng.c b/src/apng.c index 11d3ab9f5..cfb1473a4 100644 --- a/src/apng.c +++ b/src/apng.c @@ -71,7 +71,7 @@ apng_create_info_struct (png_structp pngp) { apng_infop ainfop; (void)pngp; - if (( ainfop = calloc(sizeof (apng_info),1) )) + if (( ainfop = calloc(1,sizeof (apng_info)) )) { apng_set_write_fn(pngp, ainfop, 0, 0, 0, 0, 0); apng_set_set_acTL_fn(pngp, ainfop, 0); diff --git a/src/d_main.c b/src/d_main.c index 2405b0136..3a3a0b26a 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1024,7 +1024,7 @@ void D_StartTitle(void) #define REALLOC_FILE_LIST \ if (list->files == NULL) \ { \ - list->files = calloc(sizeof(list->files), 2); \ + list->files = calloc(2, sizeof(list->files)); \ list->numfiles = 1; \ } \ else \ diff --git a/src/deh_soc.c b/src/deh_soc.c index dda3b2ef4..3759cc9c7 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -2791,7 +2791,7 @@ void readframe(MYFILE *f, INT32 num) size_t z; boolean found = false; size_t actionlen = strlen(word2) + 1; - char *actiontocompare = calloc(actionlen, 1); + char *actiontocompare = calloc(1, actionlen); strcpy(actiontocompare, word2); strupr(actiontocompare); diff --git a/src/filesrch.c b/src/filesrch.c index 3a729a9c8..ea19e00cd 100644 --- a/src/filesrch.c +++ b/src/filesrch.c @@ -1191,7 +1191,7 @@ boolean preparefilemenu(boolean samedepth) size_t i; if (filenamebuf == NULL) - filenamebuf = calloc(sizeof(char) * MAX_WADPATH, numwadfiles); + filenamebuf = calloc(numwadfiles, sizeof(char) * MAX_WADPATH); for (i = 0; i < numwadfiles; i++) { diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 249be61f6..10c866a1e 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1706,7 +1706,7 @@ static void Impl_VideoSetupBuffer(void) vid.direct = NULL; if (vid.buffer) free(vid.buffer); - vid.buffer = calloc(vid.rowbytes*vid.height, NUMSCREENS); + vid.buffer = calloc(NUMSCREENS, vid.rowbytes*vid.height); if (!vid.buffer) { I_Error("%s", M_GetText("Not enough memory for video buffer\n"));