Split r3159..r3161, part 11: Add explicit casts, pointer types.

git-svn-id: https://svn.eduke32.com/eduke32@3177 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-11-15 14:28:36 +00:00
parent 5ad385c043
commit 61d038f217
12 changed files with 59 additions and 59 deletions

View file

@ -85,8 +85,8 @@ enum osdflags_t
OSD_CAPS = 0x00000040
};
#define OSD_ALIAS (void *)0x1337
#define OSD_UNALIASED (void *)0xDEAD
#define OSD_ALIAS (int32_t (*)(const osdfuncparm_t*))0x1337
#define OSD_UNALIASED (int32_t (*)(const osdfuncparm_t*))0xDEAD
#define OSDCMD_OK 0
#define OSDCMD_SHOWHELP 1

View file

@ -10548,9 +10548,9 @@ void test_map(int32_t mode)
else
{
#ifdef _WIN32
fullparam = Bstrrchr(mapster32_fullpath, '\\');
fullparam = (char *)Bstrrchr(mapster32_fullpath, '\\');
#else
fullparam = Bstrrchr(mapster32_fullpath, '/');
fullparam = (char *)Bstrrchr(mapster32_fullpath, '/');
#endif
if (fullparam)
{

View file

@ -8264,7 +8264,7 @@ int32_t initengine(void)
#if !defined _WIN32 && defined DEBUGGINGAIDS && !defined GEKKO
struct sigaction sigact, oldact;
memset(&sigact, 0, sizeof(sigact));
sigact.sa_sigaction = (void *)sighandler;
sigact.sa_sigaction = (void (*)(int, siginfo_t*, void*))sighandler;
sigact.sa_flags = SA_SIGINFO;
sigaction(SIGFPE, &sigact, &oldact);
#endif
@ -15945,7 +15945,7 @@ static int32_t screencapture_png(const char *filename, char inverseit, const cha
text = (png_textp)png_malloc(png_ptr, 2*png_sizeof(png_text));
text[0].compression = PNG_TEXT_COMPRESSION_NONE;
text[0].key = "Title";
text[0].text = editstatus ? "Mapster32 screenshot" : "EDuke32 screenshot";
text[0].text = (png_charp)(editstatus ? "Mapster32 screenshot" : "EDuke32 screenshot");
text[1].compression = PNG_TEXT_COMPRESSION_NONE;
text[1].key = "Software";

View file

@ -721,7 +721,7 @@ static int32_t mdloadskin_cached(int32_t fil, const texcacheheader *head, int32_
if (!picc) goto failure; else midbuf = picc;
}
if (dedxtfilter(fil, &pict, pic, midbuf, packbuf, (head->flags&4)==4)) goto failure;
if (dedxtfilter(fil, &pict, (char *)pic, (char *)midbuf, (char *)packbuf, (head->flags&4)==4)) goto failure;
bglCompressedTexImage2DARB(GL_TEXTURE_2D,level,pict.format,pict.xdim,pict.ydim,pict.border,
pict.size,pic);

View file

@ -2547,9 +2547,9 @@ static int32_t polymer_buildfloor(int16_t sectnum)
s->curindice = 0;
bgluTessCallback(prtess, GLU_TESS_VERTEX_DATA, polymer_tessvertex);
bgluTessCallback(prtess, GLU_TESS_EDGE_FLAG, polymer_tessedgeflag);
bgluTessCallback(prtess, GLU_TESS_ERROR, polymer_tesserror);
bgluTessCallback(prtess, GLU_TESS_VERTEX_DATA, (void (PR_CALLBACK *)(void))polymer_tessvertex);
bgluTessCallback(prtess, GLU_TESS_EDGE_FLAG, (void (PR_CALLBACK *)(void))polymer_tessedgeflag);
bgluTessCallback(prtess, GLU_TESS_ERROR, (void (PR_CALLBACK *)(void))polymer_tesserror);
bgluTessProperty(prtess, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_POSITIVE);

View file

@ -6547,7 +6547,7 @@ int32_t dxtfilter(int32_t fil, const texcachepicture *pict, const char *pic, voi
if (stride == 16) //If DXT3...
{
//alpha_4x4
cptr = midbuf;
cptr = (char *)midbuf;
for (k=0; k<8; k++) *cptr++ = pic[k];
for (j=stride; (unsigned)j<miplen; j+=stride)
for (k=0; k<8; k++) *cptr++ = pic[j+k];
@ -6573,7 +6573,7 @@ int32_t dxtfilter(int32_t fil, const texcachepicture *pict, const char *pic, voi
}
//rgb0,rgb1
cptr = midbuf;
cptr = (char *)midbuf;
for (k=0; k<=2; k+=2)
for (j=0; (unsigned)j<miplen; j+=stride)
{ *(int16_t *)cptr = hicosub(*(int16_t *)(&pic[offs+j+k])); cptr += 2; }
@ -6598,7 +6598,7 @@ int32_t dxtfilter(int32_t fil, const texcachepicture *pict, const char *pic, voi
Bwrite(fil,writebuf,cleng);
//index_4x4
cptr = midbuf;
cptr = (char *)midbuf;
for (j=0; (unsigned)j<miplen; j+=stride)
{
const char *c2 = &pic[j+offs+4];
@ -6689,7 +6689,7 @@ int32_t dedxtfilter(int32_t fil, const texcachepicture *pict, char *pic, void *m
if (qlz_decompress(packbuf,midbuf,state_decompress) == 0) return -1;
}
cptr = midbuf;
cptr = (char *)midbuf;
for (k=0; k<8; k++) pic[k] = *cptr++;
for (j=stride; j<pict->size; j+=stride)
for (k=0; k<8; k++) pic[j+k] = (*cptr++);
@ -6736,7 +6736,7 @@ int32_t dedxtfilter(int32_t fil, const texcachepicture *pict, char *pic, void *m
if (qlz_decompress(packbuf,midbuf,state_decompress) == 0) return -1;
}
cptr = midbuf;
cptr = (char *)midbuf;
for (k=0; k<=2; k+=2)
{
for (j=0; j<pict->size; j+=stride)
@ -6787,7 +6787,7 @@ int32_t dedxtfilter(int32_t fil, const texcachepicture *pict, char *pic, void *m
if (qlz_decompress(packbuf,midbuf,state_decompress) == 0) return -1;
}
cptr = midbuf;
cptr = (char *)midbuf;
for (j=0; j<pict->size; j+=stride)
{
pic[j+offs+4] = ((cptr[0]>>0)&3) + (((cptr[1]>>0)&3)<<2) + (((cptr[2]>>0)&3)<<4) + (((cptr[3]>>0)&3)<<6);

View file

@ -341,14 +341,14 @@ void qinterpolatedown16short(intptr_t bufptr, int32_t num, int32_t val, int32_t
void clearbuf(void *d, int32_t c, int32_t a)
{
int32_t *p = d;
int32_t *p = (int32_t *)d;
while ((c--) > 0) *(p++) = a;
}
void copybuf(const void *s, void *d, int32_t c)
{
const int32_t *p = s;
const int32_t *p = (const int32_t *)s;
int32_t *q = (int32_t *)d;
while ((c--) > 0) *(q++) = *(p++);
@ -383,16 +383,16 @@ void clearbufbyte(void *D, int32_t c, int32_t a)
void copybufbyte(const void *S, void *D, int32_t c)
{
const char *p = S;
char *q = D;
const char *p = (const char *)S;
char *q = (char *)D;
while ((c--) > 0) *(q++) = *(p++);
}
void copybufreverse(const void *S, void *D, int32_t c)
{
const char *p = S;
char *q = D;
const char *p = (const char *)S;
char *q = (char *)D;
while ((c--) > 0) *(q++) = *(p--);
}

View file

@ -4384,16 +4384,16 @@ static void getnumberptr256(const char *namestart, void *num, int32_t bytes, int
switch (bytes)
{
case 1:
getnumber_dochar(num, danum);
getnumber_dochar((char *)num, danum);
break;
case 2:
getnumber_doint16_t(num, danum);
getnumber_doint16_t((int16_t *)num, danum);
break;
case 4:
getnumber_doint32(num, danum);
getnumber_doint32((int32_t *)num, danum);
break;
case 8:
getnumber_doint64(num, danum);
getnumber_doint64((int64_t *)num, danum);
break;
}
}
@ -4405,16 +4405,16 @@ static void getnumberptr256(const char *namestart, void *num, int32_t bytes, int
switch (bytes)
{
case 1:
getnumber_dochar(num, oldnum);
getnumber_dochar((char *)num, oldnum);
break;
case 2:
getnumber_doint16_t(num, oldnum);
getnumber_doint16_t((int16_t *)num, oldnum);
break;
case 4:
getnumber_doint32(num, oldnum);
getnumber_doint32((int32_t *)num, oldnum);
break;
case 8:
getnumber_doint64(num, oldnum);
getnumber_doint64((int64_t *)num, oldnum);
break;
}
}
@ -6218,21 +6218,21 @@ static void Keys3d(void)
else if (AIMING_AT_CEILING_OR_FLOOR)
{
sector[searchsector].lotag =
_getnumber256("Sector lotag: ", sector[searchsector].lotag, BTAG_MAX, 0, (void *)ExtGetSectorType);
_getnumber256("Sector lotag: ", sector[searchsector].lotag, BTAG_MAX, 0, (void *(*)(int32_t))ExtGetSectorType);
}
else if (AIMING_AT_SPRITE)
{
if (sprite[searchwall].picnum == SECTOREFFECTOR)
{
sprite[searchwall].lotag =
_getnumber256("Sprite lotag: ", sprite[searchwall].lotag, BTAG_MAX, 0+j, (void *)SectorEffectorTagText);
_getnumber256("Sprite lotag: ", sprite[searchwall].lotag, BTAG_MAX, 0+j, (void *(*)(int32_t))SectorEffectorTagText);
}
else if (sprite[searchwall].picnum == MUSICANDSFX)
{
int16_t oldtag = sprite[searchwall].lotag;
sprite[searchwall].lotag =
_getnumber256("Sprite lotag: ", sprite[searchwall].lotag, BTAG_MAX, 0+j, (void *)MusicAndSFXTagText);
_getnumber256("Sprite lotag: ", sprite[searchwall].lotag, BTAG_MAX, 0+j, (void *(*)(int32_t))MusicAndSFXTagText);
if ((sprite[searchwall].filler&1) && sprite[searchwall].lotag != oldtag)
{
@ -7870,7 +7870,7 @@ static void Keys2d(void)
j = 4*(j&1);
Bsprintf(buffer,"Sprite (%d) Lo-tag: ", i);
sprite[i].lotag = _getnumber16(buffer, sprite[i].lotag, BTAG_MAX, 0+j, sprite[i].picnum==SECTOREFFECTOR ?
(void *)SectorEffectorTagText : NULL);
(void *(*)(int32_t))SectorEffectorTagText : NULL);
}
else if (linehighlight >= 0)
{
@ -7894,7 +7894,7 @@ static void Keys2d(void)
{
Bsprintf(buffer,"Sector (%d) Lo-tag: ", tcursectornum);
sector[tcursectornum].lotag =
_getnumber16(buffer, sector[tcursectornum].lotag, BTAG_MAX, 0, (void *)ExtGetSectorType);
_getnumber16(buffer, sector[tcursectornum].lotag, BTAG_MAX, 0, (void *(*)(int32_t))ExtGetSectorType);
}
}
}

View file

@ -8487,7 +8487,7 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload)
newptr = Brealloc(anim_hi_sounds[animnum], allocsz*2*sizeof(anim_hi_sounds[0]));
if (!newptr) break;
anim_hi_sounds[animnum] = newptr;
anim_hi_sounds[animnum] = (uint16_t *)newptr;
}
bad=0;
@ -8970,7 +8970,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
break;
case 'd':
{
char *colon = Bstrchr(c, ':');
char * colon = (char *)Bstrchr(c, ':');
int32_t framespertic=-1, numrepeats=1;
c++;

View file

@ -23,7 +23,7 @@
void ClearBuffer_DW( void *ptr, unsigned data, int32_t length )
{
unsigned *ptrdw = ptr;
unsigned *ptrdw = (unsigned *)ptr;
while (length--) {
*(ptrdw++) = data;
}

View file

@ -1183,7 +1183,7 @@ skip_check:
int32_t o_g_st=vm.g_st, arsize = aGameArrays[aridx].size;
instype *end=insptr;
int32_t sectcnt, numsects=0;
int16_t *sectlist = aGameArrays[aridx].vals; // actually an int32_t array
int16_t *sectlist = (int16_t *)aGameArrays[aridx].vals; // actually an int32_t array
int32_t *sectlist32 = (int32_t *)sectlist;
int32_t j, startwall, endwall, ns;
static uint8_t sectbitmap[MAXSECTORS>>3];

View file

@ -41,7 +41,7 @@ uint8_t g_oldverSavegame[10];
void G_Util_PtrToIdx(void *ptr, int32_t count, const void *base, int32_t mode)
{
int32_t i;
intptr_t *iptr = ptr;
intptr_t *iptr = (intptr_t *)ptr;
intptr_t ibase = (intptr_t)base;
int32_t back_p = mode&P2I_BACK_BIT;
int32_t onlynon0_p = mode&P2I_ONLYNON0_BIT;
@ -485,7 +485,7 @@ static uint8_t *writespecdata(const dataspec_t *spec, FILE *fil, uint8_t *dump)
if (sp->flags&DS_STRING)
{
fwrite(sp->ptr, Bstrlen(sp->ptr), 1, fil); // not null-terminated!
fwrite(sp->ptr, Bstrlen((const char *)sp->ptr), 1, fil); // not null-terminated!
continue;
}
@ -537,7 +537,7 @@ static int32_t readspecdata(const dataspec_t *spec, int32_t fil, uint8_t **dumpv
if (sp->flags&(DS_STRING|DS_CMP)) // DS_STRING and DS_CMP is for static data only
{
if (sp->flags&(DS_STRING))
i = Bstrlen(sp->ptr);
i = Bstrlen((const char *)sp->ptr);
else
i = sp->size*sp->cnt;
@ -559,7 +559,7 @@ static int32_t readspecdata(const dataspec_t *spec, int32_t fil, uint8_t **dumpv
if (fil>=0)
{
mem = (dump && (sp->flags&DS_NOCHK)==0) ? dump : ptr;
mem = (dump && (sp->flags&DS_NOCHK)==0) ? dump : (uint8_t *)ptr;
if ((sp->flags&DS_CNTMASK)==0 && sp->size*cnt<=savegame_comprthres)
{
@ -642,15 +642,15 @@ static void docmpsd(const void *ptr, void *dump, uint32_t size, uint32_t cnt, ui
#define CPDATA(Datbits) do \
{ \
const UINT(Datbits) *p=ptr; \
UINT(Datbits) *op=dump; \
uint32_t i, nelts=(size*cnt)/BYTES(Datbits); \
if (nelts>65536) \
CPELTS(32,Datbits); \
else if (nelts>256) \
CPELTS(16,Datbits); \
else \
CPELTS(8,Datbits); \
const UINT(Datbits) *p=(UINT(Datbits) *)ptr; \
UINT(Datbits) *op=(UINT(Datbits) *)dump; \
uint32_t i, nelts=(size*cnt)/BYTES(Datbits); \
if (nelts>65536) \
CPELTS(32,Datbits); \
else if (nelts>256) \
CPELTS(16,Datbits); \
else \
CPELTS(8,Datbits); \
} while (0)
if (size==8)
@ -685,7 +685,7 @@ static void cmpspecdata(const dataspec_t *spec, uint8_t **dumpvar, uint8_t **dif
void *ptr;
uint8_t *dump=*dumpvar, *diff=*diffvar, *tmptr;
const dataspec_t *sp=spec;
int32_t cnt, eltnum=0, nbytes=(getnumvar(spec)+7)>>3, l=Bstrlen(spec->ptr);
int32_t cnt, eltnum=0, nbytes=(getnumvar(spec)+7)>>3, l=Bstrlen((const char *)spec->ptr);
Bmemcpy(diff, spec->ptr, l);
diff+=l;
@ -728,7 +728,7 @@ static int32_t applydiff(const dataspec_t *spec, uint8_t **dumpvar, uint8_t **di
{
uint8_t *dumptr=*dumpvar, *diffptr=*diffvar;
const dataspec_t *sp=spec;
int32_t cnt, eltnum=-1, nbytes=(getnumvar(spec)+7)>>3, l=Bstrlen(spec->ptr);
int32_t cnt, eltnum=-1, nbytes=(getnumvar(spec)+7)>>3, l=Bstrlen((const char *)spec->ptr);
if (Bmemcmp(diffptr, spec->ptr, l)) // check STRING magic (sync check)
return 1;
@ -882,7 +882,7 @@ static uint8_t savegame_restdata[SVARDATALEN];
static const dataspec_t svgm_udnetw[] =
{
{ DS_STRING, "blK:udnt", 0, 1 },
{ DS_STRING, (void *)"blK:udnt", 0, 1 },
{ 0, &ud.multimode, sizeof(ud.multimode), 1 },
{ 0, &g_numPlayerSprites, sizeof(g_numPlayerSprites), 1 },
{ 0, &g_playerSpawnPoints, sizeof(g_playerSpawnPoints), 1 },
@ -925,7 +925,7 @@ static const dataspec_t svgm_udnetw[] =
static const dataspec_t svgm_secwsp[] =
{
{ DS_STRING, "blK:swsp", 0, 1 },
{ DS_STRING, (void *)"blK:swsp", 0, 1 },
{ DS_NOCHK, &numwalls, sizeof(numwalls), 1 },
{ DS_MAINAR|DS_CNT(numwalls), &wall, sizeof(walltype), (intptr_t)&numwalls },
{ DS_NOCHK, &numsectors, sizeof(numsectors), 1 },
@ -969,7 +969,7 @@ static const dataspec_t svgm_secwsp[] =
static const dataspec_t svgm_script[] =
{
{ DS_STRING, "blK:scri", 0, 1 },
{ DS_STRING, (void *)"blK:scri", 0, 1 },
{ DS_NOCHK, &g_scriptSize, sizeof(g_scriptSize), 1 },
{ DS_SAVEFN|DS_LOADFN|DS_NOCHK, (void *)&sv_calcbitptrsize, 0, 1 },
{ DS_DYNAMIC|DS_CNT(savegame_bitptrsize)|DS_NOCHK, &bitptr, sizeof(bitptr[0]), (intptr_t)&savegame_bitptrsize },
@ -990,7 +990,7 @@ static const dataspec_t svgm_script[] =
static const dataspec_t svgm_anmisc[] =
{
{ DS_STRING, "blK:anms", 0, 1 },
{ DS_STRING, (void *)"blK:anms", 0, 1 },
{ 0, &g_animateCount, sizeof(g_animateCount), 1 },
{ 0, &animatesect[0], sizeof(animatesect[0]), MAXANIMATES },
{ 0, &animategoal[0], sizeof(animategoal[0]), MAXANIMATES },
@ -1031,7 +1031,7 @@ static const dataspec_t svgm_anmisc[] =
{ 0, savegame_restdata, 1, sizeof(savegame_restdata) }, // sz/cnt swapped for kdfread
{ DS_LOADFN, (void *)&sv_restload, 0, 1 },
{ DS_STRING, "savegame_end", 0, 1 },
{ DS_STRING, (void *)"savegame_end", 0, 1 },
{ DS_END, 0, 0, 0 }
};