From b1f5178bdabafde20eb65df6256b53dc5968b2e2 Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Mon, 23 Feb 2015 09:11:56 +0100 Subject: Apply trivial warning cleanups --- src/birth.cc | 4 ++-- src/cmd6.cc | 6 +----- src/loadsave.cc | 4 ++-- src/main-gcu.c | 2 +- src/main-sdl.c | 8 +++----- src/skills.cc | 6 ++---- 6 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/birth.cc b/src/birth.cc index b5fee1ec..0c98f160 100644 --- a/src/birth.cc +++ b/src/birth.cc @@ -809,9 +809,9 @@ static void player_wipe(void) for (i = 0; i < MAX_Q_IDX; i++) { quest[i].status = QUEST_STATUS_UNTAKEN; - for (j = 0; j < sizeof(quest[i].data)/sizeof(quest[i].data[0]); j++) + for (auto &quest_data : quest[i].data) { - quest[i].data[j] = 0; + quest_data = 0; } } diff --git a/src/cmd6.cc b/src/cmd6.cc index 953bd7dd..903d5a4d 100644 --- a/src/cmd6.cc +++ b/src/cmd6.cc @@ -3696,8 +3696,6 @@ static void activate_stick(s16b s, bool_ *obvious, bool_ *use_charge) */ void do_cmd_use_staff(void) { - int item, ident; - bool_ obvious, use_charge; object_type *o_ptr; @@ -3723,6 +3721,7 @@ void do_cmd_use_staff(void) /* Get an item */ q = "Use which staff? "; s = "You have no staff to use."; + int item; if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR | USE_EXTRA))) return; /* Get the item */ @@ -3741,9 +3740,6 @@ void do_cmd_use_staff(void) /* Take a turn */ energy_use = 100; - /* Not identified yet */ - ident = FALSE; - /* get the chance */ int chance; { diff --git a/src/loadsave.cc b/src/loadsave.cc index 17cca579..cf1365c7 100644 --- a/src/loadsave.cc +++ b/src/loadsave.cc @@ -2693,9 +2693,9 @@ static bool_ do_savefile_aux(int flag) for (i = 0; i < MAX_Q_IDX; i++) { do_s16b(&quest[i].status, flag); - for (j = 0; j < sizeof(quest[i].data)/sizeof(quest[i].data[0]); j++) + for (auto &quest_data : quest[i].data) { - do_s32b(&(quest[i].data[j]), flag); + do_s32b(&quest_data, flag); } /* Init the hooks */ diff --git a/src/main-gcu.c b/src/main-gcu.c index a07f216d..357b889e 100644 --- a/src/main-gcu.c +++ b/src/main-gcu.c @@ -736,7 +736,7 @@ static errr Term_text_gcu(int x, int y, int n, byte a, cptr s) { term_data *td = (term_data *)(Term->data); - int i, pic; + int i; #ifdef A_COLOR /* Set the color */ diff --git a/src/main-sdl.c b/src/main-sdl.c index 907fbcf3..6a75fb87 100644 --- a/src/main-sdl.c +++ b/src/main-sdl.c @@ -90,7 +90,7 @@ static bool_ window_properties_set = FALSE; static SDL_Surface *screen; /* the video settings for the system */ -static SDL_VideoInfo *videoInfo; +static const SDL_VideoInfo *videoInfo; /* a flag to suspend updating of the screen; this is in place so that when a large area is being @@ -1289,7 +1289,6 @@ void moveTerminal(int x, int y) void bringToTop(int current) { term_data *td; - term_data *tc; int n = 0; int i; @@ -1464,8 +1463,7 @@ void manipulationMode(void) int mouse_x, mouse_y; int value = 0, delta_x = 0, delta_y = 0; int current_term; - SDL_Surface backup; - + /* Begin by redrawing the main terminal with its purple border to signify that it is being edited*/ @@ -1857,7 +1855,7 @@ This routine processes arguments, opens the SDL window, loads fonts, etc. */ errr init_sdl(int argc, char **argv) { - int i, surface_type; + int i; char filename[PATH_MAX + 1]; const char file_sep = '.'; /* Flags to pass to SDL_SetVideoMode */ diff --git a/src/skills.cc b/src/skills.cc index 26e1537d..37e84c57 100644 --- a/src/skills.cc +++ b/src/skills.cc @@ -792,11 +792,10 @@ static int do_cmd_activate_skill_aux() { if (s_info[i].action_mkey && s_info[i].value && ((!s_info[i].hidden) || (i == SKILL_LEARN))) { - int j; bool_ next = FALSE; /* Already got it ? */ - for (j = 0; j < p.size(); j++) + for (size_t j = 0; j < p.size(); j++) { if (s_info[i].action_mkey == std::get<1>(p[j])) { @@ -815,11 +814,10 @@ static int do_cmd_activate_skill_aux() { if (ab_info[i].action_mkey && ab_info[i].acquired) { - int j; bool_ next = FALSE; /* Already got it ? */ - for (j = 0; j < p.size(); j++) + for (size_t j = 0; j < p.size(); j++) { if (ab_info[i].action_mkey == std::get<1>(p[j])) { -- cgit v1.2.3