Start making the code conform to -Wextra

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1146 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2007-02-19 16:46:48 +00:00
parent 600a8850e7
commit d3cadd9e4a
11 changed files with 19 additions and 44 deletions

View File

@ -109,8 +109,8 @@ if test "x$debug" = "xyes" ; then
# -O0 turns off all optimizations; this is necessary for accurate debugging
# -Wno-unused-label is necessary because flex produces unused labels that we cannot fix
WZ_CFLAGS="${WZ_CFLAGS} -g -O0 -DDEBUG -Wall -Wno-unused-label -Werror"
# add these when the code is ready for them
# -Wextra -Wwrite-strings -Wcast-qual -Wmissing-declarations -Wstrict-prototypes -Wold-style-definition"
# add these later for stricter checking
# -Wextra -Wmissing-declarations -Wstrict-prototypes"
else
WZ_CFLAGS="${WZ_CFLAGS} -DNDEBUG"
fi

View File

@ -331,15 +331,6 @@ BOOL getWarzoneKeyString( const char *pName, char *pString )
return TRUE;
}
///
// =======================================================================================================================
// =======================================================================================================================
//
BOOL getWarzoneKeyBinary( char *pName, UBYTE *pData, UDWORD *pSize )
{
return FALSE;
}
///
// =======================================================================================================================
// =======================================================================================================================
@ -364,12 +355,3 @@ BOOL setWarzoneKeyString( const char *pName, const char *pString )
registry_set_key( pName, pString );
return TRUE;
}
///
// =======================================================================================================================
// =======================================================================================================================
//
BOOL setWarzoneKeyBinary( char *pName, void *pData, UDWORD size )
{
return FALSE;
}

View File

