Remove useless casts

svn-id: r17400
This commit is contained in:
Max Horn 2005-04-05 17:50:33 +00:00
parent 1d14278fde
commit ebdb705ffd
9 changed files with 55 additions and 55 deletions

View File

@ -232,7 +232,7 @@ void data_closeDataFile() {
int16 file;
for (file = MAX_DATA_FILES - 1; file >= 0; file--) {
if (dataFiles[file] != 0) {
free((char *)dataFiles[file]);
free(dataFiles[file]);
dataFiles[file] = 0;
file_getHandle(dataFileHandles[file])->close();
return;
@ -269,13 +269,13 @@ char *data_getUnpackedData(const char *name) {
sizeLeft = packedSize;
ptr = packBuf;
while (sizeLeft > 0x4000) {
data_readChunk(chunk, (char *)ptr, 0x4000);
data_readChunk(chunk, ptr, 0x4000);
sizeLeft -= 0x4000;
ptr += 0x4000;
}
data_readChunk(chunk, (char *)ptr, sizeLeft);
data_readChunk(chunk, ptr, sizeLeft);
data_freeChunk(chunk);
unpackData((char *)packBuf, (char *)unpackBuf);
unpackData(packBuf, unpackBuf);
free(packBuf);
return unpackBuf;
}
@ -353,11 +353,11 @@ char *data_getData(const char *path) {
ptr = data;
while (size > 0x4000) {
data_readData(handle, (char *)ptr, 0x4000);
data_readData(handle, ptr, 0x4000);
size -= 0x4000;
ptr += 0x4000;
}
data_readData(handle, (char *)ptr, size);
data_readData(handle, ptr, size);
data_closeData(handle);
return data;

View File

@ -254,7 +254,7 @@ void game_popCollisions(void) {
game_collStackElemSizes[game_collStackSize] *
sizeof(Game_Collision));
free((char *)game_collStack[game_collStackSize]);
free(game_collStack[game_collStackSize]);
}
int16 game_checkMousePoint(int16 all, int16 *resId, int16 *resIndex) {
@ -378,7 +378,7 @@ char *game_loadTotResource(int16 id) {
itemPtr = &game_totResourceTable->items[id];
offset = itemPtr->offset;
if (offset >= 0) {
return (char *)((char *)game_totResourceTable) + szGame_TotResTable +
return ((char *)game_totResourceTable) + szGame_TotResTable +
szGame_TotResItem * game_totResourceTable->itemsCount + offset;
} else {
return (char *)(game_imFileData +
@ -438,7 +438,7 @@ void game_freeSoundSlot(int16 slot) {
game_soundFromExt[slot] = 0;
}
free((char *)game_soundSamples[slot]);
free(game_soundSamples[slot]);
game_soundSamples[slot] = 0;
}
@ -1852,13 +1852,13 @@ void game_playTot(int16 skipPlay) {
free(game_totFileData);
game_totFileData = 0;
if (game_totTextData != 0 && needTextFree != 0)
free((char *)game_totTextData);
free(game_totTextData);
game_totTextData = 0;
if (game_totResourceTable != 0
&& needFreeResTable != 0)
free((char *)game_totResourceTable);
free(game_totResourceTable);
game_totResourceTable = 0;
@ -1868,7 +1868,7 @@ void game_playTot(int16 skipPlay) {
game_imFileData = 0;
if (game_extTable != 0)
free((char *)game_extTable);
free(game_extTable);
game_extTable = 0;
if (game_extHandle >= 0)
@ -1912,7 +1912,7 @@ void game_start(void) {
game_prepareStart();
game_playTot(0);
free((char *)game_collisionAreas);
free(game_collisionAreas);
vid_freeSurfDesc(draw_cursorSprites);
vid_freeSurfDesc(draw_cursorBack);

View File

@ -1845,7 +1845,7 @@ void gob_freeObjects(void) {
for (col = 0; col < 6; col++) {
if (gob_goblins[i]->stateMach[state][col] != 0) {
free((char *)gob_goblins[i]->
free(gob_goblins[i]->
stateMach[state][col]);
gob_goblins[i]->stateMach[state][col] =
0;
@ -1858,14 +1858,14 @@ void gob_freeObjects(void) {
if (gob_goblins[3]->stateMach[state][0] == 0)
continue;
free((char *)gob_goblins[3]->
free(gob_goblins[3]->
stateMach[state][0]);
gob_goblins[3]->stateMach[state][0] = 0;
}
}
free((char *)gob_goblins[i]->stateMach);
free((char *)gob_goblins[i]);
free(gob_goblins[i]->stateMach);
free(gob_goblins[i]);
gob_goblins[i] = 0;
}
@ -1880,14 +1880,14 @@ void gob_freeObjects(void) {
if (gob_objects[i]->stateMach[state][col] == 0)
continue;
free((char *)gob_objects[i]->
free(gob_objects[i]->
stateMach[state][col]);
gob_objects[i]->stateMach[state][col] = 0;
}
}
free((char *)gob_objects[i]->stateMach);
free((char *)gob_objects[i]);
free(gob_objects[i]->stateMach);
free(gob_objects[i]);
gob_objects[i] = 0;
}
}

View File

@ -273,10 +273,10 @@ memBlocks = word ptr -2*/
free(game_totFileData);
if (game_totTextData != 0)
free((char *)game_totTextData);
free(game_totTextData);
if (game_totResourceTable != 0)
free((char *)game_totResourceTable);
free(game_totResourceTable);
}
for (i = 0; i < 4; i++) {
@ -284,7 +284,7 @@ memBlocks = word ptr -2*/
util_freeFont(draw_fonts[i]);
}
free((char *)init_palDesc);
free(init_palDesc);
data_closeDataFile();
vid_initPrimary(-1);
init_cleanup();

View File

@ -463,10 +463,10 @@ void mult_freeMult(void) {
vid_freeSurfDesc(anim_underAnimSurf);
if (mult_objects != 0)
free((char *)mult_objects);
free(mult_objects);
if (mult_renderData != 0)
free((char *)mult_renderData);
free(mult_renderData);
mult_objects = 0;
mult_renderData = 0;
@ -922,23 +922,23 @@ void mult_playMult(int16 startFrame, int16 endFrame, char checkEscape,
if (stopNoClear == 0) {
if (mult_animDataAllocated) {
if (mult_objects)
free((char *)mult_objects);
free(mult_objects);
mult_objects = 0;
if (mult_renderData)
free((char *)mult_renderData);
free(mult_renderData);
mult_renderData = 0;
if (mult_animArrayX)
free((char *)mult_animArrayX);
free(mult_animArrayX);
mult_animArrayX = 0;
if (mult_animArrayY)
free((char *)mult_animArrayY);
free(mult_animArrayY);
mult_animArrayY = 0;
if (mult_animArrayData)
free((char *)mult_animArrayData);
free(mult_animArrayData);
mult_animArrayData = 0;
if (anim_underAnimSurf)
@ -1150,42 +1150,42 @@ void mult_freeMultKeys(void) {
scen_freeAnim(mult_animIndices[i]);
}
free((char *)mult_staticKeys);
free(mult_staticKeys);
for (i = 0; i < 4; i++)
free((char *)mult_animKeys[i]);
free(mult_animKeys[i]);
free((char *)mult_palFadeKeys);
free((char *)mult_palKeys);
free((char *)mult_textKeys);
free(mult_palFadeKeys);
free(mult_palKeys);
free(mult_textKeys);
for (i = 0; i < mult_sndSlotsCount; i++) {
game_freeSoundSlot(19 - i);
}
free((char *)mult_sndKeys);
free(mult_sndKeys);
mult_multData = 0;
if (mult_animDataAllocated != 0) {
if (mult_objects)
free((char *)mult_objects);
free(mult_objects);
mult_objects = 0;
if (mult_renderData)
free((char *)mult_renderData);
free(mult_renderData);
mult_renderData = 0;
if (mult_animArrayX)
free((char *)mult_animArrayX);
free(mult_animArrayX);
mult_animArrayX = 0;
if (mult_animArrayY)
free((char *)mult_animArrayY);
free(mult_animArrayY);
mult_animArrayY = 0;
if (mult_animArrayData)
free((char *)mult_animArrayData);
free(mult_animArrayData);
mult_animArrayData = 0;
if (anim_underAnimSurf)

View File

@ -216,7 +216,7 @@ void pal_fade(PalDesc * palDesc, int16 fade, int16 allColors) {
}
if (tmpPalBuffer != 0) {
free((char *)tmpPalBuffer);
free(tmpPalBuffer);
tmpPalBuffer = 0;
}
}

View File

@ -168,7 +168,7 @@ void scen_freeStatic(int16 index) {
for (i = 0; i < scen_staticPictCount[index]; i++) {
if (scen_staticFromExt[index] == 1)
free((char *)scen_statics[index].pieces[i]);
free(scen_statics[index].pieces[i]);
spr = scen_staticPictToSprite[index * 7 + i];
scen_spriteRefs[spr]--;
@ -179,10 +179,10 @@ void scen_freeStatic(int16 index) {
}
}
free((char *)scen_statics[index].layers);
free((char *)scen_statics[index].pieces);
free(scen_statics[index].layers);
free(scen_statics[index].pieces);
if (scen_staticFromExt[index] == 1)
free((char *)scen_statics[index].dataPtr);
free(scen_statics[index].dataPtr);
scen_staticFromExt[index] = 0;
scen_staticPictCount[index] = -1;
@ -672,7 +672,7 @@ void scen_freeAnim(int16 animation) {
for (i = 0; i < scen_animPictCount[animation]; i++) {
if (scen_animFromExt[animation] == 1)
free((char *)scen_animations[animation].pieces[i]);
free(scen_animations[animation].pieces[i]);
spr = scen_animPictToSprite[animation * 7 + i];
scen_spriteRefs[spr]--;
@ -684,8 +684,8 @@ void scen_freeAnim(int16 animation) {
}
}
free((char *)scen_animations[animation].layers);
free((char *)scen_animations[animation].pieces);
free(scen_animations[animation].layers);
free(scen_animations[animation].pieces);
if (scen_animFromExt[animation] == 1)
free(scen_animations[animation].dataPtr);

View File

@ -238,7 +238,7 @@ FontDesc *util_loadFont(const char *path) {
data = data_getData(path);
if (data == 0) {
free((char *)fontDesc);
free(fontDesc);
return 0;
}
@ -263,7 +263,7 @@ FontDesc *util_loadFont(const char *path) {
void util_freeFont(FontDesc * fontDesc) {
free(fontDesc->dataPtr - 4);
free((char *)fontDesc);
free(fontDesc);
}
void util_clearPalette(void) {
@ -388,12 +388,12 @@ void util_listInsertBack(Util_List * list, void *data) {
void util_listDropFront(Util_List * list) {
if (list->pHead->pNext == 0) {
free((char *)(list->pHead));
free((list->pHead));
list->pHead = 0;
list->pTail = 0;
} else {
list->pHead = list->pHead->pNext;
free((char *)(list->pHead->pPrev));
free((list->pHead->pPrev));
list->pHead->pPrev = 0;
}
}
@ -403,7 +403,7 @@ void util_deleteList(Util_List * list) {
util_listDropFront(list);
}
free((char *)list);
free(list);
}
char util_str1[] =

View File

@ -140,7 +140,7 @@ SurfaceDesc *vid_initSurfDesc(int16 vidMode, int16 width, int16 height, int16 fl
void vid_freeSurfDesc(SurfaceDesc * surfDesc) {
sprAllocated--;
if (surfDesc != pPrimarySurfDesc)
free((char *)surfDesc);
free(surfDesc);
else
free(surfDesc->vidPtr);
}