forked from github/server
Merge pull request #390 from ennorehling/develop
latest batch of coverity scan fixes
This commit is contained in:
commit
385a5dbe3a
5 changed files with 35 additions and 29 deletions
|
@ -1391,6 +1391,7 @@ int readgame(const char *filename, bool backup)
|
|||
storage store;
|
||||
stream strm;
|
||||
FILE *F;
|
||||
size_t sz;
|
||||
|
||||
init_locales();
|
||||
log_debug("- reading game data from %s\n", filename);
|
||||
|
@ -1405,8 +1406,8 @@ int readgame(const char *filename, bool backup)
|
|||
perror(path);
|
||||
return -1;
|
||||
}
|
||||
fread(&gdata.version, sizeof(int), 1, F);
|
||||
if (gdata.version >= INTPAK_VERSION) {
|
||||
sz = fread(&gdata.version, sizeof(int), 1, F);
|
||||
if (sz!=sizeof(int) || gdata.version >= INTPAK_VERSION) {
|
||||
int stream_version;
|
||||
size_t sz = fread(&stream_version, sizeof(int), 1, F);
|
||||
assert((sz==1 && stream_version == STREAM_VERSION) || !"unsupported data format");
|
||||
|
|
|
@ -208,6 +208,7 @@ newfaction *read_newfactions(const char *filename)
|
|||
nf = calloc(sizeof(newfaction), 1);
|
||||
if (set_email(&nf->email, email) != 0) {
|
||||
log_error("Invalid email address for subscription %s: %s\n", itoa36(subscription), email);
|
||||
free(nf);
|
||||
continue;
|
||||
}
|
||||
nf->password = _strdup(password);
|
||||
|
|
|
@ -2189,7 +2189,7 @@ static const region_list *travel_i(unit * u, const region_list * route_begin,
|
|||
static void travel(unit * u, region_list ** routep)
|
||||
{
|
||||
region *r = u->region;
|
||||
region_list *route_begin = NULL;
|
||||
region_list *route_begin;
|
||||
follower *followers = NULL;
|
||||
|
||||
assert(routep);
|
||||
|
@ -2232,6 +2232,7 @@ static void travel(unit * u, region_list ** routep)
|
|||
make_route(u, u->thisorder, routep);
|
||||
route_begin = *routep;
|
||||
|
||||
if (route_begin) {
|
||||
/* und ab die post: */
|
||||
travel_i(u, route_begin, NULL, u->thisorder, TRAVEL_NORMAL, &followers);
|
||||
|
||||
|
@ -2261,7 +2262,7 @@ static void travel(unit * u, region_list ** routep)
|
|||
free_order(follow_order);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void move_cmd(unit * u, bool move_on_land)
|
||||
|
|
|
@ -1033,7 +1033,7 @@ int sp_chaosrow(struct castorder * co)
|
|||
if (u_race(df->unit)->battle_flags & BF_NOBLOCK) {
|
||||
df->side->nonblockers[row] -= df->alive;
|
||||
}
|
||||
row = FIRST_ROW + (rng_int() % (LAST_ROW - FIRST_ROW));
|
||||
row = FIRST_ROW + (rng_int() % (NUMROWS - FIRST_ROW));
|
||||
switch (row) {
|
||||
case FIGHT_ROW:
|
||||
df->status = ST_FIGHT;
|
||||
|
|
|
@ -374,7 +374,10 @@ summary *make_summary(void)
|
|||
s->factions++;
|
||||
/* Problem mit Monsterpartei ... */
|
||||
if (!is_monsters(f)) {
|
||||
s->factionrace[old_race(f->race)]++;
|
||||
int rc = old_race(f->race);
|
||||
if (rc >= 0) {
|
||||
s->factionrace[rc]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue