I ran into this problem when building 1.8.0 (GTK3 GUI plus --with-audio-driver=sdl2 and no libjsw fails because it then tries to use SDL1 for joystick support). I've just tested this patch and it works correctly for me now.
Fix sprintf that should be snprintf
Fix sprintf that should be snprintf
Fix compilation with GCC 15
Fix missing prototypes
Fix variables declared with implicit int type
Fix -fno-common problems
Fix build with GCC 15