Split r3159..r3161, part 10: add explicit casts to *alloc return values.

NOTE: changes such as these are best viewed with something like
git diff (...) --color-words='[a-zA-Z0-9_]+|[^[:space:]]'

git-svn-id: https://svn.eduke32.com/eduke32@3176 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-11-15 14:28:29 +00:00
parent 6b01b43713
commit 5ad385c043
22 changed files with 185 additions and 185 deletions

View file

@ -1580,19 +1580,19 @@ static int32_t backup_highlighted_map(mapinfofull_t *mapinfo)
}
// allocate temp storage
ptrs[np++] = mapinfo->sector = Bmalloc(highlightsectorcnt * sizeof(sectortype));
ptrs[np++] = mapinfo->sector = (sectortype *)Bmalloc(highlightsectorcnt * sizeof(sectortype));
if (!mapinfo->sector) return -2;
ptrs[np++] = mapinfo->wall = Bmalloc(tmpnumwalls * sizeof(walltype));
ptrs[np++] = mapinfo->wall = (walltype *)Bmalloc(tmpnumwalls * sizeof(walltype));
if (!mapinfo->wall) { free_n_ptrs(ptrs, np-1); return -2; }
#ifdef YAX_ENABLE
if (mapinfo->numyaxbunches > 0)
{
ptrs[np++] = mapinfo->bunchnum = Bmalloc(highlightsectorcnt*2*sizeof(int16_t));
ptrs[np++] = mapinfo->bunchnum = (int16_t *)Bmalloc(highlightsectorcnt*2*sizeof(int16_t));
if (!mapinfo->bunchnum) { free_n_ptrs(ptrs, np-1); return -2; }
ptrs[np++] = mapinfo->ynextwall = Bmalloc(tmpnumwalls*2*sizeof(int16_t));
ptrs[np++] = mapinfo->ynextwall = (int16_t *)Bmalloc(tmpnumwalls*2*sizeof(int16_t));
if (!mapinfo->ynextwall) { free_n_ptrs(ptrs, np-1); return -2; }
}
else
@ -1603,7 +1603,7 @@ static int32_t backup_highlighted_map(mapinfofull_t *mapinfo)
if (tmpnumsprites>0)
{
ptrs[np++] = mapinfo->sprite = Bmalloc(tmpnumsprites * sizeof(spritetype));
ptrs[np++] = mapinfo->sprite = (spritetype *)Bmalloc(tmpnumsprites * sizeof(spritetype));
if (!mapinfo->sprite) { free_n_ptrs(ptrs, np-1); return -2; }
}
else
@ -2445,7 +2445,7 @@ static int32_t backup_drawn_walls(int32_t restore)
if (newnumwalls <= numwalls) // shouldn't happen
return 2;
tmpwall = Bmalloc((newnumwalls-numwalls) * sizeof(walltype));
tmpwall = (walltype *)Bmalloc((newnumwalls-numwalls) * sizeof(walltype));
if (!tmpwall)
return 1;
@ -2732,7 +2732,7 @@ static int32_t bakframe_fillandfade(char **origframeptr, int32_t sectnum, const
{
if (!*origframeptr)
{
*origframeptr = Bmalloc(xdim*ydim);
*origframeptr = (char *)Bmalloc(xdim*ydim);
if (*origframeptr)
{
begindrawing();
@ -4969,8 +4969,8 @@ end_yax: ;
sector[refsect].wallnum += n;
if (refsect != numsectors-1)
{
walltype *tmpwall = Bmalloc(n * sizeof(walltype));
int16_t *tmponw = Bmalloc(n * sizeof(int16_t));
walltype *tmpwall = (walltype *)Bmalloc(n * sizeof(walltype));
int16_t *tmponw = (int16_t *)Bmalloc(n * sizeof(int16_t));
if (!tmpwall || !tmponw)
{
@ -10573,7 +10573,7 @@ void test_map(int32_t mode)
// and a possible extra space not in testplay_addparam,
// the length should be Bstrlen(game_executable)+Bstrlen(param)+(slen+1)+2+1.
fullparam = Bmalloc(Bstrlen(game_executable)+Bstrlen(param)+slen+4);
fullparam = (char *)Bmalloc(Bstrlen(game_executable)+Bstrlen(param)+slen+4);
Bsprintf(fullparam,"\"%s\"",game_executable);
if (testplay_addparam)

View file

@ -163,9 +163,9 @@ static void tile_from_truecolpic(int32_t tile, const palette_t *picptr, int32_t
const int32_t xsiz = tilesizx[tile], ysiz = tilesizy[tile];
int32_t i, j;
char *ftd = Bmalloc(xsiz*ysiz);
char *ftd = (char *)Bmalloc(xsiz*ysiz);
faketiledata[tile] = Bmalloc(xsiz*ysiz + 400);
faketiledata[tile] = (char *)Bmalloc(xsiz*ysiz + 400);
for (i=xsiz-1; i>=0; i--)
{
@ -1484,7 +1484,7 @@ static int32_t defsparser(scriptfile *script)
fd = kopen4load(fn, 0);
// load the highpalookup and send it to polymer
highpaldata = Bmalloc(PR_HIGHPALOOKUP_DATA_SIZE);
highpaldata = (char *)Bmalloc(PR_HIGHPALOOKUP_DATA_SIZE);
{
char *filebuf;
@ -1492,7 +1492,7 @@ static int32_t defsparser(scriptfile *script)
filesize = kfilelength(fd);
filebuf = Bmalloc(filesize);
filebuf = (char *)Bmalloc(filesize);
if (!filebuf) { kclose(fd); Bfree(highpaldata); break; }
klseek(fd, 0, SEEK_SET);

View file

@ -863,8 +863,8 @@ void yax_preparedrawrooms(void)
if (getrendermode()==0 && ymostallocsize < xdimen*numyaxbunches)
{
ymostallocsize = xdimen*numyaxbunches;
yumost = Brealloc(yumost, ymostallocsize*sizeof(int16_t));
ydmost = Brealloc(ydmost, ymostallocsize*sizeof(int16_t));
yumost = (int16_t *)Brealloc(yumost, ymostallocsize*sizeof(int16_t));
ydmost = (int16_t *)Brealloc(ydmost, ymostallocsize*sizeof(int16_t));
if (!yumost || !ydmost)
{
@ -1332,9 +1332,9 @@ int32_t clipmapinfo_load(void)
clipmapinfo_init();
loadsector = Bmalloc(MAXSECTORS * sizeof(sectortype));
loadwall = Bmalloc(MAXWALLS * sizeof(walltype));
loadsprite = Bmalloc(MAXSPRITES * sizeof(spritetype));
loadsector = (sectortype *)Bmalloc(MAXSECTORS * sizeof(sectortype));
loadwall = (walltype *)Bmalloc(MAXWALLS * sizeof(walltype));
loadsprite = (spritetype *)Bmalloc(MAXSPRITES * sizeof(spritetype));
if (!loadsector || !loadwall || !loadsprite)
{
@ -1408,8 +1408,8 @@ int32_t clipmapinfo_load(void)
}
// shrink
loadsector = Brealloc(loadsector, ournumsectors*sizeof(sectortype));
loadwall = Brealloc(loadwall, ournumwalls*sizeof(walltype));
loadsector = (sectortype *)Brealloc(loadsector, ournumsectors*sizeof(sectortype));
loadwall = (walltype *)Brealloc(loadwall, ournumwalls*sizeof(walltype));
Bmemcpy(sector, loadsector, ournumsectors*sizeof(sectortype));
Bmemcpy(wall, loadwall, ournumwalls*sizeof(walltype));
@ -1419,7 +1419,7 @@ int32_t clipmapinfo_load(void)
// vvvv don't use headsprite[sect,stat]! vvvv
sectoidx = Bmalloc(numsectors*sizeof(sectoidx[0]));
sectoidx = (int16_t *)Bmalloc(numsectors*sizeof(sectoidx[0]));
if (!sectoidx || !sector || !wall)
{
clipmapinfo_init();
@ -1461,8 +1461,8 @@ int32_t clipmapinfo_load(void)
int16_t ns, outersect;
int32_t pn,scnt, x,y,z, maxdist;
sectq = Bmalloc(numsectors*sizeof(sectq[0]));
tempictoidx = Bmalloc(MAXTILES*sizeof(tempictoidx[0]));
sectq = (int16_t *)Bmalloc(numsectors*sizeof(sectq[0]));
tempictoidx = (int16_t *)Bmalloc(MAXTILES*sizeof(tempictoidx[0]));
if (!sectq || !tempictoidx)
{
clipmapinfo_init();
@ -1701,7 +1701,7 @@ int32_t clipmapinfo_load(void)
Bmemcpy(loadwall, wall, ournumwalls*sizeof(walltype));
// loadwallinv will contain all walls with inverted orientation for x/y-flip handling
loadwallinv = Bmalloc(ournumwalls*sizeof(walltype));
loadwallinv = (walltype *)Bmalloc(ournumwalls*sizeof(walltype));
if (!loadwallinv)
{
clipmapinfo_init();
@ -7678,8 +7678,8 @@ static int32_t loadpalette(void)
kread(fil,palette,768);
kread(fil,&numshades,2); numshades = B_LITTLE16(numshades);
palookup[0] = Bmalloc(numshades<<8);
transluc = Bmalloc(65536);
palookup[0] = (char *)Bmalloc(numshades<<8);
transluc = (char *)Bmalloc(65536);
if (palookup[0] == NULL || transluc == NULL)
exit(1);
@ -10309,7 +10309,7 @@ int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t da
Bfree(lookups);
j = ydim*4; //Leave room for horizlookup&horizlookup2
lookups = Bmalloc(2*j*sizeof(lookups[0]));
lookups = (int32_t *)Bmalloc(2*j*sizeof(lookups[0]));
if (lookups == NULL)
{
@ -10522,7 +10522,7 @@ int32_t loadpics(const char *filename, int32_t askedsize)
if (filegrp[fil] == 254) // from zip
{
i = kfilelength(fil);
artptrs[tilefilei] = Brealloc(artptrs[tilefilei], i);
artptrs[tilefilei] = (char *)Brealloc(artptrs[tilefilei], i);
klseek(fil, 0, BSEEK_SET);
kread(fil, artptrs[tilefilei], i);
}
@ -13614,7 +13614,7 @@ void makepalookup(int32_t palnum, const char *remapbuf, int8_t r, int8_t g, int8
if (palookup[palnum] == NULL || (palnum!=0 && palookup[palnum] == palookup[0]))
{
//Allocate palookup buffer
palookup[palnum] = Bmalloc(numshades<<8);
palookup[palnum] = (char *)Bmalloc(numshades<<8);
if (palookup[palnum] == NULL)
exit(1);
}
@ -14315,7 +14315,7 @@ void setfirstwall(int16_t sectnum, int16_t newfirstwall)
if ((newfirstwall < startwall) || (newfirstwall >= startwall+danumwalls)) return;
tmpwall = Bmalloc(danumwalls * sizeof(walltype));
tmpwall = (walltype *)Bmalloc(danumwalls * sizeof(walltype));
if (!tmpwall)
{
initprintf("setfirstwall: OUT OF MEMORY!\n");
@ -16258,7 +16258,7 @@ void setpolymost2dview(void)
void hash_init(hashtable_t *t)
{
hash_free(t);
t->items=Bcalloc(1, t->size * sizeof(hashitem_t));
t->items=(hashitem_t **)Bcalloc(1, t->size * sizeof(hashitem_t));
}
void hash_free(hashtable_t *t)

View file

@ -369,7 +369,7 @@ int32_t md_defineanimation(int32_t modelid, const char *framestart, const char *
ma.fpssc = fpssc;
ma.flags = flags;
map = Bmalloc(sizeof(mdanim_t));
map = (mdanim_t *)Bmalloc(sizeof(mdanim_t));
if (!map) return(-4);
Bmemcpy(map, &ma, sizeof(ma));
@ -1161,7 +1161,7 @@ static void mdloadvbos(md3model_t *m)
{
int32_t i;
m->vbos = Bmalloc(m->head.numsurfs * sizeof(GLuint));
m->vbos = (GLuint *)Bmalloc(m->head.numsurfs * sizeof(GLuint));
bglGenBuffersARB(m->head.numsurfs, m->vbos);
i = 0;
@ -1417,9 +1417,9 @@ static md2model_t *md2load(int32_t fil, const char *filnam)
m3->skinmap = sk;
}
m3->indexes = Bmalloc(sizeof(uint16_t) * s->numtris);
m3->vindexes = Bmalloc(sizeof(uint16_t) * s->numtris * 3);
m3->maxdepths = Bmalloc(sizeof(float) * s->numtris);
m3->indexes = (uint16_t *)Bmalloc(sizeof(uint16_t) * s->numtris);
m3->vindexes = (uint16_t *)Bmalloc(sizeof(uint16_t) * s->numtris * 3);
m3->maxdepths = (float *)Bmalloc(sizeof(float) * s->numtris);
if (!m3->indexes || !m3->vindexes || !m3->maxdepths)
QuitOnFatalError("OUT OF MEMORY in md2load!");
@ -1639,9 +1639,9 @@ static md3model_t *md3load(int32_t fil)
}
#endif
m->indexes = Bmalloc(sizeof(uint16_t) * maxtrispersurf);
m->vindexes = Bmalloc(sizeof(uint16_t) * maxtrispersurf * 3);
m->maxdepths = Bmalloc(sizeof(float) * maxtrispersurf);
m->indexes = (uint16_t *)Bmalloc(sizeof(uint16_t) * maxtrispersurf);
m->vindexes = (uint16_t *)Bmalloc(sizeof(uint16_t) * maxtrispersurf * 3);
m->maxdepths = (float *)Bmalloc(sizeof(float) * maxtrispersurf);
if (!m->indexes || !m->vindexes || !m->maxdepths)
QuitOnFatalError("OUT OF MEMORY in md3load!");
@ -1857,9 +1857,9 @@ int md3postload_polymer(md3model_t *m)
initprintf("size %d (%d fr, %d v): md %s surf %d/%d\n", i, m->head.numframes, s->numverts,
m->head.nam, surfi, m->head.numsurfs);
#endif
s->geometry = Bcalloc(m->head.numframes * s->numverts * sizeof(float), 15);
s->geometry = (float *)Bcalloc(m->head.numframes * s->numverts * sizeof(float), 15);
numtris = Bcalloc(s->numverts, sizeof(int));
numtris = (int *)Bcalloc(s->numverts, sizeof(int));
if (!s->geometry || !numtris)
QuitOnFatalError("OUT OF MEMORY in md3postload_polymer!");
@ -3473,8 +3473,8 @@ int32_t mddraw(const spritetype *tspr)
if (r_vbos && (r_vbocount > allocvbos))
{
indexvbos = Brealloc(indexvbos, sizeof(GLuint) * r_vbocount);
vertvbos = Brealloc(vertvbos, sizeof(GLuint) * r_vbocount);
indexvbos = (GLuint *)Brealloc(indexvbos, sizeof(GLuint) * r_vbocount);
vertvbos = (GLuint *)Brealloc(vertvbos, sizeof(GLuint) * r_vbocount);
bglGenBuffersARB(r_vbocount - allocvbos, &(indexvbos[allocvbos]));
bglGenBuffersARB(r_vbocount - allocvbos, &(vertvbos[allocvbos]));

View file

@ -1574,7 +1574,7 @@ void polymer_texinvalidate(void)
void polymer_definehighpalookup(char basepalnum, char palnum, char *data)
{
prhighpalookups[basepalnum][palnum].data = Bmalloc(PR_HIGHPALOOKUP_DATA_SIZE);
prhighpalookups[basepalnum][palnum].data = (char *)Bmalloc(PR_HIGHPALOOKUP_DATA_SIZE);
Bmemcpy(prhighpalookups[basepalnum][palnum].data, data, PR_HIGHPALOOKUP_DATA_SIZE);
}
@ -1634,8 +1634,8 @@ static void polymer_displayrooms(int16_t dacursectnum)
mirrorcount = 0;
localsectormasks = Bmalloc(sizeof(int16_t) * numsectors);
localsectormaskcount = Bcalloc(sizeof(int16_t), 1);
localsectormasks = (int16_t *)Bmalloc(sizeof(int16_t) * numsectors);
localsectormaskcount = (int16_t *)Bcalloc(sizeof(int16_t), 1);
cursectormasks = localsectormasks;
cursectormaskcount = localsectormaskcount;
@ -2176,17 +2176,17 @@ static int32_t polymer_initsector(int16_t sectnum)
if (pr_verbosity >= 2) OSD_Printf("PR : Initializing sector %i...\n", sectnum);
sec = &sector[sectnum];
s = Bcalloc(1, sizeof(_prsector));
s = (_prsector *)Bcalloc(1, sizeof(_prsector));
if (s == NULL)
{
if (pr_verbosity >= 1) OSD_Printf("PR : Cannot initialize sector %i : Bmalloc failed.\n", sectnum);
return (0);
}
s->verts = Bcalloc(sec->wallnum, sizeof(GLdouble) * 3);
s->floor.buffer = Bcalloc(sec->wallnum, sizeof(GLfloat) * 5);
s->verts = (GLdouble *)Bcalloc(sec->wallnum, sizeof(GLdouble) * 3);
s->floor.buffer = (GLfloat *)Bcalloc(sec->wallnum, sizeof(GLfloat) * 5);
s->floor.vertcount = sec->wallnum;
s->ceil.buffer = Bcalloc(sec->wallnum, sizeof(GLfloat) * 5);
s->ceil.buffer = (GLfloat *)Bcalloc(sec->wallnum, sizeof(GLfloat) * 5);
s->ceil.vertcount = sec->wallnum;
if ((s->verts == NULL) || (s->floor.buffer == NULL) || (s->ceil.buffer == NULL))
{
@ -2516,8 +2516,8 @@ void PR_CALLBACK polymer_tessvertex(void* vertex, void* sector)
{
if (pr_verbosity >= 2) OSD_Printf("PR : Indice overflow, extending the indices list... !\n");
s->indicescount++;
s->floor.indices = Brealloc(s->floor.indices, s->indicescount * sizeof(GLushort));
s->ceil.indices = Brealloc(s->ceil.indices, s->indicescount * sizeof(GLushort));
s->floor.indices = (GLushort *)Brealloc(s->floor.indices, s->indicescount * sizeof(GLushort));
s->ceil.indices = (GLushort *)Brealloc(s->ceil.indices, s->indicescount * sizeof(GLushort));
}
s->ceil.indices[s->curindice] = (intptr_t)vertex;
s->curindice++;
@ -2541,8 +2541,8 @@ static int32_t polymer_buildfloor(int16_t sectnum)
if (s->floor.indices == NULL)
{
s->indicescount = (max(3, sec->wallnum) - 2) * 3;
s->floor.indices = Bcalloc(s->indicescount, sizeof(GLushort));
s->ceil.indices = Bcalloc(s->indicescount, sizeof(GLushort));
s->floor.indices = (GLushort *)Bcalloc(s->indicescount, sizeof(GLushort));
s->ceil.indices = (GLushort *)Bcalloc(s->indicescount, sizeof(GLushort));
}
s->curindice = 0;
@ -2686,7 +2686,7 @@ static int32_t polymer_initwall(int16_t wallnum)
if (pr_verbosity >= 2) OSD_Printf("PR : Initializing wall %i...\n", wallnum);
w = Bcalloc(1, sizeof(_prwall));
w = (_prwall *)Bcalloc(1, sizeof(_prwall));
if (w == NULL)
{
if (pr_verbosity >= 1) OSD_Printf("PR : Cannot initialize wall %i : Bmalloc failed.\n", wallnum);
@ -2694,13 +2694,13 @@ static int32_t polymer_initwall(int16_t wallnum)
}
if (w->mask.buffer == NULL) {
w->mask.buffer = Bmalloc(4 * sizeof(GLfloat) * 5);
w->mask.buffer = (GLfloat *)Bmalloc(4 * sizeof(GLfloat) * 5);
w->mask.vertcount = 4;
}
if (w->bigportal == NULL)
w->bigportal = Bmalloc(4 * sizeof(GLfloat) * 5);
w->bigportal = (GLfloat *)Bmalloc(4 * sizeof(GLfloat) * 5);
if (w->cap == NULL)
w->cap = Bmalloc(4 * sizeof(GLfloat) * 3);
w->cap = (GLfloat *)Bmalloc(4 * sizeof(GLfloat) * 3);
bglGenBuffersARB(1, &w->wall.vbo);
bglGenBuffersARB(1, &w->over.vbo);
@ -2794,7 +2794,7 @@ static void polymer_updatewall(int16_t wallnum)
}
if (w->wall.buffer == NULL) {
w->wall.buffer = Bcalloc(4, sizeof(GLfloat) * 5); // XXX
w->wall.buffer = (GLfloat *)Bcalloc(4, sizeof(GLfloat) * 5); // XXX
w->wall.vertcount = 4;
}
@ -2995,7 +2995,7 @@ static void polymer_updatewall(int16_t wallnum)
if ((overwall) || (wal->cstat & 16) || (wal->cstat & 32))
{
if (w->over.buffer == NULL) {
w->over.buffer = Bmalloc(4 * sizeof(GLfloat) * 5);
w->over.buffer = (GLfloat *)Bmalloc(4 * sizeof(GLfloat) * 5);
w->over.vertcount = 4;
}
@ -4373,9 +4373,9 @@ static void polymer_loadmodelvbos(md3model_t* m)
int32_t i;
md3surf_t *s;
m->indices = Bmalloc(m->head.numsurfs * sizeof(GLuint));
m->texcoords = Bmalloc(m->head.numsurfs * sizeof(GLuint));
m->geometry = Bmalloc(m->head.numsurfs * sizeof(GLuint));
m->indices = (GLuint *)Bmalloc(m->head.numsurfs * sizeof(GLuint));
m->texcoords = (GLuint *)Bmalloc(m->head.numsurfs * sizeof(GLuint));
m->geometry = (GLuint *)Bmalloc(m->head.numsurfs * sizeof(GLuint));
bglGenBuffersARB(m->head.numsurfs, m->indices);
bglGenBuffersARB(m->head.numsurfs, m->texcoords);
@ -5227,7 +5227,7 @@ out:
}
oldhead = prlights[lighti].planelist;
prlights[lighti].planelist = Bmalloc(sizeof(_prplanelist));
prlights[lighti].planelist = (_prplanelist *)Bmalloc(sizeof(_prplanelist));
prlights[lighti].planelist->n = oldhead;
prlights[lighti].planelist->plane = plane;
@ -5653,7 +5653,7 @@ static void polymer_initrendertargets(int32_t count)
ocount = count;
//////////
prrts = Bcalloc(count, sizeof(_prrt));
prrts = (_prrt *)Bcalloc(count, sizeof(_prrt));
i = 0;
while (i < count)

View file

@ -1544,14 +1544,14 @@ void writexcache(const char *fn, int32_t len, int32_t dameth, char effect, texca
if (alloclen < miplen)
{
void *picc = Brealloc(pic, miplen);
char *picc = (char *)Brealloc(pic, miplen);
if (!picc) goto failure; else pic = picc;
alloclen = miplen;
picc = Brealloc(packbuf, alloclen+400);
picc = (char *)Brealloc(packbuf, alloclen+400);
if (!picc) goto failure; else packbuf = picc;
picc = Brealloc(midbuf, miplen);
picc = (char *)Brealloc(midbuf, miplen);
if (!picc) goto failure; else midbuf = picc;
}
@ -1666,14 +1666,14 @@ static int32_t gloadtile_cached(int32_t fil, const texcacheheader *head, int32_t
if (alloclen < pict.size)
{
void *picc = Brealloc(pic, pict.size);
char *picc = (char *)Brealloc(pic, pict.size);
if (!picc) goto failure; else pic = picc;
alloclen = pict.size;
picc = Brealloc(packbuf, alloclen+16);
picc = (char *)Brealloc(packbuf, alloclen+16);
if (!picc) goto failure; else packbuf = picc;
picc = Brealloc(midbuf, pict.size);
picc = (char *)Brealloc(midbuf, pict.size);
if (!picc) goto failure; else midbuf = picc;
}
@ -1831,13 +1831,13 @@ static int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicre
lastfn = fn; // careful...
if (!lastpic)
{
lastpic = Bmalloc(xsiz*ysiz*sizeof(coltype));
lastpic = (coltype *)Bmalloc(xsiz*ysiz*sizeof(coltype));
lastsize = xsiz*ysiz;
}
else if (lastsize < xsiz*ysiz)
{
Bfree(lastpic);
lastpic = Bmalloc(xsiz*ysiz*sizeof(coltype));
lastpic = (coltype *)Bmalloc(xsiz*ysiz*sizeof(coltype));
}
if (lastpic)
Bmemcpy(lastpic, pic, xsiz*ysiz*sizeof(coltype));

View file

@ -102,7 +102,7 @@ int32_t animvpx_init_codec(const animvpx_ivf_header_t *info, int32_t inhandle, a
//
codec->inhandle = inhandle;
codec->pic = Bcalloc(info->width*info->height,4);
codec->pic = (uint8_t *)Bcalloc(info->width*info->height,4);
codec->compbuflen = codec->compbufallocsiz = 0;
codec->compbuf = NULL;
@ -173,14 +173,14 @@ static int32_t animvpx_read_frame(int32_t inhandle, uint8_t **bufptr, uint32_t *
if (!*bufptr)
{
*bufptr = Bmalloc(hdr.framesiz);
*bufptr = (uint8_t *)Bmalloc(hdr.framesiz);
if (!*bufptr)
return 2;
*bufallocsizptr = hdr.framesiz;
}
else if (*bufallocsizptr < hdr.framesiz)
{
*bufptr = Brealloc(*bufptr, hdr.framesiz);
*bufptr = (uint8_t *)Brealloc(*bufptr, hdr.framesiz);
if (!*bufptr)
return 2;
*bufallocsizptr = hdr.framesiz;

View file

@ -415,12 +415,12 @@ static void create_compressed_block(int32_t idx, const void *srcdata, uint32_t s
uint32_t j;
// allocate
mapstate->sws[idx] = Bmalloc(4 + size + QADDNSZ);
mapstate->sws[idx] = (char *)Bmalloc(4 + size + QADDNSZ);
if (!mapstate->sws[idx]) { initprintf("OUT OF MEM in undo/redo\n"); osdcmd_quit(NULL); }
// compress & realloc
j = qlz_compress(srcdata, mapstate->sws[idx]+4, size, state_compress);
mapstate->sws[idx] = Brealloc(mapstate->sws[idx], 4 + j);
mapstate->sws[idx] = (char *)Brealloc(mapstate->sws[idx], 4 + j);
if (!mapstate->sws[idx]) { initprintf("COULD not realloc in undo/redo\n"); osdcmd_quit(NULL); }
// write refcount
@ -474,7 +474,7 @@ void create_map_snapshot(void)
map_revision = 1;
mapstate = Bcalloc(1, sizeof(mapundo_t));
mapstate = (mapundo_t *)Bcalloc(1, sizeof(mapundo_t));
mapstate->revision = map_revision;
mapstate->prev = mapstate->next = NULL;
}
@ -485,7 +485,7 @@ void create_map_snapshot(void)
// now, have no successors
// calloc because not everything may be set in the following:
mapstate->next = Bcalloc(1, sizeof(mapundo_t));
mapstate->next = (mapundo_t *)Bcalloc(1, sizeof(mapundo_t));
mapstate->next->prev = mapstate;
mapstate = mapstate->next;
@ -524,7 +524,7 @@ void create_map_snapshot(void)
if (!try_match_with_prev(2, Numsprites, tempcrc))
{
int32_t i = 0;
spritetype *const tspri = Bmalloc(Numsprites*sizeof(spritetype) + 4);
spritetype *const tspri = (spritetype *)Bmalloc(Numsprites*sizeof(spritetype) + 4);
spritetype *spri = tspri;
if (!tspri) { initprintf("OUT OF MEM in undo/redo (2)\n"); osdcmd_quit(NULL); }
@ -897,7 +897,7 @@ int32_t taglab_load(const char *filename, int32_t flags)
len = kfilelength(fil);
filebuf = Bmalloc(len+1);
filebuf = (char *)Bmalloc(len+1);
if (!filebuf)
{
kclose(fil);
@ -1948,7 +1948,7 @@ static void ReadHelpFile(const char *name)
return;
}
helppage=Bmalloc(IHELP_INITPAGES * sizeof(helppage_t *));
helppage=(helppage_t **)Bmalloc(IHELP_INITPAGES * sizeof(helppage_t *));
numallocpages=IHELP_INITPAGES;
if (!helppage) goto HELPFILE_ERROR;
@ -1968,7 +1968,7 @@ static void ReadHelpFile(const char *name)
if (Bfeof(fp) || charsread<=0) break;
hp=Bcalloc(1,sizeof(helppage_t) + IHELP_INITLINES*80);
hp=(helppage_t *)Bcalloc(1,sizeof(helppage_t) + IHELP_INITLINES*80);
if (!hp) goto HELPFILE_ERROR;
hp->numlines = IHELP_INITLINES;
@ -1979,7 +1979,7 @@ static void ReadHelpFile(const char *name)
{
if (j >= hp->numlines)
{
hp=Brealloc(hp, sizeof(helppage_t) + 2*hp->numlines*80);
hp=(helppage_t *)Brealloc(hp, sizeof(helppage_t) + 2*hp->numlines*80);
if (!hp) goto HELPFILE_ERROR;
hp->numlines *= 2;
}
@ -2012,13 +2012,13 @@ static void ReadHelpFile(const char *name)
}
while (!newpage(tempbuf) && !Bfeof(fp) && charsread>0);
hp=Brealloc(hp, sizeof(helppage_t) + j*80);
hp=(helppage_t *)Brealloc(hp, sizeof(helppage_t) + j*80);
if (!hp) goto HELPFILE_ERROR;
hp->numlines=j;
if (i >= numallocpages)
{
helppage = Brealloc(helppage, 2*numallocpages*sizeof(helppage_t *));
helppage = (helppage_t **)Brealloc(helppage, 2*numallocpages*sizeof(helppage_t *));
numallocpages *= 2;
if (!helppage) goto HELPFILE_ERROR;
}
@ -2026,7 +2026,7 @@ static void ReadHelpFile(const char *name)
i++;
}
helppage = Brealloc(helppage, i*sizeof(helppage_t *));
helppage =(helppage_t **) Brealloc(helppage, i*sizeof(helppage_t *));
if (!helppage) goto HELPFILE_ERROR;
numhelppages = i;
@ -2335,7 +2335,7 @@ static int32_t sort_sounds(int32_t how)
n = g_numsounds;
src = source = g_sndnum;
dest = Bmalloc(sizeof(int16_t) * n);
dest = (int16_t *)Bmalloc(sizeof(int16_t) * n);
dst = dest;
if (!dest) return -1;
@ -3748,7 +3748,7 @@ static int32_t OnSaveTileGroup(void)
Bfprintf(fp, "tilegroup \"%s\""OURNEWL"{"OURNEWL, name);
Bfprintf(fp, TTAB "hotkey \"%c\""OURNEWL OURNEWL, hotkey);
if (!(s_TileGroups[tile_groups].pIds = Bmalloc(n * sizeof(s_TileGroups[tile_groups].pIds[0]))))
if (!(s_TileGroups[tile_groups].pIds = (int32_t *)Bmalloc(n * sizeof(s_TileGroups[tile_groups].pIds[0]))))
TMPERRMSG_RETURN("Out of memory.");
j = 0;
@ -4489,7 +4489,7 @@ ENDFOR1:
sprite[startspr].xoffset = -(((picanm[t])>>8)&255);
sprite[startspr].yoffset = -(((picanm[t])>>16)&255);
spritenums = Bmalloc(stackallocsize * sizeof(int16_t));
spritenums = (int16_t *)Bmalloc(stackallocsize * sizeof(int16_t));
if (!spritenums) goto ERROR_NOMEMORY;
cursor = insertsprite(sprite[startspr].sectnum,0);
@ -4624,7 +4624,7 @@ ENDFOR1:
if (numletters >= stackallocsize)
{
stackallocsize *= 2;
spritenums = Brealloc(spritenums, stackallocsize*sizeof(int16_t));
spritenums = (int16_t *)Brealloc(spritenums, stackallocsize*sizeof(int16_t));
if (!spritenums) goto ERROR_NOMEMORY;
}
spritenums[numletters++] = i;
@ -8570,14 +8570,14 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
if (argc <= 1)
return;
lengths = Bmalloc(argc*sizeof(int32_t));
lengths = (int32_t *)Bmalloc(argc*sizeof(int32_t));
for (j=1; j<argc; j++)
{
lengths[j] = Bstrlen(argv[j]);
maxlen += lengths[j];
}
testplay_addparam = Bmalloc(maxlen+argc);
testplay_addparam = (char *)Bmalloc(maxlen+argc);
testplay_addparam[0] = 0;
j = 0;
@ -8867,7 +8867,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
if (j > 0)
{
testplay_addparam[j-1] = 0;
testplay_addparam = Brealloc(testplay_addparam, j*sizeof(char));
testplay_addparam = (char *)Brealloc(testplay_addparam, j*sizeof(char));
}
else
{
@ -9015,9 +9015,9 @@ static int32_t osdcmd_testplay_addparam(const osdfuncparm_t *parm)
if (slen > 0)
{
if (!testplay_addparam)
testplay_addparam = Bmalloc(slen+1);
testplay_addparam = (char *)Bmalloc(slen+1);
else
testplay_addparam = Brealloc(testplay_addparam, slen+1);
testplay_addparam = (char *)Brealloc(testplay_addparam, slen+1);
Bmemcpy(testplay_addparam, parm->parms[0], slen);
testplay_addparam[slen] = 0;
@ -9369,7 +9369,7 @@ static int32_t osdcmd_do(const osdfuncparm_t *parm)
ofs = 2*(parm->numparms>0); // true if "do" command
slen = Bstrlen(parm->raw+ofs);
tp = Bmalloc(slen+2);
tp = (char *)Bmalloc(slen+2);
if (!tp) goto OUTOFMEM;
Bmemcpy(tp, parm->raw+ofs, slen);
@ -9893,7 +9893,7 @@ int32_t parsetilegroups(scriptfile *script)
if (scriptfile_getstring(script,&name)) break;
if (scriptfile_getbraces(script,&end)) break;
s_TileGroups[tile_groups].pIds = Bcalloc(MAX_TILE_GROUP_ENTRIES, sizeof(int32_t));
s_TileGroups[tile_groups].pIds = (int32_t *)Bcalloc(MAX_TILE_GROUP_ENTRIES, sizeof(int32_t));
s_TileGroups[tile_groups].szText = Bstrdup(name);
while (script->textptr < end)
@ -9968,7 +9968,7 @@ int32_t parsetilegroups(scriptfile *script)
}
}
s_TileGroups[tile_groups].pIds = Brealloc(s_TileGroups[tile_groups].pIds,
s_TileGroups[tile_groups].pIds = (int32_t *)Brealloc(s_TileGroups[tile_groups].pIds,
s_TileGroups[tile_groups].nIds*sizeof(int32_t));
tile_groups++;
break;
@ -10122,7 +10122,7 @@ static int32_t loadtilegroups(const char *fn)
#if 0
// ---------- Init hardcoded tile group consisting of all named tiles
s_TileGroups[0].szText = Bstrdup("All named");
s_TileGroups[0].pIds = Bmalloc(MAXTILES * sizeof(s_TileGroups[0].pIds[0]));
s_TileGroups[0].pIds = (int32_t *)Bmalloc(MAXTILES * sizeof(s_TileGroups[0].pIds[0]));
if (!s_TileGroups[0].pIds)
return -1;
j = 0;
@ -10282,7 +10282,7 @@ static int32_t parseconsounds(scriptfile *script)
duplicate = 1;
Bfree(g_sounds[sndnum].filename);
}
g_sounds[sndnum].filename = Bcalloc(slen+1,sizeof(uint8_t));
g_sounds[sndnum].filename = (char *)Bcalloc(slen+1,sizeof(uint8_t));
// Hopefully noone does memcpy(..., g_sounds[].filename, BMAX_PATH)
if (!g_sounds[sndnum].filename)
{
@ -11739,9 +11739,9 @@ int32_t CheckMapCorruption(int32_t printfromlev, uint64_t tryfixing)
if (!corruptcheck_noalreadyrefd)
{
seen_nextwalls = Bcalloc((numwalls+7)>>3,1);
seen_nextwalls = (uint8_t *)Bcalloc((numwalls+7)>>3,1);
if (!seen_nextwalls) return 5;
lastnextwallsource = Bmalloc(numwalls*sizeof(lastnextwallsource[0]));
lastnextwallsource = (int16_t *)Bmalloc(numwalls*sizeof(lastnextwallsource[0]));
if (!lastnextwallsource) { Bfree(seen_nextwalls); return 5; }
}
@ -13142,7 +13142,7 @@ static void FuncMenu(void)
{
char *statename = statesinfo[funcMenuStatenum[(col-1)*8 + row]].name;
int32_t snlen = Bstrlen(statename);
char *tmpscript = Bmalloc(1+5+1+snlen+1);
char *tmpscript = (char *)Bmalloc(1+5+1+snlen+1);
if (!tmpscript)
break;

View file

@ -146,7 +146,7 @@ void G_AddGroup(const char *buffer)
{
char buf[BMAX_PATH];
struct strllist *s = Bcalloc(1,sizeof(struct strllist));
struct strllist *s = (struct strllist *)Bcalloc(1,sizeof(struct strllist));
Bstrcpy(buf, buffer);
@ -167,7 +167,7 @@ void G_AddGroup(const char *buffer)
void G_AddPath(const char *buffer)
{
struct strllist *s = Bcalloc(1,sizeof(struct strllist));
struct strllist *s = (struct strllist *)Bcalloc(1,sizeof(struct strllist));
s->str = Bstrdup(buffer);
if (CommandPaths)
@ -311,7 +311,7 @@ void G_DoAutoload(const char *dirname)
// returns a buffer of size BMAX_PATH
char *dup_filename(const char *fn)
{
char *buf = Bmalloc(BMAX_PATH);
char *buf = (char *)Bmalloc(BMAX_PATH);
return Bstrncpyz(buf, fn, BMAX_PATH);
}

View file

@ -3803,7 +3803,7 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
// NOTE: maybe need to move this to the engine...
begindrawing();
{
palette_t *const frame = Bcalloc(xdim*ydim, 4);
palette_t *const frame = (palette_t *const)Bcalloc(xdim*ydim, 4);
char *const pic = (char *)waloff[TILE_SAVESHOT];
int32_t x, y;
@ -8426,7 +8426,7 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload)
}
if (!preload)
anim_hi_sounds[animnum] = Bcalloc(allocsz, 2*sizeof(anim_hi_sounds[0]));
anim_hi_sounds[animnum] = (uint16_t *)Bcalloc(allocsz, 2*sizeof(anim_hi_sounds[0]));
while (script->textptr < animsoundsend)
{
int32_t framenum, soundnum;
@ -9513,8 +9513,8 @@ static void G_CompileScripts(void)
char *newlabel;
int32_t *newlabelcode;
newlabel = Bmalloc(g_numLabels<<6);
newlabelcode = Bmalloc(g_numLabels*sizeof(int32_t));
newlabel = (char *)Bmalloc(g_numLabels<<6);
newlabelcode = (int32_t *)Bmalloc(g_numLabels*sizeof(int32_t));
if (!newlabel || !newlabelcode)
G_GameExit("Error: out of memory retaining labels\n");

View file

@ -1206,7 +1206,7 @@ static int32_t C_SetScriptSize(int32_t newsize)
char *scriptptrs;
char *newbitptr;
scriptptrs = Bcalloc(1, g_scriptSize * sizeof(uint8_t));
scriptptrs = (char *)Bcalloc(1, g_scriptSize * sizeof(uint8_t));
for (i=g_scriptSize-1; i>=0; i--)
{
@ -1231,7 +1231,7 @@ static int32_t C_SetScriptSize(int32_t newsize)
initprintf("Resizing code buffer to %d*%d bytes\n",newsize, (int32_t)sizeof(intptr_t));
newscript = (intptr_t *)Brealloc(script, newsize * sizeof(intptr_t));
newbitptr = Bcalloc(1,(((newsize+7)>>3)+1) * sizeof(uint8_t));
newbitptr = (char *)Bcalloc(1,(((newsize+7)>>3)+1) * sizeof(uint8_t));
if (newscript == NULL || newbitptr == NULL)
{
@ -2504,9 +2504,9 @@ static int32_t C_ParseCommand(int32_t loop)
tempbuf[j+1] = '\0';
if (MapInfo[(k*MAXLEVELS)+i].musicfn == NULL)
MapInfo[(k*MAXLEVELS)+i].musicfn = Bcalloc(Bstrlen(tempbuf)+1,sizeof(uint8_t));
MapInfo[(k*MAXLEVELS)+i].musicfn = (char *)Bcalloc(Bstrlen(tempbuf)+1,sizeof(uint8_t));
else if ((Bstrlen(tempbuf)+1) > sizeof(MapInfo[(k*MAXLEVELS)+i].musicfn))
MapInfo[(k*MAXLEVELS)+i].musicfn = Brealloc(MapInfo[(k*MAXLEVELS)+i].musicfn,(Bstrlen(tempbuf)+1));
MapInfo[(k*MAXLEVELS)+i].musicfn = (char *)Brealloc(MapInfo[(k*MAXLEVELS)+i].musicfn,(Bstrlen(tempbuf)+1));
Bstrcpy(MapInfo[(k*MAXLEVELS)+i].musicfn,tempbuf);
@ -5239,9 +5239,9 @@ repeatcase:
Bcorrectfilename(tempbuf,0);
if (MapInfo[j *MAXLEVELS+k].filename == NULL)
MapInfo[j *MAXLEVELS+k].filename = Bcalloc(Bstrlen(tempbuf)+1,sizeof(uint8_t));
MapInfo[j *MAXLEVELS+k].filename = (char *)Bcalloc(Bstrlen(tempbuf)+1,sizeof(uint8_t));
else if ((Bstrlen(tempbuf)+1) > sizeof(MapInfo[j*MAXLEVELS+k].filename))
MapInfo[j *MAXLEVELS+k].filename = Brealloc(MapInfo[j*MAXLEVELS+k].filename,(Bstrlen(tempbuf)+1));
MapInfo[j *MAXLEVELS+k].filename = (char *)Brealloc(MapInfo[j*MAXLEVELS+k].filename,(Bstrlen(tempbuf)+1));
Bstrcpy(MapInfo[j*MAXLEVELS+k].filename,tempbuf);
@ -5280,9 +5280,9 @@ repeatcase:
tempbuf[i] = '\0';
if (MapInfo[j*MAXLEVELS+k].name == NULL)
MapInfo[j*MAXLEVELS+k].name = Bcalloc(Bstrlen(tempbuf)+1,sizeof(uint8_t));
MapInfo[j*MAXLEVELS+k].name = (char *)Bcalloc(Bstrlen(tempbuf)+1,sizeof(uint8_t));
else if ((Bstrlen(tempbuf)+1) > sizeof(MapInfo[j*MAXLEVELS+k].name))
MapInfo[j *MAXLEVELS+k].name = Brealloc(MapInfo[j*MAXLEVELS+k].name,(Bstrlen(tempbuf)+1));
MapInfo[j *MAXLEVELS+k].name = (char *)Brealloc(MapInfo[j*MAXLEVELS+k].name,(Bstrlen(tempbuf)+1));
/* initprintf("level name string len: %d\n",Bstrlen(tempbuf)); */
@ -5308,7 +5308,7 @@ repeatcase:
}
if (ScriptQuotes[k] == NULL)
ScriptQuotes[k] = Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
ScriptQuotes[k] = (char *)Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
if (!ScriptQuotes[k])
{
@ -5328,7 +5328,7 @@ repeatcase:
if (tw == CON_REDEFINEQUOTE)
{
if (ScriptQuoteRedefinitions[g_numQuoteRedefinitions] == NULL)
ScriptQuoteRedefinitions[g_numQuoteRedefinitions] = Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
ScriptQuoteRedefinitions[g_numQuoteRedefinitions] = (char *)Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
if (!ScriptQuoteRedefinitions[g_numQuoteRedefinitions])
{
ScriptQuoteRedefinitions[g_numQuoteRedefinitions] = NULL;
@ -5427,7 +5427,7 @@ repeatcase:
C_SkipComments();
if (g_sounds[k].filename == NULL)
g_sounds[k].filename = Bcalloc(BMAX_PATH,sizeof(uint8_t));
g_sounds[k].filename = (char *)Bcalloc(BMAX_PATH,sizeof(uint8_t));
if (!g_sounds[k].filename)
{
Bsprintf(tempbuf,"Failed allocating %" PRIdPTR " byte buffer.",sizeof(uint8_t) * BMAX_PATH);
@ -6041,7 +6041,7 @@ void C_Compile(const char *filenam)
for (i=127; i>=0; i--)
if (ScriptQuotes[i] == NULL)
ScriptQuotes[i] = Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
ScriptQuotes[i] = (char *)Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
for (i=MAXQUOTELEN-7; i>=0; i--)
if (Bstrncmp(&ScriptQuotes[13][i],"SPACE",5) == 0)
@ -6123,7 +6123,7 @@ void C_Compile(const char *filenam)
{
if (ScriptQuotes[i+OBITQUOTEINDEX] == NULL)
{
ScriptQuotes[i+OBITQUOTEINDEX] = Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
ScriptQuotes[i+OBITQUOTEINDEX] = (char *)Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
Bstrcpy(ScriptQuotes[i+OBITQUOTEINDEX],PlayerObituaries[i]);
}
}
@ -6133,7 +6133,7 @@ void C_Compile(const char *filenam)
{
if (ScriptQuotes[i+SUICIDEQUOTEINDEX] == NULL)
{
ScriptQuotes[i+SUICIDEQUOTEINDEX] = Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
ScriptQuotes[i+SUICIDEQUOTEINDEX] = (char *)Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
Bstrcpy(ScriptQuotes[i+SUICIDEQUOTEINDEX],PlayerSelfObituaries[i]);
}
}

View file

@ -3308,7 +3308,7 @@ nullquote:
case CON_SAVEMAPSTATE:
if (MapInfo[ud.volume_number *MAXLEVELS+ud.level_number].savedstate == NULL)
MapInfo[ud.volume_number *MAXLEVELS+ud.level_number].savedstate = Bcalloc(1,sizeof(mapstate_t));
MapInfo[ud.volume_number *MAXLEVELS+ud.level_number].savedstate = (mapstate_t *)Bcalloc(1,sizeof(mapstate_t));
G_SaveMapState(MapInfo[ud.volume_number*MAXLEVELS+ud.level_number].savedstate);
insptr++;
continue;
@ -4202,7 +4202,7 @@ nullquote:
{
/*OSD_Printf(OSDTEXT_GREEN "CON_RESIZEARRAY: resizing array %s from %d to %d\n",
aGameArrays[j].szLabel, aGameArrays[j].size, asize / GAR_ELTSZ);*/
aGameArrays[j].plValues=Brealloc(aGameArrays[j].plValues, asize);
aGameArrays[j].plValues = (intptr_t *)Brealloc(aGameArrays[j].plValues, asize);
aGameArrays[j].size = asize / GAR_ELTSZ;
kread(fil, aGameArrays[j].plValues, asize);
}
@ -4253,7 +4253,7 @@ nullquote:
if (asize > 0)
{
/*OSD_Printf(OSDTEXT_GREEN "CON_RESIZEARRAY: resizing array %s from %d to %d\n", aGameArrays[j].szLabel, aGameArrays[j].size, asize);*/
aGameArrays[j].plValues=Brealloc(aGameArrays[j].plValues, GAR_ELTSZ * asize);
aGameArrays[j].plValues = (intptr_t *)Brealloc(aGameArrays[j].plValues, GAR_ELTSZ * asize);
aGameArrays[j].size = asize;
}
continue;
@ -5313,13 +5313,13 @@ void G_SaveMapState(mapstate_t *save)
if (aGameVars[i].dwFlags & GAMEVAR_PERPLAYER)
{
if (!save->vars[i])
save->vars[i] = Bcalloc(MAXPLAYERS,sizeof(intptr_t));
save->vars[i] = (intptr_t *)Bcalloc(MAXPLAYERS,sizeof(intptr_t));
Bmemcpy(&save->vars[i][0],&aGameVars[i].val.plValues[0],sizeof(intptr_t) * MAXPLAYERS);
}
else if (aGameVars[i].dwFlags & GAMEVAR_PERACTOR)
{
if (!save->vars[i])
save->vars[i] = Bcalloc(MAXSPRITES,sizeof(intptr_t));
save->vars[i] = (intptr_t *)Bcalloc(MAXSPRITES,sizeof(intptr_t));
Bmemcpy(&save->vars[i][0],&aGameVars[i].val.plValues[0],sizeof(intptr_t) * MAXSPRITES);
}
else save->vars[i] = (intptr_t *)aGameVars[i].val.lValue;

View file

@ -127,18 +127,18 @@ int32_t Gv_ReadSave(int32_t fil, int32_t newbehav)
for (i=0; i<g_gameVarCount; i++)
{
if (kdfread(&(aGameVars[i]),sizeof(gamevar_t),1,fil) != 1) goto corrupt;
aGameVars[i].szLabel=Bcalloc(MAXVARLABEL,sizeof(uint8_t));
aGameVars[i].szLabel = (char *)Bcalloc(MAXVARLABEL,sizeof(uint8_t));
if (kdfread(aGameVars[i].szLabel,sizeof(uint8_t) * MAXVARLABEL, 1, fil) != 1) goto corrupt;
hash_add(&h_gamevars, aGameVars[i].szLabel,i, 1);
if (aGameVars[i].dwFlags & GAMEVAR_PERPLAYER)
{
aGameVars[i].val.plValues=Bcalloc(MAXPLAYERS,sizeof(intptr_t));
aGameVars[i].val.plValues = (intptr_t*)Bcalloc(MAXPLAYERS,sizeof(intptr_t));
if (kdfread(aGameVars[i].val.plValues,sizeof(intptr_t) * MAXPLAYERS, 1, fil) != 1) goto corrupt;
}
else if (aGameVars[i].dwFlags & GAMEVAR_PERACTOR)
{
aGameVars[i].val.plValues=Bcalloc(MAXSPRITES,sizeof(intptr_t));
aGameVars[i].val.plValues = (intptr_t*)Bcalloc(MAXSPRITES,sizeof(intptr_t));
if (kdfread(&aGameVars[i].val.plValues[0],sizeof(intptr_t), MAXSPRITES, fil) != MAXSPRITES) goto corrupt;
}
}
@ -155,11 +155,11 @@ int32_t Gv_ReadSave(int32_t fil, int32_t newbehav)
for (i=0; i<g_gameArrayCount; i++)
{
if (kdfread(&(aGameArrays[i]),sizeof(gamearray_t),1,fil) != 1) goto corrupt;
aGameArrays[i].szLabel=Bcalloc(MAXARRAYLABEL,sizeof(uint8_t));
aGameArrays[i].szLabel = (char *)Bcalloc(MAXARRAYLABEL,sizeof(uint8_t));
if (kdfread(aGameArrays[i].szLabel,sizeof(uint8_t) * MAXARRAYLABEL, 1, fil) != 1) goto corrupt;
hash_add(&h_arrays, aGameArrays[i].szLabel, i, 1);
aGameArrays[i].plValues=Bcalloc(aGameArrays[i].size, GAR_ELTSZ);
aGameArrays[i].plValues = (intptr_t *)Bcalloc(aGameArrays[i].size, GAR_ELTSZ);
if (kdfread(aGameArrays[i].plValues, GAR_ELTSZ * aGameArrays[i].size, 1, fil) < 1) goto corrupt;
}
@ -178,7 +178,7 @@ int32_t Gv_ReadSave(int32_t fil, int32_t newbehav)
if (savedstate[i])
{
if (MapInfo[i].savedstate == NULL)
MapInfo[i].savedstate = Bcalloc(1,sizeof(mapstate_t));
MapInfo[i].savedstate = (mapstate_t *)Bcalloc(1,sizeof(mapstate_t));
if (kdfread(MapInfo[i].savedstate,sizeof(mapstate_t),1,fil) != sizeof(mapstate_t)) goto corrupt;
for (j=0; j<g_gameVarCount; j++)
{
@ -186,13 +186,13 @@ int32_t Gv_ReadSave(int32_t fil, int32_t newbehav)
if (aGameVars[j].dwFlags & GAMEVAR_PERPLAYER)
{
// if (!MapInfo[i].savedstate->vars[j])
MapInfo[i].savedstate->vars[j] = Bcalloc(MAXPLAYERS,sizeof(intptr_t));
MapInfo[i].savedstate->vars[j] = (intptr_t *)Bcalloc(MAXPLAYERS,sizeof(intptr_t));
if (kdfread(&MapInfo[i].savedstate->vars[j][0],sizeof(intptr_t) * MAXPLAYERS, 1, fil) != 1) goto corrupt;
}
else if (aGameVars[j].dwFlags & GAMEVAR_PERACTOR)
{
// if (!MapInfo[i].savedstate->vars[j])
MapInfo[i].savedstate->vars[j] = Bcalloc(MAXSPRITES,sizeof(intptr_t));
MapInfo[i].savedstate->vars[j] = (intptr_t *)Bcalloc(MAXSPRITES,sizeof(intptr_t));
if (kdfread(&MapInfo[i].savedstate->vars[j][0],sizeof(intptr_t), MAXSPRITES, fil) != MAXSPRITES) goto corrupt;
}
}
@ -478,7 +478,7 @@ int32_t Gv_NewVar(const char *pszLabel, intptr_t lValue, uint32_t dwFlags)
if ((aGameVars[i].dwFlags & GAMEVAR_SYSTEM) == 0)
{
if (aGameVars[i].szLabel == NULL)
aGameVars[i].szLabel=Bcalloc(MAXVARLABEL,sizeof(uint8_t));
aGameVars[i].szLabel = (char *)Bcalloc(MAXVARLABEL,sizeof(uint8_t));
if (aGameVars[i].szLabel != pszLabel)
Bstrcpy(aGameVars[i].szLabel,pszLabel);
aGameVars[i].dwFlags=dwFlags;
@ -505,14 +505,14 @@ int32_t Gv_NewVar(const char *pszLabel, intptr_t lValue, uint32_t dwFlags)
if (aGameVars[i].dwFlags & GAMEVAR_PERPLAYER)
{
if (!aGameVars[i].val.plValues)
aGameVars[i].val.plValues=Bcalloc(MAXPLAYERS,sizeof(intptr_t));
aGameVars[i].val.plValues = (intptr_t *)Bcalloc(MAXPLAYERS,sizeof(intptr_t));
for (j=MAXPLAYERS-1; j>=0; j--)
aGameVars[i].val.plValues[j]=lValue;
}
else if (aGameVars[i].dwFlags & GAMEVAR_PERACTOR)
{
if (!aGameVars[i].val.plValues)
aGameVars[i].val.plValues=Bcalloc(MAXSPRITES,sizeof(intptr_t));
aGameVars[i].val.plValues = (intptr_t *)Bcalloc(MAXSPRITES,sizeof(intptr_t));
for (j=MAXSPRITES-1; j>=0; j--)
aGameVars[i].val.plValues[j]=lValue;
}

View file

@ -75,7 +75,7 @@ static int32_t LoadGroupsCache(void)
if (scriptfile_getnumber(script, &fmtime)) break; // modification time
if (scriptfile_getnumber(script, &fcrcval)) break; // crc checksum
fg = Bcalloc(1, sizeof(struct grpcache));
fg = (struct grpcache *)Bcalloc(1, sizeof(struct grpcache));
fg->next = grpcache;
grpcache = fg;
@ -109,7 +109,7 @@ int32_t ScanGroups(void)
char *fn;
struct Bstat st;
#define BUFFER_SIZE (1024 * 1024 * 8)
uint8_t *buf = Bmalloc(BUFFER_SIZE);
uint8_t *buf = (uint8_t *)Bmalloc(BUFFER_SIZE);
if (!buf)
{

View file

@ -259,7 +259,7 @@ void ANIM_LoadAnim(char * buffer)
{
uint16_t i;
anim = Brealloc(anim, sizeof(anim_t));
anim = (anim_t *)Brealloc(anim, sizeof(anim_t));
anim->curlpnum = 0xffff;
anim->currentframe = -1;

View file

@ -122,7 +122,7 @@ void SCRIPT_FreeSection(ScriptSectionType * section)
#define AllocSection(s) \
{ \
(s) = Bmalloc(sizeof(ScriptSectionType)); \
(s) = (ScriptSectionType *)Bmalloc(sizeof(ScriptSectionType)); \
(s)->name = NULL; \
(s)->entries = NULL; \
(s)->lastline = NULL; \
@ -131,7 +131,7 @@ void SCRIPT_FreeSection(ScriptSectionType * section)
}
#define AllocEntry(e) \
{ \
(e) = Bmalloc(sizeof(ScriptEntryType)); \
(e) = (ScriptEntryType *)Bmalloc(sizeof(ScriptEntryType)); \
(e)->name = NULL; \
(e)->value = NULL; \
(e)->nextentry = (e); \
@ -827,7 +827,7 @@ void SCRIPT_PutString
if (*q == '\r' || *q == '\n' || *q == '\t' || *q == '\\' || *q == '"') len+=2;
else if (*q >= ' ') len++;
}
p = raw = Bmalloc(len);
p = raw = (char *)Bmalloc(len);
*(p++) = '"';
for (q=string; *q; q++)
{
@ -868,7 +868,7 @@ void SCRIPT_PutDoubleString
if (*q == '\r' || *q == '\n' || *q == '\t' || *q == '\\' || *q == '"') len+=2;
else if (*q >= ' ') len++;
}
p = raw = Bmalloc(len);
p = raw = (char *)Bmalloc(len);
*(p++) = '"';
for (q=string1; *q; q++)
{

View file

@ -787,9 +787,9 @@ static int32_t C_CopyLabel(void)
{
if (g_numLabels >= label_allocsize)
{
label = Brealloc(label, 2*label_allocsize*MAXLABELLEN*sizeof(char));
labelval = Brealloc(labelval, 2*label_allocsize*sizeof(labelval[0]));
labeltype = Brealloc(labeltype, 2*label_allocsize*sizeof(labeltype[0]));
label = (char *)Brealloc(label, 2*label_allocsize*MAXLABELLEN*sizeof(char));
labelval = (int32_t *)Brealloc(labelval, 2*label_allocsize*sizeof(labelval[0]));
labeltype = (uint8_t *)Brealloc(labeltype, 2*label_allocsize*sizeof(labeltype[0]));
if (label==NULL || labelval==NULL || labeltype==NULL)
{
@ -1025,7 +1025,7 @@ static void C_GetNextVarType(int32_t type)
if (i>=constants_allocsize)
{
constants_allocsize *= 2;
constants = Brealloc(constants, constants_allocsize * sizeof(constants[0]));
constants = (int32_t *)Brealloc(constants, constants_allocsize * sizeof(constants[0]));
if (!constants)
{
initprintf("C_GetNextVarType(): ERROR: out of memory!\n");
@ -1826,7 +1826,7 @@ static int32_t C_ParseCommand(void)
if (g_stateCount >= statesinfo_allocsize)
{
statesinfo_allocsize *= 2;
statesinfo = Brealloc(statesinfo, statesinfo_allocsize * sizeof(statesinfo[0]));
statesinfo = (statesinfo_t *)Brealloc(statesinfo, statesinfo_allocsize * sizeof(statesinfo[0]));
if (!statesinfo)
{
initprintf("C_ParseCommand(): ERROR: out of memory!\n");
@ -3220,7 +3220,7 @@ repeatcase:
}
if (ScriptQuotes[k] == NULL)
ScriptQuotes[k] = Bcalloc(MAXQUOTELEN, sizeof(uint8_t));
ScriptQuotes[k] = (char *)Bcalloc(MAXQUOTELEN, sizeof(uint8_t));
if (!ScriptQuotes[k])
{
@ -3238,7 +3238,7 @@ repeatcase:
if (tw == CON_REDEFINEQUOTE)
{
if (ScriptQuoteRedefinitions[g_numQuoteRedefinitions] == NULL)
ScriptQuoteRedefinitions[g_numQuoteRedefinitions] = Bcalloc(MAXQUOTELEN, sizeof(uint8_t));
ScriptQuoteRedefinitions[g_numQuoteRedefinitions] = (char *)Bcalloc(MAXQUOTELEN, sizeof(uint8_t));
if (!ScriptQuoteRedefinitions[g_numQuoteRedefinitions])
{
Bsprintf(tempbuf,"Failed allocating %d byte quote text buffer.", MAXQUOTELEN);
@ -3680,13 +3680,13 @@ void C_Compile(const char *filenameortext, int32_t isfilename)
if (firstime)
{
label = Bmalloc(label_allocsize * MAXLABELLEN * sizeof(char));
labelval = Bmalloc(label_allocsize * sizeof(int32_t));
labeltype = Bmalloc(label_allocsize * sizeof(uint8_t));
label = (char *)Bmalloc(label_allocsize * MAXLABELLEN * sizeof(char));
labelval = (int32_t *)Bmalloc(label_allocsize * sizeof(int32_t));
labeltype = (uint8_t *)Bmalloc(label_allocsize * sizeof(uint8_t));
constants = Bmalloc(constants_allocsize * sizeof(int32_t));
constants = (int32_t *)Bmalloc(constants_allocsize * sizeof(int32_t));
statesinfo = Bmalloc(statesinfo_allocsize * sizeof(statesinfo_t));
statesinfo = (statesinfo_t *)Bmalloc(statesinfo_allocsize * sizeof(statesinfo_t));
for (i=0; i<MAXEVENTS; i++)
{
@ -3699,7 +3699,7 @@ void C_Compile(const char *filenameortext, int32_t isfilename)
Gv_Init();
C_AddDefaultDefinitions();
script = Bcalloc(g_scriptSize, sizeof(instype));
script = (instype *)Bcalloc(g_scriptSize, sizeof(instype));
// initprintf("script: %d\n",script);
if (!script || !label || !labelval || !labeltype || !constants)
{
@ -3719,7 +3719,7 @@ void C_Compile(const char *filenameortext, int32_t isfilename)
if (isfilename)
{
fs = Bstrlen(filenameortext);
mptr = Bmalloc(fs+1+4);
mptr = (char *)Bmalloc(fs+1+4);
if (!mptr)
{
initprintf("C_Compile(): ERROR: out of memory!\n");
@ -3810,13 +3810,13 @@ void C_Compile(const char *filenameortext, int32_t isfilename)
{
if (aGameVars[i].val.plValues)
{
aGameVars[i].val.plValues = Brealloc(aGameVars[i].val.plValues, (1+MAXEVENTS+g_stateCount)*sizeof(int32_t));
aGameVars[i].val.plValues = (int32_t *)Brealloc(aGameVars[i].val.plValues, (1+MAXEVENTS+g_stateCount)*sizeof(int32_t));
for (j=ostateCount; j<g_stateCount; j++)
aGameVars[i].val.plValues[1+MAXEVENTS+j] = aGameVars[i].lDefault;
}
else
{
aGameVars[i].val.plValues = Bmalloc((1+MAXEVENTS+g_stateCount)*sizeof(int32_t));
aGameVars[i].val.plValues = (int32_t *)Bmalloc((1+MAXEVENTS+g_stateCount)*sizeof(int32_t));
for (j=0; j<(1+MAXEVENTS+g_stateCount); j++)
aGameVars[i].val.plValues[j] = aGameVars[i].lDefault;
}
@ -4006,7 +4006,7 @@ void C_PrintErrorPosition()
return;
{
char *buf = Bmalloc(nchars+1);
char *buf = (char *)Bmalloc(nchars+1);
Bmemcpy(buf, b, nchars);
buf[nchars]=0;

View file

@ -118,12 +118,12 @@ int32_t Gv_NewArray(const char *pszLabel, void *arrayptr, intptr_t asize, uint32
i = g_gameArrayCount;
if (aGameArrays[i].szLabel == NULL)
aGameArrays[i].szLabel = Bcalloc(MAXARRAYLABEL, sizeof(char));
aGameArrays[i].szLabel = (char *)Bcalloc(MAXARRAYLABEL, sizeof(char));
if (aGameArrays[i].szLabel != pszLabel)
Bstrcpy(aGameArrays[i].szLabel, pszLabel);
if (!(dwFlags & GAMEARRAY_TYPE_MASK))
aGameArrays[i].vals = Bcalloc(asize, sizeof(int32_t));
aGameArrays[i].vals = (int32_t *)Bcalloc(asize, sizeof(int32_t));
else
aGameArrays[i].vals = arrayptr;
@ -181,7 +181,7 @@ int32_t Gv_NewVar(const char *pszLabel, intptr_t lValue, uint32_t dwFlags)
if ((aGameVars[i].dwFlags & GAMEVAR_SYSTEM) == 0)
{
if (aGameVars[i].szLabel == NULL)
aGameVars[i].szLabel = Bcalloc(MAXVARLABEL, sizeof(uint8_t));
aGameVars[i].szLabel = (char *)Bcalloc(MAXVARLABEL, sizeof(uint8_t));
if (aGameVars[i].szLabel != pszLabel)
Bstrcpy(aGameVars[i].szLabel,pszLabel);
aGameVars[i].dwFlags = dwFlags;
@ -208,7 +208,7 @@ int32_t Gv_NewVar(const char *pszLabel, intptr_t lValue, uint32_t dwFlags)
if (aGameVars[i].dwFlags & GAMEVAR_PERBLOCK)
{
if (!aGameVars[i].val.plValues)
aGameVars[i].val.plValues = Bcalloc(1+MAXEVENTS+g_stateCount, sizeof(int32_t));
aGameVars[i].val.plValues = (int32_t *)Bcalloc(1+MAXEVENTS+g_stateCount, sizeof(int32_t));
for (j=0; j<1+MAXEVENTS+g_stateCount; j++)
aGameVars[i].val.plValues[j] = lValue;
}

View file

@ -1243,7 +1243,7 @@ int32_t MIDI_PlaySong
}
_MIDI_TrackMemSize = _MIDI_NumTracks * sizeof(track);
_MIDI_TrackPtr = Bmalloc(_MIDI_TrackMemSize);
_MIDI_TrackPtr = (track *)Bmalloc(_MIDI_TrackMemSize);
if (_MIDI_TrackPtr == NULL)
{
return(MIDI_NoMemory);

View file

@ -1799,7 +1799,7 @@ static void realloc_and_copy_musicfn(int32_t level_number, const char *levnamebu
char **musicfn = altp ? &MapInfo[level_number].alt_musicfn : &MapInfo[level_number].musicfn;
int32_t dastrlen = Bstrlen(levnamebuf);
*musicfn = Brealloc(*musicfn, dastrlen+1);
*musicfn = (char *)Brealloc(*musicfn, dastrlen+1);
Bstrcpy(*musicfn, levnamebuf);
}
@ -1902,7 +1902,7 @@ int32_t G_EnterLevel(int32_t g)
if (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0)
{
if (MapInfo[mii].filename == NULL)
MapInfo[mii].filename = Bcalloc(BMAX_PATH, sizeof(uint8_t));
MapInfo[mii].filename = (char *)Bcalloc(BMAX_PATH, sizeof(uint8_t));
if (MapInfo[mii].name == NULL)
MapInfo[mii].name = Bstrdup("User Map");
}

View file

@ -110,7 +110,7 @@ int32_t RTS_AddFile(const char *filename)
//
// Fill in lumpinfo
//
lump_p = Brealloc(rts_lumpinfo, (rts_numlumps + header.numlumps)*sizeof(lumpinfo_t));
lump_p = (lumpinfo_t *)Brealloc(rts_lumpinfo, (rts_numlumps + header.numlumps)*sizeof(lumpinfo_t));
if (!lump_p)
{
kclose(handle);
@ -163,7 +163,7 @@ void RTS_Init(const char *filename)
// set up caching
//
length = (rts_numlumps) * sizeof(*rts_lumpcache);
rts_lumpcache = Bmalloc(length);
rts_lumpcache = (void **)Bmalloc(length);
memset(rts_lumpcache,0,length);
RTS_Started = TRUE;
}

View file

@ -1062,7 +1062,7 @@ static void sv_makevarspec()
for (i=0; i<g_gameVarCount; i++)
numsavedvars += (aGameVars[i].dwFlags&SV_SKIPMASK) ? 0 : 1;
svgm_vars = Bmalloc((numsavedvars+g_gameArrayCount+2)*sizeof(dataspec_t));
svgm_vars = (dataspec_t *)Bmalloc((numsavedvars+g_gameArrayCount+2)*sizeof(dataspec_t));
svgm_vars[0].flags = DS_STRING;
svgm_vars[0].ptr = magic;
@ -1111,11 +1111,11 @@ static int32_t doallocsnap(int32_t allocinit)
{
sv_freemem();
svsnapshot = Bmalloc(svsnapsiz);
svsnapshot = (uint8_t *)Bmalloc(svsnapsiz);
if (allocinit)
svinitsnap = Bmalloc(svsnapsiz);
svinitsnap = (uint8_t *)Bmalloc(svsnapsiz);
svdiffsiz = svsnapsiz; // theoretically it's less than could be needed in the worst case, but practically it's overkill
svdiff = Bmalloc(svdiffsiz);
svdiff = (uint8_t *)Bmalloc(svdiffsiz);
if (svsnapshot==NULL || (allocinit && svinitsnap==NULL) || svdiff==NULL)
{
sv_freemem();
@ -1499,7 +1499,7 @@ static void sv_prescriptload_once()
{
if (script)
Bfree(script);
script = Bmalloc(g_scriptSize * sizeof(script[0]));
script = (intptr_t *)Bmalloc(g_scriptSize * sizeof(script[0]));
}
static void sv_postscript_once()
{
@ -1551,7 +1551,7 @@ static void sv_postanimateptr()
static void sv_prequote()
{
if (!savegame_quotes)
savegame_quotes = Bcalloc(MAXQUOTES, MAXQUOTELEN);
savegame_quotes = (char (*)[MAXQUOTELEN])Bcalloc(MAXQUOTES, MAXQUOTELEN);
}
static void sv_quotesave()
{
@ -1572,7 +1572,7 @@ static void sv_quoteload()
if (savegame_quotedef[i>>3]&(1<<(i&7)))
{
if (!ScriptQuotes[i])
ScriptQuotes[i] = Bcalloc(1, MAXQUOTELEN);
ScriptQuotes[i] = (char *)Bcalloc(1, MAXQUOTELEN);
Bmemcpy(ScriptQuotes[i], savegame_quotes[i], MAXQUOTELEN);
}
}
@ -1580,7 +1580,7 @@ static void sv_quoteload()
static void sv_prequoteredef()
{
// "+1" needed for dfwrite which doesn't handle the src==NULL && cnt==0 case
savegame_quoteredefs = Bcalloc(g_numQuoteRedefinitions+1, MAXQUOTELEN);
savegame_quoteredefs = (char (*)[MAXQUOTELEN])Bcalloc(g_numQuoteRedefinitions+1, MAXQUOTELEN);
}
static void sv_quoteredefsave()
{
@ -1595,7 +1595,7 @@ static void sv_quoteredefload()
for (i=0; i<g_numQuoteRedefinitions; i++)
{
if (!ScriptQuoteRedefinitions[i])
ScriptQuoteRedefinitions[i] = Bcalloc(1,MAXQUOTELEN);
ScriptQuoteRedefinitions[i] = (char *)Bcalloc(1,MAXQUOTELEN);
Bmemcpy(ScriptQuoteRedefinitions[i], savegame_quoteredefs[i], MAXQUOTELEN);
}
}