From 02856f0cb4b8a2ca97e67f0f1efec819fd47f6b6 Mon Sep 17 00:00:00 2001 From: mcmartin Date: Mon, 3 Mar 2003 05:17:33 +0000 Subject: [PATCH] Removed all unused variable/parameter warnings git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@848 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/sc2code/comm/blackur/blackurc.c | 2 ++ sc2/src/sc2code/comm/comandr/comandr.c | 1 + sc2/src/sc2code/comm/melnorm/melnorm.c | 2 ++ sc2/src/sc2code/comm/orz/orzc.c | 1 + sc2/src/sc2code/comm/pkunk/pkunkc.c | 12 ++++-------- sc2/src/sc2code/comm/rebel/rebel.c | 11 +++-------- sc2/src/sc2code/comm/shofixt/shofixt.c | 2 ++ sc2/src/sc2code/comm/slyhome/slyhome.c | 1 + sc2/src/sc2code/comm/starbas/starbas.c | 3 ++- sc2/src/sc2code/comm/syreen/syreenc.c | 1 + sc2/src/sc2code/comm/thradd/thraddc.c | 1 + sc2/src/sc2code/comm/zoqfot/zoqfotc.c | 1 + sc2/src/sc2code/globdata.c | 1 - sc2/src/sc2code/libs/graphics/sdl/rndzoom.c | 8 +++++--- .../libs/sound/decoders/mikmod/virtch_common.c | 3 +++ sc2/src/sc2code/libs/sound/sfx.c | 13 +++++++++++++ sc2/src/sc2code/libs/sound/sound.c | 3 +++ sc2/src/sc2code/libs/strings/getstr.c | 3 --- sc2/src/sc2code/libs/threads/thrcommon.c | 2 ++ sc2/src/sc2code/oscill.c | 5 ++++- sc2/src/sc2code/planets/pl_stuff.c | 3 ++- sc2/src/sc2code/planets/scan.c | 1 - 22 files changed, 53 insertions(+), 27 deletions(-) diff --git a/sc2/src/sc2code/comm/blackur/blackurc.c b/sc2/src/sc2code/comm/blackur/blackurc.c index 8a97ce41a..7588663fe 100644 --- a/sc2/src/sc2code/comm/blackur/blackurc.c +++ b/sc2/src/sc2code/comm/blackur/blackurc.c @@ -272,6 +272,7 @@ CombatIsInevitable (RESPONSE_REF R) static void Frenzy (RESPONSE_REF R) { + (void) R; // ignored switch (GET_GAME_STATE (KOHR_AH_REASONS)) { case 0: @@ -367,6 +368,7 @@ KohrAhStory (RESPONSE_REF R) static void DieHuman (RESPONSE_REF R) { + (void) R; // ignored switch (GET_GAME_STATE (KOHR_AH_REASONS)) { case 0: diff --git a/sc2/src/sc2code/comm/comandr/comandr.c b/sc2/src/sc2code/comm/comandr/comandr.c index b758e3ff1..9a7ed6ddf 100644 --- a/sc2/src/sc2code/comm/comandr/comandr.c +++ b/sc2/src/sc2code/comm/comandr/comandr.c @@ -441,6 +441,7 @@ static void RevealSelf (RESPONSE_REF R); static void TellProbe (RESPONSE_REF R) { + (void) R; // ignored NPCPhrase (THAT_WAS_PROBE); DISABLE_PHRASE (what_was_red_thing); diff --git a/sc2/src/sc2code/comm/melnorm/melnorm.c b/sc2/src/sc2code/comm/melnorm/melnorm.c index 68aac5e16..834ba76bc 100644 --- a/sc2/src/sc2code/comm/melnorm/melnorm.c +++ b/sc2/src/sc2code/comm/melnorm/melnorm.c @@ -532,6 +532,7 @@ DoRescue (RESPONSE_REF R) SIZE dx, dy; COUNT fuel_required; + (void) R; // ignored dx = LOGX_TO_UNIVERSE (GLOBAL_SIS (log_x)) - SOL_X; dy = LOGY_TO_UNIVERSE (GLOBAL_SIS (log_y)) @@ -1771,6 +1772,7 @@ DoMelnormeHate (RESPONSE_REF R) { BYTE hate_count; + (void) R; // ignored hate_count = GET_GAME_STATE (MELNORME_HATE_COUNT); switch (hate_count++) { diff --git a/sc2/src/sc2code/comm/orz/orzc.c b/sc2/src/sc2code/comm/orz/orzc.c index 71fc22bc4..1b47a44eb 100644 --- a/sc2/src/sc2code/comm/orz/orzc.c +++ b/sc2/src/sc2code/comm/orz/orzc.c @@ -407,6 +407,7 @@ static void OrzNeutral (RESPONSE_REF R); static void WhereAndrosyn (RESPONSE_REF R) { + (void) R; // ignored NPCPhrase (DISEMBLE_ABOUT_ANDROSYN); DISABLE_PHRASE (where_androsyn); diff --git a/sc2/src/sc2code/comm/pkunk/pkunkc.c b/sc2/src/sc2code/comm/pkunk/pkunkc.c index 9b7a03ebc..51458e8f8 100644 --- a/sc2/src/sc2code/comm/pkunk/pkunkc.c +++ b/sc2/src/sc2code/comm/pkunk/pkunkc.c @@ -86,14 +86,9 @@ ShipsReady (void) SIZE i; return (GET_GAME_STATE (PKUNK_MANNER) == 3 - && !((i = (GLOBAL (GameClock.year_index) - START_YEAR) - - GET_GAME_STATE (PKUNK_SHIP_YEAR)) < 0 - || (i == 0 - && (i = GLOBAL (GameClock.month_index) - - GET_GAME_STATE (PKUNK_SHIP_MONTH)) < 0 - || (i == 0 - && GLOBAL (GameClock.day_index) < - GET_GAME_STATE (PKUNK_SHIP_DAY))))); + && !((i = (GLOBAL (GameClock.year_index) - START_YEAR) - GET_GAME_STATE (PKUNK_SHIP_YEAR)) < 0 + || ((i == 0 && (i = GLOBAL (GameClock.month_index) - GET_GAME_STATE (PKUNK_SHIP_MONTH)) < 0) + || (i == 0 && GLOBAL (GameClock.day_index) < GET_GAME_STATE (PKUNK_SHIP_DAY))))); } static void @@ -815,6 +810,7 @@ static void PkunkMigrate (RESPONSE_REF R) { BYTE ReasonMask; + (void) R; // ignored ReasonMask = GET_GAME_STATE (PKUNK_REASONS); if (!(ReasonMask & GOOD_REASON_1)) diff --git a/sc2/src/sc2code/comm/rebel/rebel.c b/sc2/src/sc2code/comm/rebel/rebel.c index 38521c19b..d606ece9c 100644 --- a/sc2/src/sc2code/comm/rebel/rebel.c +++ b/sc2/src/sc2code/comm/rebel/rebel.c @@ -301,14 +301,9 @@ Rebels (RESPONSE_REF R) else if (PLAYER_SAID (R, any_ships)) { if (GET_GAME_STATE (YEHAT_SHIP_MONTH) - && ((NumVisits = (GLOBAL (GameClock.year_index) - START_YEAR) - - GET_GAME_STATE (YEHAT_SHIP_YEAR)) < 0 - || (NumVisits == 0 - && (NumVisits = GLOBAL (GameClock.month_index) - - GET_GAME_STATE (YEHAT_SHIP_MONTH)) < 0 - || (NumVisits == 0 - && GLOBAL (GameClock.day_index) < - GET_GAME_STATE (YEHAT_SHIP_DAY))))) + && ((NumVisits = (GLOBAL (GameClock.year_index) - START_YEAR) - GET_GAME_STATE (YEHAT_SHIP_YEAR)) < 0 + || ((NumVisits == 0 && (NumVisits = GLOBAL (GameClock.month_index) - GET_GAME_STATE (YEHAT_SHIP_MONTH)) < 0) + || (NumVisits == 0 && GLOBAL (GameClock.day_index) < GET_GAME_STATE (YEHAT_SHIP_DAY))))) NPCPhrase (NO_SHIPS_YET); else if ((NumVisits = ActivateStarShip (YEHAT_SHIP, FEASIBILITY_STUDY)) == 0) NPCPhrase (NO_ROOM); diff --git a/sc2/src/sc2code/comm/shofixt/shofixt.c b/sc2/src/sc2code/comm/shofixt/shofixt.c index 262439616..94e50276c 100644 --- a/sc2/src/sc2code/comm/shofixt/shofixt.c +++ b/sc2/src/sc2code/comm/shofixt/shofixt.c @@ -318,6 +318,7 @@ ExplainDefeat (RESPONSE_REF R) static void RealizeMistake (RESPONSE_REF R) { + (void) R; // ignored NPCPhrase (DGRUNTI); SET_GAME_STATE (SHOFIXTI_STACK1, 0); SET_GAME_STATE (SHOFIXTI_STACK3, 0); @@ -347,6 +348,7 @@ RealizeMistake (RESPONSE_REF R) static void Hostile (RESPONSE_REF R) { + (void) R; // ignored switch (GET_GAME_STATE (SHOFIXTI_STACK1)) { case 0: diff --git a/sc2/src/sc2code/comm/slyhome/slyhome.c b/sc2/src/sc2code/comm/slyhome/slyhome.c index 9d5bcffb2..472167537 100644 --- a/sc2/src/sc2code/comm/slyhome/slyhome.c +++ b/sc2/src/sc2code/comm/slyhome/slyhome.c @@ -154,6 +154,7 @@ static LOCDATA slylandro_desc = static void ExitConversation (RESPONSE_REF R) { + (void) R; // ignored SET_GAME_STATE (BATTLE_SEGUE, 0); switch (GET_GAME_STATE (SLYLANDRO_HOME_VISITS)) diff --git a/sc2/src/sc2code/comm/starbas/starbas.c b/sc2/src/sc2code/comm/starbas/starbas.c index d735031cb..96552ee69 100644 --- a/sc2/src/sc2code/comm/starbas/starbas.c +++ b/sc2/src/sc2code/comm/starbas/starbas.c @@ -140,6 +140,7 @@ ByeBye (RESPONSE_REF R) { BYTE b0, b1, b2, b3; + (void) R; // ignored b0 = GET_GAME_STATE (STARBASE_BULLETS0); b1 = GET_GAME_STATE (STARBASE_BULLETS1); b2 = GET_GAME_STATE (STARBASE_BULLETS2); @@ -1741,7 +1742,7 @@ SellMinerals (RESPONSE_REF R) TimeIn = GetTimeCounter (); } - if (amount = GLOBAL_SIS (ElementAmounts[i])) + if ((amount = GLOBAL_SIS (ElementAmounts[i])) != 0) { total += amount * GLOBAL (ElementWorth[i]); do diff --git a/sc2/src/sc2code/comm/syreen/syreenc.c b/sc2/src/sc2code/comm/syreen/syreenc.c index 46dad1da5..f66ae1cb2 100644 --- a/sc2/src/sc2code/comm/syreen/syreenc.c +++ b/sc2/src/sc2code/comm/syreen/syreenc.c @@ -667,6 +667,7 @@ InitialSyreen (RESPONSE_REF R) static void PlanAmbush (RESPONSE_REF R) { + (void) R; // ignored NPCPhrase (OK_FOUND_VAULT); SET_GAME_STATE (MYCON_AMBUSH, 1); diff --git a/sc2/src/sc2code/comm/thradd/thraddc.c b/sc2/src/sc2code/comm/thradd/thraddc.c index 68f29d54d..4ec936f17 100644 --- a/sc2/src/sc2code/comm/thradd/thraddc.c +++ b/sc2/src/sc2code/comm/thradd/thraddc.c @@ -475,6 +475,7 @@ ThraddCulture (RESPONSE_REF R) static void ThraddWorship (RESPONSE_REF R) { + (void) R; // ignored SET_GAME_STATE (THRADD_VISITS, 0); SET_GAME_STATE (THRADD_MANNER, 1); SET_GAME_STATE (THRADD_STACK_1, 0); diff --git a/sc2/src/sc2code/comm/zoqfot/zoqfotc.c b/sc2/src/sc2code/comm/zoqfot/zoqfotc.c index 0587f0c6d..4437691f8 100644 --- a/sc2/src/sc2code/comm/zoqfot/zoqfotc.c +++ b/sc2/src/sc2code/comm/zoqfot/zoqfotc.c @@ -227,6 +227,7 @@ ExitConversation (RESPONSE_REF R) static void FormAlliance (RESPONSE_REF R) { + (void) R; // ignored NPCPhrase_cb (ALLY_WITH_US0, &SelectAlienZOQ); NPCPhrase_cb (ALLY_WITH_US1, &SelectAlienPIK); NPCPhrase_cb (ALLY_WITH_US2, &SelectAlienZOQ); diff --git a/sc2/src/sc2code/globdata.c b/sc2/src/sc2code/globdata.c index b4f5ecb84..c68f710e6 100644 --- a/sc2/src/sc2code/globdata.c +++ b/sc2/src/sc2code/globdata.c @@ -135,7 +135,6 @@ InitSIS (void) { HSTARSHIP hMasterShip; STARSHIPPTR MasterShipPtr; - extern QUEUE master_q; hMasterShip = FindMasterShip (ship_ref); MasterShipPtr = LockStarShip (&master_q, hMasterShip); diff --git a/sc2/src/sc2code/libs/graphics/sdl/rndzoom.c b/sc2/src/sc2code/libs/graphics/sdl/rndzoom.c index 29035d4d9..ecacb3822 100644 --- a/sc2/src/sc2code/libs/graphics/sdl/rndzoom.c +++ b/sc2/src/sc2code/libs/graphics/sdl/rndzoom.c @@ -295,6 +295,7 @@ void rZF_nearestneighbor (SDL_Surface *src, SDL_Surface *dst, int use_weight) for (y = 0; y < dst->h; y++) { if (y) + { if (!(y & 0x03)) { yptr += src->w; @@ -303,8 +304,9 @@ void rZF_nearestneighbor (SDL_Surface *src, SDL_Surface *dst, int use_weight) if (use_weight) pry = prob_weight; } - else if (use_weight ) + else if (use_weight) pry += 12; + } for (x = 0; x < dst->w; x++) { Uint32 p; @@ -386,7 +388,7 @@ void rZF_continuous (SDL_Surface *src, SDL_Surface *dst) putpix (dst, 0, dy, pnew); } } - for ( x = 0; x < src->w; x++) + for (x = 0; x < src->w; x++) { p10 = getpix (src, x, 0); if (x == src->w - 1) @@ -421,7 +423,7 @@ void rZF_continuous (SDL_Surface *src, SDL_Surface *dst) int fromx, fromx4; int dy1; Uint32 p00; - char cpl[3][3] = {0,0,0,0,0,0,0,0,0}; + char cpl[3][3] = {{0,0,0},{0,0,0},{0,0,0}}; if (x == src->w) fromx = 0; else diff --git a/sc2/src/sc2code/libs/sound/decoders/mikmod/virtch_common.c b/sc2/src/sc2code/libs/sound/decoders/mikmod/virtch_common.c index ce57d2bdd..de356ef23 100644 --- a/sc2/src/sc2code/libs/sound/decoders/mikmod/virtch_common.c +++ b/sc2/src/sc2code/libs/sound/decoders/mikmod/virtch_common.c @@ -404,6 +404,7 @@ SWORD VC1_SampleLoad(struct SAMPLOAD* sload,int type) ULONG VC1_SampleSpace(int type) { + (void) type; // ignored return vc_memory; } @@ -411,6 +412,8 @@ ULONG VC1_SampleLength(int type,SAMPLE* s) { if (!s) return 0; + (void) type; // ignored + return (s->length*((s->flags&SF_16BITS)?2:1))+16; } diff --git a/sc2/src/sc2code/libs/sound/sfx.c b/sc2/src/sc2code/libs/sound/sfx.c index 081e444fd..ea435127b 100644 --- a/sc2/src/sc2code/libs/sound/sfx.c +++ b/sc2/src/sc2code/libs/sound/sfx.c @@ -37,12 +37,18 @@ PlayChannel (COUNT channel, PVOID sample, COUNT sample_length, COUNT loop_begin, TFBSound_Sourcei (soundSource[channel].handle, TFBSOUND_BUFFER, tfb_sample->buffer[0]); TFBSound_SourcePlay (soundSource[channel].handle); + /* ignored arguments */ + (void)sample_length; + (void)loop_begin; + (void)loop_length; + (void)priority; } void StopChannel (COUNT channel, unsigned char Priority) { StopSource (channel); + (void)Priority; // ignored } static void @@ -84,6 +90,7 @@ SetChannelVolume (COUNT channel, COUNT volume, BYTE priority) { TFBSound_Sourcef (soundSource[channel].handle, TFBSOUND_GAIN, (volume / (float)MAX_VOLUME) * sfxVolumeScale); + (void)priority; // ignored } // Status: Ignored @@ -98,6 +105,7 @@ GetSampleAddress (SOUND sound) COUNT GetSampleLength (SOUND sound) { + (void)sound; return 0; } @@ -105,12 +113,16 @@ GetSampleLength (SOUND sound) void SetChannelRate (COUNT channel, DWORD rate_hz, unsigned char priority) { + (void) channel; + (void) rate_hz; + (void) priority; } // Status: Ignored COUNT GetSampleRate (SOUND sound) { + (void) sound; return 0; } @@ -127,6 +139,7 @@ _GetSoundBankData (FILE *fp, DWORD length) TFB_SoundSample *sndfx[MAX_FX]; STRING_TABLE Snd; + (void) length; // ignored opos = ftell (fp); { diff --git a/sc2/src/sc2code/libs/sound/sound.c b/sc2/src/sc2code/libs/sound/sound.c index b70de971c..2817f2fab 100644 --- a/sc2/src/sc2code/libs/sound/sound.c +++ b/sc2/src/sc2code/libs/sound/sound.c @@ -162,6 +162,9 @@ get_previous_chain (TFB_SoundChain *first_chain, TFB_SoundChain *current_chain) BOOLEAN InitSound (int argc, char* argv[]) { + /* Quell compiler warnings */ + (void)argc; + (void)argv; return TRUE; } diff --git a/sc2/src/sc2code/libs/strings/getstr.c b/sc2/src/sc2code/libs/strings/getstr.c index 08fab4434..ee2f2d140 100644 --- a/sc2/src/sc2code/libs/strings/getstr.c +++ b/sc2/src/sc2code/libs/strings/getstr.c @@ -271,9 +271,6 @@ _GetStringData (FILE *fp, DWORD length) lpStringOffs = lpST->StringOffsets; lpClipOffs = &lpST->StringOffsets[lpST->StringCount + 1]; - { - long foo = (lpST->StringCount + 1) << ((lpST->flags & HAS_SOUND_CLIPS) ? 1 : 0); - } lpTSOffs = &lpST->StringOffsets[(lpST->StringCount + 1) << ((lpST->flags & HAS_SOUND_CLIPS) ? 1 : 0)]; for (n = 0; n < (int)lpST->StringCount; diff --git a/sc2/src/sc2code/libs/threads/thrcommon.c b/sc2/src/sc2code/libs/threads/thrcommon.c index 363bc6185..89d3bc915 100644 --- a/sc2/src/sc2code/libs/threads/thrcommon.c +++ b/sc2/src/sc2code/libs/threads/thrcommon.c @@ -553,6 +553,7 @@ ClearSemaphore (Semaphore sem) sem_name = SemMon[i].Name; if (SemMon[i].Thread && SemMon[i].Thread != NativeThreadID ()) #if defined (THREAD_QUEUE) && defined (THREAD_NAMES) + { if (ThreadNameNative (SemMon[i].Thread) == NULL) fprintf( stderr, "Freeing %s Semaphore in '%s' set by defunct thread '%s'!\n", sem_name, @@ -563,6 +564,7 @@ ClearSemaphore (Semaphore sem) sem_name, ThreadNameNative (NativeThreadID ()), ThreadNameNative (SemMon[i].Thread)); + } SemMon[i].ThreadName[0] = 0; #else fprintf (stderr, "Freeing %s Semaphore that was set by a different thread\n", diff --git a/sc2/src/sc2code/oscill.c b/sc2/src/sc2code/oscill.c index 64571a262..d52e76f02 100644 --- a/sc2/src/sc2code/oscill.c +++ b/sc2/src/sc2code/oscill.c @@ -39,7 +39,10 @@ InitOscilloscope (DWORD x, DWORD y, DWORD width, DWORD height, FRAME_DESC *f) scope_surf = TFB_DrawImage_New (scope_surf_canvas); TFB_DrawImage_Image (f->image, 0, 0, 0, NULL, scope_bg); scope_init = 1; - } + } + /* remove compiler warnings */ + (void) x; + (void) y; } void diff --git a/sc2/src/sc2code/planets/pl_stuff.c b/sc2/src/sc2code/planets/pl_stuff.c index b36ed50aa..3f16b15cc 100644 --- a/sc2/src/sc2code/planets/pl_stuff.c +++ b/sc2/src/sc2code/planets/pl_stuff.c @@ -61,8 +61,9 @@ RotatePlanet (int x, int da, int dx, int dy, int zoom) RECT r, *rp = NULL; CONTEXT OldContext; + (void)da; // ignored - // If thiis frame hasn' been generted, generate it + // If this frame hasn't been generted, generate it if (! pSolarSysState->isPFADefined[x]) { RenderLevelMasks (x); pSolarSysState->isPFADefined[x] = 1; diff --git a/sc2/src/sc2code/planets/scan.c b/sc2/src/sc2code/planets/scan.c index 30f7f8919..18c1cc7e7 100644 --- a/sc2/src/sc2code/planets/scan.c +++ b/sc2/src/sc2code/planets/scan.c @@ -110,7 +110,6 @@ PrintCoarseScanPC (void) SIZE temp; TEXT t; RECT r; - STAMP s; UNICODE buf[40]; SetSemaphore (GraphicsSem);