summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml257
-rwxr-xr-xconfigure90
-rw-r--r--configure.ac1
-rw-r--r--src/common/HPM.c5
-rw-r--r--src/map/atcommand.c6
-rw-r--r--src/map/clif.c2
-rw-r--r--src/map/itemdb.c136
-rw-r--r--src/map/itemdb.h12
-rw-r--r--src/map/log.c14
-rw-r--r--src/map/script.c4
-rw-r--r--src/map/skill.c2
-rw-r--r--src/map/status.c4
-rw-r--r--src/plugins/HPMHooking/HPMHooking.Defs.inc4
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc6
-rw-r--r--src/plugins/constdb2doc.c18
15 files changed, 389 insertions, 172 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 72dbcf1d2..438dbc267 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -35,7 +35,7 @@ variables: &base_vars
pre_re:clang-3.9:
<<: *branch_exceptions
<<: *prerequisites
- stage: primary
+ stage: secondary
image: debian:stretch
services:
- mariadb:10.1
@@ -50,7 +50,7 @@ pre_re:clang-3.9:
re:clang-3.9:
<<: *branch_exceptions
<<: *prerequisites
- stage: primary
+ stage: secondary
image: debian:stretch
services:
- mariadb:10.1
@@ -80,7 +80,7 @@ zero-2018:clang-3.9:
pre_re:clang-4.0:
<<: *branch_exceptions
<<: *prerequisites
- stage: secondary
+ stage: primary
image: debian:stretch
services:
- mariadb:10.1
@@ -95,7 +95,7 @@ pre_re:clang-4.0:
re:clang-4.0:
<<: *branch_exceptions
<<: *prerequisites
- stage: secondary
+ stage: primary
image: debian:stretch
services:
- mariadb:10.1
@@ -194,8 +194,8 @@ zero-2018:clang-5.0:
pre_re:clang-6.0:
<<: *branch_exceptions
<<: *prerequisites
- stage: primary
- image: debian:unstable
+ stage: secondary
+ image: debian:buster
services:
- mariadb:10
variables:
@@ -209,8 +209,8 @@ pre_re:clang-6.0:
re:clang-6.0:
<<: *branch_exceptions
<<: *prerequisites
- stage: primary
- image: debian:unstable
+ stage: secondary
+ image: debian:buster
services:
- mariadb:10
variables:
@@ -225,7 +225,7 @@ zero-2018:clang-6.0:
<<: *branch_exceptions
<<: *prerequisites
stage: clients
- image: debian:unstable
+ image: debian:buster
services:
- mariadb:10
variables:
@@ -239,8 +239,8 @@ zero-2018:clang-6.0:
pre_re:clang-7:
<<: *branch_exceptions
<<: *prerequisites
- stage: secondary
- image: debian:unstable
+ stage: primary
+ image: debian:buster
services:
- mariadb:10
variables:
@@ -254,8 +254,8 @@ pre_re:clang-7:
re:clang-7:
<<: *branch_exceptions
<<: *prerequisites
- stage: secondary
- image: debian:unstable
+ stage: primary
+ image: debian:buster
services:
- mariadb:10
variables:
@@ -270,7 +270,7 @@ zero-2018:clang-7:
<<: *branch_exceptions
<<: *prerequisites
stage: clients
- image: debian:unstable
+ image: debian:buster
services:
- mariadb:10
variables:
@@ -281,6 +281,51 @@ zero-2018:clang-7:
- ./tools/ci/travis.sh build CC=clang-7 --enable-debug --enable-Werror --enable-buildbot --enable-packetver-zero --enable-packetver=20180511
- ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
+pre_re:clang-8:
+ <<: *branch_exceptions
+ <<: *prerequisites
+ stage: secondary
+ image: debian:unstable
+ services:
+ - mariadb:10
+ variables:
+ <<: *base_vars
+ INSTALL_PACKAGES: clang-8 mariadb-client libmariadbclient-dev-compat
+ SQLHOST: mariadb
+ script:
+ - ./tools/ci/travis.sh build CC=clang-8 --enable-debug --enable-Werror --enable-buildbot --disable-renewal
+ - ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
+
+re:clang-8:
+ <<: *branch_exceptions
+ <<: *prerequisites
+ stage: secondary
+ image: debian:unstable
+ services:
+ - mariadb:10
+ variables:
+ <<: *base_vars
+ INSTALL_PACKAGES: clang-8 mariadb-client libmariadbclient-dev-compat
+ SQLHOST: mariadb
+ script:
+ - ./tools/ci/travis.sh build CC=clang-8 --enable-debug --enable-Werror --enable-buildbot
+ - ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
+
+zero-2018:clang-8:
+ <<: *branch_exceptions
+ <<: *prerequisites
+ stage: clients
+ image: debian:unstable
+ services:
+ - mariadb:10
+ variables:
+ <<: *base_vars
+ INSTALL_PACKAGES: clang-8 mariadb-client libmariadbclient-dev-compat
+ SQLHOST: mariadb
+ script:
+ - ./tools/ci/travis.sh build CC=clang-8 --enable-debug --enable-Werror --enable-buildbot --enable-packetver-zero --enable-packetver=20180511
+ - ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
+
pre_re:gcc-4.8:
<<: *branch_exceptions
<<: *prerequisites
@@ -329,7 +374,7 @@ zero-2018:gcc-4.8:
pre_re:gcc-4.9:
<<: *branch_exceptions
<<: *prerequisites
- stage: primary
+ stage: secondary
image: debian:jessie
services:
- mysql:5.5
@@ -344,7 +389,7 @@ pre_re:gcc-4.9:
re:gcc-4.9:
<<: *branch_exceptions
<<: *prerequisites
- stage: primary
+ stage: secondary
image: debian:jessie
services:
- mysql:5.5
@@ -420,7 +465,7 @@ pre_re:gcc-7:
<<: *branch_exceptions
<<: *prerequisites
stage: secondary
- image: debian:unstable
+ image: debian:buster
services:
- mariadb:10
variables:
@@ -435,7 +480,7 @@ re:gcc-7:
<<: *branch_exceptions
<<: *prerequisites
stage: secondary
- image: debian:unstable
+ image: debian:buster
services:
- mariadb:10
variables:
@@ -450,7 +495,7 @@ zero-2018:gcc-7:
<<: *branch_exceptions
<<: *prerequisites
stage: clients
- image: debian:unstable
+ image: debian:buster
services:
- mariadb:10
variables:
@@ -464,8 +509,8 @@ zero-2018:gcc-7:
pre_re:gcc-8:
<<: *branch_exceptions
<<: *prerequisites
- stage: secondary
- image: debian:unstable
+ stage: primary
+ image: debian:buster
services:
- mariadb:10
variables:
@@ -479,8 +524,8 @@ pre_re:gcc-8:
re:gcc-8:
<<: *branch_exceptions
<<: *prerequisites
- stage: secondary
- image: debian:unstable
+ stage: primary
+ image: debian:buster
services:
- mariadb:10
variables:
@@ -495,7 +540,7 @@ zero-2018:gcc-8:
<<: *branch_exceptions
<<: *prerequisites
stage: clients
- image: debian:unstable
+ image: debian:buster
services:
- mariadb:10
variables:
@@ -506,179 +551,179 @@ zero-2018:gcc-8:
- ./tools/ci/travis.sh build CC=gcc-8 --enable-debug --enable-Werror --enable-buildbot --enable-packetver-zero --enable-packetver=20180511
- ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
-pre_re:gcc-6_i386:
+pre_re:gcc-8_i386:
<<: *branch_exceptions
<<: *prerequisites
stage: primary
image: i386/debian:stable
services:
- - mariadb:10.1
+ - mariadb:10
variables:
<<: *base_vars
- INSTALL_PACKAGES: gcc-6 mariadb-client libmariadbclient-dev-compat
+ INSTALL_PACKAGES: gcc-8 mariadb-client libmariadbclient-dev-compat
SQLHOST: mariadb
script:
- - ./tools/ci/travis.sh build CC=gcc-6 --enable-debug --enable-Werror --enable-buildbot --disable-renewal
+ - ./tools/ci/travis.sh build CC=gcc-8 --enable-debug --enable-Werror --enable-buildbot --disable-renewal
- ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
-re:gcc-6_i386:
+re:gcc-8_i386:
<<: *branch_exceptions
<<: *prerequisites
stage: primary
image: i386/debian:stable
services:
- - mariadb:10.1
+ - mariadb:10
variables:
<<: *base_vars
- INSTALL_PACKAGES: gcc-6 mariadb-client libmariadbclient-dev-compat
+ INSTALL_PACKAGES: gcc-8 mariadb-client libmariadbclient-dev-compat
SQLHOST: mariadb
script:
- - ./tools/ci/travis.sh build CC=gcc-6 --enable-debug --enable-Werror --enable-buildbot
+ - ./tools/ci/travis.sh build CC=gcc-8 --enable-debug --enable-Werror --enable-buildbot
- ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
-zero-2018:gcc-6_i386:
+zero-2018:gcc-8_i386:
<<: *branch_exceptions
<<: *prerequisites
stage: clients
image: i386/debian:stable
services:
- - mariadb:10.1
+ - mariadb:10
variables:
<<: *base_vars
- INSTALL_PACKAGES: gcc-6 mariadb-client libmariadbclient-dev-compat
+ INSTALL_PACKAGES: gcc-8 mariadb-client libmariadbclient-dev-compat
SQLHOST: mariadb
script:
- - ./tools/ci/travis.sh build CC=gcc-6 --enable-debug --enable-Werror --enable-buildbot --enable-packetver-zero --enable-packetver=20180511
+ - ./tools/ci/travis.sh build CC=gcc-8 --enable-debug --enable-Werror --enable-buildbot --enable-packetver-zero --enable-packetver=20180511
- ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
-pre_re:gcc-6_sanitize:
+pre_re:gcc-8_sanitize:
<<: *branch_exceptions
<<: *prerequisites
stage: secondary
- image: debian:stretch
+ image: debian:stable
services:
- - mariadb:10.1
+ - mariadb:10
variables:
<<: *base_vars
- INSTALL_PACKAGES: gcc-6 mariadb-client libmariadbclient-dev-compat
+ INSTALL_PACKAGES: gcc-8 mariadb-client libmariadbclient-dev-compat
SQLHOST: mariadb
script:
- - ./tools/ci/travis.sh build CC=gcc-6 --enable-debug --enable-Werror --enable-buildbot --disable-renewal --disable-manager --enable-sanitize=full
+ - ./tools/ci/travis.sh build CC=gcc-8 --enable-debug --enable-Werror --enable-buildbot --disable-renewal --disable-manager --enable-sanitize=full
- ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
-re:gcc-6_sanitize:
+re:gcc-8_sanitize:
<<: *branch_exceptions
<<: *prerequisites
stage: secondary
- image: debian:stretch
+ image: debian:stable
services:
- - mariadb:10.1
+ - mariadb:10
variables:
<<: *base_vars
- INSTALL_PACKAGES: gcc-6 mariadb-client libmariadbclient-dev-compat
+ INSTALL_PACKAGES: gcc-8 mariadb-client libmariadbclient-dev-compat
SQLHOST: mariadb
script:
- - ./tools/ci/travis.sh build CC=gcc-6 --enable-debug --enable-Werror --enable-buildbot --disable-manager --enable-sanitize=full
+ - ./tools/ci/travis.sh build CC=gcc-8 --enable-debug --enable-Werror --enable-buildbot --disable-manager --enable-sanitize=full
- ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
-zero-2018:gcc-6_sanitize:
+zero-2018:gcc-8_sanitize:
<<: *branch_exceptions
<<: *prerequisites
stage: clients
- image: debian:stretch
+ image: debian:stable
services:
- - mariadb:10.1
+ - mariadb:10
variables:
<<: *base_vars
- INSTALL_PACKAGES: gcc-6 mariadb-client libmariadbclient-dev-compat
+ INSTALL_PACKAGES: gcc-8 mariadb-client libmariadbclient-dev-compat
SQLHOST: mariadb
script:
- - ./tools/ci/travis.sh build CC=gcc-6 --enable-debug --enable-Werror --enable-buildbot --disable-manager --enable-sanitize=full --enable-packetver-zero --enable-packetver=20180511
+ - ./tools/ci/travis.sh build CC=gcc-8 --enable-debug --enable-Werror --enable-buildbot --disable-manager --enable-sanitize=full --enable-packetver-zero --enable-packetver=20180511
- ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
-pre_re:gcc-6_i386_sanitize:
+pre_re:gcc-8_i386_sanitize:
<<: *branch_exceptions
<<: *prerequisites
stage: secondary
image: i386/debian:stable
services:
- - mariadb:10.1
+ - mariadb:10
variables:
<<: *base_vars
- INSTALL_PACKAGES: gcc-6 mariadb-client libmariadbclient-dev-compat
+ INSTALL_PACKAGES: gcc-8 mariadb-client libmariadbclient-dev-compat
SQLHOST: mariadb
script:
- - ./tools/ci/travis.sh build CC=gcc-6 --enable-debug --enable-Werror --enable-buildbot --disable-renewal --disable-manager --enable-sanitize=full
+ - ./tools/ci/travis.sh build CC=gcc-8 --enable-debug --enable-Werror --enable-buildbot --disable-renewal --disable-manager --enable-sanitize=full
- ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
-re:gcc-6_i386_sanitize:
+re:gcc-8_i386_sanitize:
<<: *branch_exceptions
<<: *prerequisites
stage: secondary
image: i386/debian:stable
services:
- - mariadb:10.1
+ - mariadb:10
variables:
<<: *base_vars
- INSTALL_PACKAGES: gcc-6 mariadb-client libmariadbclient-dev-compat
+ INSTALL_PACKAGES: gcc-8 mariadb-client libmariadbclient-dev-compat
SQLHOST: mariadb
script:
- - ./tools/ci/travis.sh build CC=gcc-6 --enable-debug --enable-Werror --enable-buildbot --disable-manager --enable-sanitize=full
+ - ./tools/ci/travis.sh build CC=gcc-8 --enable-debug --enable-Werror --enable-buildbot --disable-manager --enable-sanitize=full
- ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
-zero-2018:gcc-6_i386_sanitize:
+zero-2018:gcc-8_i386_sanitize:
<<: *branch_exceptions
<<: *prerequisites
stage: clients
image: i386/debian:stable
services:
- - mariadb:10.1
+ - mariadb:10
variables:
<<: *base_vars
- INSTALL_PACKAGES: gcc-6 mariadb-client libmariadbclient-dev-compat
+ INSTALL_PACKAGES: gcc-8 mariadb-client libmariadbclient-dev-compat
SQLHOST: mariadb
script:
- - ./tools/ci/travis.sh build CC=gcc-6 --enable-debug --enable-Werror --enable-buildbot --disable-manager --enable-sanitize=full --enable-packetver-zero --enable-packetver=20180511
+ - ./tools/ci/travis.sh build CC=gcc-8 --enable-debug --enable-Werror --enable-buildbot --disable-manager --enable-sanitize=full --enable-packetver-zero --enable-packetver=20180511
- ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
-pre_re:gcc-6_cov:
+pre_re:gcc-8_cov:
<<: *branch_exceptions
<<: *prerequisites
stage: secondary
- image: debian:stretch
+ image: debian:buster
services:
- - mariadb:10.1
+ - mariadb:10
variables:
<<: *base_vars
- INSTALL_PACKAGES: gcc-6 gcovr mariadb-client libmariadbclient-dev-compat
+ INSTALL_PACKAGES: gcc-8 gcovr mariadb-client libmariadbclient-dev-compat
SQLHOST: mariadb
script:
- - ./tools/ci/travis.sh build CC=gcc-6 --enable-debug --enable-Werror --enable-buildbot --disable-renewal CFLAGS="-coverage" LDFLAGS="-coverage"
+ - ./tools/ci/travis.sh build CC=gcc-8 --enable-debug --enable-Werror --enable-buildbot --disable-renewal CFLAGS="-coverage" LDFLAGS="-coverage"
- ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
- - gcovr -r . --gcov-executable=gcov-6 -o gcov_pre.txt
- - gcovr -r . --gcov-executable=gcov-6 --html -o gcov_pre.html
+ - gcovr -r . --gcov-executable=gcov-8 -o gcov_pre.txt
+ - gcovr -r . --gcov-executable=gcov-8 --html -o gcov_pre.html
- cat gcov_pre.txt
artifacts:
paths:
- gcov_pre.*
when: on_success
-re:gcc-6_cov:
+re:gcc-8_cov:
<<: *branch_exceptions
<<: *prerequisites
stage: secondary
- image: debian:stretch
+ image: debian:buster
services:
- - mariadb:10.1
+ - mariadb:10
variables:
<<: *base_vars
- INSTALL_PACKAGES: gcc-6 gcovr mariadb-client libmariadbclient-dev-compat
+ INSTALL_PACKAGES: gcc-8 gcovr mariadb-client libmariadbclient-dev-compat
SQLHOST: mariadb
script:
- - ./tools/ci/travis.sh build CC=gcc-6 --enable-debug --enable-Werror --enable-buildbot CFLAGS="-coverage" LDFLAGS="-coverage"
+ - ./tools/ci/travis.sh build CC=gcc-8 --enable-debug --enable-Werror --enable-buildbot CFLAGS="-coverage" LDFLAGS="-coverage"
- ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
- - gcovr -r . --gcov-executable=gcov-6 -o gcov_re.txt
- - gcovr -r . --gcov-executable=gcov-6 --html -o gcov_re.html
+ - gcovr -r . --gcov-executable=gcov-8 -o gcov_re.txt
+ - gcovr -r . --gcov-executable=gcov-8 --html -o gcov_re.html
- cat gcov_re.txt
artifacts:
paths:
@@ -693,11 +738,11 @@ pre_re:debian-oldstable:
stage: platforms
image: debian:oldstable
services:
- - mysql:5.5
+ - mariadb:10.1
variables:
<<: *base_vars
- INSTALL_PACKAGES: gcc mysql-client libmysqlclient-dev
- SQLHOST: mysql
+ INSTALL_PACKAGES: gcc mariadb-client libmariadbclient-dev-compat
+ SQLHOST: mariadb
script:
- ./tools/ci/travis.sh build --enable-debug --enable-Werror --enable-buildbot --disable-renewal
- ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
@@ -708,11 +753,11 @@ re:debian-oldstable:
stage: platforms
image: debian:oldstable
services:
- - mysql:5.5
+ - mariadb:10.1
variables:
<<: *base_vars
- INSTALL_PACKAGES: gcc mysql-client libmysqlclient-dev
- SQLHOST: mysql
+ INSTALL_PACKAGES: gcc mariadb-client libmariadbclient-dev-compat
+ SQLHOST: mariadb
script:
- ./tools/ci/travis.sh build --enable-debug --enable-Werror --enable-buildbot
- ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
@@ -723,7 +768,7 @@ pre_re:debian-stable:
stage: platforms
image: debian:stable
services:
- - mariadb:10.1
+ - mariadb:10.3
variables:
<<: *base_vars
INSTALL_PACKAGES: gcc mariadb-client libmariadbclient-dev-compat
@@ -738,7 +783,7 @@ re:debian-stable:
stage: platforms
image: debian:stable
services:
- - mariadb:10.1
+ - mariadb:10.3
variables:
<<: *base_vars
INSTALL_PACKAGES: gcc mariadb-client libmariadbclient-dev-compat
@@ -753,7 +798,7 @@ pre_re:debian-testing:
stage: platforms
image: debian:testing
services:
- - mariadb:10.1
+ - mariadb:10.3
variables:
<<: *base_vars
INSTALL_PACKAGES: gcc mariadb-client libmariadbclient-dev-compat
@@ -768,7 +813,7 @@ re:debian-testing:
stage: platforms
image: debian:testing
services:
- - mariadb:10.1
+ - mariadb:10.3
variables:
<<: *base_vars
INSTALL_PACKAGES: gcc mariadb-client libmariadbclient-dev-compat
@@ -1045,7 +1090,7 @@ pre_re:mariadb-10.1:
<<: *branch_exceptions
<<: *prerequisites
stage: platforms
- image: debian:stable
+ image: debian:stretch
services:
- mariadb:10.1
variables:
@@ -1060,7 +1105,7 @@ re:mariadb-10.1:
<<: *branch_exceptions
<<: *prerequisites
stage: platforms
- image: debian:stable
+ image: debian:stretch
services:
- mariadb:10.1
variables:
@@ -1071,6 +1116,36 @@ re:mariadb-10.1:
- ./tools/ci/travis.sh build --enable-debug --enable-Werror --enable-buildbot
- ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
+pre_re:mariadb-10.3:
+ <<: *branch_exceptions
+ <<: *prerequisites
+ stage: platforms
+ image: debian:buster
+ services:
+ - mariadb:10.3
+ variables:
+ <<: *base_vars
+ INSTALL_PACKAGES: gcc mariadb-client-10.3 libmariadbclient-dev-compat
+ SQLHOST: mariadb
+ script:
+ - ./tools/ci/travis.sh build --enable-debug --enable-Werror --enable-buildbot --disable-renewal
+ - ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
+
+re:mariadb-10.3:
+ <<: *branch_exceptions
+ <<: *prerequisites
+ stage: platforms
+ image: debian:buster
+ services:
+ - mariadb:10.3
+ variables:
+ <<: *base_vars
+ INSTALL_PACKAGES: gcc mariadb-client-10.3 libmariadbclient-dev-compat
+ SQLHOST: mariadb
+ script:
+ - ./tools/ci/travis.sh build --enable-debug --enable-Werror --enable-buildbot
+ - ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
+
pre_re:mariadb-latest:
<<: *branch_exceptions
<<: *prerequisites
@@ -1150,8 +1225,8 @@ pages:
- mv gcov_*.* public/
- cp tools/doxygen/pages_index.html public/index.html
dependencies:
- - re:gcc-6_cov
- - pre_re:gcc-6_cov
+ - re:gcc-8_cov
+ - pre_re:gcc-8_cov
artifacts:
paths:
- public
diff --git a/configure b/configure
index 65e716b09..957398296 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.ac 20c3ecff9.
+# From configure.ac 76896e850.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69.
#
@@ -7986,6 +7986,94 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-array-bounds" >&5
+$as_echo_n "checking whether $CC supports -Wno-array-bounds... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror -Wno-array-bounds"
+ 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 -Warray-bounds"
+ 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-array-bounds"
+ # Optionally, run a test
+ if test "x" != "x"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wno-array-bounds" >&5
+$as_echo_n "checking whether $CC can actually use -Wno-array-bounds... " >&6; }
+ CFLAGS="$OLD_CFLAGS -Werror -Warray-bounds"
+ 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-array-bounds"
+ 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-array-bounds"
+
+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.ac b/configure.ac
index ec9e35cfe..cbb9a5c46 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1090,6 +1090,7 @@ 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)
+AC_CHECK_COMPILER_WNOFLAG(array-bounds)
# 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/common/HPM.c b/src/common/HPM.c
index a579a0926..479135767 100644
--- a/src/common/HPM.c
+++ b/src/common/HPM.c
@@ -458,11 +458,12 @@ static bool hplugins_addconf(unsigned int pluginID, enum HPluginConfType type, c
static struct hplugin *hplugin_load(const char *filename)
{
+ typedef void *(ImportSymbolFunc)(char *, unsigned int);
struct hplugin *plugin;
struct hplugin_info *info;
struct HPMi_interface **HPMi;
bool anyEvent = false;
- void **import_symbol_ref;
+ ImportSymbolFunc **import_symbol_ref;
int *HPMDataCheckVer;
unsigned int *HPMDataCheckLen;
struct s_HPMDataCheck *HPMDataCheck;
@@ -499,7 +500,7 @@ static struct hplugin *hplugin_load(const char *filename)
plugin->info = info;
plugin->filename = aStrdup(filename);
- if( !( import_symbol_ref = plugin_import(plugin->dll, "import_symbol",void **) ) ) {
+ if ((import_symbol_ref = plugin_import(plugin->dll, "import_symbol", ImportSymbolFunc **)) == NULL) {
ShowFatalError("HPM:plugin_load: failed to retrieve 'import_symbol' for '"CL_WHITE"%s"CL_RESET"'!\n", filename);
exit(EXIT_FAILURE);
}
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 968a4282a..145a5c95d 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -3559,7 +3559,7 @@ ACMD(idsearch)
safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,77), item_name); // Search results for '%s' (name: id):
clif->message(fd, atcmd_output);
- match = itemdb->search_name_array(item_array, MAX_SEARCH, item_name, 0);
+ match = itemdb->search_name_array(item_array, MAX_SEARCH, item_name, IT_SEARCH_NAME_PARTIAL);
if (match > MAX_SEARCH) {
safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,269), MAX_SEARCH, match);
clif->message(fd, atcmd_output);
@@ -7453,7 +7453,7 @@ ACMD(iteminfo)
return false;
}
if ((item_array[0] = itemdb->exists(atoi(message))) == NULL)
- count = itemdb->search_name_array(item_array, MAX_SEARCH, message, 0);
+ count = itemdb->search_name_array(item_array, MAX_SEARCH, message, IT_SEARCH_NAME_PARTIAL);
if (!count) {
clif->message(fd, msg_fd(fd,19)); // Invalid item ID or name.
@@ -7504,7 +7504,7 @@ ACMD(whodrops)
return false;
}
if ((item_array[0] = itemdb->exists(atoi(message))) == NULL)
- count = itemdb->search_name_array(item_array, MAX_SEARCH, message, 0);
+ count = itemdb->search_name_array(item_array, MAX_SEARCH, message, IT_SEARCH_NAME_PARTIAL);
if (!count) {
clif->message(fd, msg_fd(fd,19)); // Invalid item ID or name.
diff --git a/src/map/clif.c b/src/map/clif.c
index f8abb36a0..f6caa502e 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -15323,7 +15323,7 @@ static void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd)
safestrncpy(item_monster_name, p->str, sizeof(item_monster_name));
- if ( (count=itemdb->search_name_array(item_array, 10, item_monster_name, 1)) > 0 ) {
+ if ( (count=itemdb->search_name_array(item_array, 10, item_monster_name, IT_SEARCH_NAME_EXACT)) > 0 ) {
for(i = 0; i < count; i++) {
if( !item_array[i] )
continue;
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 375bd18f1..a97325e57 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -117,73 +117,105 @@ static struct item_data *itemdb_name2id(const char *str)
*/
static int itemdb_searchname_array_sub(union DBKey key, struct DBData data, va_list ap)
{
- struct item_data *item = DB->data2ptr(&data);
- char *str;
- str=va_arg(ap,char *);
+ struct item_data *itd = DB->data2ptr(&data);
+ const char *str = va_arg(ap, const char *);
+ enum item_name_search_flag flag = va_arg(ap, enum item_name_search_flag);
+
nullpo_ret(str);
- if (item == &itemdb->dummy)
+
+ if (itd == &itemdb->dummy)
return 1; //Invalid item.
- if(stristr(item->jname,str))
- return 0;
- if(battle_config.case_sensitive_aegisnames && strstr(item->name,str))
- return 0;
- if(!battle_config.case_sensitive_aegisnames && stristr(item->name,str))
+
+ if (
+ (flag == IT_SEARCH_NAME_PARTIAL
+ && (stristr(itd->jname, str) != NULL
+ || (battle_config.case_sensitive_aegisnames && strstr(itd->name, str))
+ || (!battle_config.case_sensitive_aegisnames && stristr(itd->name, str))
+ ))
+ || (flag == IT_SEARCH_NAME_EXACT
+ && (strcmp(itd->jname, str) == 0
+ || (battle_config.case_sensitive_aegisnames && strcmp(itd->name, str) == 0)
+ || (!battle_config.case_sensitive_aegisnames && strcasecmp(itd->name, str) == 0)
+ ))
+ ) {
+
return 0;
- return strcmpi(item->jname,str);
+ } else {
+ return 1;
+ }
}
-/*==========================================
- * Founds up to N matches. Returns number of matches [Skotlex]
- * search flag :
- * 0 - approximate match
- * 1 - exact match
- *------------------------------------------*/
-static int itemdb_searchname_array(struct item_data **data, int size, const char *str, int flag)
+/**
+ * Finds up to passed size matches
+ * @param data array of struct item_data for returning the results in
+ * @param size size of the array
+ * @param str string used in this search
+ * @param flag search mode refer to enum item_name_search_flag for possible values
+ * @return returns all found matches in the database which could be bigger than size
+ **/
+static int itemdb_searchname_array(struct item_data **data, const int size, const char *str, enum item_name_search_flag flag)
{
- struct item_data* item;
- int i;
- int count=0;
-
nullpo_ret(data);
nullpo_ret(str);
- // Search in the array
- for( i = 0; i < ARRAYLENGTH(itemdb->array); ++i )
- {
- item = itemdb->array[i];
- if( item == NULL )
+ Assert_ret(flag >= IT_SEARCH_NAME_PARTIAL && flag < IT_SEARCH_NAME_MAX);
+ Assert_ret(size > 0);
+
+ int
+ results_count = 0,
+ length = 0;
+
+ // Search in array
+ for (int i = 0; i < ARRAYLENGTH(itemdb->array); ++i) {
+ struct item_data *itd = itemdb->array[i];
+
+ if (itd == NULL)
continue;
- if(
- (!flag
- && (stristr(item->jname,str)
- || (battle_config.case_sensitive_aegisnames && strstr(item->name,str))
- || (!battle_config.case_sensitive_aegisnames && stristr(item->name,str))
- ))
- || (flag
- && (strcmp(item->jname,str) == 0
- || (battle_config.case_sensitive_aegisnames && strcmp(item->name,str) == 0)
- || (!battle_config.case_sensitive_aegisnames && strcasecmp(item->name,str) == 0)
- ))
- ) {
- if( count < size )
- data[count] = item;
- ++count;
+ if (
+ (flag == IT_SEARCH_NAME_PARTIAL
+ && (stristr(itd->jname, str) != NULL
+ || (battle_config.case_sensitive_aegisnames && strstr(itd->name, str))
+ || (!battle_config.case_sensitive_aegisnames && stristr(itd->name, str))
+ ))
+ || (flag == IT_SEARCH_NAME_EXACT
+ && (strcmp(itd->jname, str) == 0
+ || (battle_config.case_sensitive_aegisnames && strcmp(itd->name, str) == 0)
+ || (!battle_config.case_sensitive_aegisnames && strcasecmp(itd->name, str) == 0)
+ ))
+ ) {
+ if (length < size) {
+ data[length] = itd;
+ ++length;
+ }
+
+ ++results_count;
}
}
- // search in the db
- if( count < size )
- {
- struct DBData *db_data[MAX_SEARCH];
- int db_count = 0;
- size -= count;
- db_count = itemdb->other->getall(itemdb->other, (struct DBData**)&db_data, size, itemdb->searchname_array_sub, str);
- for (i = 0; i < db_count; i++)
- data[count++] = DB->data2ptr(db_data[i]);
- count += db_count;
+ // Search in dbmap
+ int dbmap_size = size - length;
+ if (dbmap_size > 0) {
+ struct DBData **dbmap_data = NULL;
+ int dbmap_count = 0;
+ CREATE(dbmap_data, struct DBData *, dbmap_size);
+
+ dbmap_count = itemdb->other->getall(itemdb->other, dbmap_data, dbmap_size, itemdb->searchname_array_sub, str, flag);
+ dbmap_size = min(dbmap_count, dbmap_size);
+
+ for (int i = 0; i < dbmap_size; ++i) {
+ data[length] = DB->data2ptr(dbmap_data[i]);
+ ++length;
+ }
+
+ results_count += dbmap_count;
+ aFree(dbmap_data);
+ } else { // We got all matches we can return, so we only need to count now.
+ results_count += itemdb->other->getall(itemdb->other, NULL, 0, itemdb->searchname_array_sub, str, flag);
}
- return count;
+
+ return results_count;
}
+
/* [Ind/Hercules] */
static int itemdb_chain_item(unsigned short chain_id, int *rate)
{
diff --git a/src/map/itemdb.h b/src/map/itemdb.h
index a2876c2a9..14ead7707 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -412,6 +412,16 @@ enum ItemOptionTypes {
IT_OPT_MAX
};
+/**
+ * Item name search flags
+ **/
+
+enum item_name_search_flag {
+ IT_SEARCH_NAME_PARTIAL,
+ IT_SEARCH_NAME_EXACT,
+ IT_SEARCH_NAME_MAX,
+};
+
/** Convenience item list (entry) used in various functions */
struct itemlist_entry {
int id; ///< Item ID or (inventory) index
@@ -644,7 +654,7 @@ struct itemdb_interface {
/* */
struct item_data* (*name2id) (const char *str);
struct item_data* (*search_name) (const char *name);
- int (*search_name_array) (struct item_data** data, int size, const char *str, int flag);
+ int (*search_name_array) (struct item_data **data, const int size, const char *str, enum item_name_search_flag flag);
struct item_data* (*load)(int nameid);
struct item_data* (*search)(int nameid);
struct item_data* (*exists) (int nameid);
diff --git a/src/map/log.c b/src/map/log.c
index 5bbca02a9..aa2f5f8f3 100644
--- a/src/map/log.c
+++ b/src/map/log.c
@@ -511,7 +511,7 @@ static void log_sql_final(void)
/**
* Initializes logs->config variables
*/
-void log_set_defaults(void)
+static void log_set_defaults(void)
{
memset(&logs->config, 0, sizeof(logs->config));
@@ -540,7 +540,7 @@ void log_set_defaults(void)
*
* @retval false in case of error.
*/
-bool log_config_read_database(const char *filename, struct config_t *config, bool imported)
+static bool log_config_read_database(const char *filename, struct config_t *config, bool imported)
{
struct config_setting_t *setting = NULL;
@@ -596,7 +596,7 @@ bool log_config_read_database(const char *filename, struct config_t *config, boo
*
* @retval false in case of error.
*/
-bool log_config_read_filter_item(const char *filename, struct config_t *config, bool imported)
+static bool log_config_read_filter_item(const char *filename, struct config_t *config, bool imported)
{
struct config_setting_t *setting = NULL;
@@ -625,7 +625,7 @@ bool log_config_read_filter_item(const char *filename, struct config_t *config,
*
* @retval false in case of error.
*/
-bool log_config_read_filter_chat(const char *filename, struct config_t *config, bool imported)
+static bool log_config_read_filter_chat(const char *filename, struct config_t *config, bool imported)
{
struct config_setting_t *setting = NULL;
@@ -651,7 +651,7 @@ bool log_config_read_filter_chat(const char *filename, struct config_t *config,
*
* @retval false in case of error.
*/
-bool log_config_read_filter(const char *filename, struct config_t *config, bool imported)
+static bool log_config_read_filter(const char *filename, struct config_t *config, bool imported)
{
bool retval = true;
@@ -674,7 +674,7 @@ bool log_config_read_filter(const char *filename, struct config_t *config, bool
*
* @retval false in case of error.
*/
-bool log_config_read(const char *filename, bool imported)
+static bool log_config_read(const char *filename, bool imported)
{
struct config_t config;
struct config_setting_t *setting = NULL;
@@ -755,7 +755,7 @@ bool log_config_read(const char *filename, bool imported)
return retval;
}
-void log_config_complete(void)
+static void log_config_complete(void)
{
if( logs->config.sql_logs ) {
logs->pick_sub = log_pick_sub_sql;
diff --git a/src/map/script.c b/src/map/script.c
index 9a9b46615..0fe97574c 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -105,7 +105,7 @@ static inline void SETVALUE(struct script_buf *buf, int i, int n)
VECTOR_INDEX(*buf, i+2) = GetByte(n, 2);
}
-const char *script_op2name(int op)
+static const char *script_op2name(int op)
{
#define RETURN_OP_NAME(type) case type: return #type
switch( op ) {
@@ -18804,7 +18804,7 @@ static BUILDIN(searchitem)
if ((items[0] = itemdb->exists(atoi(itemname)))) {
count = 1;
} else {
- count = itemdb->search_name_array(items, ARRAYLENGTH(items), itemname, 0);
+ count = itemdb->search_name_array(items, ARRAYLENGTH(items), itemname, IT_SEARCH_NAME_PARTIAL);
if (count > MAX_SEARCH) count = MAX_SEARCH;
}
diff --git a/src/map/skill.c b/src/map/skill.c
index 4b6ab7d0d..ad27ef0e3 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -82,7 +82,7 @@
#endif
static struct skill_interface skill_s;
-struct s_skill_dbs skilldbs;
+static struct s_skill_dbs skilldbs;
struct skill_interface *skill;
diff --git a/src/map/status.c b/src/map/status.c
index ba32b267e..71cce28c5 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -11808,10 +11808,10 @@ static int status_change_timer(int tid, int64 tick, int id, intptr_t data)
case SC_SPLASHER:
#if 0 // custom Venom Splasher countdown timer
- if (sce->val4 % 1000 == 0) {
+ if (sce->val4 % 1000 == 0 && bl && bl->type == BL_PC) {
char counter[10];
snprintf (counter, 10, "%d", sce->val4/1000);
- clif->message(bl, counter);
+ clif->message(BL_UCCAST(BL_PC, bl)->fd, counter);
}
#endif // 0
if((sce->val4 -= 500) > 0) {
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc
index 8c2f3b7a3..7e81d48de 100644
--- a/src/plugins/HPMHooking/HPMHooking.Defs.inc
+++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc
@@ -3990,8 +3990,8 @@ typedef struct item_data* (*HPMHOOK_pre_itemdb_name2id) (const char **str);
typedef struct item_data* (*HPMHOOK_post_itemdb_name2id) (struct item_data* retVal___, const char *str);
typedef struct item_data* (*HPMHOOK_pre_itemdb_search_name) (const char **name);
typedef struct item_data* (*HPMHOOK_post_itemdb_search_name) (struct item_data* retVal___, const char *name);
-typedef int (*HPMHOOK_pre_itemdb_search_name_array) (struct item_data ***data, int *size, const char **str, int *flag);
-typedef int (*HPMHOOK_post_itemdb_search_name_array) (int retVal___, struct item_data **data, int size, const char *str, int flag);
+typedef int (*HPMHOOK_pre_itemdb_search_name_array) (struct item_data ***data, const int *size, const char **str, enum item_name_search_flag *flag);
+typedef int (*HPMHOOK_post_itemdb_search_name_array) (int retVal___, struct item_data **data, const int size, const char *str, enum item_name_search_flag flag);
typedef struct item_data* (*HPMHOOK_pre_itemdb_load) (int *nameid);
typedef struct item_data* (*HPMHOOK_post_itemdb_load) (struct item_data* retVal___, int nameid);
typedef struct item_data* (*HPMHOOK_pre_itemdb_search) (int *nameid);
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index e519887c9..1817b0660 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -41595,11 +41595,11 @@ struct item_data* HP_itemdb_search_name(const char *name) {
}
return retVal___;
}
-int HP_itemdb_search_name_array(struct item_data **data, int size, const char *str, int flag) {
+int HP_itemdb_search_name_array(struct item_data **data, const int size, const char *str, enum item_name_search_flag flag) {
int hIndex = 0;
int retVal___ = 0;
if (HPMHooks.count.HP_itemdb_search_name_array_pre > 0) {
- int (*preHookFunc) (struct item_data ***data, int *size, const char **str, int *flag);
+ int (*preHookFunc) (struct item_data ***data, const int *size, const char **str, enum item_name_search_flag *flag);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_search_name_array_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_itemdb_search_name_array_pre[hIndex].func;
@@ -41614,7 +41614,7 @@ int HP_itemdb_search_name_array(struct item_data **data, int size, const char *s
retVal___ = HPMHooks.source.itemdb.search_name_array(data, size, str, flag);
}
if (HPMHooks.count.HP_itemdb_search_name_array_post > 0) {
- int (*postHookFunc) (int retVal___, struct item_data **data, int size, const char *str, int flag);
+ int (*postHookFunc) (int retVal___, struct item_data **data, const int size, const char *str, enum item_name_search_flag flag);
for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_search_name_array_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_itemdb_search_name_array_post[hIndex].func;
retVal___ = postHookFunc(retVal___, data, size, str, flag);
diff --git a/src/plugins/constdb2doc.c b/src/plugins/constdb2doc.c
index 3f681ea1a..ebaf7a833 100644
--- a/src/plugins/constdb2doc.c
+++ b/src/plugins/constdb2doc.c
@@ -22,7 +22,8 @@
/// db/constants.conf -> doc/constants.md generator plugin
#include "common/hercules.h"
-//#include "common/memmgr.h"
+#include "common/db.h"
+#include "common/memmgr.h"
#include "common/nullpo.h"
#include "common/strlib.h"
#include "map/itemdb.h"
@@ -143,17 +144,26 @@ struct item_data *constdb2doc_itemdb_search(int nameid)
void constdb2doc_itemdb(void)
{
- int i;
-
nullpo_retv(out_fp);
fprintf(out_fp, "## Items (db/"DBPATH"item_db.conf)\n");
- for (i = 0; i < ARRAYLENGTH(itemdb->array); i++) {
+ for (int i = 0; i < ARRAYLENGTH(itemdb->array); i++) {
struct item_data *id = constdb2doc_itemdb_search(i);
if (id == NULL || id->name[0] == '\0')
continue;
fprintf(out_fp, "- `%s`: %d\n", id->name, id->nameid);
}
+
+ if (db_size(itemdb->other) > 0) {
+ struct DBIterator *iter = db_iterator(itemdb->other);
+ for (struct item_data *itd = dbi_first(iter); dbi_exists(iter); itd = dbi_next(iter)) {
+ if (itd == &itemdb->dummy)
+ continue;
+ fprintf(out_fp, "- `%s`: %d\n", itd->name, itd->nameid);
+ }
+ dbi_destroy(iter);
+ }
+
fprintf(out_fp, "\n");
}