SW: Add casts to void pointers where needed

Patch from Striker.

git-svn-id: https://svn.eduke32.com/eduke32@7503 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2019-04-08 06:25:59 +00:00 committed by Christoph Oelckers
parent c456c414da
commit f3a223914f
10 changed files with 36 additions and 34 deletions

View file

@ -67,7 +67,7 @@ static int LoadGroupsCache(void)
if (scriptfile_getnumber(script, &fmtime)) break; // modification time
if (scriptfile_getnumber(script, &fcrcval)) break; // crc checksum
fg = calloc(1, sizeof(struct grpcache));
fg = (struct grpcache*)calloc(1, sizeof(struct grpcache));
fg->next = grpcache;
grpcache = fg;

View file

@ -1151,7 +1151,7 @@ InitOrgTile(OrgTileListP thelist)
OrgTileP tp;
tp = CallocMem(sizeof(OrgTile), 1);
tp = (OrgTileP)CallocMem(sizeof(OrgTile), 1);
ASSERT(tp);

View file

@ -244,6 +244,8 @@ typedef enum
uc_setup, uc_draw, uc_touchup, uc_hit
} UserCall;
struct MenuGroup;
typedef struct MENU_ITEM
{
MenuTag type; // What kind of item is this on the
@ -253,7 +255,7 @@ typedef struct MENU_ITEM
BTNType button; // Button state, if any
unsigned char hotkey; // First letter of item
const char *text; // Text appearing in item, if any.
void *child; // Should be menugroup, used to spawn
MenuGroup *child; // Should be menugroup, used to spawn
// sub-groups from items.
int x, y; // x,y position on screen.
short pic; // Startpic to use
@ -265,7 +267,7 @@ typedef struct MENU_ITEM
SWBOOL (*postprocess)(struct MENU_ITEM *); // Can do things on items select
} MenuItem, *MenuItem_p;
typedef struct
typedef struct MenuGroup
{
int x, y; // Menu x,y position on screen.
const char *text;

View file

@ -1463,7 +1463,7 @@ getpackets(void)
{
PACKET_RTSp p;
p = (void *)&packbuf[0];
p = (PACKET_RTSp)packbuf;
PlaySoundRTS(p->RTSnum);
@ -1483,7 +1483,7 @@ getpackets(void)
//level_number //volume_number //player_skill //monsters_off //respawn_monsters
//respawn_items //respawn_inventory //coop //marker //friendlyfire //boardname
p = (void *)&packbuf[0];
p = (PACKET_NEW_GAMEp)packbuf;
ready2send = 0;
@ -1544,7 +1544,7 @@ getpackets(void)
PACKET_VERSIONp p;
pp = Player + otherconnectindex;
p = (void *)&packbuf[0];
p = (PACKET_VERSIONp)packbuf;
//tenDbLprintf(gTenLog, 3, "rcv pid %d version %lx", (int) otherconnectindex, (int) p->Version);
pp->PlayerVersion = p->Version;
@ -1556,7 +1556,7 @@ getpackets(void)
PACKET_OPTIONSp p;
pp = Player + otherconnectindex;
p = (void *)&packbuf[0];
p = (PACKET_OPTIONSp)packbuf;
// auto run
if (p->AutoRun)
@ -1579,7 +1579,7 @@ getpackets(void)
{
PACKET_NAME_CHANGEp p;
pp = Player + otherconnectindex;
p = (void *)&packbuf[0];
p = (PACKET_NAME_CHANGEp)packbuf;
// someone else has changed their name

View file

@ -7206,7 +7206,7 @@ pSpawnSprite(PLAYERp pp, PANEL_STATEp state, uint8_t priority, int x, int y)
ASSERT(pp);
psp = CallocMem(sizeof(PANEL_SPRITE), 1);
psp = (PANEL_SPRITEp)CallocMem(sizeof(PANEL_SPRITE), 1);
PRODUCTION_ASSERT(psp);

View file

@ -106,7 +106,7 @@ int32_t RTS_AddFile(char *filename)
header.numlumps = B_LITTLE32(header.numlumps);
header.infotableofs = B_LITTLE32(header.infotableofs);
length = header.numlumps*sizeof(filelump_t);
fileinfo = fileinfoo = malloc(length);
fileinfo = fileinfoo = (filelump_t*)malloc(length);
if (!fileinfo)
{
buildprintf("RTS file could not allocate header info\n");
@ -119,7 +119,7 @@ int32_t RTS_AddFile(char *filename)
//
// Fill in lumpinfo
//
lump_p = realloc(lumpinfo, (numlumps + header.numlumps)*sizeof(lumpinfo_t));
lump_p = (lumpinfo_t*)realloc(lumpinfo, (numlumps + header.numlumps)*sizeof(lumpinfo_t));
if (!lump_p)
{
kclose(handle);
@ -173,7 +173,7 @@ void RTS_Init(char *filename)
// set up caching
//
length = (numlumps) * sizeof(*lumpcache);
lumpcache = Xmalloc(length);
lumpcache = (intptr_t*)Xmalloc(length);
memset(lumpcache,0,length);
}

View file

@ -849,7 +849,7 @@ int LoadGame(short save_num)
if (ndx == -1)
break;
psp = CallocMem(sizeof(PANEL_SPRITE), 1);
psp = (PANEL_SPRITEp)CallocMem(sizeof(PANEL_SPRITE), 1);
ASSERT(psp);
MREAD(psp, sizeof(PANEL_SPRITE),1,fil);
@ -918,23 +918,23 @@ int LoadGame(short save_num)
if (u->WallShade)
{
u->WallShade = CallocMem(u->WallCount * sizeof(*u->WallShade), 1);
u->WallShade = (int8_t*)CallocMem(u->WallCount * sizeof(*u->WallShade), 1);
MREAD(u->WallShade,sizeof(*u->WallShade)*u->WallCount,1,fil);
}
if (u->rotator)
{
u->rotator = CallocMem(sizeof(*u->rotator), 1);
u->rotator = (ROTATORp)CallocMem(sizeof(*u->rotator), 1);
MREAD(u->rotator,sizeof(*u->rotator),1,fil);
if (u->rotator->origx)
{
u->rotator->origx = CallocMem(u->rotator->num_walls * sizeof(*u->rotator->origx), 1);
u->rotator->origx = (int*)CallocMem(u->rotator->num_walls * sizeof(*u->rotator->origx), 1);
MREAD(u->rotator->origx,sizeof(*u->rotator->origx)*u->rotator->num_walls,1,fil);
}
if (u->rotator->origy)
{
u->rotator->origy = CallocMem(u->rotator->num_walls * sizeof(*u->rotator->origy), 1);
u->rotator->origy = (int*)CallocMem(u->rotator->num_walls * sizeof(*u->rotator->origy), 1);
MREAD(u->rotator->origy,sizeof(*u->rotator->origy)*u->rotator->num_walls,1,fil);
}
}
@ -1117,7 +1117,7 @@ int LoadGame(short save_num)
if (ndx == -1)
break;
otp = CallocMem(sizeof(*otp), 1);
otp = (OrgTileP)CallocMem(sizeof(*otp), 1);
ASSERT(otp);
MREAD(otp, sizeof(*otp),1,fil);

View file

@ -2384,15 +2384,15 @@ SpriteSetup(void)
for (w = startwall, wallcount = 0; w <= endwall; w++)
wallcount++;
u->rotator = CallocMem(sizeof(ROTATOR), 1);
u->rotator = (ROTATORp)CallocMem(sizeof(ROTATOR), 1);
u->rotator->num_walls = wallcount;
u->rotator->open_dest = SP_TAG5(sp);
u->rotator->speed = SP_TAG7(sp);
u->rotator->vel = SP_TAG8(sp);
u->rotator->pos = 0; // closed
u->rotator->tgt = u->rotator->open_dest; // closed
u->rotator->origx = CallocMem(sizeof(u->rotator->origx) * wallcount, 1);
u->rotator->origy = CallocMem(sizeof(u->rotator->origy) * wallcount, 1);
u->rotator->origx = (int*)CallocMem(sizeof(u->rotator->origx) * wallcount, 1);
u->rotator->origy = (int*)CallocMem(sizeof(u->rotator->origy) * wallcount, 1);
u->rotator->orig_speed = u->rotator->speed;
@ -2444,7 +2444,7 @@ SpriteSetup(void)
u->WaitTics = time*15; // 1/8 of a sec
u->Tics = 0;
u->rotator = CallocMem(sizeof(ROTATOR), 1);
u->rotator = (ROTATORp)CallocMem(sizeof(ROTATOR), 1);
u->rotator->open_dest = SP_TAG5(sp);
u->rotator->speed = SP_TAG7(sp);
u->rotator->vel = SP_TAG8(sp);
@ -2598,7 +2598,7 @@ SpriteSetup(void)
User[SpriteNum] = u = SpawnUser(SpriteNum, 0, NULL);
u->WallCount = wallcount;
wall_shade = u->WallShade = CallocMem(u->WallCount * sizeof(*u->WallShade), 1);
wall_shade = u->WallShade = (int8_t*)CallocMem(u->WallCount * sizeof(*u->WallShade), 1);
// save off original wall shades
for (w = startwall, wallcount = 0; w <= endwall; w++)
@ -2654,7 +2654,7 @@ SpriteSetup(void)
// make an wall_shade array and put it in User
User[SpriteNum] = u = SpawnUser(SpriteNum, 0, NULL);
u->WallCount = wallcount;
wall_shade = u->WallShade = CallocMem(u->WallCount * sizeof(*u->WallShade), 1);
wall_shade = u->WallShade = (int8_t*)CallocMem(u->WallCount * sizeof(*u->WallShade), 1);
// save off original wall shades
for (w = startwall, wallcount = 0; w <= endwall; w++)

View file

@ -200,7 +200,7 @@ PutStringTimer(PLAYERp pp, short x, short y, const char *string, short seconds)
if (c > asc_Space && c < 127)
{
nsp = pSpawnFullViewSprite(pp, ac, PRI_FRONT_MAX, offset, y);
nsp->PanelSpriteFunc = func;
nsp->PanelSpriteFunc = (PANEL_SPRITE_FUNCp)func;
nsp->kill_tics = kill_tics;
nsp->ID = id;
offset += tilesiz[ac].x;

View file

@ -368,7 +368,7 @@ void QuickJumpSetup(short stat, short lotag, short type)
//MONO_PRINT(ds);
FreeMem(Track[ndx].TrackPoint);
Track[ndx].TrackPoint = CallocMem((4 * sizeof(TRACK_POINT)), 1);
Track[ndx].TrackPoint = (TRACK_POINTp)CallocMem((4 * sizeof(TRACK_POINT)), 1);
tp = Track[ndx].TrackPoint;
t = &Track[ndx];
@ -431,7 +431,7 @@ void QuickScanSetup(short stat, short lotag, short type)
// save space for 3 points
FreeMem(Track[ndx].TrackPoint);
Track[ndx].TrackPoint = CallocMem((4 * sizeof(TRACK_POINT)), 1);
Track[ndx].TrackPoint = (TRACK_POINTp)CallocMem((4 * sizeof(TRACK_POINT)), 1);
ASSERT(Track[ndx].TrackPoint != NULL);
@ -491,7 +491,7 @@ void QuickExitSetup(short stat, short type)
// save space for 3 points
FreeMem(Track[ndx].TrackPoint);
Track[ndx].TrackPoint = CallocMem((4 * sizeof(TRACK_POINT)), 1);
Track[ndx].TrackPoint = (TRACK_POINTp)CallocMem((4 * sizeof(TRACK_POINT)), 1);
ASSERT(Track[ndx].TrackPoint != NULL);
@ -546,7 +546,7 @@ void QuickLadderSetup(short stat, short lotag, short type)
// save space for 3 points
FreeMem(Track[ndx].TrackPoint);
Track[ndx].TrackPoint = CallocMem((4 * sizeof(TRACK_POINT)), 1);
Track[ndx].TrackPoint = (TRACK_POINTp)CallocMem((4 * sizeof(TRACK_POINT)), 1);
ASSERT(Track[ndx].TrackPoint != NULL);
@ -603,7 +603,7 @@ TrackSetup(void)
{
// for some reason I need at least one record allocated
// can't remember why at this point
Track[ndx].TrackPoint = CallocMem(sizeof(TRACK_POINT) * 1, 1);
Track[ndx].TrackPoint = (TRACK_POINTp)CallocMem(sizeof(TRACK_POINT) * 1, 1);
continue;
}
@ -611,7 +611,7 @@ TrackSetup(void)
// make the track array rather large. I'll resize it to correct size
// later.
Track[ndx].TrackPoint = CallocMem(sizeof(TRACK_POINT) * 500, 1);
Track[ndx].TrackPoint = (TRACK_POINTp)CallocMem(sizeof(TRACK_POINT) * 500, 1);
ASSERT(Track[ndx].TrackPoint != NULL);
@ -678,7 +678,7 @@ TrackSetup(void)
}
size = (Track[ndx].NumPoints + 1) * sizeof(TRACK_POINT);
New = CallocMem(size, 1);
New = (TRACK_POINTp)CallocMem(size, 1);
memcpy(New, Track[ndx].TrackPoint, size);
FreeMem(Track[ndx].TrackPoint);
Track[ndx].TrackPoint = New;
@ -2233,7 +2233,7 @@ void CallbackSOsink(ANIMp ap, void *data)
char found = FALSE;
int tgt_depth;
sop = data;
sop = (SECTOR_OBJECTp)data;
for (i = 0; sop->sector[i] != -1; i++)
{