From 7105d7d53766ebc269126f8bb9d161e086966100 Mon Sep 17 00:00:00 2001 From: jeblanchard Date: Fri, 6 Jun 2008 01:21:51 +0000 Subject: [PATCH] Numerous seemingly harmless gcc warning fixes --- src/debug.cpp | 2 -- src/drivers/common/vidblit.cpp | 5 +---- src/drivers/win/basicbot.cpp | 20 +++++++++----------- src/drivers/win/debuggersp.h | 2 +- src/drivers/win/memwatch.h | 2 +- src/drivers/win/oakra.h | 2 -- src/drivers/win/state.h | 2 +- src/drivers/win/tasedit.h | 2 +- src/drivers/win/throttle.h | 2 +- src/drivers/win/window.cpp | 2 +- src/input.cpp | 2 +- src/movie.h | 2 +- src/utils/xstring.cpp | 2 +- src/utils/xstring.h | 2 +- 14 files changed, 20 insertions(+), 29 deletions(-) diff --git a/src/debug.cpp b/src/debug.cpp index e7a70151..f2307e3a 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -131,8 +131,6 @@ int checkCondition(const char* condition, int num) **/ unsigned int NewBreak(const char* name, int start, int end, unsigned int type, const char* condition, unsigned int num, bool enable) { - unsigned int brk=0; - // Finally add breakpoint to the list watchpoint[num].address = start; watchpoint[num].endaddress = 0; diff --git a/src/drivers/common/vidblit.cpp b/src/drivers/common/vidblit.cpp index 67b198f8..08abc305 100644 --- a/src/drivers/common/vidblit.cpp +++ b/src/drivers/common/vidblit.cpp @@ -79,10 +79,7 @@ int InitBlitToHigh(int b, uint32 rmask, uint32 gmask, uint32 bmask, int efx, int { if(specfilt == 2 || specfilt == 4) // scale2x and scale3x { - int multi; - - if(specfilt == 2) multi = 2 * 2; - else if(specfilt == 4) multi = 3 * 3; + int multi = ((specfilt == 2) ? 2 * 2 : 3 * 3); specbuf8bpp = (uint8*)malloc(256*240*multi); //mbg merge 7/17/06 added cast diff --git a/src/drivers/win/basicbot.cpp b/src/drivers/win/basicbot.cpp index b78c6392..6e348f44 100644 --- a/src/drivers/win/basicbot.cpp +++ b/src/drivers/win/basicbot.cpp @@ -79,7 +79,8 @@ static uint32 rand1=1, rand2=0x1337EA75, rand3=0x0BADF00D; char * Formula[BOT_FORMULAS]; // These hold BOT_FORMULAS formula's entered in the GUI: int * Bytecode[BOT_FORMULAS]; // Byte code converted formulas static int ByteCodeField; // Working field -static int CODE_1_A = 0, // Code fields +enum { + CODE_1_A = 0, // Code fields CODE_1_B = 1, CODE_1_SELECT = 2, CODE_1_START = 3, @@ -132,8 +133,9 @@ static int CODE_1_A = 0, // Code fields CODE_TITLE6 = 43, CODE_ROMNAME = 44, CODE_SKIPS = 45, - CODE_SLOW = 46; + CODE_SLOW = 46 // BOT_FORMULAS needs to be CODE_SLOW+1 ! +}; // array contains GUI id's for certain pieces of code // these are in sync with the CODE_ ints above @@ -291,7 +293,7 @@ static uint32 CurrentAttempt[BOT_MAXFRAMES]; // Contains all the frames of the static uint32 BestAttempt[BOT_MAXFRAMES]; // Contains all the frames of the best attempt so far. static uint32 AttemptPointer; // Points to the last frame of the current attempt. -static bool ProcessCode = true; // This boolean tells the code whether or not to process +//static bool ProcessCode = true; // This boolean tells the code whether or not to process // some code. This is mainly used in branching (iif's) // to skip over the part of the code that is not to be // executed. It still needs to be parsed because the @@ -380,10 +382,6 @@ lastPart * NewPart(int part, int attempt, return l; } -static void mbox(char * txt) -{ - MessageBox(hwndBasicBot, txt, "Debug", MB_OK); -} static void SeedRandom(uint32 seed) { rand1 = seed; @@ -585,9 +583,9 @@ static int * ToByteCode(char * formula, int codefield) int qmarkstack[100]; int colonstack[100]; // stack-counters - int qpoint=-1,cpoint=-1,lpoint=-1; + int qpoint=-1,cpoint=-1; - int pointerStart = (int)GlobalCurrentChar; + char * pointerStart = GlobalCurrentChar; while(*GlobalCurrentChar != 0 && !EvaluateError) { @@ -1160,7 +1158,7 @@ static int * ToByteCode(char * formula, int codefield) GlobalCurrentChar += (*(GlobalCurrentChar+1) == 'c') ? 3 : 11; bytes[pointer++] = BOT_BYTE_SC; } - // qfox: Added stop command. Should do exactly the same as pressing the "stop" button.\ + // qfox: Added stop command. Should do exactly the same as pressing the "stop" button. // But probably won't yet :) else if(*(GlobalCurrentChar+1) == 't' &&*(GlobalCurrentChar+2) == 'o' @@ -1333,7 +1331,7 @@ static int * ToByteCode(char * formula, int codefield) default: // Unknown characters should error out. You can use spaces. BotSyntaxError(12001); - sprintf(errormsg,"[%d][%d] Unknown character... '%c'",codefield,GlobalCurrentChar-pointerStart,(*GlobalCurrentChar)); + sprintf(errormsg,"[%d][%d] Unknown character... '%c'",codefield,int(GlobalCurrentChar-pointerStart),(*GlobalCurrentChar)); debugS(errormsg); delete bytes; return NULL; diff --git a/src/drivers/win/debuggersp.h b/src/drivers/win/debuggersp.h index f9668860..30cd3210 100644 --- a/src/drivers/win/debuggersp.h +++ b/src/drivers/win/debuggersp.h @@ -44,4 +44,4 @@ void DeleteDebuggerBookmark(HWND hwnd); void GoToDebuggerBookmark(HWND hwnd); int getBank(int offs); void dumpBookmarks(HWND hwmd); -int isHex(char c); \ No newline at end of file +int isHex(char c); diff --git a/src/drivers/win/memwatch.h b/src/drivers/win/memwatch.h index a1a3b758..f9c9280a 100644 --- a/src/drivers/win/memwatch.h +++ b/src/drivers/win/memwatch.h @@ -5,4 +5,4 @@ extern char * MemWatchDir; extern bool MemWatchLoadOnStart; extern bool MemWatchLoadFileOnStart; extern char *memw_recent_files[]; -extern HWND memw_pwindow; \ No newline at end of file +extern HWND memw_pwindow; diff --git a/src/drivers/win/oakra.h b/src/drivers/win/oakra.h index 5e815bf4..b75f64d6 100644 --- a/src/drivers/win/oakra.h +++ b/src/drivers/win/oakra.h @@ -103,14 +103,12 @@ public: } static int generateSilence(int samples, void *buf, int sampleSize) { - char *cbuf = (char *)buf; int n = sampleSize*samples; memset(buf,0,n); return samples; } static int generateSilence(int samples, void *buf, OAKRA_Format &format) { - char *cbuf = (char *)buf; int n = format.size*samples; memset(buf,0,n); return samples; diff --git a/src/drivers/win/state.h b/src/drivers/win/state.h index f0909119..559106bf 100644 --- a/src/drivers/win/state.h +++ b/src/drivers/win/state.h @@ -1,2 +1,2 @@ void FCEUD_SaveStateAs(); -void FCEUD_LoadStateFrom(); \ No newline at end of file +void FCEUD_LoadStateFrom(); diff --git a/src/drivers/win/tasedit.h b/src/drivers/win/tasedit.h index 06dbdef3..3aea264d 100644 --- a/src/drivers/win/tasedit.h +++ b/src/drivers/win/tasedit.h @@ -1,2 +1,2 @@ void DoTasEdit(); -void UpdateTasEdit(); \ No newline at end of file +void UpdateTasEdit(); diff --git a/src/drivers/win/throttle.h b/src/drivers/win/throttle.h index 61601d83..e719a7de 100644 --- a/src/drivers/win/throttle.h +++ b/src/drivers/win/throttle.h @@ -1,3 +1,3 @@ void InitSpeedThrottle(void); int SpeedThrottle(void); -void RefreshThrottleFPS(); \ No newline at end of file +void RefreshThrottleFPS(); diff --git a/src/drivers/win/window.cpp b/src/drivers/win/window.cpp index fd15fabb..0bab8493 100644 --- a/src/drivers/win/window.cpp +++ b/src/drivers/win/window.cpp @@ -630,7 +630,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) int h=wrect->bottom-wrect->top; int w=wrect->right-wrect->left; - int how; + int how = 0; if(wParam == WMSZ_BOTTOM || wParam == WMSZ_TOP) how = 2; diff --git a/src/input.cpp b/src/input.cpp index 8d76bbb0..2a26aba8 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -543,7 +543,7 @@ static void CommandStateLoad(void); static void CommandStateSave(void); static void CommandSelectSaveSlot(void); static void CommandEmulationSpeed(void); -static void CommandMovieSelectSlot(void); +// static void CommandMovieSelectSlot(void); static void CommandMovieRecord(void); static void CommandMovieReplay(void); static void CommandSoundAdjust(void); diff --git a/src/movie.h b/src/movie.h index 09c82e0b..25784744 100644 --- a/src/movie.h +++ b/src/movie.h @@ -88,8 +88,8 @@ public: MovieData(); - int emuVersion; int version; + int emuVersion; //todo - somehow force mutual exclusion for poweron and reset (with an error in the parser) bool palFlag; bool poweronFlag; diff --git a/src/utils/xstring.cpp b/src/utils/xstring.cpp index 304e46bc..478de179 100644 --- a/src/utils/xstring.cpp +++ b/src/utils/xstring.cpp @@ -457,4 +457,4 @@ char *U8ToHexStr(uint8 a) TempArray[1] = a%16 > 9?'A'+(a%16) - 10:'0' + (a%16); TempArray[2] = 0; return TempArray; -} \ No newline at end of file +} diff --git a/src/utils/xstring.h b/src/utils/xstring.h index 1be281db..bad33e62 100644 --- a/src/utils/xstring.h +++ b/src/utils/xstring.h @@ -52,4 +52,4 @@ char *U32ToDecStr(uint32 a); char *U32ToDecStr(char* buf, uint32 a); char *U8ToDecStr(uint8 a); char *U8ToHexStr(uint8 a); -char *U16ToHexStr(uint16 a); \ No newline at end of file +char *U16ToHexStr(uint16 a);