diff options
author | Haru <haru@dotalux.com> | 2013-12-10 19:48:55 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2013-12-17 01:11:33 +0100 |
commit | 15a0f6dea6f4f3c5adc9a1bc9e7e8be81cc49c48 (patch) | |
tree | c5dd5b25003f8c21381c7a2e1f010dba71e40b90 /src/map/mob.c | |
parent | a23d072a66d2569ba13921522be3c82ae9aad576 (diff) | |
download | hercules-15a0f6dea6f4f3c5adc9a1bc9e7e8be81cc49c48.tar.gz hercules-15a0f6dea6f4f3c5adc9a1bc9e7e8be81cc49c48.tar.bz2 hercules-15a0f6dea6f4f3c5adc9a1bc9e7e8be81cc49c48.tar.xz hercules-15a0f6dea6f4f3c5adc9a1bc9e7e8be81cc49c48.zip |
Fixed several compiler warnings
- Warnings detected thanks to Xcode's compiler settings (more strict by
default) and clang, warnings mostly but not only related to data sizes
on 64 bit systems, that were silenced until now by very lax compiler
settings.
- This also decreases by a great deal the amount of warnings produced by
MSVC in x64 mode (for the adventurous ones who tried that)
- Also fixed (or silenced in case of false positives) the potential
issues pointed out by the (awesome) clang static analyzer.
- Patch co-produced with Ind, I'm merging and committing in his place!
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/mob.c')
-rw-r--r-- | src/map/mob.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/map/mob.c b/src/map/mob.c index 8c02503aa..90a967d61 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -878,14 +878,15 @@ int mob_setdelayspawn(struct mob_data *md) } int mob_count_sub(struct block_list *bl, va_list ap) { - int mobid[10], i; - ARR_FIND(0, 10, i, (mobid[i] = va_arg(ap, int)) == 0); //fetch till 0 - if (mobid[0]) { //if there one let's check it otherwise go backward - TBL_MOB *md = BL_CAST(BL_MOB, bl); - ARR_FIND(0, 10, i, md->class_ == mobid[i]); - return (i < 10) ? 1 : 0; - } - return 1; //backward compatibility + int mobid[10] = { 0 }, i; + ARR_FIND(0, 10, i, (mobid[i] = va_arg(ap, int)) == 0); //fetch till 0 + if (mobid[0]) { //if there one let's check it otherwise go backward + TBL_MOB *md = BL_CAST(BL_MOB, bl); + nullpo_ret(md); + ARR_FIND(0, 10, i, md->class_ == mobid[i]); + return (i < 10) ? 1 : 0; + } + return 1; //backward compatibility } /*========================================== @@ -4104,7 +4105,7 @@ bool mob_parse_row_chatdb(char** str, const char* source, int line, int* last_ms //MSG ID ms->msg_id=msg_id; //Color - ms->color=strtoul(str[1],NULL,0); + ms->color=(unsigned int)strtoul(str[1],NULL,0); //Message msg = str[2]; len = strlen(msg); |