prboom-plus/prboom-types2.diff

195 lines
7.9 KiB
Diff

From: Jan Engelhardt <jengelh@medozas.de>
build: fix compiler warnings about casting across different-size types
p_saveg.c: In function 'P_ArchivePlayers':
p_saveg.c:66:9: warning: cast from pointer to integer of different size
[...]
---
src/g_overflow.c | 3 ++-
src/p_saveg.c | 31 ++++++++++++++++---------------
src/r_drawflush.inl | 4 +++-
3 files changed, 21 insertions(+), 17 deletions(-)
Index: prboom2/src/g_overflow.c
===================================================================
--- prboom2.orig/src/g_overflow.c
+++ prboom2/src/g_overflow.c
@@ -35,6 +35,7 @@
#include "config.h"
#endif
+#include <stdint.h>
#include <stdio.h>
#include <stdarg.h>
@@ -170,7 +171,7 @@ void InterceptsOverrun(int num_intercept
InterceptsMemoryOverrun(location, intercept->frac);
InterceptsMemoryOverrun(location + 4, intercept->isaline);
- InterceptsMemoryOverrun(location + 8, (int) intercept->d.thing);
+ InterceptsMemoryOverrun(location + 8, (uintptr_t) intercept->d.thing);
}
}
}
Index: prboom2/src/p_saveg.c
===================================================================
--- prboom2.orig/src/p_saveg.c
+++ prboom2/src/p_saveg.c
@@ -31,6 +31,7 @@
*
*-----------------------------------------------------------------------------*/
+#include <stdint.h>
#include "doomstat.h"
#include "r_main.h"
#include "p_maputl.h"
@@ -48,7 +49,7 @@ byte *save_p;
// Pads save_p to a 4-byte boundary
// so that the load/save works on SGI&Gecko.
-#define PADSAVEP() do { save_p += (4 - ((int) save_p & 3)) & 3; } while (0)
+#define PADSAVEP() do { save_p += (4 - ((uintptr_t) save_p & 3)) & 3; } while (0)
//
// P_ArchivePlayers
//
@@ -99,7 +100,7 @@ void P_UnArchivePlayers (void)
for (j=0 ; j<NUMPSPRITES ; j++)
if (players[i]. psprites[j].state)
players[i]. psprites[j].state =
- &states[ (int)players[i].psprites[j].state ];
+ &states[ (uintptr_t)players[i].psprites[j].state ];
}
}
@@ -279,7 +280,7 @@ void P_ThinkerToIndex(void)
number_of_thinkers = 0;
for (th = thinkercap.next ; th != &thinkercap ; th=th->next)
if (th->function == P_MobjThinker)
- th->prev = (thinker_t *) ++number_of_thinkers;
+ th->prev = (thinker_t *)(uintptr_t) ++number_of_thinkers;
}
// phares 9/13/98: Moved this code outside of P_ArchiveThinkers so the
@@ -474,10 +475,10 @@ void P_UnArchiveThinkers (void)
memcpy (mobj, save_p, sizeof(mobj_t));
save_p += sizeof(mobj_t);
- mobj->state = states + (int) mobj->state;
+ mobj->state = states + (uintptr_t) mobj->state;
if (mobj->player)
- (mobj->player = &players[(int) mobj->player - 1]) -> mo = mobj;
+ (mobj->player = &players[(uintptr_t) mobj->player - 1]) -> mo = mobj;
P_SetThingPosition (mobj);
mobj->info = &mobjinfo[mobj->type];
@@ -799,7 +800,7 @@ void P_UnArchiveSpecials (void)
ceiling_t *ceiling = Z_Malloc (sizeof(*ceiling), PU_LEVEL, NULL);
memcpy (ceiling, save_p, sizeof(*ceiling));
save_p += sizeof(*ceiling);
- ceiling->sector = &sectors[(int)ceiling->sector];
+ ceiling->sector = &sectors[(uintptr_t)ceiling->sector];
ceiling->sector->ceilingdata = ceiling; //jff 2/22/98
if (ceiling->thinker.function)
@@ -816,10 +817,10 @@ void P_UnArchiveSpecials (void)
vldoor_t *door = Z_Malloc (sizeof(*door), PU_LEVEL, NULL);
memcpy (door, save_p, sizeof(*door));
save_p += sizeof(*door);
- door->sector = &sectors[(int)door->sector];
+ door->sector = &sectors[(uintptr_t)door->sector];
//jff 1/31/98 unarchive line remembered by door as well
- door->line = (int)door->line!=-1? &lines[(int)door->line] : NULL;
+ door->line = (uintptr_t)door->line!=-1? &lines[(uintptr_t)door->line] : NULL;
door->sector->ceilingdata = door; //jff 2/22/98
door->thinker.function = T_VerticalDoor;
@@ -833,7 +834,7 @@ void P_UnArchiveSpecials (void)
floormove_t *floor = Z_Malloc (sizeof(*floor), PU_LEVEL, NULL);
memcpy (floor, save_p, sizeof(*floor));
save_p += sizeof(*floor);
- floor->sector = &sectors[(int)floor->sector];
+ floor->sector = &sectors[(uintptr_t)floor->sector];
floor->sector->floordata = floor; //jff 2/22/98
floor->thinker.function = T_MoveFloor;
P_AddThinker (&floor->thinker);
@@ -846,7 +847,7 @@ void P_UnArchiveSpecials (void)
plat_t *plat = Z_Malloc (sizeof(*plat), PU_LEVEL, NULL);
memcpy (plat, save_p, sizeof(*plat));
save_p += sizeof(*plat);
- plat->sector = &sectors[(int)plat->sector];
+ plat->sector = &sectors[(uintptr_t)plat->sector];
plat->sector->floordata = plat; //jff 2/22/98
if (plat->thinker.function)
@@ -863,7 +864,7 @@ void P_UnArchiveSpecials (void)
lightflash_t *flash = Z_Malloc (sizeof(*flash), PU_LEVEL, NULL);
memcpy (flash, save_p, sizeof(*flash));
save_p += sizeof(*flash);
- flash->sector = &sectors[(int)flash->sector];
+ flash->sector = &sectors[(uintptr_t)flash->sector];
flash->thinker.function = T_LightFlash;
P_AddThinker (&flash->thinker);
break;
@@ -875,7 +876,7 @@ void P_UnArchiveSpecials (void)
strobe_t *strobe = Z_Malloc (sizeof(*strobe), PU_LEVEL, NULL);
memcpy (strobe, save_p, sizeof(*strobe));
save_p += sizeof(*strobe);
- strobe->sector = &sectors[(int)strobe->sector];
+ strobe->sector = &sectors[(uintptr_t)strobe->sector];
strobe->thinker.function = T_StrobeFlash;
P_AddThinker (&strobe->thinker);
break;
@@ -887,7 +888,7 @@ void P_UnArchiveSpecials (void)
glow_t *glow = Z_Malloc (sizeof(*glow), PU_LEVEL, NULL);
memcpy (glow, save_p, sizeof(*glow));
save_p += sizeof(*glow);
- glow->sector = &sectors[(int)glow->sector];
+ glow->sector = &sectors[(uintptr_t)glow->sector];
glow->thinker.function = T_Glow;
P_AddThinker (&glow->thinker);
break;
@@ -899,7 +900,7 @@ void P_UnArchiveSpecials (void)
fireflicker_t *flicker = Z_Malloc (sizeof(*flicker), PU_LEVEL, NULL);
memcpy (flicker, save_p, sizeof(*flicker));
save_p += sizeof(*flicker);
- flicker->sector = &sectors[(int)flicker->sector];
+ flicker->sector = &sectors[(uintptr_t)flicker->sector];
flicker->thinker.function = T_FireFlicker;
P_AddThinker (&flicker->thinker);
break;
@@ -912,7 +913,7 @@ void P_UnArchiveSpecials (void)
elevator_t *elevator = Z_Malloc (sizeof(*elevator), PU_LEVEL, NULL);
memcpy (elevator, save_p, sizeof(*elevator));
save_p += sizeof(*elevator);
- elevator->sector = &sectors[(int)elevator->sector];
+ elevator->sector = &sectors[(uintptr_t)elevator->sector];
elevator->sector->floordata = elevator; //jff 2/22/98
elevator->sector->ceilingdata = elevator; //jff 2/22/98
elevator->thinker.function = T_MoveElevator;
Index: prboom2/src/r_drawflush.inl
===================================================================
--- prboom2.orig/src/r_drawflush.inl
+++ prboom2/src/r_drawflush.inl
@@ -28,6 +28,8 @@
*
*-----------------------------------------------------------------------------*/
+#include <stdint.h>
+
#if (R_DRAWCOLUMN_PIPELINE_BITS == 8)
#define SCREENTYPE byte
#define TOPLEFT byte_topleft
@@ -250,7 +252,7 @@ static void R_FLUSHQUAD_FUNCNAME(void)
}
#else
#if (R_DRAWCOLUMN_PIPELINE_BITS == 8)
- if ((sizeof(int) == 4) && (((int)source % 4) == 0) && (((int)dest % 4) == 0)) {
+ if ((sizeof(int) == 4) && (((uintptr_t)source % 4) == 0) && (((uintptr_t)dest % 4) == 0)) {
while(--count >= 0)
{
*(int *)dest = *(int *)source;