diff --git a/src/bind_unit.c b/src/bind_unit.c index 576678642..42fafae39 100755 --- a/src/bind_unit.c +++ b/src/bind_unit.c @@ -756,9 +756,7 @@ static int tolua_unit_get_spells(lua_State * L) quicklist *slist = 0; if (sb) { quicklist **slist_ptr = &sb->spells; - if (slist_ptr) { - slist = *slist_ptr; - } + slist = *slist_ptr; } return tolua_quicklist_push(L, "spellbook", "spell_entry", slist); } diff --git a/src/gmtool.c b/src/gmtool.c index 05997ed6e..7aab2fea7 100644 --- a/src/gmtool.c +++ b/src/gmtool.c @@ -184,7 +184,7 @@ map_region *mr_get(const view * vi, int xofs, int yofs) static point *coor2point(const coordinate * c, point * p) { assert(c && p); - p->x = c->x * TWIDTH + c->y * TWIDTH / 2; + p->x = c->x * TWIDTH + c->y * TWIDTH / 2; //-V537 p->y = c->y * THEIGHT; return p; } @@ -262,7 +262,7 @@ static chtype mr_tile(const map_region * mr, int highlight) const region *r = mr->r; switch (r->terrain->_name[0]) { case 'o': - return '.' | COLOR_PAIR(hl + COLOR_CYAN) | A_BOLD; + return '.' | COLOR_PAIR(hl + COLOR_CYAN) | A_BOLD; //-V525 case 'd': return 'D' | COLOR_PAIR(hl + COLOR_YELLOW) | A_BOLD; case 't': @@ -1167,7 +1167,7 @@ static void handlekey(state * st, int c) region *first = (mr && mr->r && mr->r->next) ? mr->r->next : regions; if (findmode == 'f') { - sprintf(sbuffer, "find-faction: %s", locate); + snprintf(sbuffer, sizeof(sbuffer), "find-faction: %s", locate); statusline(st->wnd_status->handle, sbuffer); f = findfaction(atoi36(locate)); if (f == NULL) { diff --git a/src/kernel/build.c b/src/kernel/build.c index 649679d93..b5a1b3417 100644 --- a/src/kernel/build.c +++ b/src/kernel/build.c @@ -249,7 +249,7 @@ int destroy_cmd(unit * u, struct order *ord) } if (con) { - /* TODO: Nicht an ZERSTÖRE mit Punktangabe angepasst! */ + /* TODO: Nicht an ZERST�RE mit Punktangabe angepasst! */ int c; for (c = 0; con->materials[c].number; ++c) { const requirement *rq = con->materials + c; @@ -513,8 +513,8 @@ int build(unit * u, const construction * ctype, int completed, int want) /* Hier ist entweder maxsize == -1, oder completed < maxsize. * Andernfalls ist das Datenfile oder sonstwas kaputt... - * (enno): Nein, das ist für Dinge, bei denen die nächste Ausbaustufe - * die gleiche wie die vorherige ist. z.b. gegenstände. + * (enno): Nein, das ist f�r Dinge, bei denen die n�chste Ausbaustufe + * die gleiche wie die vorherige ist. z.b. gegenst�nde. */ if (type->maxsize > 0) { completed = completed % type->maxsize; @@ -759,10 +759,8 @@ build_building(unit * u, const building_type * btype, int id, int want, order * return 0; } } - } - - if (b) built = b->size; + } if (n <= 0 || n == INT_MAX) { if (b == NULL) { if (btype->maxsize > 0) { @@ -817,11 +815,11 @@ build_building(unit * u, const building_type * btype, int id, int want, order * btname = LOC(lang, btype->_name); if (want - built <= 0) { - /* gebäude fertig */ + /* geb�ude fertig */ new_order = default_order(lang); } else if (want != INT_MAX && btname) { - /* reduzierte restgröße */ + /* reduzierte restgr��e */ const char *hasspace = strchr(btname, ' '); if (hasspace) { new_order = @@ -833,7 +831,7 @@ build_building(unit * u, const building_type * btype, int id, int want, order * } } else if (btname) { - /* Neues Haus, Befehl mit Gebäudename */ + /* Neues Haus, Befehl mit Geb�udename */ const char *hasspace = strchr(btname, ' '); if (hasspace) { new_order = create_order(K_MAKE, lang, "\"%s\" %i", btname, b->no); diff --git a/src/kernel/group.test.c b/src/kernel/group.test.c index 22d55e36f..78ee6b24f 100644 --- a/src/kernel/group.test.c +++ b/src/kernel/group.test.c @@ -82,7 +82,7 @@ static void test_group_readwrite(CuTest * tc) mstream_init(&data.strm); gamedata_init(&data, &store, RELEASE_VERSION); f = test_create_faction(0); - g = new_group(f, "NW", 42); + new_group(f, "NW", 42); g = new_group(f, "Egoisten", 43); key_set(&g->attribs, 44); al = ally_add(&g->allies, f); diff --git a/src/kernel/item.c b/src/kernel/item.c index cedf15df0..53fff79ab 100644 --- a/src/kernel/item.c +++ b/src/kernel/item.c @@ -239,7 +239,6 @@ item_type *it_get_or_create(resource_type *rtype) { item_type * itype; assert(rtype); itype = it_find(rtype->_name); - assert(!itype || !itype->rtype || itype->rtype == rtype); if (!itype) { itype = (item_type *)calloc(sizeof(item_type), 1); } diff --git a/src/util/bsdstring.test.c b/src/util/bsdstring.test.c index 0fffd187c..b5fe81156 100644 --- a/src/util/bsdstring.test.c +++ b/src/util/bsdstring.test.c @@ -32,7 +32,7 @@ static void test_strlcpy(CuTest * tc) CuAssertIntEquals(tc, 4, (int)strlcpy(buffer, "herp", 4)); CuAssertStrEquals(tc, "her", buffer); - CuAssertIntEquals(tc, 4, (int)strlcpy(buffer, "herp", 8)); + CuAssertIntEquals(tc, 4, (int)strlcpy(buffer, "herp", 8)); //-V666 CuAssertStrEquals(tc, "herp", buffer); CuAssertIntEquals(tc, 0x7f, buffer[5]); diff --git a/src/util/event.c b/src/util/event.c index ad5a9e725..cdf178aec 100644 --- a/src/util/event.c +++ b/src/util/event.c @@ -244,7 +244,7 @@ void tt_register(trigger_type * tt) trigger_type *tt_find(const char *name) { trigger_type *tt = triggertypes; - while (tt && strcmp(tt->name, name)) + while (tt && strcmp(tt->name, name)!=0) tt = tt->next; return tt; } diff --git a/src/util/log.c b/src/util/log.c index d394aa20d..759efba39 100644 --- a/src/util/log.c +++ b/src/util/log.c @@ -220,7 +220,7 @@ void log_fatal(const char *format, ...) va_end(args); } -void log_error(const char *format, ...) +void log_error(const char *format, ...) //-V524 { va_list args; va_start(args, format); diff --git a/src/util/rand.c b/src/util/rand.c index b92b4aff3..f5c8a28bc 100644 --- a/src/util/rand.c +++ b/src/util/rand.c @@ -103,13 +103,13 @@ void random_source_inject_constant(double value) { r_source = &constant_provider; } -static int i = 0; static double *values; -static int value_size = 0; +static int value_size; +static int value_index; static double array_source (void) { - assert(i 0); value_size = size; if (values) @@ -125,7 +126,7 @@ void random_source_inject_array(double inject[], int size) { for (i=0; i < size; ++i) { values[i] = inject[i]; } - i = 0; + value_index = 0; r_source = &array_provider; }