The attached patch makes Warzone almost compile with "g++ -fpermissive".
It contains mainly explicit casts, some type changes, a few fixes. In
other words, just code cleanup. Comments in the next mail.
--
Oh, wow! Look at the moon!
Index: src/scriptfuncs.c
===================================================================
--- src/scriptfuncs.c (revision 358)
+++ src/scriptfuncs.c (working copy)
@@ -6600,7 +6600,7 @@
ASSERT( PTRVALID(psTemplate, sizeof(DROID_TEMPLATE)),
"scrFactoryGetTemplate: Invalid template pointer" );
- if (!stackPushResult(ST_TEMPLATE, (UDWORD)psTemplate))
+ if (!stackPushResult((INTERP_TYPE)ST_TEMPLATE, (UDWORD)psTemplate))
{
debug(LOG_ERROR, "scrFactoryGetTemplate: stackPushResult
failed");
return FALSE;
@@ -8174,7 +8174,7 @@
psStruct = NULL;
}
- if (!stackPushResult(ST_STRUCTURE, (UDWORD)psStruct))
+ if (!stackPushResult((INTERP_TYPE)ST_STRUCTURE, (UDWORD)psStruct))
{
return FALSE;
}
@@ -8331,14 +8331,14 @@
if(bFound)
{
- if (!stackPushResult(ST_BASEOBJECT, (SDWORD)psObj))
+ if (!stackPushResult((INTERP_TYPE)ST_BASEOBJECT, (SDWORD)psObj))
{
return FALSE;
}
}
else
{
- if (!stackPushResult(ST_BASEOBJECT, (SDWORD)NULL))
+ if (!stackPushResult((INTERP_TYPE)ST_BASEOBJECT, (SDWORD)NULL))
{
return FALSE;
}
@@ -8691,14 +8691,14 @@
if(bFound)
{
- if (!stackPushResult(ST_DROID, (SDWORD)foundDroid))
+ if (!stackPushResult((INTERP_TYPE)ST_DROID, (SDWORD)foundDroid))
{
return FALSE;
}
}
else
{
- if (!stackPushResult(ST_DROID, (SDWORD)NULL))
+ if (!stackPushResult((INTERP_TYPE)ST_DROID, (SDWORD)NULL))
{
return FALSE;
}
@@ -8772,14 +8772,14 @@
if(bFound)
{
- if (!stackPushResult(ST_STRUCTURE, (SDWORD)foundStruct))
+ if (!stackPushResult((INTERP_TYPE)ST_STRUCTURE,
(SDWORD)foundStruct))
{
return FALSE;
}
}
else
{
- if (!stackPushResult(ST_STRUCTURE, (SDWORD)NULL))
+ if (!stackPushResult((INTERP_TYPE)ST_STRUCTURE, (SDWORD)NULL))
{
return FALSE;
}
@@ -9381,7 +9381,7 @@
}
}
- if (!stackPushResult(ST_DROID, (SDWORD)psClosestDroid))
+ if (!stackPushResult((INTERP_TYPE)ST_DROID, (SDWORD)psClosestDroid))
{
return FALSE;
}
Index: src/group.c
===================================================================
--- src/group.c (revision 358)
+++ src/group.c (working copy)
@@ -42,7 +42,7 @@
// create a new group
BOOL grpCreate(DROID_GROUP **ppsGroup)
{
- if (!HEAP_ALLOC(psGrpHeap, (void*) ppsGroup))
+ if (!HEAP_ALLOC(psGrpHeap, (void**) ppsGroup))
{
return FALSE;
}
Index: src/scriptobj.c
===================================================================
--- src/scriptobj.c (revision 358)
+++ src/scriptobj.c (working copy)
@@ -250,13 +250,13 @@
if (psObj->type == OBJ_STRUCTURE)
{
- type = ST_STRUCTURESTAT;
+ type = (INTERP_TYPE)ST_STRUCTURESTAT;
val = ((STRUCTURE *)psObj)->pStructureType -
asStructureStats;
}
else if (psObj->type == OBJ_DROID)
{
//psStructStats = (STRUCTURE_STATS*)psDroid->psTarStats;
- type = ST_STRUCTURESTAT;
+ type = (INTERP_TYPE)ST_STRUCTURESTAT;
val = (SDWORD)((STRUCTURE_STATS *)(((DROID
*)psObj)->psTarStats) - asStructureStats);
}
else //Nothing else supported
@@ -272,13 +272,13 @@
//added object->psTarget
if (psObj->type == OBJ_STRUCTURE)
{
- type = ST_BASEOBJECT;
+ type = (INTERP_TYPE)ST_BASEOBJECT;
val = (SDWORD)((STRUCTURE *)psObj)->psTarget;
}
else if (psObj->type == OBJ_DROID)
{
//psStructStats = (STRUCTURE_STATS*)psDroid->psTarStats;
- type = ST_BASEOBJECT;
+ type = (INTERP_TYPE)ST_BASEOBJECT;
val = (SDWORD)(((DROID *)psObj)->psTarget);
}
else //Nothing else supported
Index: src/droid.c
===================================================================
--- src/droid.c (revision 358)
+++ src/droid.c (working copy)
@@ -2855,7 +2855,7 @@
for (i=0; i < NumDroids; i++)
{
- if (!HEAP_ALLOC(psTemplateHeap, (void*) &pDroidDesign))
+ if (!HEAP_ALLOC(psTemplateHeap, (void**) &pDroidDesign))
{
debug( LOG_ERROR, "Out of memory - Droid Templates" );
abort();
Index: src/data.c
===================================================================
--- src/data.c (revision 358)
+++ src/data.c (working copy)
@@ -900,13 +900,13 @@
}
else
{
- NewTexturePage = MALLOC(sizeof(TEXTUREPAGE));
+ NewTexturePage = (TEXTUREPAGE*)MALLOC(sizeof(TEXTUREPAGE));
if (!NewTexturePage) return FALSE;
NewTexturePage->Texture=NULL;
NewTexturePage->Palette=NULL;
- psPal = MALLOC(sizeof(iPalette));
+ psPal = (iPalette*)MALLOC(sizeof(iPalette));
if (!psPal) return FALSE;
psSprite = (iSprite*)MALLOC(sizeof(iSprite));
@@ -1071,7 +1071,7 @@
void dataAnimRelease( void *pData )
{
- anim_ReleaseAnim(pData);
+ anim_ReleaseAnim((BASEANIM*)pData);
}
/* Load a string resource file */
Index: src/formation.c
===================================================================
--- src/formation.c (revision 358)
+++ src/formation.c (working copy)
@@ -115,7 +115,7 @@
SDWORD i;
// get a heap structure
- if (!HEAP_ALLOC(psFHeap, (void*) &psNew))
+ if (!HEAP_ALLOC(psFHeap, (void**) &psNew))
{
return FALSE;
}
Index: src/effects.c
===================================================================
--- src/effects.c (revision 358)
+++ src/effects.c (working copy)
@@ -2925,7 +2925,7 @@
fileSize = ( sizeof(struct _fx_save_header) + ( fxEntries*sizeof(struct
_effect_def) ) );
/* Try and allocate it - freed up in same function */
- pFileData = MALLOC(fileSize);
+ pFileData = (char*)MALLOC(fileSize);
/* Did we get it? */
if(!pFileData)
@@ -3091,7 +3091,7 @@
if(asEffectsList[i].imd)
{
/* Restore the pointer from the hashed ID */
- endian_udword(&asEffectsList[i].imd);
+ endian_udword((UDWORD*)&asEffectsList[i].imd);
asEffectsList[i].imd =
(iIMDShape*)resGetDataFromHash("IMD",(UDWORD)asEffectsList[i].imd);
}
}
Index: src/environ.c
===================================================================
--- src/environ.c (revision 358)
+++ src/environ.c (working copy)
@@ -67,7 +67,7 @@
//this function just allocates the memory now for MaxMapWidth, MaxMapHeight
BOOL environInit( void )
{
- pEnvironData = MALLOC(sizeof(struct environ_data) * MAP_MAXWIDTH *
MAP_MAXHEIGHT);
+ pEnvironData = (ENVIRON_DATA*)MALLOC(sizeof(struct environ_data) *
MAP_MAXWIDTH * MAP_MAXHEIGHT);
if(!pEnvironData)
{
debug( LOG_ERROR, "Can't get memory for the environment data" );
Index: src/gatewaysup.c
===================================================================
--- src/gatewaysup.c (revision 358)
+++ src/gatewaysup.c (working copy)
@@ -505,7 +505,7 @@
gwFreeZoneMap();
}
- apRLEZones = MALLOC(sizeof(UBYTE *) * gwMapHeight());
+ apRLEZones = (UBYTE**)MALLOC(sizeof(UBYTE *) * gwMapHeight());
if (apRLEZones == NULL)
{
debug( LOG_ERROR, "gwCreateBlankZoneMap: Out of memory" );
@@ -515,7 +515,7 @@
for(i=0; i< gwMapHeight(); i++)
{
- apRLEZones[i] = MALLOC(gwMapWidth() * 2);
+ apRLEZones[i] = (UBYTE*)MALLOC(gwMapWidth() * 2);
if (apRLEZones[i] == NULL)
{
Index: src/game.c
===================================================================
--- src/game.c (revision 358)
+++ src/game.c (working copy)
@@ -10153,7 +10153,7 @@
psSaveMessage = (SAVE_MESSAGE *) pFileData;
/* SAVE_MESSAGE */
- endian_sdword(&psSaveMessage->type); /* FIXME: enum may not
be this type! */
+ endian_sdword((SDWORD*)&psSaveMessage->type); /* FIXME: enum
may not be this type! */
endian_udword(&psSaveMessage->objId);
endian_udword(&psSaveMessage->player);
@@ -10317,7 +10317,7 @@
psSaveMessage->read = psMessage->read;
//flag to indicate whether message has been read
psSaveMessage->player = psMessage->player;
//which player this message belongs to
- endian_sdword(&psSaveMessage->type); /* FIXME: enum may
be different type! */
+ endian_sdword((SDWORD*)&psSaveMessage->type); /* FIXME:
enum may be different type! */
endian_udword(&psSaveMessage->objId);
endian_udword(&psSaveMessage->player);
@@ -10591,7 +10591,7 @@
psSaveflag = (SAVE_FLAG *) pFileData;
/* SAVE_FLAG */
- endian_sdword(&psSaveflag->type); /* FIXME: enum may not be
this type! */
+ endian_sdword((SDWORD*)psSaveflag->type); /* FIXME: enum may
not be this type! */
endian_udword(&psSaveflag->frameNumber);
endian_udword(&psSaveflag->screenX);
endian_udword(&psSaveflag->screenY);
@@ -10791,7 +10791,7 @@
}
/* SAVE_FLAG */
- endian_sdword(&psSaveflag->type); /* FIXME: enum may be
different type! */
+ endian_sdword((SDWORD*)&psSaveflag->type); /* FIXME:
enum may be different type! */
endian_udword(&psSaveflag->frameNumber);
endian_udword(&psSaveflag->screenX);
endian_udword(&psSaveflag->screenY);
@@ -10842,7 +10842,7 @@
}
/* SAVE_FLAG */
-
endian_sdword(&psSaveflag->type); /* FIXME: enum may be different type! */
+
endian_sdword((SDWORD*)&psSaveflag->type); /* FIXME: enum may be different
type! */
endian_udword(&psSaveflag->frameNumber);
endian_udword(&psSaveflag->screenX);
endian_udword(&psSaveflag->screenY);
Index: src/multiplay.c
===================================================================
--- src/multiplay.c (revision 358)
+++ src/multiplay.c (working copy)
@@ -1335,7 +1335,7 @@
MultiMsgPlayerTo = selectedPlayer;
strcpy(MultiplayMsg,&(pMsg->body[4]));
- eventFireCallbackTrigger(CALL_AI_MSG);
+ eventFireCallbackTrigger((TRIGGER_TYPE)CALL_AI_MSG);
// make some noise!
if(titleMode == MULTIOPTION || titleMode == MULTILIMIT)
@@ -1938,7 +1938,7 @@
strcpy(MultiplayMsg, msg);
- eventFireCallbackTrigger(CALL_BEACON);
+ eventFireCallbackTrigger((TRIGGER_TYPE)CALL_BEACON);
break;
case CALL_AI_MSG:
@@ -1953,7 +1953,7 @@
strcpy(MultiplayMsg, msg);
- eventFireCallbackTrigger(CALL_AI_MSG);
+ eventFireCallbackTrigger((TRIGGER_TYPE)CALL_AI_MSG);
break;
default:
@@ -1987,4 +1987,4 @@
strcpy(beaconReceiveMsg[sender], msg);
return addHelpBlip(locX,locY,receiver,sender,beaconReceiveMsg[sender]);
-}
\ No newline at end of file
+}
Index: src/init.c
===================================================================
--- src/init.c (revision 358)
+++ src/init.c (working copy)
@@ -1014,7 +1014,7 @@
{
displayBufferSize = 5000000;
}
- DisplayBuffer = MALLOC(displayBufferSize);
+ DisplayBuffer = (char*)MALLOC(displayBufferSize);
if (DisplayBuffer == NULL)
{
debug( LOG_ERROR, "Unable to allocate memory for display
buffer" );
Index: src/scriptai.c
===================================================================
--- src/scriptai.c (revision 358)
+++ src/scriptai.c (working copy)
@@ -2320,7 +2320,7 @@
psDroid = NULL;
}
- if (!stackPushResult(ST_DROID, (SDWORD)psDroid))
+ if (!stackPushResult((INTERP_TYPE)ST_DROID, (SDWORD)psDroid))
{
debug(LOG_ERROR, "scrIterateGroupB: stackPushResult failed");
return FALSE;
Index: src/frontend.c
===================================================================
--- src/frontend.c (revision 358)
+++ src/frontend.c (working copy)
@@ -70,7 +70,7 @@
extern void set_active_data_directory(int);
extern CURSORSNAP InterfaceSnap;
-extern void ProcessCursorSnap(VOID);
+extern void ProcessCursorSnap(void);
int StartWithGame = 1; // New game starts in Cam 1.
Index: src/keybind.c
===================================================================
--- src/keybind.c (revision 358)
+++ src/keybind.c (working copy)
@@ -1855,7 +1855,7 @@
//--------------------------
ConsolePlayer = selectedPlayer;
strcpy(ConsoleMsg,sTextToSend);
- eventFireCallbackTrigger(CALL_CONSOLE);
+
eventFireCallbackTrigger((TRIGGER_TYPE)CALL_CONSOLE);
if(bMultiPlayer && NetPlay.bComms)
Index: src/feature.c
===================================================================
--- src/feature.c (revision 358)
+++ src/feature.c (working copy)
@@ -1043,7 +1043,8 @@
/* Remove a Feature and free it's memory */
void destroyFeature(FEATURE *psDel)
{
- UDWORD widthScatter,breadthScatter,heightScatter, i,
explosionSize;
+ UDWORD widthScatter,breadthScatter,heightScatter, i;
+ EFFECT_TYPE explosionSize;
iVector pos;
UDWORD width,breadth;
UDWORD mapX,mapY;
Index: src/gateway.c
===================================================================
--- src/gateway.c (revision 358)
+++ src/gateway.c (working copy)
@@ -160,7 +160,7 @@
return FALSE;
}
- psNew = MALLOC(sizeof(GATEWAY));
+ psNew = (GATEWAY*)MALLOC(sizeof(GATEWAY));
if (!psNew)
{
debug( LOG_ERROR, "gwNewGateway: out of memory" );
@@ -232,7 +232,7 @@
return FALSE;
}
- psNew = MALLOC(sizeof(GATEWAY));
+ psNew = (GATEWAY*)MALLOC(sizeof(GATEWAY));
if (!psNew)
{
debug( LOG_ERROR, "gwNewGateway: out of memory" );
@@ -705,7 +705,7 @@
// note which zones have a gateway
- aZoneReachable = MALLOC( sizeof(UBYTE) * gwNumZones );
+ aZoneReachable = (UBYTE*)MALLOC( sizeof(UBYTE) * gwNumZones );
if (aZoneReachable == NULL)
{
debug( LOG_ERROR, "gwLinkGateways: out of memory" );
@@ -795,7 +795,7 @@
}
if (zone1Links+zone2Links > 0)
{
- psCurr->psLinks = MALLOC(sizeof(GATEWAY_LINK) *
(zone1Links+zone2Links));
+ psCurr->psLinks =
(GATEWAY_LINK*)MALLOC(sizeof(GATEWAY_LINK) * (zone1Links+zone2Links));
if (psCurr->psLinks == NULL)
{
debug( LOG_ERROR, "gwLinkGateways: out of
memory" );
@@ -910,7 +910,7 @@
gwFreeZoneMap();
}
- apRLEZones = MALLOC(sizeof(UBYTE *) * gwMapHeight());
+ apRLEZones = (UBYTE**)MALLOC(sizeof(UBYTE *) * gwMapHeight());
if (apRLEZones == NULL)
{
debug( LOG_ERROR, "gwNewZoneMap: Out of memory" );
@@ -937,7 +937,7 @@
FREE(apRLEZones[Line]);
}
- apRLEZones[Line] = MALLOC(Size);
+ apRLEZones[Line] = (UBYTE*)MALLOC(Size);
if (apRLEZones[Line] == NULL)
{
debug( LOG_ERROR, "gwNewZoneLine: Out of memory" );
@@ -1032,7 +1032,7 @@
"gwNewEquivTable: invalid number of zones" );
gwNumZones = numZones;
- aNumEquiv = MALLOC(sizeof(UBYTE) * numZones);
+ aNumEquiv = (UBYTE*)MALLOC(sizeof(UBYTE) * numZones);
if (aNumEquiv == NULL)
{
debug( LOG_ERROR, "gwNewEquivTable: out of memory" );
@@ -1044,7 +1044,7 @@
aNumEquiv[i] = 0;
}
- apEquivZones = MALLOC(sizeof(UBYTE *) * numZones);
+ apEquivZones = (UBYTE**)MALLOC(sizeof(UBYTE *) * numZones);
if (apEquivZones == NULL)
{
debug( LOG_ERROR, "gwNewEquivTable: out of memory" );
@@ -1095,7 +1095,7 @@
ASSERT( numEquiv <= gwNumZones,
"gwSetZoneEquiv: invalid number of zone equivalents" );
- apEquivZones[zone] = MALLOC(sizeof(UBYTE) * numEquiv);
+ apEquivZones[zone] = (UBYTE*)MALLOC(sizeof(UBYTE) * numEquiv);
if (apEquivZones[zone] == NULL)
{
debug( LOG_ERROR, "gwSetZoneEquiv: out of memory" );
Index: src/main.c
===================================================================
--- src/main.c (revision 358)
+++ src/main.c (working copy)
@@ -3,6 +3,7 @@
*
*/
#include "lib/framework/frame.h"
+#include "lib/framework/configfile.h"
/* For SHGetFolderPath */
#ifdef WIN32
@@ -84,7 +85,6 @@
char MultiPlayersPath[MAX_PATH];
char KeyMapPath[MAX_PATH];
char UserMusicPath[MAX_PATH];
-char RegFilePath[MAX_PATH];
void debug_callback_stderr( void**, const char * );
void debug_callback_win32debug( void**, const char * );
Index: src/intdisplay.c
===================================================================
--- src/intdisplay.c (revision 358)
+++ src/intdisplay.c (working copy)
@@ -2319,7 +2319,7 @@
UDWORD i;
for(i=0; i<NUM_OBJECTSURFACES; i++) {
- ObjectSurfaces[i].Buffer = MALLOC(Width*Height);
+ ObjectSurfaces[i].Buffer = (uint8*)MALLOC(Width*Height);
ASSERT( ObjectSurfaces[i].Buffer!=NULL,"intInitialise : Failed
to allocate Object surface" );
ObjectSurfaces[i].Surface =
iV_SurfaceCreate(REND_SURFACE_USR,Width,Height,10,10,ObjectSurfaces[i].Buffer);
ASSERT( ObjectSurfaces[i].Surface!=NULL,"intInitialise : Failed
to create Object surface" );
@@ -2331,7 +2331,7 @@
}
for(i=0; i<NUM_SYSTEM0SURFACES; i++) {
- System0Surfaces[i].Buffer = MALLOC(Width*Height);
+ System0Surfaces[i].Buffer = (uint8*)MALLOC(Width*Height);
ASSERT( System0Surfaces[i].Buffer!=NULL,"intInitialise : Failed
to allocate System0 surface" );
System0Surfaces[i].Surface =
iV_SurfaceCreate(REND_SURFACE_USR,Width,Height,10,10,System0Surfaces[i].Buffer);
ASSERT( System0Surfaces[i].Surface!=NULL,"intInitialise :
Failed to create System0 surface" );
@@ -2343,7 +2343,7 @@
}
for(i=0; i<NUM_TOPICSURFACES; i++) {
- TopicSurfaces[i].Buffer = MALLOC(WidthTopic*HeightTopic);
+ TopicSurfaces[i].Buffer =
(uint8*)MALLOC(WidthTopic*HeightTopic);
ASSERT( TopicSurfaces[i].Buffer!=NULL,"intInitialise : Failed
to allocate Topic surface" );
TopicSurfaces[i].Surface =
iV_SurfaceCreate(REND_SURFACE_USR,WidthTopic,HeightTopic,10,10,TopicSurfaces[i].Buffer);
ASSERT( TopicSurfaces[i].Surface!=NULL,"intInitialise : Failed
to create Topic surface" );
@@ -2355,7 +2355,7 @@
}
for(i=0; i<NUM_STATSURFACES; i++) {
- StatSurfaces[i].Buffer = MALLOC(Width*Height);
+ StatSurfaces[i].Buffer = (uint8*)MALLOC(Width*Height);
ASSERT( StatSurfaces[i].Buffer!=NULL,"intInitialise : Failed to
allocate Stats surface" );
StatSurfaces[i].Surface =
iV_SurfaceCreate(REND_SURFACE_USR,Width,Height,10,10,StatSurfaces[i].Buffer);
ASSERT( StatSurfaces[i].Surface!=NULL,"intInitialise : Failed
to create Stat surface" );
Index: src/scriptvals_parser.y
===================================================================
--- src/scriptvals_parser.y (revision 358)
+++ src/scriptvals_parser.y (working copy)
@@ -168,20 +168,20 @@
{
if
(resPresent("BLO",stringname)==TRUE)
{
-
psCurrScript=resGetData("BLO",stringname);
+ psCurrScript =
(SCRIPT_CODE*)resGetData("BLO",stringname);
}
else
{
// change extension to
"slo"
stringname[extpos]='s';
-
psCurrScript=resGetData("SCRIPT",stringname);
+ psCurrScript =
(SCRIPT_CODE*)resGetData("SCRIPT",stringname);
}
}
else if
(strncmp(&stringname[extpos],"slo",3)==0)
{
if
(resPresent("SCRIPT",stringname)==TRUE)
{
-
psCurrScript=resGetData("SCRIPT",stringname);
+ psCurrScript =
(SCRIPT_CODE*)resGetData("SCRIPT",stringname);
}
}
Index: src/astar.c
===================================================================
--- src/astar.c (revision 358)
+++ src/astar.c (working copy)
@@ -128,7 +128,7 @@
}
#if OPEN_LIST == 2
- apsNodes = MALLOC(sizeof(FP_NODE *) * FPATH_TABLESIZE);
+ apsNodes = (FP_NODE**)MALLOC(sizeof(FP_NODE *) * FPATH_TABLESIZE);
if (!apsNodes)
{
return FALSE;
@@ -759,7 +759,7 @@
{
FP_NODE *psNode;
- if (!HEAP_ALLOC(psFPNodeHeap, (void*) &psNode))
+ if (!HEAP_ALLOC(psFPNodeHeap, (void**) &psNode))
{
return NULL;
}
Index: lib/gamelib/ptrlist.c
===================================================================
--- lib/gamelib/ptrlist.c (revision 358)
+++ lib/gamelib/ptrlist.c (working copy)
@@ -27,7 +27,7 @@
UDWORD udwExtElements, UDWORD udwElementSize )
{
/* create ptr list struct */
- (*ppsList) = MALLOC( sizeof(PTRLIST) );
+ (*ppsList) = (PTRLIST*)MALLOC( sizeof(PTRLIST) );
/* allocate heaps */
if ( !HEAP_CREATE( &(*ppsList)->psNodeHeap, sizeof(LISTNODE),
@@ -178,7 +178,7 @@
"ptrList_InsertElement: element pointer invalid\n" );
/* get node from heap */
- HEAP_ALLOC( ptrList->psNodeHeap, (void*) &psNode );
+ HEAP_ALLOC( ptrList->psNodeHeap, (void**) &psNode );
/* set node elements */
psNode->sdwKey = sdwKey;
Index: lib/gamelib/animobj.c
===================================================================
--- lib/gamelib/animobj.c (revision 358)
+++ lib/gamelib/animobj.c (working copy)
@@ -126,7 +126,7 @@
SDWORD dwTime;
BOOL bRemove;
- psObj = hashTable_GetFirst( g_pAnimObjTable );
+ psObj = (ANIM_OBJECT*)hashTable_GetFirst( g_pAnimObjTable );
while ( psObj != NULL )
{
@@ -166,7 +166,7 @@
}
}
- psObj = hashTable_GetNext( g_pAnimObjTable );
+ psObj = (ANIM_OBJECT*)hashTable_GetNext( g_pAnimObjTable );
}
}
@@ -191,7 +191,7 @@
/* get object from table */
- psObj = hashTable_GetElement( g_pAnimObjTable );
+ psObj = (ANIM_OBJECT*)hashTable_GetElement( g_pAnimObjTable );
if (psObj==NULL)
@@ -282,7 +282,7 @@
ANIM_OBJECT *
animObj_GetNext( void )
{
- return hashTable_GetNext( g_pAnimObjTable );
+ return (ANIM_OBJECT*)hashTable_GetNext( g_pAnimObjTable );
}
/***************************************************************************/
@@ -290,7 +290,7 @@
ANIM_OBJECT *
animObj_Find( void *pParentObj, int iAnimID )
{
- return hashTable_FindElement( g_pAnimObjTable,
+ return (ANIM_OBJECT*)hashTable_FindElement( g_pAnimObjTable,
(int) pParentObj, iAnimID );
}
Index: lib/gamelib/anim.c
===================================================================
--- lib/gamelib/anim.c (revision 358)
+++ lib/gamelib/anim.c (working copy)
@@ -121,7 +121,7 @@
psAnim->uwAnimTime = (UWORD) (uwStates*1000 / psAnim->uwFrameRate);
/* allocate frames */
- psAnim->psStates = MALLOC( uwObj*psAnim->uwStates*sizeof(ANIM_STATE) );
+ psAnim->psStates = (ANIM_STATE*)MALLOC(
uwObj*psAnim->uwStates*sizeof(ANIM_STATE) );
}
/***************************************************************************/
@@ -135,7 +135,7 @@
UWORD uwFrames, i;
/* allocate anim */
- if ( (psAnim3D = MALLOC(sizeof(ANIM3D))) == NULL )
+ if ( (psAnim3D = (ANIM3D*)MALLOC(sizeof(ANIM3D))) == NULL )
{
return FALSE;
}
@@ -169,7 +169,7 @@
}
/* get pointers to individual frames */
- psAnim3D->apFrame = MALLOC( uwFrames*sizeof(iIMDShape *) );
+ psAnim3D->apFrame = (iIMDShape**)MALLOC( uwFrames*sizeof(iIMDShape *) );
psFrames = psAnim3D->psFrames;
for ( i=0; i<uwFrames; i++ )
{
@@ -295,7 +295,7 @@
anim_SetVals( char szFileName[], UWORD uwAnimID )
{
/* get track pointer from resource */
- BASEANIM *psAnim = resGetData( "ANI", szFileName );
+ BASEANIM *psAnim = (BASEANIM*)resGetData( "ANI", szFileName );
if ( psAnim == NULL )
{
Index: lib/gamelib/hashtabl.c
===================================================================
--- lib/gamelib/hashtabl.c (revision 358)
+++ lib/gamelib/hashtabl.c (working copy)
@@ -74,9 +74,9 @@
/* allocate and init table */
- (*ppsTable) = MALLOC( sizeof(HASHTABLE) );
+ (*ppsTable) = (HASHTABLE*)MALLOC( sizeof(HASHTABLE) );
udwSize = udwTableSize * sizeof(HASHNODE *);
- (*ppsTable)->ppsNode = MALLOC( udwSize );
+ (*ppsTable)->ppsNode = (HASHNODE**)MALLOC( udwSize );
memset( (*ppsTable)->ppsNode, 0, udwSize );
/* allocate heaps */
@@ -260,7 +260,7 @@
udwHashIndex = hashTable_GetHashKey( psTable, iKey1, iKey2 );
/* get node from heap */
- HEAP_ALLOC( psTable->psNodeHeap, (void*) &psNode );
+ HEAP_ALLOC( psTable->psNodeHeap, (void**) &psNode );
/* set node elements */
psNode->iKey1 = iKey1;
Index: lib/gamelib/anim.h
===================================================================
--- lib/gamelib/anim.h (revision 358)
+++ lib/gamelib/anim.h (working copy)
@@ -95,7 +95,7 @@
/***************************************************************************/
-typedef void * (* GETSHAPEFUNC) ( STRING *pStr );
+typedef iIMDShape * (* GETSHAPEFUNC) ( STRING *pStr );
typedef struct ANIMGLOBALS
{
Index: lib/ivis_common/imdload.c
===================================================================
--- lib/ivis_common/imdload.c (revision 358)
+++ lib/ivis_common/imdload.c (working copy)
@@ -531,7 +531,7 @@
}
// Build table of nodes - we sort out the links later
- NodeList=MALLOC((sizeof(BSPTREENODE))*BSPNodeCount); // Allocate the
entire node tree
+ NodeList = (BSPTREENODE*)MALLOC((sizeof(BSPTREENODE))*BSPNodeCount);
// Allocate the entire node tree
memset(NodeList,0,(sizeof(BSPTREENODE))*BSPNodeCount); // Zero it out
... we need to make all pointers NULL
Index: lib/ivis_common/piestate.c
===================================================================
--- lib/ivis_common/piestate.c (revision 358)
+++ lib/ivis_common/piestate.c (working copy)
@@ -18,7 +18,6 @@
pie_SetFogColour(0x00000000);//nicks colour
//depth Buffer on
- rendStates.depthBuffer = FALSE;//to force reset to true
pie_SetDepthBufferStatus(DEPTH_CMP_LEQ_WRT_ON);
//set render mode
Index: lib/ivis_common/bitimage.c
===================================================================
--- lib/ivis_common/bitimage.c (revision 358)
+++ lib/ivis_common/bitimage.c (working copy)
@@ -84,20 +84,20 @@
endian_uword(&Header->BitDepth);
endian_uword(&Header->NumTPages);
- ImageFile = MALLOC(sizeof(IMAGEFILE));
+ ImageFile = (IMAGEFILE*)MALLOC(sizeof(IMAGEFILE));
if(ImageFile == NULL) {
debug( LOG_ERROR, "Out of memory" );
return NULL;
}
- ImageFile->TexturePages = MALLOC(sizeof(iSprite)*Header->NumTPages);
+ ImageFile->TexturePages =
(iSprite*)MALLOC(sizeof(iSprite)*Header->NumTPages);
if(ImageFile->TexturePages == NULL) {
debug( LOG_ERROR, "Out of memory" );
return NULL;
}
- ImageFile->ImageDefs = MALLOC(sizeof(IMAGEDEF)*Header->NumImages);
+ ImageFile->ImageDefs =
(IMAGEDEF*)MALLOC(sizeof(IMAGEDEF)*Header->NumImages);
if(ImageFile->ImageDefs == NULL) {
debug( LOG_ERROR, "Out of memory" );
return NULL;
Index: lib/ivis_common/piestate.h
===================================================================
--- lib/ivis_common/piestate.h (revision 358)
+++ lib/ivis_common/piestate.h (working copy)
@@ -100,7 +100,6 @@
typedef struct RENDER_STATE
{
- DEPTH_MODE
depthBuffer;
BOOL
translucent;
BOOL
additive;
FOG_CAP fogCap;
Index: lib/ivis_common/pcx.c
===================================================================
--- lib/ivis_common/pcx.c (revision 358)
+++ lib/ivis_common/pcx.c (working copy)
@@ -103,7 +103,7 @@
s->width = w;
s->height = h;
// Freeing s->bmp before allocating new mem would give
a HEAP error on Windows (Invalid Address specified to RtlFreeHeap( x, x )).
- s->bmp = malloc(w*h*info_ptr->channels);
+ s->bmp = (iBitmap*)malloc(w*h*info_ptr->channels);
}
{
Index: lib/widget/editbox.c
===================================================================
--- lib/widget/editbox.c (revision 358)
+++ lib/widget/editbox.c (working copy)
@@ -54,7 +54,7 @@
*ppsWidget = (W_EDITBOX *)MALLOC(sizeof(W_EDITBOX));
if (*ppsWidget == NULL)
#else
- if (!HEAP_ALLOC(psEdbHeap, (void*) ppsWidget))
+ if (!HEAP_ALLOC(psEdbHeap, (void**) ppsWidget))
#endif
{
ASSERT( FALSE, "Out of memory" );
Index: lib/widget/form.c
===================================================================
--- lib/widget/form.c (revision 358)
+++ lib/widget/form.c (working copy)
@@ -88,7 +88,7 @@
*ppsWidget = (W_FORM *)MALLOC(sizeof(W_FORM));
if (*ppsWidget == NULL)
#else
- if (!HEAP_ALLOC(psFormHeap, (void*) ppsWidget))
+ if (!HEAP_ALLOC(psFormHeap, (void**) ppsWidget))
#endif
{
ASSERT( FALSE, "formCreatePlain: Out of memory" );
@@ -152,7 +152,7 @@
*ppsWidget = (W_CLICKFORM *)MALLOC(sizeof(W_CLICKFORM));
if (*ppsWidget == NULL)
#else
- if (!HEAP_ALLOC(psCFormHeap, (void*) ppsWidget))
+ if (!HEAP_ALLOC(psCFormHeap, (void**) ppsWidget))
#endif
{
ASSERT( FALSE, "formCreateClickable: Out of memory" );
@@ -279,7 +279,7 @@
*ppsWidget = (W_TABFORM *)MALLOC(sizeof(W_TABFORM));
if (*ppsWidget == NULL)
#else
- if (!HEAP_ALLOC(psTFormHeap, (void*) ppsWidget))
+ if (!HEAP_ALLOC(psTFormHeap, (void**) ppsWidget))
#endif
{
ASSERT( FALSE, "formCreateTabbed: Out of memory" );
Index: lib/widget/bar.c
===================================================================
--- lib/widget/bar.c (revision 358)
+++ lib/widget/bar.c (working copy)
@@ -48,7 +48,7 @@
*ppsWidget = (W_BARGRAPH *)MALLOC(sizeof(W_BARGRAPH));
if (*ppsWidget == NULL)
#else
- if (!HEAP_ALLOC(psBarHeap, (void*) ppsWidget))
+ if (!HEAP_ALLOC(psBarHeap, (void**) ppsWidget))
#endif
{
ASSERT( FALSE, "barGraphCreate: Out of memory" );
Index: lib/widget/button.c
===================================================================
--- lib/widget/button.c (revision 358)
+++ lib/widget/button.c (working copy)
@@ -47,7 +47,7 @@
*ppsWidget = (W_BUTTON *)MALLOC(sizeof(W_BUTTON));
if (*ppsWidget == NULL)
#else
- if (!HEAP_ALLOC(psButHeap, (void*) ppsWidget))
+ if (!HEAP_ALLOC(psButHeap, (void**) ppsWidget))
#endif
{
ASSERT( FALSE, "buttonCreate: Out of memory" );
Index: lib/widget/label.c
===================================================================
--- lib/widget/label.c (revision 358)
+++ lib/widget/label.c (working copy)
@@ -36,7 +36,7 @@
*ppsWidget = (W_LABEL *)MALLOC(sizeof(W_LABEL));
if (*ppsWidget == NULL)
#else
- if (!HEAP_ALLOC(psLabHeap, (void*) ppsWidget))
+ if (!HEAP_ALLOC(psLabHeap, (void**) ppsWidget))
#endif
{
ASSERT( FALSE, "Out of memory" );
Index: lib/widget/slider.c
===================================================================
--- lib/widget/slider.c (revision 358)
+++ lib/widget/slider.c (working copy)
@@ -64,7 +64,7 @@
*ppsWidget = (W_SLIDER *)MALLOC(sizeof(W_SLIDER));
if (*ppsWidget == NULL)
#else
- if (!HEAP_ALLOC(psSldHeap, (void*) ppsWidget))
+ if (!HEAP_ALLOC(psSldHeap, (void**) ppsWidget))
#endif
{
ASSERT( FALSE, "sliderCreate: Out of memory" );
Index: lib/widget/widget.c
===================================================================
--- lib/widget/widget.c (revision 358)
+++ lib/widget/widget.c (working copy)
@@ -144,7 +144,7 @@
/* Get a string from the string heap */
BOOL widgAllocString(STRING **ppStr)
{
- if (!HEAP_ALLOC(psStrHeap, (void*) ppStr))
+ if (!HEAP_ALLOC(psStrHeap, (void**) ppStr))
{
return FALSE;
}
@@ -174,7 +174,7 @@
*/
BOOL widgAllocCopyString(STRING **ppDest, STRING *pSrc)
{
- if (!HEAP_ALLOC(psStrHeap, (void*) ppDest))
+ if (!HEAP_ALLOC(psStrHeap, (void**) ppDest))
{
*ppDest = NULL;
return FALSE;
Index: lib/script/interp.c
===================================================================
--- lib/script/interp.c (revision 358)
+++ lib/script/interp.c (working copy)
@@ -329,7 +329,7 @@
case OP_FUNC:
//debug( LOG_SCRIPT, "-OP_FUNC" );
//debug( LOG_SCRIPT, "OP_FUNC: remember
event %d, ip=%d", CurEvent, (ip + 2) );
- if(!RetStackRemember(CurEvent, (ip +
2))) //Remember where to jump back later
+ if(!RetStackRemember(CurEvent, *(ip +
2))) //Remember where to jump back later
{
debug( LOG_ERROR,
"interpRunScript() - RetStackRemember() failed.");
return FALSE;
Index: lib/script/stack.c
===================================================================
--- lib/script/stack.c (revision 358)
+++ lib/script/stack.c (working copy)
@@ -72,7 +72,7 @@
{
return FALSE;
}
- psCurrChunk->psNext->aVals = MALLOC(sizeof(INTERP_VAL) * size);
+ psCurrChunk->psNext->aVals =
(INTERP_VAL*)MALLOC(sizeof(INTERP_VAL) * size);
if (!psCurrChunk->psNext->aVals)
{
FREE(psCurrChunk->psNext);
@@ -627,7 +627,7 @@
abort();
return FALSE;
}
- psStackBase->aVals = MALLOC(sizeof(INTERP_VAL) * INIT_SIZE);
+ psStackBase->aVals = (INTERP_VAL*)MALLOC(sizeof(INTERP_VAL) *
INIT_SIZE);
if (!psStackBase->aVals)
{
debug( LOG_ERROR, "Out of memory" );
Index: lib/script/script_parser.y
===================================================================
--- lib/script/script_parser.y (revision 358)
+++ lib/script/script_parser.y (working copy)
@@ -4086,7 +4086,6 @@
//debug(LOG_SCRIPT,"[YACC]: PUT_DATA
VAL_STRING, val: '%s'",yyvsp[0].sval);
/* Manage string stack */
- *STRSTACK[CURSTACKSTR] =
(char)MALLOC(MAXSTRLEN);
widgCopyString(STRSTACK[CURSTACKSTR],yyvsp[0].sval);
CURSTACKSTR = CURSTACKSTR + 1;
/* Increment 'pointer' to the top of the string stack */
Index: lib/script/interp.h
===================================================================
--- lib/script/interp.h (revision 358)
+++ lib/script/interp.h (working copy)
@@ -158,7 +158,7 @@
typedef struct _array_data
{
UDWORD base; // the base index of
the array values
- UBYTE type; // the array data type
+ INTERP_TYPE type; // the array data type
UBYTE dimensions;
UBYTE elements[VAR_MAX_DIMENSIONS];
} ARRAY_DATA;
@@ -193,7 +193,7 @@
/* Description of a trigger for the SCRIPT_CODE */
typedef struct _trigger_data
{
- UWORD type; // Type of trigger
+ TRIGGER_TYPE type; // Type of trigger
UWORD code; // BOOL - is there code with
this trigger
UDWORD time; // How often to check the
trigger
} TRIGGER_DATA;
Index: lib/script/script.h
===================================================================
--- lib/script/script.h (revision 358)
+++ lib/script/script.h (working copy)
@@ -94,13 +94,6 @@
* Event system functions
*/
-// Whether a context is released when there are no active triggers for it
-typedef enum _context_release
-{
- CR_RELEASE, // release the context
- CR_NORELEASE, // do not release the context
-} CONTEXT_RELEASE;
-
// reset the event system
extern void eventReset(void);
Index: lib/script/parse.h
===================================================================
--- lib/script/parse.h (revision 358)
+++ lib/script/parse.h (working copy)
@@ -66,7 +66,7 @@
/* Type for a user type symbol */
typedef struct _type_symbol
{
- SWORD typeID; // The type id to use in the
type field of values
+ INTERP_TYPE typeID; // The type id to use in the
type field of values
SWORD accessType; // Whether the type is an
object or a simple value
STRING *pIdent; // Type identifier
SCR_VAL_SAVE saveFunc; // load and save functions
Index: lib/script/event.c
===================================================================
--- lib/script/event.c (revision 358)
+++ lib/script/event.c (working copy)
@@ -366,14 +366,15 @@
SCRIPT_CONTEXT **ppsContext)
{
SCRIPT_CONTEXT *psContext;
- SDWORD val, storeIndex, type, arrayNum, i,j, arraySize;
+ SDWORD val, storeIndex, arrayNum, i,j, arraySize;
+ INTERP_TYPE type;
VAL_CHUNK *psNewChunk, *psNextChunk;
ASSERT( PTRVALID(psCode, sizeof(SCRIPT_CODE)),
"eventNewContext: Invalid code pointer" );
// Get a new context
- if (!HEAP_ALLOC(psContHeap, (void*) &psContext))
+ if (!HEAP_ALLOC(psContHeap, (void**) &psContext))
{
debug(LOG_ERROR,"eventNewContext: HEAP_ALLOC failed");
return FALSE;
@@ -382,7 +383,7 @@
// Initialise the context
psContext->psCode = psCode;
psContext->triggerCount = 0;
- psContext->release = (SWORD)(release == CR_RELEASE ? TRUE : FALSE);
+ psContext->release = release;
psContext->psGlobals = NULL;
psContext->id = -1; // only used by the save game
val = psCode->numGlobals + psCode->arraySize - 1;
@@ -457,7 +458,7 @@
while (val >= 0)
{
- if (!HEAP_ALLOC(psValHeap, (void*) &psNewChunk))
+ if (!HEAP_ALLOC(psValHeap, (void**) &psNewChunk))
{
for(psNewChunk=psContext->psGlobals; psNewChunk;
psNewChunk = psNextChunk)
{
@@ -842,7 +843,7 @@
}
// Get a trigger object
- if (!HEAP_ALLOC(psTrigHeap, (void*) &psNewTrig))
+ if (!HEAP_ALLOC(psTrigHeap, (void**) &psNewTrig))
{
return FALSE;
}
@@ -876,7 +877,7 @@
"eventLoadTrigger: Trigger out of range" );
// Get a trigger object
- if (!HEAP_ALLOC(psTrigHeap, (void*) &psNewTrig))
+ if (!HEAP_ALLOC(psTrigHeap, (void**) &psNewTrig))
{
debug( LOG_ERROR, "eventLoadTrigger: out of memory" );
abort();
@@ -909,7 +910,7 @@
"eventAddTrigger: Event out of range" );
// Get a trigger object
- if (!HEAP_ALLOC(psTrigHeap, (void*) &psNewTrig))
+ if (!HEAP_ALLOC(psTrigHeap, (void**) &psNewTrig))
{
return FALSE;
}
Index: lib/script/event.h
===================================================================
--- lib/script/event.h (revision 358)
+++ lib/script/event.h (working copy)
@@ -29,14 +29,21 @@
struct _link_chunk *psNext;
} LINK_CHUNK;
+// Whether a context is released when there are no active triggers for it
+typedef enum _context_release
+{
+ CR_RELEASE, // release the context
+ CR_NORELEASE, // do not release the context
+} CONTEXT_RELEASE;
+
/* The data needed within an object to run a script */
typedef struct _script_context
{
SCRIPT_CODE *psCode; // The actual script to
run
VAL_CHUNK *psGlobals; // The objects copy of
the global variables
SDWORD triggerCount; // Number of currently active
triggers
- SWORD release; // Whether to release
the context when there are no triggers
+ CONTEXT_RELEASE release; // Whether to release
the context when there are no triggers
SWORD id;
struct _script_context *psNext;
Index: lib/script/evntsave.c
===================================================================
--- lib/script/evntsave.c (revision 358)
+++ lib/script/evntsave.c (working copy)
@@ -171,7 +171,7 @@
char *pPos;
STRING *pScriptID;
SCRIPT_CODE *psCode;
- SWORD release;
+ CONTEXT_RELEASE release;
INTERP_VAL *psVal;
size = 0;
@@ -187,7 +187,7 @@
{
// get the script code
pScriptID = (STRING *)pPos;
- psCode = resGetData("SCRIPT", pScriptID);
+ psCode = (SCRIPT_CODE*)resGetData("SCRIPT", pScriptID);
pPos += strlen(pScriptID) + 1;
// check the number of variables
@@ -200,7 +200,7 @@
}
pPos += sizeof(SWORD);
- release = *pPos;
+ release = (CONTEXT_RELEASE)*pPos;
pPos += sizeof(UBYTE);
// create the context
@@ -218,7 +218,7 @@
for(i=0; i < numVars; i+= 1)
{
// get the variable type
- type = *((SWORD*)pPos);
+ type = (INTERP_TYPE)*pPos;
pPos += sizeof(SWORD);
size += sizeof(SWORD);
@@ -289,7 +289,7 @@
//not hashed STRING *pScriptID;
UDWORD hashedName;
SCRIPT_CODE *psCode;
- SWORD release;
+ CONTEXT_RELEASE release;
INTERP_VAL *psVal;
size = 0;
@@ -309,7 +309,7 @@
//notHashed pPos += strlen(pScriptID) + 1;
hashedName = *((UDWORD*)pPos);
pPos += sizeof(UDWORD);
- psCode = resGetDataFromHash("SCRIPT", hashedName);
+ psCode = (SCRIPT_CODE*)resGetDataFromHash("SCRIPT", hashedName);
// check the number of variables
@@ -322,7 +322,7 @@
}
pPos += sizeof(SWORD);
- release = *pPos;
+ release = (CONTEXT_RELEASE)*pPos;
pPos += sizeof(UBYTE);
// create the context
@@ -340,7 +340,7 @@
for(i=0; i < numVars; i+= 1)
{
// get the variable type
- type = *((SWORD*)pPos);
+ type = (INTERP_TYPE)*pPos;
pPos += sizeof(SWORD);
size += sizeof(SWORD);
@@ -584,7 +584,7 @@
// Allocate the buffer to save to
- pBuffer = MALLOC(totalSize);
+ pBuffer = (char*)MALLOC(totalSize);
if (pBuffer == NULL)
{
debug( LOG_ERROR, "eventSaveState: out of memory" );
Index: lib/sequence/rpl_reader.c
===================================================================
--- lib/sequence/rpl_reader.c (revision 358)
+++ lib/sequence/rpl_reader.c (working copy)
@@ -25,7 +25,7 @@
if (data_buffer != NULL) {
free(data_buffer);
}
- data_buffer = malloc(size);
+ data_buffer = (char*)malloc(size);
data_buffer_size = size;
}
}
@@ -185,7 +185,7 @@
unsigned int i;
unsigned int max_video_size = 0;
- rpl->chunks = malloc(sizeof(RPL_chunk_info_t)*rpl->nb_chunks);
+ rpl->chunks =
(RPL_chunk_info_t*)malloc(sizeof(RPL_chunk_info_t)*rpl->nb_chunks);
PHYSFS_seek(f, rpl->otcc);
for (i = 0; i < rpl->nb_chunks; ++i) {
@@ -228,7 +228,7 @@
total_audio_size += rpl->chunks[i].audio_size;
}
- audio_buffer = malloc(total_audio_size);
+ audio_buffer = (char*)malloc(total_audio_size);
tmp = audio_buffer;
for (i = 0; i < rpl->nb_chunks; ++i) {
@@ -289,7 +289,7 @@
if (audio_frame_size > tmp_buffer_size) {
tmp_buffer_size = audio_frame_size << 1;
free(tmp_buffer);
- tmp_buffer = malloc(tmp_buffer_size);
+ tmp_buffer = (unsigned char*)malloc(tmp_buffer_size);
}
PHYSFS_seek(rpl->f,
rpl->chunks[cf].offset+rpl->chunks[cf].video_size);
PHYSFS_read(rpl->f, tmp_buffer, audio_frame_size, 1);
Index: lib/sound/playlist.c
===================================================================
--- lib/sound/playlist.c (revision 358)
+++ lib/sound/playlist.c (working copy)
@@ -29,7 +29,7 @@
unsigned int i;
for (i = 0; i < NB_TRACKS; ++i) {
- playlist[i].songs = malloc(2*sizeof(char*));
+ playlist[i].songs = (char**)malloc(2*sizeof(char*));
playlist[i].list_size = 2;
playlist[i].nb_songs = 0;
memset( playlist[i].songs, 0,
playlist[i].list_size*sizeof(char*) );
@@ -100,10 +100,10 @@
char* filepath;
if (path_to_music == NULL) {
- filepath = malloc(strlen(filename)+1);
+ filepath = (char*)malloc(strlen(filename)+1);
sprintf(filepath, "%s", filename);
} else {
- filepath = malloc( strlen(filename)
+ filepath = (char*)malloc( strlen(filename)
+ strlen(path_to_music)+2);
sprintf(filepath, "%s/%s", path_to_music,
filename);
}
@@ -111,7 +111,7 @@
if (CURRENT_TRACK.nb_songs == CURRENT_TRACK.list_size) {
CURRENT_TRACK.list_size <<= 1;
- CURRENT_TRACK.songs =
realloc(CURRENT_TRACK.songs,
+ CURRENT_TRACK.songs =
(char**)realloc(CURRENT_TRACK.songs,
CURRENT_TRACK.list_size*sizeof(char*));
}
Index: lib/sound/audio.c
===================================================================
--- lib/sound/audio.c (revision 358)
+++ lib/sound/audio.c (working copy)
@@ -371,7 +371,7 @@
}
// debug(LOG_SOUND, "audio_queuetrack called1" );
- HEAP_ALLOC( g_psSampleHeap, (void *) &psSample );
+ HEAP_ALLOC( g_psSampleHeap, (void **) &psSample );
if ( psSample != NULL )
{
memset( psSample, 0, sizeof(AUDIO_SAMPLE) );
//[check] -Q
@@ -650,7 +650,7 @@
//
=======================================================================================================================
//
=======================================================================================================================
//
-void *audio_LoadTrackFromBuffer(char *pBuffer, UDWORD udwSize)
+TRACK *audio_LoadTrackFromBuffer(char *pBuffer, UDWORD udwSize)
{
// if audio not enabled return TRUE to carry on game without audio
if ( g_bAudioEnabled == FALSE )
@@ -703,7 +703,7 @@
}
// get track pointer from resource
- psTrack = resGetData( "WAV", szFileName ); //at this point
we have 4 valid entries, and 8 invalid -Q
+ psTrack = (TRACK*)resGetData( "WAV", szFileName ); //at
this point we have 4 valid entries, and 8 invalid -Q
if ( psTrack == NULL )
{
debug( LOG_NEVER, "audio_SetTrackVals: track %s resource not
found\n", szFileName );
@@ -755,7 +755,7 @@
}
// get track pointer from resource
- psTrack = resGetDataFromHash( "WAV", hash );
+ psTrack = (TRACK*)resGetDataFromHash( "WAV", hash );
if ( psTrack == NULL )
{
return FALSE;
@@ -859,7 +859,7 @@
return FALSE;
}
- HEAP_ALLOC( g_psSampleHeap, (void *) &psSample );
+ HEAP_ALLOC( g_psSampleHeap, (void **) &psSample );
if ( psSample == NULL )
{
return FALSE;
@@ -987,7 +987,7 @@
return FALSE;
}
- HEAP_ALLOC( g_psSampleHeap, (void *) &psSample );
+ HEAP_ALLOC( g_psSampleHeap, (void **) &psSample );
if ( psSample != NULL )
{
memset( psSample, 0, sizeof(AUDIO_SAMPLE) );
@@ -1058,7 +1058,7 @@
return;
}
- HEAP_ALLOC( g_psSampleHeap, (void *) &psSample );
+ HEAP_ALLOC( g_psSampleHeap, (void **) &psSample );
if ( psSample != NULL )
{
// setup sample
@@ -1259,7 +1259,7 @@
}
else
{
- psTrack = resGetData( "WAV", szFileName );
+ psTrack = (TRACK*)resGetData( "WAV", szFileName );
if ( psTrack == NULL )
{
return SAMPLE_NOT_FOUND;
@@ -1290,7 +1290,7 @@
}
else
{
- psTrack = resGetDataFromHash( "WAV", hash );
+ psTrack = (TRACK*)resGetDataFromHash( "WAV", hash );
if ( psTrack == NULL )
{
return SAMPLE_NOT_FOUND;
Index: lib/sound/track.c
===================================================================
--- lib/sound/track.c (revision 358)
+++ lib/sound/track.c (working copy)
@@ -234,7 +234,7 @@
//
=======================================================================================================================
//
=======================================================================================================================
//
-void *sound_LoadTrackFromBuffer(char *pBuffer, UDWORD udwSize)
+TRACK *sound_LoadTrackFromBuffer(char *pBuffer, UDWORD udwSize)
{
//~~~~~~~~~~~~
TRACK *pTrack;
@@ -252,7 +252,7 @@
else
{
pTrack->bMemBuffer = TRUE;
- pTrack->pName = MALLOC( strlen(GetLastResourceFilename()) + 1 );
+ pTrack->pName = (STRING*)MALLOC(
strlen(GetLastResourceFilename()) + 1 );
if ( pTrack->pName == NULL )
{
debug( LOG_ERROR, "sound_LoadTrackFromBuffer: couldn't
allocate memory\n" );
@@ -296,7 +296,7 @@
if ( pTrack != NULL )
{
pTrack->bMemBuffer = FALSE;
- pTrack->pName = MALLOC( strlen((char*) szFileName) + 1 );
+ pTrack->pName = (STRING*)MALLOC( strlen((char*) szFileName) + 1
);
if ( pTrack->pName == NULL )
{
debug( LOG_ERROR, "sound_LoadTrackFromFile: Out of
memory" );
@@ -469,7 +469,7 @@
//
=======================================================================================================================
//
=======================================================================================================================
//
-char *sound_GetTrackName( SDWORD iTrack )
+const char *sound_GetTrackName( SDWORD iTrack )
{
if ( iTrack == SAMPLE_NOT_FOUND ) return NULL;
ASSERT( g_apTrack[iTrack] != NULL, "sound_GetTrackName: unallocated
track" );
Index: lib/sound/audio.h
===================================================================
--- lib/sound/audio.h (revision 358)
+++ lib/sound/audio.h (working copy)
@@ -17,7 +17,7 @@
extern BOOL audio_Disabled( void );
extern BOOL audio_LoadTrackFromFile( char szFileName[] );
-extern void * audio_LoadTrackFromBuffer(char *pBuffer, UDWORD udwSize);
+extern TRACK * audio_LoadTrackFromBuffer(char *pBuffer, UDWORD udwSize);
extern BOOL audio_SetTrackVals( char szFileName[], BOOL bLoop, int
*piID,
int iVol, int iPriority, int
iAudibleRadius, int VagID );
extern BOOL audio_SetTrackValsHashName( UDWORD hash, BOOL bLoop,
int iTrack, int iVol,
Index: lib/sound/cdaudio.c
===================================================================
--- lib/sound/cdaudio.c (revision 358)
+++ lib/sound/cdaudio.c (working copy)
@@ -231,8 +231,6 @@
return sample >> (MAD_F_FRACBITS + 1 - 16);
}
-#define MIN(x, y) (((x) < (y)) ? (x) : (y))
-
static int mp3_read_buffer(char *buffer, const int size) {
int samples = 0;
Index: lib/sound/track.h
===================================================================
--- lib/sound/track.h (revision 358)
+++ lib/sound/track.h (working copy)
@@ -99,7 +99,7 @@
BOOL sound_Shutdown(void);
BOOL sound_LoadTrackFromFile(char szFileName[]);
-void * sound_LoadTrackFromBuffer(char *pBuffer, UDWORD udwSize);
+TRACK * sound_LoadTrackFromBuffer(char *pBuffer, UDWORD udwSize);
BOOL sound_SetTrackVals( TRACK *psTrack, BOOL bLoop, SDWORD iTrack,
SDWORD iVol, SDWORD iPriority, SDWORD iAudibleRadius,
SDWORD VagID );
@@ -117,7 +117,7 @@
SDWORD sound_GetTrackPriority( SDWORD iTrack );
SDWORD sound_GetTrackAudibleRadius( SDWORD iTrack );
SDWORD sound_GetTrackVolume( SDWORD iTrack );
-char * sound_GetTrackName( SDWORD iTrack );
+const char * sound_GetTrackName( SDWORD iTrack );
UDWORD sound_GetTrackHashName( SDWORD iTrack );
BOOL sound_TrackLooped( SDWORD iTrack );
Index: lib/framework/configfile.h
===================================================================
--- lib/framework/configfile.h (revision 358)
+++ lib/framework/configfile.h (working copy)
@@ -9,3 +9,5 @@
extern BOOL setWarzoneKeyNumeric (const STRING *pName,DWORD val);
extern BOOL getWarzoneKeyString(const STRING *pName, STRING *pString);
extern BOOL setWarzoneKeyString(const STRING *pName, const STRING *pString);
+
+extern char RegFilePath[MAX_PATH];
Index: lib/framework/strres.c
===================================================================
--- lib/framework/strres.c (revision 358)
+++ lib/framework/strres.c (working copy)
@@ -48,7 +48,7 @@
memset((*ppsBlock)->apStrings, 0, sizeof(STRING *) * size);
#ifdef DEBUG
- (*ppsBlock)->aUsage = MALLOC(sizeof(UDWORD) * size);
+ (*ppsBlock)->aUsage = (UDWORD*)MALLOC(sizeof(UDWORD) * size);
memset((*ppsBlock)->aUsage, 0, sizeof(UDWORD) * size);
#endif
Index: lib/framework/frame.c
===================================================================
--- lib/framework/frame.c (revision 358)
+++ lib/framework/frame.c (working copy)
@@ -512,7 +512,7 @@
if (AllocateMem == TRUE) {
// Allocate a buffer to store the data and a terminating zero
- *ppFileData = MALLOC(filesize + 1);
+ *ppFileData = (char*)MALLOC(filesize + 1);
if (*ppFileData == NULL) {
debug(LOG_ERROR, "loadFile2: Out of memory loading %s",
pFileName);
assert(FALSE);
Index: lib/ivis_opengl/screen.c
===================================================================
--- lib/ivis_opengl/screen.c (revision 358)
+++ lib/ivis_opengl/screen.c (working copy)
@@ -234,7 +234,7 @@
if (image->data != NULL) {
free(image->data);
}
- image->data = malloc(width*height*channels);
+ image->data = (unsigned char*)malloc(width*height*channels);
return FALSE;
}
@@ -534,7 +534,7 @@
free(buffer);
}
buffer_size = row_stride * screen->h;
- buffer = malloc(buffer_size);
+ buffer = (unsigned char*)malloc(buffer_size);
}
glReadPixels(0, 0, screen->w, screen->h, GL_RGB, GL_UNSIGNED_BYTE,
buffer);
_______________________________________________
Warzone-dev mailing list
[email protected]
https://mail.gna.org/listinfo/warzone-dev