diff --git a/appveyor.yml b/appveyor.yml index 98da61dbf..b37bd1a65 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -92,8 +92,8 @@ before_build: - ccache -V - ccache -s - if [%NOUPX%] == [1] ( set "NOUPX=NOUPX=1" ) else ( set "NOUPX=" ) -- set "SRB2_MFLAGS=-C src WARNINGMODE=1 CCACHE=1 GCC72=1 NOOBJDUMP=1 %NOUPX%" -- if [%X86_64%] == [1] ( set "MINGW_FLAGS=MINGW64=1 X86_64=1" ) else ( set "MINGW_FLAGS=MINGW=1" ) +- set "SRB2_MFLAGS=-C src WARNINGMODE=1 CCACHE=1 GCC73=1 NOOBJDUMP=1 %NOUPX%" +- if [%X86_64%] == [1] ( set "MINGW_FLAGS=MINGW64=1 X86_64=1" ) else ( set "MINGW_FLAGS=MINGW=1 GCC91=1" ) - set "SRB2_MFLAGS=%SRB2_MFLAGS% %MINGW_FLAGS% %CONFIGURATION%=1" build_script: diff --git a/src/Makefile.cfg b/src/Makefile.cfg index 2b05b7097..cbbbf426f 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -7,11 +7,19 @@ # and other things # -ifdef GCC81 -GCC80=1 +ifdef GCC91 +GCC83=1 endif -ifdef GCC80 +ifdef GCC83 +GCC82=1 +endif + +ifdef GCC82 +GCC81=1 +endif + +ifdef GCC81 GCC72=1 endif @@ -142,6 +150,9 @@ ifdef GCC43 endif endif WFLAGS+=-Wsign-compare +ifdef GCC91 + WFLAGS+=-Wno-error=address-of-packed-member +endif ifdef GCC45 WFLAGS+=-Wlogical-op endif @@ -178,6 +189,9 @@ ifndef GCC295 endif endif WFLAGS+=-Wformat-y2k +ifdef GCC71 +WFLAGS+=-Wno-error=format-overflow=2 +endif WFLAGS+=-Wformat-security ifndef GCC29 #WFLAGS+=-Winit-self @@ -215,7 +229,7 @@ ifdef GCC71 WFLAGS+=-Wno-error=implicit-fallthrough WFLAGS+=-Wno-implicit-fallthrough endif -ifdef GCC80 +ifdef GCC81 WFLAGS+=-Wno-error=format-overflow WFLAGS+=-Wno-error=stringop-truncation WFLAGS+=-Wno-error=stringop-overflow diff --git a/src/doomdef.h b/src/doomdef.h index 7bcc533c2..c948d7805 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -148,7 +148,7 @@ extern FILE *logstream; // Does this version require an added patch file? // Comment or uncomment this as necessary. -#define USE_PATCH_DTA +//#define USE_PATCH_DTA // Use .kart extension addons //#define USE_KART diff --git a/src/f_finale.c b/src/f_finale.c index 25ca8eb46..fedc08234 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -46,7 +46,7 @@ // Stage of animation: // 0 = text, 1 = art screen static INT32 finalecount; -INT32 titlescrollxspeed = 80; +INT32 titlescrollxspeed = 20; INT32 titlescrollyspeed = 0; UINT8 titlemapinaction = TITLEMAP_OFF; @@ -68,7 +68,7 @@ static INT32 menuanimtimer; // Title screen: background animation timing mobj_t *titlemapcameraref = NULL; // menu presentation state -char curbgname[8]; +char curbgname[9]; SINT8 curfadevalue; boolean curhidepics; INT32 curbgcolor; @@ -2093,7 +2093,7 @@ void F_InitMenuPresValues(void) activeMenuId = MainDef.menuid; // Set defaults for presentation values - strncpy(curbgname, "TITLESKY", 8); + strncpy(curbgname, "TITLESKY", 9); curfadevalue = 16; curhidepics = hidetitlepics; curbgcolor = -1; diff --git a/src/f_finale.h b/src/f_finale.h index 1149e1d5b..d640abc8a 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -87,7 +87,7 @@ typedef enum // Current menu parameters extern mobj_t *titlemapcameraref; -extern char curbgname[8]; +extern char curbgname[9]; extern SINT8 curfadevalue; extern boolean curhidepics; extern INT32 curbgcolor; diff --git a/src/g_game.c b/src/g_game.c index dad873fe7..c96b0805c 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -97,7 +97,7 @@ boolean runemeraldmanager = false; UINT16 emeraldspawndelay = 60*TICRATE; // menu demo things -UINT8 numDemos = 3; +UINT8 numDemos = 0; UINT32 demoDelayTime = 15*TICRATE; UINT32 demoIdleTime = 3*TICRATE; diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 86097822e..d4728315a 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1198,7 +1198,7 @@ static UINT8 P_GetModelSprite2(md2_t *md2, skin_t *skin, UINT8 spr2, player_t *p if (!md2 || !skin) return 0; - if ((spr2 & ~FF_SPR2SUPER) >= free_spr2) + if ((unsigned)(spr2 & ~FF_SPR2SUPER) >= free_spr2) return 0; while (!(md2->model->spr2frames[spr2*2 + 1]) diff --git a/src/i_addrinfo.c b/src/i_addrinfo.c index 375fd4845..94b921461 100644 --- a/src/i_addrinfo.c +++ b/src/i_addrinfo.c @@ -68,10 +68,10 @@ static int inet_aton(const char *cp, struct in_addr *addr) #ifdef USE_WINSOCK2 static HMODULE ipv6dll = NULL; -typedef int (WSAAPI *p_getaddrinfo) (const char *node, const char *service, - const struct my_addrinfo *hints, - struct my_addrinfo **res); -typedef void (WSAAPI *p_freeaddrinfo) (struct my_addrinfo *res); +typedef int (WSAAPI *p_getaddrinfo) (const char *, const char *, + const struct my_addrinfo *, + struct my_addrinfo **); +typedef void (WSAAPI *p_freeaddrinfo) (struct my_addrinfo *); static p_getaddrinfo WS_getaddrinfo = NULL; static p_freeaddrinfo WS_freeaddrinfo = NULL; @@ -80,10 +80,10 @@ static HMODULE WS_getfunctions(HMODULE tmp) { if (tmp != NULL) { - WS_getaddrinfo = (p_getaddrinfo)GetProcAddress(tmp, "getaddrinfo"); + WS_getaddrinfo = (p_getaddrinfo)(LPVOID)GetProcAddress(tmp, "getaddrinfo"); if (WS_getaddrinfo == NULL) return NULL; - WS_freeaddrinfo = (p_freeaddrinfo)GetProcAddress(tmp, "freeaddrinfo"); + WS_freeaddrinfo = (p_freeaddrinfo)(LPVOID)GetProcAddress(tmp, "freeaddrinfo"); if (WS_freeaddrinfo == NULL) { WS_getaddrinfo = NULL; diff --git a/src/m_menu.c b/src/m_menu.c index e2a02989e..815b7bcbb 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1310,12 +1310,12 @@ static menuitem_t OP_SoundOptionsMenu[] = {IT_STRING | IT_CVAR, NULL, "Closed Captioning", &cv_closedcaptioning, 115}, // 56 {IT_STRING | IT_CVAR, NULL, "Reset Music Upon Dying", &cv_resetmusic, 125}, // 62 -#if defined(HAVE_OPENMPT) || defined(HAVE_MIXERX) +#ifdef HAVE_MIXERX {IT_STRING | IT_SUBMENU, NULL, "Advanced Settings...", &OP_SoundAdvancedDef, 143}, #endif }; -#if defined(HAVE_OPENMPT) || defined(HAVE_MIXERX) +#ifdef HAVE_MIXERX #ifdef HAVE_OPENMPT #define OPENMPT_MENUOFFSET 32 @@ -2337,7 +2337,7 @@ static boolean MIT_SetCurBackground(UINT32 menutype, INT32 level, INT32 *retval, } else if (menupres[menutype].bgname[0]) { - strncpy(curbgname, menupres[menutype].bgname, 8); + strncpy(curbgname, menupres[menutype].bgname, 9); curbgxspeed = menupres[menutype].titlescrollxspeed != INT32_MAX ? menupres[menutype].titlescrollxspeed : titlescrollxspeed; curbgyspeed = menupres[menutype].titlescrollyspeed != INT32_MAX ? menupres[menutype].titlescrollyspeed : titlescrollyspeed; return true; @@ -2350,7 +2350,7 @@ static boolean MIT_SetCurBackground(UINT32 menutype, INT32 level, INT32 *retval, curbghide = true; else { - strncpy(curbgname, defaultname, 8); + strncpy(curbgname, defaultname, 9); curbgxspeed = (gamestate == GS_TIMEATTACK) ? 0 : titlescrollxspeed; curbgyspeed = (gamestate == GS_TIMEATTACK) ? 0 : titlescrollyspeed; } @@ -2509,7 +2509,7 @@ static void M_HandleMenuPresState(menu_t *newMenu) activeMenuId = newMenu ? newMenu->menuid : 0; // Set defaults for presentation values - strncpy(curbgname, "TITLESKY", 8); + strncpy(curbgname, "TITLESKY", 9); curfadevalue = 16; curhidepics = hidetitlepics; curbgcolor = -1; diff --git a/src/m_misc.c b/src/m_misc.c index 6fdae9411..22e19df73 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -58,7 +58,7 @@ typedef off_t off64_t; #endif #endif -#if defined(__MINGW32__) && ((__GNUC__ > 7) || (__GNUC__ == 6 && __GNUC_MINOR__ >= 3)) +#if defined(__MINGW32__) && ((__GNUC__ > 7) || (__GNUC__ == 6 && __GNUC_MINOR__ >= 3)) && (__GNUC__ < 8) #define PRIdS "u" #elif defined (_WIN32) #define PRIdS "Iu" diff --git a/src/p_enemy.c b/src/p_enemy.c index 9f1b15d53..4126d0716 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13715,4 +13715,4 @@ void A_ModuloToState(mobj_t *actor) if ((modulothing % locvar1 == 0)) P_SetMobjState(actor, (locvar2)); modulothing++; -} \ No newline at end of file +} diff --git a/src/p_maputl.c b/src/p_maputl.c index 740797fb0..45fc82fbf 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -419,10 +419,6 @@ void P_CameraLineOpening(line_t *linedef) if (front->ffloors || back->ffloors) { ffloor_t *rover; - fixed_t highestceiling = highceiling; - fixed_t lowestceiling = opentop; - fixed_t highestfloor = openbottom; - fixed_t lowestfloor = lowfloor; fixed_t delta1, delta2; // Check for frontsector's fake floors @@ -438,15 +434,15 @@ void P_CameraLineOpening(line_t *linedef) delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); - if (bottomheight < lowestceiling && delta1 >= delta2) - lowestceiling = bottomheight; - else if (bottomheight < highestceiling && delta1 >= delta2) - highestceiling = bottomheight; + if (bottomheight < opentop && delta1 >= delta2) + opentop = bottomheight; + else if (bottomheight < highceiling && delta1 >= delta2) + highceiling = bottomheight; - if (topheight > highestfloor && delta1 < delta2) - highestfloor = topheight; - else if (topheight > lowestfloor && delta1 < delta2) - lowestfloor = topheight; + if (topheight > openbottom && delta1 < delta2) + openbottom = topheight; + else if (topheight > lowfloor && delta1 < delta2) + lowfloor = topheight; } // Check for backsectors fake floors @@ -462,28 +458,16 @@ void P_CameraLineOpening(line_t *linedef) delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); - if (bottomheight < lowestceiling && delta1 >= delta2) - lowestceiling = bottomheight; - else if (bottomheight < highestceiling && delta1 >= delta2) - highestceiling = bottomheight; + if (bottomheight < opentop && delta1 >= delta2) + opentop = bottomheight; + else if (bottomheight < highceiling && delta1 >= delta2) + highceiling = bottomheight; - if (topheight > highestfloor && delta1 < delta2) - highestfloor = topheight; - else if (topheight > lowestfloor && delta1 < delta2) - lowestfloor = topheight; + if (topheight > openbottom && delta1 < delta2) + openbottom = topheight; + else if (topheight > lowfloor && delta1 < delta2) + lowfloor = topheight; } - - if (highestceiling < highceiling) - highceiling = highestceiling; - - if (highestfloor > openbottom) - openbottom = highestfloor; - - if (lowestceiling < opentop) - opentop = lowestceiling; - - if (lowestfloor > lowfloor) - lowfloor = lowestfloor; } openrange = opentop - openbottom; return; @@ -501,25 +485,27 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) return; } - // Treat polyobjects kind of like 3D Floors -#ifdef POLYOBJECTS - if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT)) - { - front = linedef->frontsector; - back = linedef->frontsector; - } - else -#endif - { - front = linedef->frontsector; - back = linedef->backsector; - } + front = linedef->frontsector; + back = linedef->backsector; I_Assert(front != NULL); I_Assert(back != NULL); openfloorrover = openceilingrover = NULL; - +#ifdef POLYOBJECTS + if (linedef->polyobj) + { + // set these defaults so that polyobjects don't interfere with collision above or below them + opentop = INT32_MAX; + openbottom = INT32_MIN; + highceiling = INT32_MIN; + lowfloor = INT32_MAX; +#ifdef ESLOPE + opentopslope = openbottomslope = NULL; +#endif + } + else +#endif { // Set open and high/low values here fixed_t frontheight, backheight; @@ -625,27 +611,49 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) } } } - - // Check for fake floors in the sector. - if (front->ffloors || back->ffloors #ifdef POLYOBJECTS - || linedef->polyobj + if (linedef->polyobj) + { + // Treat polyobj's backsector like a 3D Floor + if (linedef->polyobj->flags & POF_TESTHEIGHT) + { + const sector_t *polysec = linedef->backsector; + fixed_t polytop, polybottom; + fixed_t delta1, delta2; + + if (linedef->polyobj->flags & POF_CLIPPLANES) + { + polytop = polysec->ceilingheight; + polybottom = polysec->floorheight; + } + else + { + polytop = INT32_MAX; + polybottom = INT32_MIN; + } + + delta1 = abs(mobj->z - (polybottom + ((polytop - polybottom)/2))); + delta2 = abs(thingtop - (polybottom + ((polytop - polybottom)/2))); + + if (polybottom < opentop && delta1 >= delta2) + opentop = polybottom; + else if (polybottom < highceiling && delta1 >= delta2) + highceiling = polybottom; + + if (polytop > openbottom && delta1 < delta2) + openbottom = polytop; + else if (polytop > lowfloor && delta1 < delta2) + lowfloor = polytop; + } + // otherwise don't do anything special, pretend there's nothing else there + } + else #endif - ) + // Check for fake floors in the sector. + if (front->ffloors || back->ffloors) { ffloor_t *rover; - - fixed_t highestceiling = highceiling; - fixed_t lowestceiling = opentop; - fixed_t highestfloor = openbottom; - fixed_t lowestfloor = lowfloor; fixed_t delta1, delta2; -#ifdef ESLOPE - pslope_t *ceilingslope = opentopslope; - pslope_t *floorslope = openbottomslope; -#endif - ffloor_t *floorrover = NULL; - ffloor_t *ceilingrover = NULL; // Check for frontsector's fake floors for (rover = front->ffloors; rover; rover = rover->next) @@ -668,28 +676,28 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF { - if (bottomheight < lowestceiling) { - lowestceiling = bottomheight; + if (bottomheight < opentop) { + opentop = bottomheight; #ifdef ESLOPE - ceilingslope = *rover->b_slope; + opentopslope = *rover->b_slope; #endif - ceilingrover = rover; + openceilingrover = rover; } - else if (bottomheight < highestceiling) - highestceiling = bottomheight; + else if (bottomheight < highceiling) + highceiling = bottomheight; } if (delta1 < delta2 && !(rover->flags & FF_REVERSEPLATFORM)) // thing is above FOF { - if (topheight > highestfloor) { - highestfloor = topheight; + if (topheight > openbottom) { + openbottom = topheight; #ifdef ESLOPE - floorslope = *rover->t_slope; + openbottomslope = *rover->t_slope; #endif - floorrover = rover; + openfloorrover = rover; } - else if (topheight > lowestfloor) - lowestfloor = topheight; + else if (topheight > lowfloor) + lowfloor = topheight; } } @@ -714,81 +722,30 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF { - if (bottomheight < lowestceiling) { - lowestceiling = bottomheight; + if (bottomheight < opentop) { + opentop = bottomheight; #ifdef ESLOPE - ceilingslope = *rover->b_slope; + opentopslope = *rover->b_slope; #endif - ceilingrover = rover; + openceilingrover = rover; } - else if (bottomheight < highestceiling) - highestceiling = bottomheight; + else if (bottomheight < highceiling) + highceiling = bottomheight; } if (delta1 < delta2 && !(rover->flags & FF_REVERSEPLATFORM)) // thing is above FOF { - if (topheight > highestfloor) { - highestfloor = topheight; + if (topheight > openbottom) { + openbottom = topheight; #ifdef ESLOPE - floorslope = *rover->t_slope; + openbottomslope = *rover->t_slope; #endif - floorrover = rover; + openfloorrover = rover; } - else if (topheight > lowestfloor) - lowestfloor = topheight; + else if (topheight > lowfloor) + lowfloor = topheight; } } - -#ifdef POLYOBJECTS - // Treat polyobj's backsector like a 3D Floor - if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT)) - { - const sector_t *polysec = linedef->backsector; - - delta1 = abs(mobj->z - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2))); - delta2 = abs(thingtop - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2))); - if (polysec->floorheight < lowestceiling && delta1 >= delta2) { - lowestceiling = polysec->floorheight; -#ifdef ESLOPE - ceilingslope = NULL; -#endif - ceilingrover = NULL; - } - else if (polysec->floorheight < highestceiling && delta1 >= delta2) - highestceiling = polysec->floorheight; - - if (polysec->ceilingheight > highestfloor && delta1 < delta2) { - highestfloor = polysec->ceilingheight; -#ifdef ESLOPE - floorslope = NULL; -#endif - floorrover = NULL; - } - else if (polysec->ceilingheight > lowestfloor && delta1 < delta2) - lowestfloor = polysec->ceilingheight; - } -#endif - if (highestceiling < highceiling) - highceiling = highestceiling; - - if (highestfloor > openbottom) { - openbottom = highestfloor; -#ifdef ESLOPE - openbottomslope = floorslope; -#endif - openfloorrover = floorrover; - } - - if (lowestceiling < opentop) { - opentop = lowestceiling; -#ifdef ESLOPE - opentopslope = ceilingslope; -#endif - openceilingrover = ceilingrover; - } - - if (lowestfloor > lowfloor) - lowfloor = lowestfloor; } } diff --git a/src/p_saveg.c b/src/p_saveg.c index 0bfb81f4e..ea998b445 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -2404,7 +2404,7 @@ static void P_NetArchiveThinkers(void) } #endif // ESLOPE #ifdef PARANOIA - else if (th->function.acp1 != P_RemoveThinkerDelayed) // wait garbage collection + else if (th->function.acp1 != (actionf_p1)P_RemoveThinkerDelayed) // wait garbage collection I_Error("unknown thinker type %p", th->function.acp1); #endif } diff --git a/src/p_slopes.c b/src/p_slopes.c index d6080c15d..f89dd3c96 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -717,7 +717,7 @@ void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope) if (slope->flags & SL_NOPHYSICS) { // No physics, no need to make anything complicated. if (P_MobjFlip(thing)*(thing->momz) < 0) { // falling, land on slope - thing->momz = -P_MobjFlip(thing); + //thing->momz = -P_MobjFlip(thing); thing->standingslope = slope; } return; @@ -732,7 +732,7 @@ void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope) if (P_MobjFlip(thing)*mom.z < 0) { // falling, land on slope thing->momx = mom.x; thing->momy = mom.y; - thing->momz = -P_MobjFlip(thing); + //thing->momz = -P_MobjFlip(thing); thing->standingslope = slope; } diff --git a/src/p_spec.c b/src/p_spec.c index 23ab04fc7..5e06a18a7 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -9265,4 +9265,4 @@ static void P_SpawnPushers(void) Add_Pusher(p_downwind, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); break; } -} \ No newline at end of file +} diff --git a/src/p_tick.c b/src/p_tick.c index 92b3c6b42..c6a20acc5 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -199,7 +199,7 @@ void P_InitThinkers(void) void P_AddThinker(const thinklistnum_t n, thinker_t *thinker) { #ifdef PARANOIA - I_Assert(n >= 0 && n < NUM_THINKERLISTS); + I_Assert(n < NUM_THINKERLISTS); #endif thlist[n].prev->next = thinker; @@ -328,7 +328,7 @@ static inline void P_RunThinkers(void) for (currentthinker = thlist[i].next; currentthinker != &thlist[i]; currentthinker = currentthinker->next) { #ifdef PARANOIA - I_Assert(currentthinker->function.acp1 != NULL) + I_Assert(currentthinker->function.acp1 != NULL); #endif currentthinker->function.acp1(currentthinker); } diff --git a/src/p_user.c b/src/p_user.c index 0a338a6e7..b74cafd21 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4730,6 +4730,7 @@ void P_DoAbilityBounce(player_t *player, boolean changemomz) return; if (changemomz) { + fixed_t minmomz; prevmomz = player->mo->momz; if (P_MobjFlip(player->mo)*prevmomz < 0) prevmomz = 0; @@ -4737,7 +4738,8 @@ void P_DoAbilityBounce(player_t *player, boolean changemomz) prevmomz /= 2; P_DoJump(player, false); player->pflags &= ~(PF_STARTJUMP|PF_JUMPED); - player->mo->momz = (FixedMul(player->mo->momz, 3*FRACUNIT/2) + prevmomz)/2; + minmomz = FixedMul(player->mo->momz, 3*FRACUNIT/2); + player->mo->momz = max(minmomz, (minmomz + prevmomz)/2); } S_StartSound(player->mo, sfx_boingf); P_SetPlayerMobjState(player->mo, S_PLAY_BOUNCE_LANDING); @@ -10389,7 +10391,7 @@ static void P_MinecartThink(player_t *player) if (P_IsObjectOnGround(minecart)) { sector_t *sec; - INT32 lnum; + INT32 lnum = -1; fixed_t dummy; // Just hit floor. diff --git a/src/r_things.c b/src/r_things.c index 645d10015..92f2b9460 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2511,7 +2511,7 @@ UINT8 P_GetSkinSprite2(skin_t *skin, UINT8 spr2, player_t *player) if (!skin) return 0; - if ((spr2 & ~FF_SPR2SUPER) >= free_spr2) + if ((unsigned)(spr2 & ~FF_SPR2SUPER) >= free_spr2) return 0; while (!(skin->sprites[spr2].numframes) diff --git a/src/s_sound.c b/src/s_sound.c index 2c6faf041..1c6cd5ef1 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2304,4 +2304,4 @@ void ModFilter_OnChange(void) if (openmpt_mhandle) openmpt_module_set_render_param(openmpt_mhandle, OPENMPT_MODULE_RENDER_INTERPOLATIONFILTER_LENGTH, cv_modfilter.value); } -#endif \ No newline at end of file +#endif diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 7a30d4c85..98166a1ce 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -1479,7 +1479,7 @@ const char *I_GetJoyName(INT32 joyindex) { tempname = SDL_JoystickNameForIndex(joyindex); if (tempname) - strncpy(joyname, tempname, 255); + strncpy(joyname, tempname, 254); } SDL_QuitSubSystem(SDL_INIT_JOYSTICK); } @@ -1487,7 +1487,7 @@ const char *I_GetJoyName(INT32 joyindex) { tempname = SDL_JoystickNameForIndex(joyindex); if (tempname) - strncpy(joyname, tempname, 255); + strncpy(joyname, tempname, 254); } return joyname; } @@ -2042,7 +2042,7 @@ static void I_ShutdownTimer(void) pfntimeGetTime = NULL; if (winmm) { - p_timeEndPeriod pfntimeEndPeriod = (p_timeEndPeriod)GetProcAddress(winmm, "timeEndPeriod"); + p_timeEndPeriod pfntimeEndPeriod = (p_timeEndPeriod)(LPVOID)GetProcAddress(winmm, "timeEndPeriod"); if (pfntimeEndPeriod) pfntimeEndPeriod(1); FreeLibrary(winmm); @@ -2087,10 +2087,10 @@ void I_StartupTimer(void) winmm = LoadLibraryA("winmm.dll"); if (winmm) { - p_timeEndPeriod pfntimeBeginPeriod = (p_timeEndPeriod)GetProcAddress(winmm, "timeBeginPeriod"); + p_timeEndPeriod pfntimeBeginPeriod = (p_timeEndPeriod)(LPVOID)GetProcAddress(winmm, "timeBeginPeriod"); if (pfntimeBeginPeriod) pfntimeBeginPeriod(1); - pfntimeGetTime = (p_timeGetTime)GetProcAddress(winmm, "timeGetTime"); + pfntimeGetTime = (p_timeGetTime)(LPVOID)GetProcAddress(winmm, "timeGetTime"); } I_AddExitFunc(I_ShutdownTimer); #endif @@ -2389,7 +2389,7 @@ void I_GetDiskFreeSpace(INT64 *freespace) if (!testwin95) { - pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA"); + pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)(LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA"); testwin95 = true; } if (pfnGetDiskFreeSpaceEx) @@ -2413,7 +2413,7 @@ void I_GetDiskFreeSpace(INT64 *freespace) char *I_GetUserName(void) { - static char username[MAXPLAYERNAME]; + static char username[MAXPLAYERNAME+1]; char *p; #ifdef _WIN32 DWORD i = MAXPLAYERNAME; @@ -2884,7 +2884,7 @@ const CPUInfoFlags *I_CPUInfo(void) #if defined (_WIN32) static CPUInfoFlags WIN_CPUInfo; SYSTEM_INFO SI; - p_IsProcessorFeaturePresent pfnCPUID = (p_IsProcessorFeaturePresent)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsProcessorFeaturePresent"); + p_IsProcessorFeaturePresent pfnCPUID = (p_IsProcessorFeaturePresent)(LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsProcessorFeaturePresent"); ZeroMemory(&WIN_CPUInfo,sizeof (WIN_CPUInfo)); if (pfnCPUID) diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 64b7cc722..d94010d9a 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -163,7 +163,10 @@ static void MidiSoundfontPath_Onchange(void) boolean proceed = true; // check if file exists; menu calls this method at every keystroke - while ((miditoken = strtok_r(source, ";", &source))) + // get first token + miditoken = strtok(source, ";"); + + while (miditoken != NULL) { SDL_RWops *rw = SDL_RWFromFile(miditoken, "r"); if (rw != NULL) @@ -173,6 +176,7 @@ static void MidiSoundfontPath_Onchange(void) proceed = false; break; } + miditoken = strtok(NULL, ";"); } free(source); diff --git a/src/win32/Makefile.cfg b/src/win32/Makefile.cfg index a57920932..27926b208 100644 --- a/src/win32/Makefile.cfg +++ b/src/win32/Makefile.cfg @@ -56,10 +56,6 @@ ifndef GCC44 #OPTS+=-mms-bitfields endif -ifndef MINGW64 - OPTS+=-gdwarf-2 -endif - ifndef SDL OPTS+=-D_WINDOWS endif diff --git a/src/win32/fabdxlib.c b/src/win32/fabdxlib.c index c19b036a0..45ec5d0d3 100644 --- a/src/win32/fabdxlib.c +++ b/src/win32/fabdxlib.c @@ -147,7 +147,7 @@ static inline BOOL LoadDirectDraw(VOID) DDrawDLL = LoadLibraryA("DDRAW.DLL"); if (DDrawDLL == NULL) return false; - pfnDirectDrawCreate = (DDCreate)GetProcAddress(DDrawDLL, "DirectDrawCreate"); + pfnDirectDrawCreate = (DDCreate)(LPVOID)GetProcAddress(DDrawDLL, "DirectDrawCreate"); if (pfnDirectDrawCreate == NULL) return false; return true; diff --git a/src/win32/win_sys.c b/src/win32/win_sys.c index 8b7adf7c6..d10f73b58 100644 --- a/src/win32/win_sys.c +++ b/src/win32/win_sys.c @@ -3395,7 +3395,7 @@ BOOL LoadDirectInput(VOID) DInputDLL = LoadLibraryA("DINPUT.DLL"); if (DInputDLL == NULL) return false; - pfnDirectInputCreateA = (DICreateA)GetProcAddress(DInputDLL, "DirectInputCreateA"); + pfnDirectInputCreateA = (DICreateA)(LPVOID)GetProcAddress(DInputDLL, "DirectInputCreateA"); if (pfnDirectInputCreateA == NULL) return false; return true; @@ -3529,7 +3529,7 @@ void I_GetDiskFreeSpace(INT64* freespace) if (!testwin95) { - pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA"); + pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)(LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA"); testwin95 = true; } if (pfnGetDiskFreeSpaceEx) @@ -3615,7 +3615,7 @@ const CPUInfoFlags *I_CPUInfo(void) { static CPUInfoFlags WIN_CPUInfo; SYSTEM_INFO SI; - p_IsProcessorFeaturePresent pfnCPUID = (p_IsProcessorFeaturePresent)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsProcessorFeaturePresent"); + p_IsProcessorFeaturePresent pfnCPUID = (p_IsProcessorFeaturePresent)(LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsProcessorFeaturePresent"); ZeroMemory(&WIN_CPUInfo,sizeof (WIN_CPUInfo)); if (pfnCPUID) @@ -3658,9 +3658,9 @@ static p_SetProcessAffinityMask pfnSetProcessAffinityMask = NULL; static inline VOID GetAffinityFuncs(VOID) { HMODULE h = GetModuleHandleA("kernel32.dll"); - pfnGetCurrentProcess = (p_GetCurrentProcess)GetProcAddress(h, "GetCurrentProcess"); - pfnGetProcessAffinityMask = (p_GetProcessAffinityMask)GetProcAddress(h, "GetProcessAffinityMask"); - pfnSetProcessAffinityMask = (p_SetProcessAffinityMask)GetProcAddress(h, "SetProcessAffinityMask"); + pfnGetCurrentProcess = (p_GetCurrentProcess)(LPVOID)GetProcAddress(h, "GetCurrentProcess"); + pfnGetProcessAffinityMask = (p_GetProcessAffinityMask)(LPVOID)GetProcAddress(h, "GetProcessAffinityMask"); + pfnSetProcessAffinityMask = (p_SetProcessAffinityMask)(LPVOID)GetProcAddress(h, "SetProcessAffinityMask"); } static void CPUAffinity_OnChange(void)