From 869a103e0ecd8f583d84a128333bff901a275907 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 18 May 2025 15:35:59 +0100 Subject: [PATCH 1/7] i_tcp_detail: Rearrange header includes to silence warning winsock2.h contains a preprocessor warning that it must be included before windows.h. This was violated for k_bans.cpp when the new json include was added, but also rearranges i_tcp_detail.h to guarantee no alteration to existing doom-based headings would ever violate this again. --- src/i_tcp_detail.h | 8 ++++---- src/k_bans.cpp | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/i_tcp_detail.h b/src/i_tcp_detail.h index 9e3cccda4..b56b1c1dc 100644 --- a/src/i_tcp_detail.h +++ b/src/i_tcp_detail.h @@ -40,8 +40,6 @@ extern "C" { #include #endif -#include "doomdef.h" - #ifdef USE_WINSOCK1 #include #else @@ -115,9 +113,11 @@ extern "C" { static UINT8 UPNP_support = TRUE; #endif // HAVE_MINIUPNC -#include "d_net.h" -#include "doomtype.h" #include "i_tcp.h" +#include "d_net.h" + +#include "doomdef.h" +#include "doomtype.h" union mysockaddr_t { diff --git a/src/k_bans.cpp b/src/k_bans.cpp index 673adf0b7..a47902c21 100644 --- a/src/k_bans.cpp +++ b/src/k_bans.cpp @@ -17,10 +17,11 @@ #include #include +#include "i_tcp_detail.h" // clientaddress + #include "core/json.hpp" #include "core/string.h" #include "io/streams.hpp" -#include "i_tcp_detail.h" // clientaddress #include "k_bans.h" #include "byteptr.h" // READ/WRITE macros #include "command.h" From 1c7b26639a0ba10ae13b83559d07e47befd584a1 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 18 May 2025 15:36:46 +0100 Subject: [PATCH 2/7] D_CleanFile: Consistent signedness for int types --- src/d_main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index e1a31892d..7afb32df7 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -1306,7 +1306,8 @@ static void D_AddFile(initmultiplefilesentry_t *list, size_t index, const char * static inline void D_CleanFile(initmultiplefilesentry_t *list, size_t count) { - for (INT32 i = 0; i < count; ++i) + size_t i; + for (i = 0; i < count; ++i) { if (list[i].filename != NULL) free((void*)list[i].filename); From cbd7803e61e9a21e0a8d0b01a4d47dcb8f4cb288 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 18 May 2025 15:39:00 +0100 Subject: [PATCH 3/7] apng_create_info_struct: Swap order of calloc params Instead of making one apng_info sized struct, it was making apng_info's size many bytes. Which SHOULD be identical, but in the case of padding may not be. Certainly enough of a risk for the compiler to warn about it --- src/apng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apng.c b/src/apng.c index a5f2485d7..6216fb347 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); From b8625339fa4aa36f455460b86fd5f39bce441189 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 18 May 2025 15:42:16 +0100 Subject: [PATCH 4/7] CheckpointManager::link_checkpoint: No need for std::move for linetag element Also removes mistakenly committed `__attribute__` optimisation-disabler in the same file --- src/objects/checkpoint.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/objects/checkpoint.cpp b/src/objects/checkpoint.cpp index 8ceba4df4..03502e1bb 100644 --- a/src/objects/checkpoint.cpp +++ b/src/objects/checkpoint.cpp @@ -495,7 +495,7 @@ struct CheckpointManager else // Checkpoint isn't in the list, find any associated tagged lines and make the pair { if (chk->linetag()) - lines_.try_emplace(chk->linetag(), std::move(tagged_lines(chk->linetag()))); + lines_.try_emplace(chk->linetag(), tagged_lines(chk->linetag())); list_.push_front(chk); } @@ -558,7 +558,7 @@ void Obj_CheckpointThink(mobj_t* end) chk->animate(); } -void __attribute__((optimize("O0"))) Obj_CrossCheckpoints(player_t* player, fixed_t old_x, fixed_t old_y) +void Obj_CrossCheckpoints(player_t* player, fixed_t old_x, fixed_t old_y) { LineOnDemand ray(old_x, old_y, player->mo->x, player->mo->y, player->mo->radius); From 67ff68f7a39e1f5a7a3da90990d29a448256af14 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 18 May 2025 15:45:12 +0100 Subject: [PATCH 5/7] K_MoveKartPlayer: Remove unused mobj_t ref from forward-thrown Landmine --- src/k_kart.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 90024cd0f..41b531e0b 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -13802,9 +13802,10 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->itemamount--; if (player->throwdir > 0) { - mobj_t *landmine = K_ThrowKartItem(player, true, MT_LANDMINE, -1, 0, 0); + K_ThrowKartItem(player, true, MT_LANDMINE, -1, 0, 0); } - else { + else + { K_ThrowLandMine(player); } K_PlayAttackTaunt(player->mo); From 471e11f4b55213ae0e3c75263ce3e9859ffacb9b Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 18 May 2025 15:50:34 +0100 Subject: [PATCH 6/7] HWR_CreateBlendedTexture: Do not operate on colorbrightnesses outside of TC_RAINBOW This array is uninitialised when that is not being operated upon, and the valid context was only one bracket away, so shift it over --- src/hardware/hw_md2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 7a49edcb8..977db93b6 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -826,10 +826,9 @@ static void HWR_CreateBlendedTexture(patch_t *gpatch, patch_t *blendgpatch, GLMi } } } - } - if (translen > 0) colorbrightnesses[translen] = colorbrightnesses[translen-1]; + } if (skinnum == TC_BLINK) blendcolor = V_GetColor(skincolors[color].ramp[3]); From b1af67bcaf65423bcd3b3b6a65aa904cf3a3bd40 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 18 May 2025 15:51:00 +0100 Subject: [PATCH 7/7] WebmVorbisEncoder::make_vorbis_private_data(): Resolve esoteric optimisation errors under GCC15 by assigning directly std::vector's reserve func was somehow optimised into providing non-stack data which emplace_back wasn't playing nice with!? What even is the point of these optimisations if a very basic call dies like that --- src/media/webm_vorbis_lace.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/media/webm_vorbis_lace.cpp b/src/media/webm_vorbis_lace.cpp index 45c564419..2c45d68ca 100644 --- a/src/media/webm_vorbis_lace.cpp +++ b/src/media/webm_vorbis_lace.cpp @@ -61,7 +61,8 @@ std::vector WebmVorbisEncoder::make_vorbis_private_data() // The first byte is the number of packets. Once again, // the last packet is not counted. - v.emplace_back(std::byte {2}); + v.resize(1); + v[0] = std::byte {2}; // Then the laced sizes for each packet. lace(v, packets[0]);