From 975a1d3c5db0dc11a4f5ada68d5d424850858161 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 5 Apr 2014 19:56:28 +0100 Subject: Fix cppcheck variableScope warnings --- amiga/arexx.c | 6 ++++-- amiga/download.c | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'amiga') diff --git a/amiga/arexx.c b/amiga/arexx.c index 7fc58ef97..3bac0c249 100644 --- a/amiga/arexx.c +++ b/amiga/arexx.c @@ -196,11 +196,12 @@ int ami_find_tab_bw(struct gui_window_2 *gwin, struct browser_window *bw) struct browser_window *ami_find_tab(int window, int tab) { - int windows = 0; struct nsObject *node, *nnode; if(!IsMinListEmpty(window_list)) { + int windows = 0; + node = (struct nsObject *)GetHead((struct List *)window_list); do @@ -568,7 +569,6 @@ STATIC VOID rx_windows(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__(( STATIC VOID rx_active(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused))) { - int windows = 0; int window = 0, tab = 0; struct browser_window *bw = curbw; struct nsObject *node, *nnode; @@ -578,6 +578,8 @@ STATIC VOID rx_active(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((u if(!IsMinListEmpty(window_list)) { + int windows = 0; + node = (struct nsObject *)GetHead((struct List *)window_list); do diff --git a/amiga/download.c b/amiga/download.c index fb5c10957..74cb51f15 100644 --- a/amiga/download.c +++ b/amiga/download.c @@ -347,7 +347,6 @@ void ami_free_download_list(struct List *dllist) void gui_window_save_link(struct gui_window *g, const char *url, const char *title) { - BPTR fh = 0; char fname[1024]; STRPTR openurlstring,linkname; struct DiskObject *dobj = NULL; @@ -369,6 +368,8 @@ gui_window_save_link(struct gui_window *g, const char *url, const char *title) if(ami_download_check_overwrite(fname, g->shared->win, 0)) { + BPTR fh; + if(fh = FOpen(fname,MODE_NEWFILE,0)) { /* TODO: Should be URLOpen on OS4.1 */ @@ -401,8 +402,6 @@ BOOL ami_download_check_overwrite(const char *file, struct Window *win, ULONG si /* Return TRUE if file can be (over-)written */ int32 res = 0; BPTR lock = 0; - BPTR fh = 0; - int64 oldsize = 0; char *overwritetext; if(nsoption_bool(ask_overwrite) == false) return TRUE; @@ -412,6 +411,9 @@ BOOL ami_download_check_overwrite(const char *file, struct Window *win, ULONG si if(lock) { if(size) { + BPTR fh; + int64 oldsize = 0; + if(fh = OpenFromLock(lock)) { oldsize = GetFileSize(fh); Close(fh); -- cgit v1.2.3