From 61d038f217538e45b20fee329a68749ad3eef9ba Mon Sep 17 00:00:00 2001 From: helixhorned Date: Thu, 15 Nov 2012 14:28:36 +0000 Subject: [PATCH] Split r3159..r3161, part 11: Add explicit casts, pointer types. git-svn-id: https://svn.eduke32.com/eduke32@3177 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/osd.h | 4 +-- polymer/eduke32/build/src/build.c | 4 +-- polymer/eduke32/build/src/engine.c | 4 +-- polymer/eduke32/build/src/mdsprite.c | 2 +- polymer/eduke32/build/src/polymer.c | 6 ++-- polymer/eduke32/build/src/polymost.c | 12 +++---- polymer/eduke32/build/src/pragmas.c | 12 +++---- polymer/eduke32/source/astub.c | 26 +++++++------- polymer/eduke32/source/game.c | 4 +-- polymer/eduke32/source/jaudiolib/src/mix.c | 2 +- polymer/eduke32/source/m32exec.c | 2 +- polymer/eduke32/source/savegame.c | 40 +++++++++++----------- 12 files changed, 59 insertions(+), 59 deletions(-) diff --git a/polymer/eduke32/build/include/osd.h b/polymer/eduke32/build/include/osd.h index b73ced1f6..341737008 100644 --- a/polymer/eduke32/build/include/osd.h +++ b/polymer/eduke32/build/include/osd.h @@ -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 diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index 71df8f41c..a5a43eea9 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -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) { diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index c78bc292b..6bd1820b3 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -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"; diff --git a/polymer/eduke32/build/src/mdsprite.c b/polymer/eduke32/build/src/mdsprite.c index 072d7ccc3..4ecce3b09 100644 --- a/polymer/eduke32/build/src/mdsprite.c +++ b/polymer/eduke32/build/src/mdsprite.c @@ -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); diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index 2160f2e34..dd7c30ea3 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -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); diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index 3e89fbf43..2c894670a 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -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)jsize; 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; jsize; 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; jsize; 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); diff --git a/polymer/eduke32/build/src/pragmas.c b/polymer/eduke32/build/src/pragmas.c index f88d2f175..9aeefa591 100644 --- a/polymer/eduke32/build/src/pragmas.c +++ b/polymer/eduke32/build/src/pragmas.c @@ -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--); } diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 9688379e8..3963b0f96 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -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); } } } diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index ee062fc1b..9e737ffaf 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -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++; diff --git a/polymer/eduke32/source/jaudiolib/src/mix.c b/polymer/eduke32/source/jaudiolib/src/mix.c index 592e38af4..edf2cc9ab 100644 --- a/polymer/eduke32/source/jaudiolib/src/mix.c +++ b/polymer/eduke32/source/jaudiolib/src/mix.c @@ -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; } diff --git a/polymer/eduke32/source/m32exec.c b/polymer/eduke32/source/m32exec.c index f2b04771b..0636a80b2 100644 --- a/polymer/eduke32/source/m32exec.c +++ b/polymer/eduke32/source/m32exec.c @@ -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]; diff --git a/polymer/eduke32/source/savegame.c b/polymer/eduke32/source/savegame.c index 303887323..9811492e8 100644 --- a/polymer/eduke32/source/savegame.c +++ b/polymer/eduke32/source/savegame.c @@ -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 } };