diff options
author | Haru <haru@dotalux.com> | 2016-04-29 01:27:47 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2016-04-29 01:27:47 +0200 |
commit | 8ac699f4840bdadfb92326250295e1fed8286183 (patch) | |
tree | 09f2e0a63cffc44d33c208c179aeaee497d45419 | |
parent | f488476193e26615a1d29d56bc3ccf5b52aeffe4 (diff) | |
parent | ba9e21984ee191865d11df1bb87f4142bb4cc5ab (diff) | |
download | hercules-8ac699f4840bdadfb92326250295e1fed8286183.tar.gz hercules-8ac699f4840bdadfb92326250295e1fed8286183.tar.bz2 hercules-8ac699f4840bdadfb92326250295e1fed8286183.tar.xz hercules-8ac699f4840bdadfb92326250295e1fed8286183.zip |
Merge pull request #1272 from 4144/gccwarnings
Add some new gcc 6 warnings and fix some error found by it
-rwxr-xr-x | configure | 237 | ||||
-rw-r--r-- | configure.ac (renamed from configure.in) | 12 | ||||
-rw-r--r-- | src/map/clif.c | 3 | ||||
-rw-r--r-- | src/map/script.c | 1 | ||||
-rw-r--r-- | src/map/skill.c | 2 | ||||
-rw-r--r-- | src/map/status.c | 19 |
6 files changed, 209 insertions, 65 deletions
@@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in 8291fd8. +# From configure.ac 045a895. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # @@ -4603,6 +4603,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # -Wunused-parameter -Wunused-but-set-parameter unused parameters # -Wunused-macros unused macro warnings, but it also enable unused parameters # -Wstrict-prototypes show warning in grammar.y +# -wdiscarded-qualifiers show different const removal # attributes suggestion # -Wsuggest-attribute=const -Wsuggest-attribute=format -Wsuggest-attribute=pure @@ -6986,11 +6987,12 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext #AC_CHECK_COMPILER_WFLAG(cast-align) +#AC_CHECK_COMPILER_WFLAG(logical-op) # some useless warnings - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wlogical-op" >&5 -$as_echo_n "checking whether $CC supports -Wlogical-op... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wnested-externs" >&5 +$as_echo_n "checking whether $CC supports -Wnested-externs... " >&6; } OLD_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Werror -Wlogical-op" + CFLAGS="$CFLAGS -Werror -Wnested-externs" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; @@ -6999,12 +7001,12 @@ if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - CFLAGS="$OLD_CFLAGS -Wlogical-op" + CFLAGS="$OLD_CFLAGS -Wnested-externs" # Optionally, run a test if test "x" != "x"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wlogical-op" >&5 -$as_echo_n "checking whether $CC can actually use -Wlogical-op... " >&6; } - CFLAGS="$OLD_CFLAGS -Werror -Wlogical-op" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wnested-externs" >&5 +$as_echo_n "checking whether $CC can actually use -Wnested-externs... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wnested-externs" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7018,7 +7020,7 @@ $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - CFLAGS="$OLD_CFLAGS -Wlogical-op" + CFLAGS="$OLD_CFLAGS -Wnested-externs" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext @@ -7036,10 +7038,10 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wnested-externs" >&5 -$as_echo_n "checking whether $CC supports -Wnested-externs... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wold-style-definition" >&5 +$as_echo_n "checking whether $CC supports -Wold-style-definition... " >&6; } OLD_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Werror -Wnested-externs" + CFLAGS="$CFLAGS -Werror -Wold-style-definition" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; @@ -7048,12 +7050,12 @@ if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - CFLAGS="$OLD_CFLAGS -Wnested-externs" + CFLAGS="$OLD_CFLAGS -Wold-style-definition" # Optionally, run a test if test "x" != "x"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wnested-externs" >&5 -$as_echo_n "checking whether $CC can actually use -Wnested-externs... " >&6; } - CFLAGS="$OLD_CFLAGS -Werror -Wnested-externs" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wold-style-definition" >&5 +$as_echo_n "checking whether $CC can actually use -Wold-style-definition... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wold-style-definition" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7067,7 +7069,7 @@ $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - CFLAGS="$OLD_CFLAGS -Wnested-externs" + CFLAGS="$OLD_CFLAGS -Wold-style-definition" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext @@ -7085,10 +7087,10 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wold-style-definition" >&5 -$as_echo_n "checking whether $CC supports -Wold-style-definition... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Woverlength-strings" >&5 +$as_echo_n "checking whether $CC supports -Woverlength-strings... " >&6; } OLD_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Werror -Wold-style-definition" + CFLAGS="$CFLAGS -Werror -Woverlength-strings" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; @@ -7097,12 +7099,12 @@ if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - CFLAGS="$OLD_CFLAGS -Wold-style-definition" + CFLAGS="$OLD_CFLAGS -Woverlength-strings" # Optionally, run a test if test "x" != "x"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wold-style-definition" >&5 -$as_echo_n "checking whether $CC can actually use -Wold-style-definition... " >&6; } - CFLAGS="$OLD_CFLAGS -Werror -Wold-style-definition" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Woverlength-strings" >&5 +$as_echo_n "checking whether $CC can actually use -Woverlength-strings... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Woverlength-strings" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7116,7 +7118,7 @@ $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - CFLAGS="$OLD_CFLAGS -Wold-style-definition" + CFLAGS="$OLD_CFLAGS -Woverlength-strings" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext @@ -7134,10 +7136,10 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Woverlength-strings" >&5 -$as_echo_n "checking whether $CC supports -Woverlength-strings... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wredundant-decls" >&5 +$as_echo_n "checking whether $CC supports -Wredundant-decls... " >&6; } OLD_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Werror -Woverlength-strings" + CFLAGS="$CFLAGS -Werror -Wredundant-decls" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; @@ -7146,12 +7148,12 @@ if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - CFLAGS="$OLD_CFLAGS -Woverlength-strings" + CFLAGS="$OLD_CFLAGS -Wredundant-decls" # Optionally, run a test if test "x" != "x"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Woverlength-strings" >&5 -$as_echo_n "checking whether $CC can actually use -Woverlength-strings... " >&6; } - CFLAGS="$OLD_CFLAGS -Werror -Woverlength-strings" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wredundant-decls" >&5 +$as_echo_n "checking whether $CC can actually use -Wredundant-decls... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wredundant-decls" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7165,7 +7167,7 @@ $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - CFLAGS="$OLD_CFLAGS -Woverlength-strings" + CFLAGS="$OLD_CFLAGS -Wredundant-decls" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext @@ -7183,10 +7185,10 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wredundant-decls" >&5 -$as_echo_n "checking whether $CC supports -Wredundant-decls... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wcast-qual" >&5 +$as_echo_n "checking whether $CC supports -Wcast-qual... " >&6; } OLD_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Werror -Wredundant-decls" + CFLAGS="$CFLAGS -Werror -Wcast-qual" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; @@ -7195,12 +7197,12 @@ if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - CFLAGS="$OLD_CFLAGS -Wredundant-decls" + CFLAGS="$OLD_CFLAGS -Wcast-qual" # Optionally, run a test if test "x" != "x"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wredundant-decls" >&5 -$as_echo_n "checking whether $CC can actually use -Wredundant-decls... " >&6; } - CFLAGS="$OLD_CFLAGS -Werror -Wredundant-decls" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wcast-qual" >&5 +$as_echo_n "checking whether $CC can actually use -Wcast-qual... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wcast-qual" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7214,7 +7216,7 @@ $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - CFLAGS="$OLD_CFLAGS -Wredundant-decls" + CFLAGS="$OLD_CFLAGS -Wcast-qual" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext @@ -7232,10 +7234,10 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wcast-qual" >&5 -$as_echo_n "checking whether $CC supports -Wcast-qual... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wmisleading-indentation" >&5 +$as_echo_n "checking whether $CC supports -Wmisleading-indentation... " >&6; } OLD_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Werror -Wcast-qual" + CFLAGS="$CFLAGS -Werror -Wmisleading-indentation" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; @@ -7244,12 +7246,12 @@ if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - CFLAGS="$OLD_CFLAGS -Wcast-qual" + CFLAGS="$OLD_CFLAGS -Wmisleading-indentation" # Optionally, run a test if test "x" != "x"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wcast-qual" >&5 -$as_echo_n "checking whether $CC can actually use -Wcast-qual... " >&6; } - CFLAGS="$OLD_CFLAGS -Werror -Wcast-qual" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wmisleading-indentation" >&5 +$as_echo_n "checking whether $CC can actually use -Wmisleading-indentation... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wmisleading-indentation" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7263,7 +7265,56 @@ $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - CFLAGS="$OLD_CFLAGS -Wcast-qual" + CFLAGS="$OLD_CFLAGS -Wmisleading-indentation" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wnull-dereference" >&5 +$as_echo_n "checking whether $CC supports -Wnull-dereference... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wnull-dereference" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wnull-dereference" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wnull-dereference" >&5 +$as_echo_n "checking whether $CC can actually use -Wnull-dereference... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wnull-dereference" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wnull-dereference" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext @@ -7545,6 +7596,94 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-suggest-attribute=format" >&5 +$as_echo_n "checking whether $CC supports -Wno-suggest-attribute=format... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wno-suggest-attribute=format" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + # Recent versions of gcc don't fail if -Wno-foo is not recognized + # (unless there are also other warnings), so we also check for -Wfoo + # which always fails if not supported + CFLAGS="$OLD_CFLAGS -Werror -Wsuggest-attribute=format" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wno-suggest-attribute=format" + # Optionally, run a test + if test "x" != "x"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wno-suggest-attribute=format" >&5 +$as_echo_n "checking whether $CC can actually use -Wno-suggest-attribute=format... " >&6; } + CFLAGS="$OLD_CFLAGS -Werror -Wsuggest-attribute=format" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not needed but enabled" >&5 +$as_echo "not needed but enabled" >&6; } + CFLAGS="$OLD_CFLAGS" + +else + + CFLAGS="$OLD_CFLAGS -Werror -Wno-suggest-attribute=format" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + CFLAGS="$OLD_CFLAGS -Wno-suggest-attribute=format" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + # Certain versions of gcc make -Wshadow completely useless by making it flood # you with unnecessary warnings <https://lkml.org/lkml/2006/11/28/239> # Let's check if we can really use it diff --git a/configure.in b/configure.ac index 3968dc568..d6f783505 100644 --- a/configure.in +++ b/configure.ac @@ -492,6 +492,7 @@ AC_LANG([C]) # -Wunused-parameter -Wunused-but-set-parameter unused parameters # -Wunused-macros unused macro warnings, but it also enable unused parameters # -Wstrict-prototypes show warning in grammar.y +# -wdiscarded-qualifiers show different const removal # attributes suggestion # -Wsuggest-attribute=const -Wsuggest-attribute=format -Wsuggest-attribute=pure @@ -675,7 +676,7 @@ if test "$enable_lto" != "no" ; then ) fi -AC_DEFUN(AC_CHECK_SANITIZER_FLAG, +AC_DEFUN([AC_CHECK_SANITIZER_FLAG], [ AC_MSG_CHECKING([whether $CC supports -fsanitize=$1]) OLD_CFLAGS="$CFLAGS" @@ -741,7 +742,7 @@ if test "$enable_sanitize" != "no" ; then fi -AC_DEFUN(AC_CHECK_COMPILER_WFLAG, +AC_DEFUN([AC_CHECK_COMPILER_WFLAG], [ AC_MSG_CHECKING([whether $CC supports -W$1]) OLD_CFLAGS="$CFLAGS" @@ -776,7 +777,7 @@ AC_DEFUN(AC_CHECK_COMPILER_WFLAG, ] ) -AC_DEFUN(AC_CHECK_COMPILER_WNOFLAG, +AC_DEFUN([AC_CHECK_COMPILER_WNOFLAG], [ AC_MSG_CHECKING([whether $CC supports -Wno-$1]) OLD_CFLAGS="$CFLAGS" @@ -854,15 +855,18 @@ AC_CHECK_COMPILER_WFLAG(missing-include-dirs) AC_CHECK_COMPILER_WFLAG(suggest-attribute=noreturn) AC_CHECK_COMPILER_WFLAG(undef) #AC_CHECK_COMPILER_WFLAG(cast-align) -AC_CHECK_COMPILER_WFLAG(logical-op) +#AC_CHECK_COMPILER_WFLAG(logical-op) # some useless warnings AC_CHECK_COMPILER_WFLAG(nested-externs) AC_CHECK_COMPILER_WFLAG(old-style-definition) AC_CHECK_COMPILER_WFLAG(overlength-strings) AC_CHECK_COMPILER_WFLAG(redundant-decls) AC_CHECK_COMPILER_WFLAG(cast-qual) +AC_CHECK_COMPILER_WFLAG(misleading-indentation) +AC_CHECK_COMPILER_WFLAG(null-dereference) AC_CHECK_COMPILER_WNOFLAG(format-nonliteral) AC_CHECK_COMPILER_WNOFLAG(switch) AC_CHECK_COMPILER_WNOFLAG(missing-field-initializers) +AC_CHECK_COMPILER_WNOFLAG(suggest-attribute=format) # Certain versions of gcc make -Wshadow completely useless by making it flood # you with unnecessary warnings <https://lkml.org/lkml/2006/11/28/239> diff --git a/src/map/clif.c b/src/map/clif.c index 4ec58b6bc..1948eecea 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -9785,8 +9785,6 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data *sd) bool is_fakename = false; int outlen = 0; - nullpo_retv(sd); - packet = RP2PTR(fd); message = clif->process_chat_message(sd, packet, full_message, sizeof full_message); if (message == NULL) @@ -17801,7 +17799,6 @@ void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) { const struct packet_bgqueue_checkstate *p = RP2PTR(fd); - nullpo_retv(sd); if (sd->bg_queue.arena && sd->bg_queue.type) { clif->bgqueue_update_info(sd,sd->bg_queue.arena->id,bg->id2pos(sd->bg_queue.arena->queue_id,sd->status.account_id)); } else { diff --git a/src/map/script.c b/src/map/script.c index e869ddb62..181ff350f 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -10085,6 +10085,7 @@ int buildin_killmonsterall_sub_strip(struct block_list *bl,va_list ap) struct mob_data *md; md = BL_CAST(BL_MOB, bl); + nullpo_ret(md); if (md->npc_event[0]) md->npc_event[0] = 0; diff --git a/src/map/skill.c b/src/map/skill.c index d3cb8d0be..3004bf0e9 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -9280,7 +9280,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin improv_skill_lv = 4 + skill_lv; clif->skill_nodamage (src, bl, skill_id, skill_lv, 1); - if (sd == NULL) { + if (sd != NULL) { sd->state.abra_flag = 2; sd->skillitem = improv_skill_id; sd->skillitemlv = improv_skill_lv; diff --git a/src/map/status.c b/src/map/status.c index a8771c0a5..39bb25737 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -5576,9 +5576,9 @@ unsigned short status_calc_speed(struct block_list *bl, struct status_change *sc { int val = 0; - if( sd && sc->data[SC_HIDING] && pc->checkskill(sd,RG_TUNNELDRIVE) > 0 ) + if ( sd && sc->data[SC_HIDING] && pc->checkskill(sd,RG_TUNNELDRIVE) > 0 ) { val = 120 - 6 * pc->checkskill(sd,RG_TUNNELDRIVE); - else + } else { if( sd && sc->data[SC_CHASEWALK] && sc->data[SC_CHASEWALK]->val3 < 0 ) val = sc->data[SC_CHASEWALK]->val3; else @@ -5648,8 +5648,8 @@ unsigned short status_calc_speed(struct block_list *bl, struct status_change *sc if( sd && sd->bonus.speed_rate + sd->bonus.speed_add_rate > 0 ) // permanent item-based speedup val = max( val, sd->bonus.speed_rate + sd->bonus.speed_add_rate ); } - - speed_rate += val; + } + speed_rate += val; } //GetMoveHasteValue1() @@ -7495,8 +7495,9 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t if (tick == 1) return 1; //Minimal duration: Only strip without causing the SC break; case SC_NOEQUIPSHIELD: - if( val2 == 1 ) val2 = 0; //GX effect. Do not take shield off.. - else + if (val2 == 1) { + val2 = 0; //GX effect. Do not take shield off.. + } else { if (sd && !(flag&SCFLAG_LOADED)) { int i; if(sd->bonus.unstripable_equip&EQP_SHIELD) @@ -7506,8 +7507,10 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t return 0; pc->unequipitem(sd, i, PCUNEQUIPITEM_RECALC|PCUNEQUIPITEM_FORCE); } - if (tick == 1) return 1; //Minimal duration: Only strip without causing the SC - break; + } + if (tick == 1) + return 1; //Minimal duration: Only strip without causing the SC + break; case SC_NOEQUIPARMOR: if (sd && !(flag&SCFLAG_LOADED)) { int i; |