diff options
author | Haru <haru@dotalux.com> | 2016-09-15 15:29:16 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2016-10-07 01:10:28 +0200 |
commit | c5780deadbda31d4a76e7f4ded866d769c2a1151 (patch) | |
tree | 42a3c979fa9f96ddfe014f485115dffc4e9883d3 | |
parent | 953feee90e47d75449151834707a165f9ce57fda (diff) | |
download | hercules-c5780deadbda31d4a76e7f4ded866d769c2a1151.tar.gz hercules-c5780deadbda31d4a76e7f4ded866d769c2a1151.tar.bz2 hercules-c5780deadbda31d4a76e7f4ded866d769c2a1151.tar.xz hercules-c5780deadbda31d4a76e7f4ded866d769c2a1151.zip |
Fixed some issues detected by clang's static analyzer (Xcode 8/macOS Sierra)
Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r-- | src/common/HPM.c | 2 | ||||
-rw-r--r-- | src/common/socket.c | 4 | ||||
-rw-r--r-- | src/common/timer.c | 4 | ||||
-rw-r--r-- | src/map/battle.c | 6 | ||||
-rw-r--r-- | src/map/clif.c | 5 | ||||
-rw-r--r-- | src/map/path.c | 2 | ||||
-rw-r--r-- | src/map/script.c | 2 |
7 files changed, 4 insertions, 21 deletions
diff --git a/src/common/HPM.c b/src/common/HPM.c index c34828010..ff1371b14 100644 --- a/src/common/HPM.c +++ b/src/common/HPM.c @@ -898,7 +898,7 @@ bool hplugins_parse_conf(const struct config_t *config, const char *filename, en for (i = 0; i < VECTOR_LENGTH(HPM->config_listeners[point]); i++) { const struct HPConfListenStorage *entry = &VECTOR_INDEX(HPM->config_listeners[point], i); const char *config_name = entry->key; - const char *str = buf; + const char *str = NULL; if ((setting = libconfig->lookup(config, config_name)) == NULL) { if (!imported && entry->required) { ShowWarning("Missing configuration '%s' in file %s!\n", config_name, filename); diff --git a/src/common/socket.c b/src/common/socket.c index 5f284587a..d4b8bb43f 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -1023,10 +1023,6 @@ int do_sockets(int next) } } -#ifdef __clang_analyzer__ - // Let Clang's static analyzer know this never happens (it thinks it might because of a NULL check in session_is_valid) - if (!sockt->session[i]) continue; -#endif // __clang_analyzer__ sockt->session[i]->func_parse(i); if(!sockt->session[i]) diff --git a/src/common/timer.c b/src/common/timer.c index 0b28f6a06..f820ebe12 100644 --- a/src/common/timer.c +++ b/src/common/timer.c @@ -258,10 +258,6 @@ int64 timer_gettick(void) { /// Adds a timer to the timer_heap static void push_timer_heap(int tid) { BHEAP_ENSURE(timer_heap, 1, 256); -#ifdef __clang_analyzer__ // Clang's static analyzer warns that BHEAP_ENSURE might set BHEAP_DATA(timer_heap) to NULL. -#include "assert.h" - assert(BHEAP_DATA(timer_heap) != NULL); -#endif // __clang_analyzer__ BHEAP_PUSH(timer_heap, tid, DIFFTICK_MINTOPCMP, swap); } diff --git a/src/map/battle.c b/src/map/battle.c index daef8f6a8..67ab8c9b8 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -6008,20 +6008,18 @@ int battle_damage_area(struct block_list *bl, va_list ap) { if (bl->type == BL_MOB && BL_UCCAST(BL_MOB, bl)->class_ == MOBID_EMPELIUM) return 0; if( bl != src && battle->check_target(src,bl,BCT_ENEMY) > 0 ) { - struct map_session_data *sd = NULL; nullpo_ret(src); map->freeblock_lock(); - sd = BL_CAST(BL_PC, src); if (src->type == BL_PC) - battle->drain(sd, bl, damage, damage, status_get_race(bl), is_boss(bl)); + battle->drain(BL_UCAST(BL_PC, src), bl, damage, damage, status_get_race(bl), is_boss(bl)); if( amotion ) battle->delay_damage(tick, amotion,src,bl,0,CR_REFLECTSHIELD,0,damage,ATK_DEF,0,true); else status_fix_damage(src,bl,damage,0); clif->damage(bl,bl,amotion,dmotion,damage,1,BDT_ENDURE,0); - if (src->type != BL_PC || !sd->state.autocast) + if (src->type != BL_PC || !BL_UCCAST(BL_PC, src)->state.autocast) skill->additional_effect(src, bl, CR_REFLECTSHIELD, 1, BF_WEAPON|BF_SHORT|BF_NORMAL,ATK_DEF,tick); map->freeblock_unlock(); } diff --git a/src/map/clif.c b/src/map/clif.c index 040f86a58..3e6b4937b 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -3249,10 +3249,7 @@ void clif_changelook(struct block_list *bl,int type,int val) #endif break; case LOOK_BODY2: - if (val && ( - sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || - sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || - sd->sc.option&OPTION_OKTOBERFEST)) + if (sd != NULL && (sd->sc.option&OPTION_COSTUME) != OPTION_NOTHING) val = 0; vd->body_style = val; break; diff --git a/src/map/path.c b/src/map/path.c index f5e08d4df..07b38b740 100644 --- a/src/map/path.c +++ b/src/map/path.c @@ -192,10 +192,8 @@ bool path_search_long(struct shootpath_data *spd,struct block_list *bl,int16 m,i /// Ensures there is enough space in array to store new element. static void heap_push_node(struct node_heap *heap, struct path_node *node) { -#ifndef __clang_analyzer__ // TODO: Figure out why clang's static analyzer doesn't like this BHEAP_ENSURE(*heap, 1, 256); BHEAP_PUSH2(*heap, node, NODE_MINTOPCMP, swap_ptr); -#endif // __clang_analyzer__ } /// Updates path_node in the binary node_heap. diff --git a/src/map/script.c b/src/map/script.c index a1efbb3b8..d1aee29bf 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -5482,8 +5482,6 @@ bool script_sprintf(struct script_state *st, int start, struct StringBuf *out) safestrncpy(buf, p, len); StrBuf->AppendStr(out, buf); } - - p = np; np++; // placeholder = "%%" ; (special case) |