summaryrefslogtreecommitdiff
path: root/src/map/skill.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-05-19 01:59:33 +0200
committerHaru <haru@dotalux.com>2015-05-19 03:08:22 +0200
commitbd2109d614a443045c7bbbf632bb9035216e3623 (patch)
tree2e125e4ce2b6a8c60b5e2303b1e2b0a88386ff70 /src/map/skill.c
parent6ac5a0ccfb601b81e1b84f6e86175d40bb16864b (diff)
downloadhercules-bd2109d614a443045c7bbbf632bb9035216e3623.tar.gz
hercules-bd2109d614a443045c7bbbf632bb9035216e3623.tar.bz2
hercules-bd2109d614a443045c7bbbf632bb9035216e3623.tar.xz
hercules-bd2109d614a443045c7bbbf632bb9035216e3623.zip
Fixed some issues reported by coverity scan [3/3]
- Automatically zeroed variables are now zeroed in the correct size, regardless of padding. - Special thanks to Ind. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/skill.c')
-rw-r--r--src/map/skill.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index 77e9f24aa..70a7a565e 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -18959,16 +18959,7 @@ void skill_readdb(bool minimal) {
/* when != it was called during init and this procedure was already performed by skill_defaults() */
if( runflag == MAPSERVER_ST_RUNNING ) {
- memset(skill->db,0,sizeof(skill->db)
- + sizeof(skill->produce_db)
- + sizeof(skill->arrow_db)
- + sizeof(skill->abra_db)
- + sizeof(skill->magicmushroom_db)
- + sizeof(skill->improvise_db)
- + sizeof(skill->changematerial_db)
- + sizeof(skill->spellbook_db)
- + sizeof(skill->reproduce_db)
- );
+ memset(ZEROED_BLOCK_POS(skill), 0, ZEROED_BLOCK_SIZE(skill));
}
// load skill databases
@@ -19107,18 +19098,10 @@ void skill_defaults(void) {
skill->timer_ers = NULL;
skill->cd_ers = NULL;
skill->cd_entry_ers = NULL;
- /* one huge 0, follows skill.h order */
- memset(skill->db,0,sizeof(skill->db)
- + sizeof(skill->produce_db)
- + sizeof(skill->arrow_db)
- + sizeof(skill->abra_db)
- + sizeof(skill->magicmushroom_db)
- + sizeof(skill->improvise_db)
- + sizeof(skill->changematerial_db)
- + sizeof(skill->spellbook_db)
- + sizeof(skill->reproduce_db)
- + sizeof(skill->unit_layout)
- );
+
+ memset(ZEROED_BLOCK_POS(skill), 0, ZEROED_BLOCK_SIZE(skill));
+ memset(skill->unit_layout, 0, sizeof(skill->unit_layout));
+
/* */
memcpy(skill->enchant_eff, skill_enchant_eff, sizeof(skill->enchant_eff));
memcpy(skill->deluge_eff, skill_deluge_eff, sizeof(skill->deluge_eff));