summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-09-30 18:21:14 +0300
committerAndrei Karas <akaras@inbox.ru>2016-09-30 20:37:26 +0300
commit2000a698da35915afb1a598433337a735d27ae24 (patch)
tree119c8d409657cee1d90cd0c072ef3b7e846fa3f0 /src/map/mob.c
parent84ecefb4db23bbd98194a43a592cfe313477a1ab (diff)
downloadhercules-2000a698da35915afb1a598433337a735d27ae24.tar.gz
hercules-2000a698da35915afb1a598433337a735d27ae24.tar.bz2
hercules-2000a698da35915afb1a598433337a735d27ae24.tar.xz
hercules-2000a698da35915afb1a598433337a735d27ae24.zip
Add different fixes for gcc 7 warnings.
Some possible buffer overflows. Add attribute for mark fallthrough cases. Skipped libconfig warnings.
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index bede7deed..590cbf856 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1099,6 +1099,7 @@ int mob_ai_sub_hard_activesearch(struct block_list *bl, va_list ap)
case BL_PC:
if (BL_UCCAST(BL_PC, bl)->state.gangsterparadise && !(status_get_mode(&md->bl)&MD_BOSS))
return 0; //Gangster paradise protection.
+ FALLTHROUGH
default:
if (battle_config.hom_setting&0x4 &&
(*target) && (*target)->type == BL_HOM && bl->type != BL_HOM)
@@ -1326,6 +1327,7 @@ int mob_unlocktarget(struct mob_data *md, int64 tick) {
break;
//Because it is not unset when the mob finishes walking.
md->state.skillstate = MSS_IDLE;
+ FALLTHROUGH
case MSS_IDLE:
// Idle skill.
if (!(++md->ud.walk_count%IDLE_SKILL_INTERVAL) && mob->skill_use(md, tick, -1))
@@ -3289,6 +3291,7 @@ int mobskill_use(struct mob_data *md, int64 tick, int event) {
bl = map->id2bl(md->master_id);
if (bl) //Otherwise, fall through.
break;
+ FALLTHROUGH
case MST_FRIEND:
bl = fbl?fbl:(fmd?&fmd->bl:&md->bl);
break;
@@ -3331,6 +3334,7 @@ int mobskill_use(struct mob_data *md, int64 tick, int event) {
bl = map->id2bl(md->master_id);
if (bl) //Otherwise, fall through.
break;
+ FALLTHROUGH
case MST_FRIEND:
if (fbl) {
bl = fbl;
@@ -3339,6 +3343,7 @@ int mobskill_use(struct mob_data *md, int64 tick, int event) {
bl = &fmd->bl;
break;
} // else fall through
+ FALLTHROUGH
default:
bl = &md->bl;
break;
@@ -5057,7 +5062,7 @@ void mob_readskilldb(void) {
for( fi = 0; fi < ARRAYLENGTH(filename); ++fi ) {
if(fi > 0) {
char filepath[256];
- sprintf(filepath, "%s/%s", map->db_path, filename[fi]);
+ snprintf(filepath, 256, "%s/%s", map->db_path, filename[fi]);
if(!exists(filepath)) {
continue;
}