@ -119,7 +119,7 @@ static int code_part_from_str(const char *str)
* \param data Ignored. Use NULL.
* \param outputBuffer Buffer containing the preprocessed text to output.
*/
void debug_callback_stderr( void ** data, const char * outputBuffer )
void debug_callback_stderr( __attribute__((unused)) void ** data, const char * outputBuffer )
{
if ( !strchr( outputBuffer, '\n' ) ) {
fprintf( stderr, "%s\n", outputBuffer );

View File

@ -314,11 +314,6 @@ hashTable_FindElement( HASHTABLE *psTable, int iKey1, int iKey2 )
/* get hashed index */
udwHashIndex = hashTable_GetHashKey( psTable, iKey1, iKey2 );
/* check hash index within bounds */
ASSERT( udwHashIndex>=0 && udwHashIndex<psTable->udwTableSize,
"hashTable_GetElement: hash value %i too large for table size %i\n",
udwHashIndex, psTable->udwTableSize );
psNode = psTable->ppsNode[udwHashIndex];
/* loop through node list to find element match */

View File

@ -305,8 +305,9 @@ SDWORD scriptGetCustomFuncToken(EVENT_SYMBOL *psFunc)
/* Look up defined macro and return new define buffer */
BOOL scriptLoopUpMacro(const char *pMacro, char **ppMacroBody)
{
UDWORD i;
for(i=0;i<scr_num_macros;i++)
int i;
for ( i = 0; i < scr_num_macros; i++ )
{
if(strcmp(pMacro, &(scr_macro[i].scr_define_macro[0]) ) == 0)
{

View File

@ -877,10 +877,7 @@ MAPTILE *psTile;
tileX = psDroid->x/TILE_UNITS;
tileY = psDroid->y/TILE_UNITS;
// double check it's on map
if( (tileX>=0) &&
(tileY>=0) &&
(tileX<mapWidth) &&
(tileY<mapHeight) )
if ( tileX < mapWidth && tileY < mapHeight )
{
psTile = mapTile(tileX,tileY);
if(TERRAIN_TYPE(psTile) != TER_WATER)

View File

@ -1744,7 +1744,7 @@ void displayInitVars(void)
// Start repositioning a delivery point.
//
void StartDeliveryPosition(OBJECT_POSITION *psLocation,BOOL driveActive)
void StartDeliveryPosition( OBJECT_POSITION *psLocation )
{
FLAG_POSITION *psFlagPos;
/* clear the selection */
@ -2509,7 +2509,7 @@ DROID_OACTION_INFO oaInfo = {{NULL}};
case POS_DELIVERY:
if(psLocation->player == selectedPlayer)
{
StartDeliveryPosition(psLocation,FALSE);
StartDeliveryPosition( psLocation );
/* We've clicked on one of our own DP */
// addConsoleMessage("Clicked on your delivery point",DEFAULT_JUSTIFY);

View File

@ -212,7 +212,7 @@ void CancelObjectOrbit(void);
extern void FinishDeliveryPosition(UDWORD xPos,UDWORD yPos,void *UserData);
extern void CancelDeliveryRepos(void);
extern void StartDeliveryPosition(OBJECT_POSITION *psLocation,BOOL driveActive);
extern void StartDeliveryPosition( OBJECT_POSITION *psLocation );
extern BOOL GetDeliveryRepos(UDWORD *xPos,UDWORD *yPos);
extern BOOL DeliveryReposValid(void);

View File

@ -185,7 +185,7 @@ static void effectSetupDestruction ( EFFECT *psEffect );
static void effectSetupFire ( EFFECT *psEffect );
static void effectSetUpSatLaser ( EFFECT *psEffect );
static void effectSetUpFirework ( EFFECT *psEffect );
BOOL validatePie(EFFECT_GROUP group, EFFECT_TYPE type, iIMDShape *pie);
static BOOL validatePie( EFFECT_GROUP group, iIMDShape *pie );
// ----------------------------------------------------------------------------------------
//void initPerimeterSmoke ( EFFECT *psEffect );
void initPerimeterSmoke ( iIMDShape *pImd, UDWORD x, UDWORD y, UDWORD z);
@ -225,7 +225,7 @@ static BOOL essentialEffect(EFFECT_GROUP group, EFFECT_TYPE type)
break;
}
}
static BOOL utterlyReject(EFFECT_GROUP group, EFFECT_TYPE type)
static BOOL utterlyReject( EFFECT_GROUP group )
{
switch(group)
{
@ -372,7 +372,7 @@ BOOL bSmoke;
if(!essentialEffect(group,type) )
{
/* Some we can get rid of right away */
if(utterlyReject(group,type))
if ( utterlyReject( group ) )
{
skipped++;
return;
@ -526,7 +526,7 @@ BOOL bSmoke;
*/
#ifdef DEBUG
if(validatePie(group,type,asEffectsList[freeEffect].imd) == FALSE)
if ( validatePie( group, asEffectsList[freeEffect].imd ) == FALSE )
{
ASSERT( FALSE,"No PIE found or specified for an effect" );
}
@ -542,7 +542,7 @@ BOOL bSmoke;
#ifdef DEBUG
// ----------------------------------------------------------------------------------------
BOOL validatePie(EFFECT_GROUP group, EFFECT_TYPE type, iIMDShape *pie)
static BOOL validatePie( EFFECT_GROUP group, iIMDShape *pie )
{
/* If we haven't got a pie */

View File

@ -1034,7 +1034,7 @@ static void intDoScreenRefresh(void)
if (psFlag != NULL)
{
// need to restart the delivery point position
StartDeliveryPosition((OBJECT_POSITION *)psFlag,FALSE);
StartDeliveryPosition( (OBJECT_POSITION *)psFlag );
}
// make sure the commander order screen is in the right state
@ -3121,7 +3121,7 @@ static void intProcessStats(UDWORD id)
psFlag = FindFactoryDelivery(psStruct);
if (psFlag)
{
StartDeliveryPosition((OBJECT_POSITION *)psFlag,FALSE);
StartDeliveryPosition( (OBJECT_POSITION *)psFlag );
}
}
}
@ -3401,7 +3401,7 @@ void intDisplayWidgets(void)
{
screen_RestartBackDrop();
// Download buffer in system memory to the display back buffer.
pie_DownloadDisplayBuffer(DisplayBuffer);
/* pie_DownloadDisplayBuffer(DisplayBuffer); -- did nothing. removed. what gives? - Per */
// DISP_WIDTH, DISP_HEIGHT);
/*Add the radar to the design screen - only if player has HQ*/

View File

@ -299,7 +299,7 @@ BOOL seq_BlitBufferToScreen(char* screen, SDWORD screenStride, SDWORD xOffset, S
}
else
{
pie_DownLoadBufferToScreen(pVideoBuffer, xOffset, yOffset,width,height,(2*width));
/* pie_DownLoadBufferToScreen(pVideoBuffer, xOffset, yOffset,width,height,(2*width)); no longer exists */
}
return TRUE;
}