summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-02-20 15:59:58 +0100
committerHaru <haru@dotalux.com>2016-02-20 15:59:58 +0100
commit71968e6985a2d6798505b84bc7ed22f5c6bfcfac (patch)
tree4740ae636d410980f379cc4bb3a969b49451c7c7
parent5b74faa8afd04771af7acb918072ea71a3db475f (diff)
parentb7f772294594c40ef1e18f9c044e5c4fe6b490f4 (diff)
downloadhercules-71968e6985a2d6798505b84bc7ed22f5c6bfcfac.tar.gz
hercules-71968e6985a2d6798505b84bc7ed22f5c6bfcfac.tar.bz2
hercules-71968e6985a2d6798505b84bc7ed22f5c6bfcfac.tar.xz
hercules-71968e6985a2d6798505b84bc7ed22f5c6bfcfac.zip
Merge pull request #1162 from 4144/flags
Add some compiler warning flags and fix new warnings
-rw-r--r--3rdparty/libconfig/libconfig.c6
-rw-r--r--3rdparty/mysql/include/my_global.h2
-rwxr-xr-xconfigure755
-rw-r--r--configure.in33
-rw-r--r--src/char/char.c24
-rw-r--r--src/char/geoip.c2
-rw-r--r--src/char/int_auction.c4
-rw-r--r--src/char/int_elemental.c4
-rw-r--r--src/char/int_guild.c14
-rw-r--r--src/char/int_homun.c6
-rw-r--r--src/char/int_mail.c2
-rw-r--r--src/char/int_quest.c4
-rw-r--r--src/char/int_storage.c4
-rw-r--r--src/char/inter.h2
-rw-r--r--src/char/loginif.c1
-rw-r--r--src/common/HPM.c12
-rw-r--r--src/common/ers.c6
-rw-r--r--src/common/md5calc.c6
-rw-r--r--src/common/memmgr.c4
-rw-r--r--src/common/showmsg.c2
-rw-r--r--src/common/socket.c18
-rw-r--r--src/common/socket.h10
-rw-r--r--src/common/sql.c6
-rw-r--r--src/login/account_sql.c2
-rw-r--r--src/login/ipban_sql.c2
-rw-r--r--src/login/login.c10
-rw-r--r--src/login/loginlog_sql.c2
-rw-r--r--src/map/atcommand.c38
-rw-r--r--src/map/battle.c4
-rw-r--r--src/map/battleground.c13
-rw-r--r--src/map/battleground.h2
-rw-r--r--src/map/channel.c2
-rw-r--r--src/map/chrif.c12
-rw-r--r--src/map/clif.c28
-rw-r--r--src/map/instance.c4
-rw-r--r--src/map/intif.c30
-rw-r--r--src/map/itemdb.c12
-rw-r--r--src/map/log.c4
-rw-r--r--src/map/map.c2
-rw-r--r--src/map/mapreg_sql.c8
-rw-r--r--src/map/mob.c4
-rw-r--r--src/map/npc.c14
-rw-r--r--src/map/pc.c12
-rw-r--r--src/map/pc_groups.c4
-rw-r--r--src/map/quest.c2
-rw-r--r--src/map/script.c130
-rw-r--r--src/map/skill.c8
-rw-r--r--src/map/status.c2
-rw-r--r--src/map/storage.c4
-rw-r--r--src/map/unit.c4
-rw-r--r--src/map/vending.c14
-rw-r--r--src/plugins/db2sql.c66
-rw-r--r--src/plugins/sample.c8
53 files changed, 1079 insertions, 295 deletions
diff --git a/3rdparty/libconfig/libconfig.c b/3rdparty/libconfig/libconfig.c
index 0942241c2..696f5fc08 100644
--- a/3rdparty/libconfig/libconfig.c
+++ b/3rdparty/libconfig/libconfig.c
@@ -192,7 +192,7 @@ static void __config_write_value(const struct config_t *config,
switch(format)
{
case CONFIG_FORMAT_HEX:
- fprintf(stream, "0x%X", value->ival);
+ fprintf(stream, "0x%X", (unsigned int)(value->ival));
break;
case CONFIG_FORMAT_DEFAULT:
@@ -207,7 +207,7 @@ static void __config_write_value(const struct config_t *config,
switch(format)
{
case CONFIG_FORMAT_HEX:
- fprintf(stream, "0x" INT64_HEX_FMT "L", value->llval);
+ fprintf(stream, "0x" INT64_HEX_FMT "L", (unsigned long long)(value->llval));
break;
case CONFIG_FORMAT_DEFAULT:
@@ -291,7 +291,7 @@ static void __config_write_value(const struct config_t *config,
if(c >= ' ')
fputc(c, stream);
else
- fprintf(stream, "\\x%02X", c);
+ fprintf(stream, "\\x%02X", (unsigned int)(c));
}
}
}
diff --git a/3rdparty/mysql/include/my_global.h b/3rdparty/mysql/include/my_global.h
index 2417477e2..8e4287c19 100644
--- a/3rdparty/mysql/include/my_global.h
+++ b/3rdparty/mysql/include/my_global.h
@@ -93,7 +93,7 @@
#define NETWARE_SET_SCREEN_MODE(A)
#endif
-#include "../common/strlib.h"
+#include "common/strlib.h"
/*
The macros below are borrowed from include/linux/compiler.h in the
diff --git a/configure b/configure
index d558217c6..56938baf9 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.in 8ca4506.
+# From configure.in 9bd03cf.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69.
#
@@ -4567,6 +4567,24 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+# -Wcast-qual use for check wrong casts. It cant be added by default, because some casts must be wrong.
+# -Wconversion warning: conversion to 'long unsigned int' from 'int' may change the sign of the result
+# -Wfloat-equal comparing floating point with == or != is unsafe
+# -Wunsuffixed-float-constants float issues
+# -Wpedantic different pedantic checks. Not all can be fixed in nice way.
+# -Wtraditional-conversion some conversion issues
+# -Wunsafe-loop-optimizations possible optimisation issues
+# -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
+# attributes suggestion
+# -Wsuggest-attribute=const -Wsuggest-attribute=format -Wsuggest-attribute=pure
+
+# flags what can be used but now return no warnings:
+# -Wchkp -Wdisabled-optimization
+# -Werror-implicit-function-declaration -Wtrampolines
+# -Wjump-misses-init
+
CFLAGS="$CFLAGS -pipe -ffast-math -Wall -Wextra -Wno-sign-compare"
CPPFLAGS="$CPPFLAGS -I../common"
LDFLAGS="$LDFLAGS"
@@ -6208,6 +6226,153 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Winit-self" >&5
+$as_echo_n "checking whether $CC supports -Winit-self... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror -Winit-self"
+ 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 -Winit-self"
+ # Optionally, run a test
+ if test "x" != "x"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Winit-self" >&5
+$as_echo_n "checking whether $CC can actually use -Winit-self... " >&6; }
+ CFLAGS="$OLD_CFLAGS -Werror -Winit-self"
+ 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 -Winit-self"
+
+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 -Wpointer-arith" >&5
+$as_echo_n "checking whether $CC supports -Wpointer-arith... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror -Wpointer-arith"
+ 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 -Wpointer-arith"
+ # Optionally, run a test
+ if test "x" != "x"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wpointer-arith" >&5
+$as_echo_n "checking whether $CC can actually use -Wpointer-arith... " >&6; }
+ CFLAGS="$OLD_CFLAGS -Werror -Wpointer-arith"
+ 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 -Wpointer-arith"
+
+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 -Wswitch-bool" >&5
+$as_echo_n "checking whether $CC supports -Wswitch-bool... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror -Wswitch-bool"
+ 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 -Wswitch-bool"
+ # Optionally, run a test
+ if test "x" != "x"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wswitch-bool" >&5
+$as_echo_n "checking whether $CC can actually use -Wswitch-bool... " >&6; }
+ CFLAGS="$OLD_CFLAGS -Werror -Wswitch-bool"
+ 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 -Wswitch-bool"
+
+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 -Wenum-conversion" >&5
$as_echo_n "checking whether $CC supports -Wenum-conversion... " >&6; }
OLD_CFLAGS="$CFLAGS"
@@ -6453,6 +6618,594 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wformat" >&5
+$as_echo_n "checking whether $CC supports -Wformat... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror -Wformat"
+ 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 -Wformat"
+ # Optionally, run a test
+ if test "x" != "x"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wformat" >&5
+$as_echo_n "checking whether $CC can actually use -Wformat... " >&6; }
+ CFLAGS="$OLD_CFLAGS -Werror -Wformat"
+ 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 -Wformat"
+
+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 -Wformat-signedness" >&5
+$as_echo_n "checking whether $CC supports -Wformat-signedness... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror -Wformat-signedness"
+ 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 -Wformat-signedness"
+ # Optionally, run a test
+ if test "x" != "x"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wformat-signedness" >&5
+$as_echo_n "checking whether $CC can actually use -Wformat-signedness... " >&6; }
+ CFLAGS="$OLD_CFLAGS -Werror -Wformat-signedness"
+ 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 -Wformat-signedness"
+
+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 -Wformat-y2k" >&5
+$as_echo_n "checking whether $CC supports -Wformat-y2k... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror -Wformat-y2k"
+ 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 -Wformat-y2k"
+ # Optionally, run a test
+ if test "x" != "x"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wformat-y2k" >&5
+$as_echo_n "checking whether $CC can actually use -Wformat-y2k... " >&6; }
+ CFLAGS="$OLD_CFLAGS -Werror -Wformat-y2k"
+ 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 -Wformat-y2k"
+
+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 -Wmissing-include-dirs" >&5
+$as_echo_n "checking whether $CC supports -Wmissing-include-dirs... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror -Wmissing-include-dirs"
+ 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 -Wmissing-include-dirs"
+ # Optionally, run a test
+ if test "x" != "x"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wmissing-include-dirs" >&5
+$as_echo_n "checking whether $CC can actually use -Wmissing-include-dirs... " >&6; }
+ CFLAGS="$OLD_CFLAGS -Werror -Wmissing-include-dirs"
+ 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 -Wmissing-include-dirs"
+
+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 -Wsuggest-attribute=noreturn" >&5
+$as_echo_n "checking whether $CC supports -Wsuggest-attribute=noreturn... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror -Wsuggest-attribute=noreturn"
+ 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 -Wsuggest-attribute=noreturn"
+ # Optionally, run a test
+ if test "x" != "x"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wsuggest-attribute=noreturn" >&5
+$as_echo_n "checking whether $CC can actually use -Wsuggest-attribute=noreturn... " >&6; }
+ CFLAGS="$OLD_CFLAGS -Werror -Wsuggest-attribute=noreturn"
+ 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 -Wsuggest-attribute=noreturn"
+
+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 -Wundef" >&5
+$as_echo_n "checking whether $CC supports -Wundef... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror -Wundef"
+ 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 -Wundef"
+ # Optionally, run a test
+ if test "x" != "x"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wundef" >&5
+$as_echo_n "checking whether $CC can actually use -Wundef... " >&6; }
+ CFLAGS="$OLD_CFLAGS -Werror -Wundef"
+ 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 -Wundef"
+
+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 -Wcast-align" >&5
+$as_echo_n "checking whether $CC supports -Wcast-align... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror -Wcast-align"
+ 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 -Wcast-align"
+ # Optionally, run a test
+ if test "x" != "x"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wcast-align" >&5
+$as_echo_n "checking whether $CC can actually use -Wcast-align... " >&6; }
+ CFLAGS="$OLD_CFLAGS -Werror -Wcast-align"
+ 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 -Wcast-align"
+
+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 -Wlogical-op" >&5
+$as_echo_n "checking whether $CC supports -Wlogical-op... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror -Wlogical-op"
+ 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 -Wlogical-op"
+ # 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"
+ 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 -Wlogical-op"
+
+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 -Wnested-externs" >&5
+$as_echo_n "checking whether $CC supports -Wnested-externs... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror -Wnested-externs"
+ 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 -Wnested-externs"
+ # 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"
+ 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 -Wnested-externs"
+
+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 -Wold-style-definition" >&5
+$as_echo_n "checking whether $CC supports -Wold-style-definition... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror -Wold-style-definition"
+ 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 -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 -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. */
+
+_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 -Wold-style-definition"
+
+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 -Woverlength-strings" >&5
+$as_echo_n "checking whether $CC supports -Woverlength-strings... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror -Woverlength-strings"
+ 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 -Woverlength-strings"
+ # 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"
+ 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 -Woverlength-strings"
+
+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 -Wredundant-decls" >&5
+$as_echo_n "checking whether $CC supports -Wredundant-decls... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror -Wredundant-decls"
+ 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 -Wredundant-decls"
+ # 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"
+ 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 -Wredundant-decls"
+
+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 -Wno-format-nonliteral" >&5
$as_echo_n "checking whether $CC supports -Wno-format-nonliteral... " >&6; }
OLD_CFLAGS="$CFLAGS"
diff --git a/configure.in b/configure.in
index c8bc3a864..4729c095e 100644
--- a/configure.in
+++ b/configure.in
@@ -456,6 +456,24 @@ AC_PATH_PROG(AR, ar)
AC_LANG([C])
+# -Wcast-qual use for check wrong casts. It cant be added by default, because some casts must be wrong.
+# -Wconversion warning: conversion to 'long unsigned int' from 'int' may change the sign of the result
+# -Wfloat-equal comparing floating point with == or != is unsafe
+# -Wunsuffixed-float-constants float issues
+# -Wpedantic different pedantic checks. Not all can be fixed in nice way.
+# -Wtraditional-conversion some conversion issues
+# -Wunsafe-loop-optimizations possible optimisation issues
+# -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
+# attributes suggestion
+# -Wsuggest-attribute=const -Wsuggest-attribute=format -Wsuggest-attribute=pure
+
+# flags what can be used but now return no warnings:
+# -Wchkp -Wdisabled-optimization
+# -Werror-implicit-function-declaration -Wtrampolines
+# -Wjump-misses-init
+
CFLAGS="$CFLAGS -pipe -ffast-math -Wall -Wextra -Wno-sign-compare"
CPPFLAGS="$CPPFLAGS -I../common"
LDFLAGS="$LDFLAGS"
@@ -794,11 +812,26 @@ AC_CHECK_COMPILER_WNOFLAG(clobbered)
AC_CHECK_COMPILER_WFLAG(empty-body)
AC_CHECK_COMPILER_WFLAG(newline-eof)
AC_CHECK_COMPILER_WFLAG(int-conversion)
+AC_CHECK_COMPILER_WFLAG(init-self)
+AC_CHECK_COMPILER_WFLAG(pointer-arith)
+AC_CHECK_COMPILER_WFLAG(switch-bool)
AC_CHECK_COMPILER_WFLAG(enum-conversion)
AC_CHECK_COMPILER_WFLAG(shorten-64-to-32)
AC_CHECK_COMPILER_WFLAG(constant-conversion)
AC_CHECK_COMPILER_WFLAG(bool-conversion)
AC_CHECK_COMPILER_WFLAG(format-security)
+AC_CHECK_COMPILER_WFLAG(format)
+AC_CHECK_COMPILER_WFLAG(format-signedness)
+AC_CHECK_COMPILER_WFLAG(format-y2k)
+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(nested-externs)
+AC_CHECK_COMPILER_WFLAG(old-style-definition)
+AC_CHECK_COMPILER_WFLAG(overlength-strings)
+AC_CHECK_COMPILER_WFLAG(redundant-decls)
AC_CHECK_COMPILER_WNOFLAG(format-nonliteral)
AC_CHECK_COMPILER_WNOFLAG(switch)
AC_CHECK_COMPILER_WNOFLAG(missing-field-initializers)
diff --git a/src/char/char.c b/src/char/char.c
index cdb2fe5ea..e8709c5b9 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -466,11 +466,11 @@ int char_mmo_char_tosql(int char_id, struct mmo_charstatus* p)
if( p->show_equip )
opt |= OPT_SHOW_EQUIP;
- if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `base_level`='%d', `job_level`='%d',"
+ if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `base_level`='%u', `job_level`='%u',"
"`base_exp`='%u', `job_exp`='%u', `zeny`='%d',"
- "`max_hp`='%d',`hp`='%d',`max_sp`='%d',`sp`='%d',`status_point`='%d',`skill_point`='%d',"
+ "`max_hp`='%d',`hp`='%d',`max_sp`='%d',`sp`='%d',`status_point`='%u',`skill_point`='%u',"
"`str`='%d',`agi`='%d',`vit`='%d',`int`='%d',`dex`='%d',`luk`='%d',"
- "`option`='%d',`party_id`='%d',`guild_id`='%d',`pet_id`='%d',`homun_id`='%d',`elemental_id`='%d',"
+ "`option`='%u',`party_id`='%d',`guild_id`='%d',`pet_id`='%d',`homun_id`='%d',`elemental_id`='%d',"
"`weapon`='%d',`shield`='%d',`head_top`='%d',`head_mid`='%d',`head_bottom`='%d',"
"`last_map`='%s',`last_x`='%d',`last_y`='%d',`save_map`='%s',`save_x`='%d',`save_y`='%d', `rename`='%d',"
"`delete_date`='%lu',`robe`='%d',`slotchange`='%d', `char_opt`='%u', `font`='%u', `uniqueitem_counter` ='%u',"
@@ -781,7 +781,7 @@ int char_memitemdata_to_sql(const struct item items[], int max, int id, int tabl
} else {
// update all fields.
StrBuf->Clear(&buf);
- StrBuf->Printf(&buf, "UPDATE `%s` SET `amount`='%d', `equip`='%d', `identify`='%d', `refine`='%d',`attribute`='%d', `expire_time`='%u', `bound`='%d'",
+ StrBuf->Printf(&buf, "UPDATE `%s` SET `amount`='%d', `equip`='%u', `identify`='%d', `refine`='%d',`attribute`='%d', `expire_time`='%u', `bound`='%d'",
tablename, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound);
for( j = 0; j < MAX_SLOTS; ++j )
StrBuf->Printf(&buf, ", `card%d`=%d", j, items[i].card[j]);
@@ -828,7 +828,7 @@ int char_memitemdata_to_sql(const struct item items[], int max, int id, int tabl
else
found = true;
- StrBuf->Printf(&buf, "('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%u', '%d', '%"PRIu64"'",
+ StrBuf->Printf(&buf, "('%d', '%d', '%d', '%u', '%d', '%d', '%d', '%u', '%d', '%"PRIu64"'",
id, items[i].nameid, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound, items[i].unique_id);
for( j = 0; j < MAX_SLOTS; ++j )
StrBuf->Printf(&buf, ", '%d'", items[i].card[j]);
@@ -927,7 +927,7 @@ int char_inventory_to_sql(const struct item items[], int max, int id) {
} else {
// update all fields.
StrBuf->Clear(&buf);
- StrBuf->Printf(&buf, "UPDATE `%s` SET `amount`='%d', `equip`='%d', `identify`='%d', `refine`='%d',`attribute`='%d', `expire_time`='%u', `favorite`='%d', `bound`='%d'",
+ StrBuf->Printf(&buf, "UPDATE `%s` SET `amount`='%d', `equip`='%u', `identify`='%d', `refine`='%d',`attribute`='%d', `expire_time`='%u', `favorite`='%d', `bound`='%d'",
inventory_db, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].favorite, items[i].bound);
for( j = 0; j < MAX_SLOTS; ++j )
StrBuf->Printf(&buf, ", `card%d`=%d", j, items[i].card[j]);
@@ -970,7 +970,7 @@ int char_inventory_to_sql(const struct item items[], int max, int id) {
else
found = true;
- StrBuf->Printf(&buf, "('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%u', '%d', '%d', '%"PRIu64"'",
+ StrBuf->Printf(&buf, "('%d', '%d', '%d', '%u', '%d', '%d', '%d', '%u', '%d', '%d', '%"PRIu64"'",
id, items[i].nameid, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].favorite, items[i].bound, items[i].unique_id);
for( j = 0; j < MAX_SLOTS; ++j )
StrBuf->Printf(&buf, ", '%d'", items[i].card[j]);
@@ -3093,7 +3093,7 @@ void char_parse_frommap_map_names(int fd, int id)
VECTOR_PUSH(chr->server[id].maps, RFIFOW(fd,i));
}
- ShowStatus("Map-Server %d connected: %d maps, from IP %d.%d.%d.%d port %d.\n",
+ ShowStatus("Map-Server %d connected: %d maps, from IP %u.%u.%u.%u port %d.\n",
id, (int)VECTOR_LENGTH(chr->server[id].maps), CONVIP(chr->server[id].ip), chr->server[id].port);
ShowStatus("Map-server %d loading complete.\n", id);
@@ -3655,7 +3655,7 @@ void char_parse_frommap_ragsrvinfo(int fd)
SQL->EscapeString(inter->sql_handle, esc_server_name, chr->server_name);
- if( SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` SET `index`='%d',`name`='%s',`exp`='%d',`jexp`='%d',`drop`='%d'",
+ if( SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` SET `index`='%d',`name`='%s',`exp`='%u',`jexp`='%u',`drop`='%u'",
ragsrvinfo_db, fd, esc_server_name, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)) )
{
Sql_ShowDebug(inter->sql_handle);
@@ -3712,7 +3712,7 @@ void char_parse_frommap_save_status_change_data(int fd)
memcpy (&data, RFIFOP(fd, 14+i*sizeof(struct status_change_data)), sizeof(struct status_change_data));
if( i > 0 )
StrBuf->AppendStr(&buf, ", ");
- StrBuf->Printf(&buf, "('%d','%d','%hu','%d','%d','%d','%d','%d')", aid, cid,
+ StrBuf->Printf(&buf, "('%d','%d','%hu','%u','%d','%d','%d','%d')", aid, cid,
data.type, data.tick, data.val1, data.val2, data.val3, data.val4);
}
if( SQL_ERROR == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) )
@@ -3831,7 +3831,7 @@ void char_parse_frommap_auth_request(int fd, int id)
void char_parse_frommap_update_ip(int fd, int id)
{
chr->server[id].ip = ntohl(RFIFOL(fd, 2));
- ShowInfo("Updated IP address of map-server #%d to %d.%d.%d.%d.\n", id, CONVIP(chr->server[id].ip));
+ ShowInfo("Updated IP address of map-server #%d to %u.%u.%u.%u.\n", id, CONVIP(chr->server[id].ip));
RFIFOSKIP(fd,6);
}
@@ -4450,7 +4450,7 @@ void char_parse_char_connect(int fd, struct char_session_data* sd, uint32 ipl)
RFIFOSKIP(fd,17);
- ShowInfo("request connect - account_id:%d/login_id1:%d/login_id2:%d\n", account_id, login_id1, login_id2);
+ ShowInfo("request connect - account_id:%d/login_id1:%u/login_id2:%u\n", account_id, login_id1, login_id2);
if (sd) {
//Received again auth packet for already authenticated account?? Discard it.
diff --git a/src/char/geoip.c b/src/char/geoip.c
index 36b908561..433ff0918 100644
--- a/src/char/geoip.c
+++ b/src/char/geoip.c
@@ -101,7 +101,7 @@ const char* geoip_getcountry(uint32 ipnum)
}
offset = x;
}
- ShowError("geoip_getcountry(): Error traversing database for ipnum %d\n", ipnum);
+ ShowError("geoip_getcountry(): Error traversing database for ipnum %u\n", ipnum);
ShowWarning("geoip_getcountry(): Possible database corruption!\n");
return geoip_countryname[0];
diff --git a/src/char/int_auction.c b/src/char/int_auction.c
index b402e7f98..90dd75962 100644
--- a/src/char/int_auction.c
+++ b/src/char/int_auction.c
@@ -73,7 +73,7 @@ void inter_auction_save(struct auction_data *auction)
auction_db, auction->seller_id, auction->buyer_id, auction->price, auction->buynow, auction->hours, (unsigned long)auction->timestamp, auction->item.nameid, auction->type, auction->item.refine, auction->item.attribute);
for( j = 0; j < MAX_SLOTS; j++ )
StrBuf->Printf(&buf, ", `card%d` = '%d'", j, auction->item.card[j]);
- StrBuf->Printf(&buf, " WHERE `auction_id` = '%d'", auction->auction_id);
+ StrBuf->Printf(&buf, " WHERE `auction_id` = '%u'", auction->auction_id);
stmt = SQL->StmtMalloc(inter->sql_handle);
if( SQL_SUCCESS != SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf))
@@ -183,7 +183,7 @@ void inter_auction_delete(struct auction_data *auction)
auction_id = auction->auction_id;
- if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `auction_id` = '%d'", auction_db, auction_id) )
+ if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `auction_id` = '%u'", auction_db, auction_id) )
Sql_ShowDebug(inter->sql_handle);
if( auction->auction_end_timer != INVALID_TIMER )
diff --git a/src/char/int_elemental.c b/src/char/int_elemental.c
index b781654db..82208d3f5 100644
--- a/src/char/int_elemental.c
+++ b/src/char/int_elemental.c
@@ -47,7 +47,7 @@ bool mapif_elemental_save(struct s_elemental* ele) {
if( ele->elemental_id == 0 ) { // Create new DB entry
if( SQL_ERROR == SQL->Query(inter->sql_handle,
"INSERT INTO `%s` (`char_id`,`class`,`mode`,`hp`,`sp`,`max_hp`,`max_sp`,`atk1`,`atk2`,`matk`,`aspd`,`def`,`mdef`,`flee`,`hit`,`life_time`)"
- "VALUES ('%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%u')",
+ "VALUES ('%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d')",
elemental_db, ele->char_id, ele->class_, ele->mode, ele->hp, ele->sp, ele->max_hp, ele->max_sp, ele->atk, ele->atk2, ele->matk, ele->amotion, ele->def, ele->mdef, ele->flee, ele->hit, ele->life_time) )
{
Sql_ShowDebug(inter->sql_handle);
@@ -58,7 +58,7 @@ bool mapif_elemental_save(struct s_elemental* ele) {
} else if( SQL_ERROR == SQL->Query(inter->sql_handle,
"UPDATE `%s` SET `char_id` = '%d', `class` = '%d', `mode` = '%d', `hp` = '%d', `sp` = '%d',"
"`max_hp` = '%d', `max_sp` = '%d', `atk1` = '%d', `atk2` = '%d', `matk` = '%d', `aspd` = '%d', `def` = '%d',"
- "`mdef` = '%d', `flee` = '%d', `hit` = '%d', `life_time` = '%u' WHERE `ele_id` = '%d'",
+ "`mdef` = '%d', `flee` = '%d', `hit` = '%d', `life_time` = '%d' WHERE `ele_id` = '%d'",
elemental_db, ele->char_id, ele->class_, ele->mode, ele->hp, ele->sp, ele->max_hp, ele->max_sp, ele->atk, ele->atk2,
ele->matk, ele->amotion, ele->def, ele->mdef, ele->flee, ele->hit, ele->life_time, ele->elemental_id) )
{ // Update DB entry
diff --git a/src/char/int_guild.c b/src/char/int_guild.c
index 60efeac94..c78b6b04f 100644
--- a/src/char/int_guild.c
+++ b/src/char/int_guild.c
@@ -1548,7 +1548,7 @@ int mapif_parse_GuildMemberInfoChange(int fd, int guild_id, int account_id, int
{
case GMI_POSITION:
{
- g->member[i].position=*((short *)data);
+ g->member[i].position=*((const short *)data);
g->member[i].modified = GS_MEMBER_MODIFIED;
mapif->guild_memberinfochanged(guild_id,account_id,char_id,type,data,len);
g->save_flag |= GS_MEMBER;
@@ -1557,7 +1557,7 @@ int mapif_parse_GuildMemberInfoChange(int fd, int guild_id, int account_id, int
case GMI_EXP:
{
uint64 old_exp = g->member[i].exp;
- g->member[i].exp=*((uint64 *)data);
+ g->member[i].exp=*((const uint64 *)data);
g->member[i].modified = GS_MEMBER_MODIFIED;
if (g->member[i].exp > old_exp) {
uint64 exp = g->member[i].exp - old_exp;
@@ -1582,7 +1582,7 @@ int mapif_parse_GuildMemberInfoChange(int fd, int guild_id, int account_id, int
}
case GMI_HAIR:
{
- g->member[i].hair=*((short *)data);
+ g->member[i].hair=*((const short *)data);
g->member[i].modified = GS_MEMBER_MODIFIED;
mapif->guild_memberinfochanged(guild_id,account_id,char_id,type,data,len);
g->save_flag |= GS_MEMBER; //Save new data.
@@ -1590,7 +1590,7 @@ int mapif_parse_GuildMemberInfoChange(int fd, int guild_id, int account_id, int
}
case GMI_HAIR_COLOR:
{
- g->member[i].hair_color=*((short *)data);
+ g->member[i].hair_color=*((const short *)data);
g->member[i].modified = GS_MEMBER_MODIFIED;
mapif->guild_memberinfochanged(guild_id,account_id,char_id,type,data,len);
g->save_flag |= GS_MEMBER; //Save new data.
@@ -1598,7 +1598,7 @@ int mapif_parse_GuildMemberInfoChange(int fd, int guild_id, int account_id, int
}
case GMI_GENDER:
{
- g->member[i].gender=*((short *)data);
+ g->member[i].gender=*((const short *)data);
g->member[i].modified = GS_MEMBER_MODIFIED;
mapif->guild_memberinfochanged(guild_id,account_id,char_id,type,data,len);
g->save_flag |= GS_MEMBER; //Save new data.
@@ -1606,7 +1606,7 @@ int mapif_parse_GuildMemberInfoChange(int fd, int guild_id, int account_id, int
}
case GMI_CLASS:
{
- g->member[i].class_=*((short *)data);
+ g->member[i].class_=*((const short *)data);
g->member[i].modified = GS_MEMBER_MODIFIED;
mapif->guild_memberinfochanged(guild_id,account_id,char_id,type,data,len);
g->save_flag |= GS_MEMBER; //Save new data.
@@ -1614,7 +1614,7 @@ int mapif_parse_GuildMemberInfoChange(int fd, int guild_id, int account_id, int
}
case GMI_LEVEL:
{
- g->member[i].lv=*((short *)data);
+ g->member[i].lv=*((const short *)data);
g->member[i].modified = GS_MEMBER_MODIFIED;
mapif->guild_memberinfochanged(guild_id,account_id,char_id,type,data,len);
g->save_flag |= GS_MEMBER; //Save new data.
diff --git a/src/char/int_homun.c b/src/char/int_homun.c
index f60394ee7..d633dc7e0 100644
--- a/src/char/int_homun.c
+++ b/src/char/int_homun.c
@@ -181,7 +181,7 @@ bool mapif_homunculus_load(int homun_id, struct s_homunculus* hd)
nullpo_ret(hd);
memset(hd, 0, sizeof(*hd));
- if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `homun_id`,`char_id`,`class`,`prev_class`,`name`,`level`,`exp`,`intimacy`,`hunger`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `hp`,`max_hp`,`sp`,`max_sp`,`skill_point`,`rename_flag`, `vaporize` FROM `%s` WHERE `homun_id`='%u'", homunculus_db, homun_id) )
+ if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `homun_id`,`char_id`,`class`,`prev_class`,`name`,`level`,`exp`,`intimacy`,`hunger`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `hp`,`max_hp`,`sp`,`max_sp`,`skill_point`,`rename_flag`, `vaporize` FROM `%s` WHERE `homun_id`='%d'", homunculus_db, homun_id) )
{
Sql_ShowDebug(inter->sql_handle);
return false;
@@ -255,8 +255,8 @@ bool mapif_homunculus_load(int homun_id, struct s_homunculus* hd)
bool mapif_homunculus_delete(int homun_id)
{
- if (SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `homun_id` = '%u'", homunculus_db, homun_id)
- || SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `homun_id` = '%u'", skill_homunculus_db, homun_id)
+ if (SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `homun_id` = '%d'", homunculus_db, homun_id)
+ || SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `homun_id` = '%d'", skill_homunculus_db, homun_id)
) {
Sql_ShowDebug(inter->sql_handle);
return false;
diff --git a/src/char/int_mail.c b/src/char/int_mail.c
index c15dc5180..b75a362fb 100644
--- a/src/char/int_mail.c
+++ b/src/char/int_mail.c
@@ -138,7 +138,7 @@ int inter_mail_savemessage(struct mail_message* msg)
StrBuf->Printf(&buf, "INSERT INTO `%s` (`send_name`, `send_id`, `dest_name`, `dest_id`, `title`, `message`, `time`, `status`, `zeny`, `amount`, `nameid`, `refine`, `attribute`, `identify`, `unique_id`", mail_db);
for (j = 0; j < MAX_SLOTS; j++)
StrBuf->Printf(&buf, ", `card%d`", j);
- StrBuf->Printf(&buf, ") VALUES (?, '%d', ?, '%d', ?, ?, '%lu', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%"PRIu64"'",
+ StrBuf->Printf(&buf, ") VALUES (?, '%d', ?, '%d', ?, ?, '%lu', '%u', '%d', '%d', '%d', '%d', '%d', '%d', '%"PRIu64"'",
msg->send_id, msg->dest_id, (unsigned long)msg->timestamp, msg->status, msg->zeny, msg->item.amount, msg->item.nameid, msg->item.refine, msg->item.attribute, msg->item.identify, msg->item.unique_id);
for (j = 0; j < MAX_SLOTS; j++)
StrBuf->Printf(&buf, ", '%d'", msg->item.card[j]);
diff --git a/src/char/int_quest.c b/src/char/int_quest.c
index 946603b0a..de3fbd000 100644
--- a/src/char/int_quest.c
+++ b/src/char/int_quest.c
@@ -154,7 +154,7 @@ bool mapif_quest_add(int char_id, struct quest qd)
for (i = 0; i < MAX_QUEST_OBJECTIVES; i++) {
StrBuf->Printf(&buf, ", `count%d`", i+1);
}
- StrBuf->Printf(&buf, ") VALUES ('%d', '%d', '%d', '%d'", qd.quest_id, char_id, qd.state, qd.time);
+ StrBuf->Printf(&buf, ") VALUES ('%d', '%d', '%u', '%u'", qd.quest_id, char_id, qd.state, qd.time);
for (i = 0; i < MAX_QUEST_OBJECTIVES; i++) {
StrBuf->Printf(&buf, ", '%d'", qd.count[i]);
}
@@ -182,7 +182,7 @@ bool mapif_quest_update(int char_id, struct quest qd)
int i;
StrBuf->Init(&buf);
- StrBuf->Printf(&buf, "UPDATE `%s` SET `state`='%d'", quest_db, qd.state);
+ StrBuf->Printf(&buf, "UPDATE `%s` SET `state`='%u'", quest_db, qd.state);
for (i = 0; i < MAX_QUEST_OBJECTIVES; i++) {
StrBuf->Printf(&buf, ", `count%d`='%d'", i+1, qd.count[i]);
}
diff --git a/src/char/int_storage.c b/src/char/int_storage.c
index 086ef2044..30647233b 100644
--- a/src/char/int_storage.c
+++ b/src/char/int_storage.c
@@ -37,8 +37,6 @@
#include <stdio.h>
#include <stdlib.h>
-#define STORAGE_MEMINC 16
-
struct inter_storage_interface inter_storage_s;
struct inter_storage_interface *inter_storage;
@@ -418,7 +416,7 @@ int mapif_parse_ItemBoundRetrieve_sub(int fd)
if( j )
StrBuf->AppendStr(&buf, ",");
- StrBuf->Printf(&buf, "('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%"PRIu64"'",
+ StrBuf->Printf(&buf, "('%d', '%d', '%d', '%u', '%d', '%d', '%d', '%u', '%d', '%"PRIu64"'",
guild_id, items[j].nameid, items[j].amount, items[j].equip, items[j].identify, items[j].refine,
items[j].attribute, items[j].expire_time, items[j].bound, items[j].unique_id);
for( s = 0; s < MAX_SLOTS; ++s )
diff --git a/src/char/inter.h b/src/char/inter.h
index 49eca1256..b8bcb2def 100644
--- a/src/char/inter.h
+++ b/src/char/inter.h
@@ -37,7 +37,7 @@ struct inter_interface {
void (*do_final_msg) (void);
const char* (*job_name) (int class_);
void (*vmsg_to_fd) (int fd, int u_fd, int aid, char* msg, va_list ap);
- void (*msg_to_fd) (int fd, int u_fd, int aid, char *msg, ...);
+ void (*msg_to_fd) (int fd, int u_fd, int aid, char *msg, ...) __attribute__((format(printf, 4, 5)));
void (*savereg) (int account_id, int char_id, const char *key, unsigned int index, intptr_t val, bool is_string);
int (*accreg_fromsql) (int account_id,int char_id, int fd, int type);
int (*config_read) (const char* cfgName);
diff --git a/src/char/loginif.c b/src/char/loginif.c
index c577ad791..1e457fcca 100644
--- a/src/char/loginif.c
+++ b/src/char/loginif.c
@@ -39,6 +39,7 @@ struct loginif_interface loginif_s;
struct loginif_interface *loginif;
/// Resets all the data.
+void loginif_reset(void) __attribute__ ((noreturn));
void loginif_reset(void)
{
int id;
diff --git a/src/common/HPM.c b/src/common/HPM.c
index f115c886e..fa4025fb8 100644
--- a/src/common/HPM.c
+++ b/src/common/HPM.c
@@ -214,11 +214,11 @@ bool hplugin_data_store_validate(enum HPluginDataTypes type, struct hplugin_data
break;
default:
if (HPM->data_store_validate_sub == NULL) {
- ShowError("HPM:validateHPData failed, type %d needs sub-handler!\n",type);
+ ShowError("HPM:validateHPData failed, type %u needs sub-handler!\n", type);
return false;
}
if (!HPM->data_store_validate_sub(type, storeptr, initialize)) {
- ShowError("HPM:HPM:validateHPData failed, unknown type %d!\n",type);
+ ShowError("HPM:HPM:validateHPData failed, unknown type %u!\n", type);
return false;
}
break;
@@ -228,7 +228,7 @@ bool hplugin_data_store_validate(enum HPluginDataTypes type, struct hplugin_data
store = *storeptr;
}
if (store->type != type) {
- ShowError("HPM:HPM:validateHPData failed, store type mismatch %d != %d.\n",store->type, type);
+ ShowError("HPM:HPM:validateHPData failed, store type mismatch %u != %u.\n", store->type, type);
return false;
}
return true;
@@ -253,7 +253,7 @@ void hplugins_addToHPData(enum HPluginDataTypes type, uint32 pluginID, struct hp
if (!HPM->data_store_validate(type, storeptr, true)) {
/* woo it failed! */
- ShowError("HPM:addToHPData:%s: failed, type %d (%u|%u)\n", HPM->pid2name(pluginID), type, pluginID, classid);
+ ShowError("HPM:addToHPData:%s: failed, type %u (%u|%u)\n", HPM->pid2name(pluginID), type, pluginID, classid);
return;
}
store = *storeptr;
@@ -294,7 +294,7 @@ void *hplugins_getFromHPData(enum HPluginDataTypes type, uint32 pluginID, struct
if (!HPM->data_store_validate(type, &store, false)) {
/* woo it failed! */
- ShowError("HPM:getFromHPData:%s: failed, type %d (%u|%u)\n", HPM->pid2name(pluginID), type, pluginID, classid);
+ ShowError("HPM:getFromHPData:%s: failed, type %u (%u|%u)\n", HPM->pid2name(pluginID), type, pluginID, classid);
return NULL;
}
if (!store)
@@ -322,7 +322,7 @@ void hplugins_removeFromHPData(enum HPluginDataTypes type, uint32 pluginID, stru
if (!HPM->data_store_validate(type, &store, false)) {
/* woo it failed! */
- ShowError("HPM:removeFromHPData:%s: failed, type %d (%u|%u)\n", HPM->pid2name(pluginID), type, pluginID, classid);
+ ShowError("HPM:removeFromHPData:%s: failed, type %u (%u|%u)\n", HPM->pid2name(pluginID), type, pluginID, classid);
return;
}
if (!store)
diff --git a/src/common/ers.c b/src/common/ers.c
index 85e1fb759..8970fefc2 100644
--- a/src/common/ers.c
+++ b/src/common/ers.c
@@ -288,7 +288,7 @@ static void ers_obj_destroy(ERS *self)
if (instance->Count > 0)
if (!(instance->Options & ERS_OPT_CLEAR))
- ShowWarning("Memory leak detected at ERS '%s', %d objects not freed.\n", instance->Name, instance->Count);
+ ShowWarning("Memory leak detected at ERS '%s', %u objects not freed.\n", instance->Name, instance->Count);
if (--instance->Cache->ReferenceCount <= 0)
ers_free_cache(instance->Cache, true);
@@ -313,7 +313,7 @@ void ers_cache_size(ERS *self, unsigned int new_size) {
nullpo_retv(instance);
if( !(instance->Cache->Options&ERS_OPT_FLEX_CHUNK) ) {
- ShowWarning("ers_cache_size: '%s' has adjusted its chunk size to '%d', however ERS_OPT_FLEX_CHUNK is missing!\n",instance->Name,new_size);
+ ShowWarning("ers_cache_size: '%s' has adjusted its chunk size to '%u', however ERS_OPT_FLEX_CHUNK is missing!\n", instance->Name, new_size);
}
instance->Cache->ChunkSize = new_size;
@@ -382,7 +382,7 @@ void ers_report(void) {
for (cache = CacheList; cache; cache = cache->Next) {
cache_c++;
ShowMessage(CL_BOLD"[ERS Cache of size '"CL_NORMAL""CL_WHITE"%u"CL_NORMAL""CL_BOLD"' report]\n"CL_NORMAL, cache->ObjectSize);
- ShowMessage("\tinstances : %u\n", cache->ReferenceCount);
+ ShowMessage("\tinstances : %d\n", cache->ReferenceCount);
ShowMessage("\tblocks in use : %u/%u\n", cache->UsedObjs, cache->UsedObjs+cache->Free);
ShowMessage("\tblocks unused : %u\n", cache->Free);
ShowMessage("\tmemory in use : %.2f MB\n", cache->UsedObjs == 0 ? 0. : (double)((cache->UsedObjs * cache->ObjectSize)/1024)/1024);
diff --git a/src/common/md5calc.c b/src/common/md5calc.c
index 44f912992..bc70d9006 100644
--- a/src/common/md5calc.c
+++ b/src/common/md5calc.c
@@ -169,7 +169,7 @@ static void MD5_String2binary(const char * string, unsigned char * output)
//var
/*8bit*/
unsigned char padding_message[64]; //Extended message 512bit 64byte
- unsigned char *pstring; //The position of string in the present scanning notes is held.
+ const unsigned char *pstring; //The position of string in the present scanning notes is held.
/*32bit*/
unsigned int string_byte_len, //The byte chief of string is held.
@@ -192,7 +192,7 @@ static void MD5_String2binary(const char * string, unsigned char * output)
//Step 1.Append Padding Bits (extension of a mark bit)
//1-1
string_byte_len = (unsigned int)strlen(string); //The byte chief of a character sequence is acquired.
- pstring = (unsigned char *)string; //The position of the present character sequence is set.
+ pstring = (const unsigned char *)string; //The position of the present character sequence is set.
//1-2 Repeat calculation until length becomes less than 64 bytes.
for (i=string_byte_len; 64<=i; i-=64,pstring+=64)
@@ -200,7 +200,7 @@ static void MD5_String2binary(const char * string, unsigned char * output)
//1-3
copy_len = string_byte_len % 64; //The number of bytes which remained is computed.
- strncpy((char *)padding_message, (char *)pstring, copy_len); //A message is copied to an extended bit sequence.
+ strncpy((char *)padding_message, (const char *)pstring, copy_len); //A message is copied to an extended bit sequence.
memset(padding_message+copy_len, 0, 64 - copy_len); //It buries by 0 until it becomes extended bit length.
padding_message[copy_len] |= 0x80; //The next of a message is 1.
diff --git a/src/common/memmgr.c b/src/common/memmgr.c
index 93c23ff18..0c8eceb3c 100644
--- a/src/common/memmgr.c
+++ b/src/common/memmgr.c
@@ -305,7 +305,7 @@ void *mmalloc_(size_t size, const char *file, int line, const char *func) {
struct unit_head *head;
if (((long) size) < 0) {
- ShowError("mmalloc_: %"PRIdS"\n", size);
+ ShowError("mmalloc_: %"PRIuS"\n", size);
return NULL;
}
@@ -820,7 +820,7 @@ void memmgr_report (int extra) {
}
for( j = 0; j < 100; j++ ) {
if( data[j].size != 0 ) {
- ShowMessage("[malloc] : "CL_WHITE"%s"CL_RESET":"CL_WHITE"%d"CL_RESET" %d instances => %.2f MB\n",data[j].file,data[j].line,data[j].count,(double)((data[j].size)/1024)/1024);
+ ShowMessage("[malloc] : "CL_WHITE"%s"CL_RESET":"CL_WHITE"%d"CL_RESET" %u instances => %.2f MB\n",data[j].file,data[j].line,data[j].count,(double)((data[j].size)/1024)/1024);
}
}
ShowMessage("[malloc] : reporting %u instances | %.2f MB\n",count,(double)((size)/1024)/1024);
diff --git a/src/common/showmsg.c b/src/common/showmsg.c
index 4d4c72b42..1c1d4ca8b 100644
--- a/src/common/showmsg.c
+++ b/src/common/showmsg.c
@@ -805,7 +805,7 @@ void showmsg_showConfigWarning(struct config_setting_t *config, const char *stri
va_list ap;
StrBuf->Init(&buf);
StrBuf->AppendStr(&buf, string);
- StrBuf->Printf(&buf, " (%s:%d)\n", config_setting_source_file(config), config_setting_source_line(config));
+ StrBuf->Printf(&buf, " (%s:%u)\n", config_setting_source_file(config), config_setting_source_line(config));
va_start(ap, string);
vShowMessage_(MSG_WARNING, StrBuf->Value(&buf), ap);
va_end(ap);
diff --git a/src/common/socket.c b/src/common/socket.c
index 8b1ab3959..10712c78b 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -625,7 +625,7 @@ int make_connection(uint32 ip, uint16 port, struct hSockOpt *opt) {
remote_address.sin_port = htons(port);
if( !( opt && opt->silent ) )
- ShowStatus("Connecting to %d.%d.%d.%d:%i\n", CONVIP(ip), port);
+ ShowStatus("Connecting to %u.%u.%u.%u:%i\n", CONVIP(ip), port);
result = sConnect(fd, (struct sockaddr *)(&remote_address), sizeof(struct sockaddr_in));
if( result == SOCKET_ERROR ) {
@@ -758,7 +758,7 @@ int wfifoset(int fd, size_t len)
if (s->wdata_size+len > s->max_wdata) {
// actually there was a buffer overflow already
uint32 ip = s->client_addr;
- ShowFatalError("WFIFOSET: Write Buffer Overflow. Connection %d (%d.%d.%d.%d) has written %u bytes on a %u/%u bytes buffer.\n", fd, CONVIP(ip), (unsigned int)len, (unsigned int)s->wdata_size, (unsigned int)s->max_wdata);
+ ShowFatalError("WFIFOSET: Write Buffer Overflow. Connection %d (%u.%u.%u.%u) has written %u bytes on a %u/%u bytes buffer.\n", fd, CONVIP(ip), (unsigned int)len, (unsigned int)s->wdata_size, (unsigned int)s->max_wdata);
ShowDebug("Likely command that caused it: 0x%x\n", (*(uint16*)(s->wdata + s->wdata_size)));
// no other chance, make a better fifo model
exit(EXIT_FAILURE);
@@ -768,7 +768,7 @@ int wfifoset(int fd, size_t len)
{
// dynamic packets allow up to UINT16_MAX bytes (<packet_id>.W <packet_len>.W ...)
// all known fixed-size packets are within this limit, so use the same limit
- ShowFatalError("WFIFOSET: Packet 0x%x is too big. (len=%u, max=%u)\n", (*(uint16*)(s->wdata + s->wdata_size)), (unsigned int)len, 0xFFFF);
+ ShowFatalError("WFIFOSET: Packet 0x%x is too big. (len=%u, max=%u)\n", (*(uint16*)(s->wdata + s->wdata_size)), (unsigned int)len, 0xFFFFU);
exit(EXIT_FAILURE);
}
else if( len == 0 )
@@ -985,7 +985,7 @@ static int connect_check(uint32 ip)
{
int result = connect_check_(ip);
if( access_debug ) {
- ShowInfo("connect_check: Connection from %d.%d.%d.%d %s\n", CONVIP(ip),result ? "allowed." : "denied!");
+ ShowInfo("connect_check: Connection from %u.%u.%u.%u %s\n", CONVIP(ip),result ? "allowed." : "denied!");
}
return result;
}
@@ -1005,7 +1005,7 @@ static int connect_check_(uint32 ip)
for( i=0; i < access_allownum; ++i ){
if (SUBNET_MATCH(ip, access_allow[i].ip, access_allow[i].mask)) {
if( access_debug ){
- ShowInfo("connect_check: Found match from allow list:%d.%d.%d.%d IP:%d.%d.%d.%d Mask:%d.%d.%d.%d\n",
+ ShowInfo("connect_check: Found match from allow list:%u.%u.%u.%u IP:%u.%u.%u.%u Mask:%u.%u.%u.%u\n",
CONVIP(ip),
CONVIP(access_allow[i].ip),
CONVIP(access_allow[i].mask));
@@ -1018,7 +1018,7 @@ static int connect_check_(uint32 ip)
for( i=0; i < access_denynum; ++i ){
if (SUBNET_MATCH(ip, access_deny[i].ip, access_deny[i].mask)) {
if( access_debug ){
- ShowInfo("connect_check: Found match from deny list:%d.%d.%d.%d IP:%d.%d.%d.%d Mask:%d.%d.%d.%d\n",
+ ShowInfo("connect_check: Found match from deny list:%u.%u.%u.%u IP:%u.%u.%u.%u Mask:%u.%u.%u.%u\n",
CONVIP(ip),
CONVIP(access_deny[i].ip),
CONVIP(access_deny[i].mask));
@@ -1065,7 +1065,7 @@ static int connect_check_(uint32 ip)
hist->tick = timer->gettick();
if( ++hist->count >= ddos_count ) {// DDoS attack detected
hist->ddos = 1;
- ShowWarning("connect_check: DDoS Attack detected from %d.%d.%d.%d!\n", CONVIP(ip));
+ ShowWarning("connect_check: DDoS Attack detected from %u.%u.%u.%u!\n", CONVIP(ip));
return (connect_ok == 2 ? 1 : 0);
}
return connect_ok;
@@ -1153,7 +1153,7 @@ int access_ipmask(const char* str, AccessControl* acc)
}
}
if( access_debug ){
- ShowInfo("access_ipmask: Loaded IP:%d.%d.%d.%d mask:%d.%d.%d.%d\n", CONVIP(ip), CONVIP(mask));
+ ShowInfo("access_ipmask: Loaded IP:%u.%u.%u.%u mask:%u.%u.%u.%u\n", CONVIP(ip), CONVIP(mask));
}
acc->ip = ip;
acc->mask = mask;
@@ -1429,7 +1429,7 @@ void socket_init(void)
timer->add_interval(timer->gettick()+1000, connect_check_clear, 0, 0, 5*60*1000);
#endif
- ShowInfo("Server supports up to '"CL_WHITE"%"PRId64""CL_RESET"' concurrent connections.\n", rlim_cur);
+ ShowInfo("Server supports up to '"CL_WHITE"%"PRIu64""CL_RESET"' concurrent connections.\n", rlim_cur);
}
bool session_is_valid(int fd)
diff --git a/src/common/socket.h b/src/common/socket.h
index 70fbc3492..e1ea94f5a 100644
--- a/src/common/socket.h
+++ b/src/common/socket.h
@@ -85,11 +85,11 @@ struct config_setting_t;
#define WP2PTR(fd) WFIFO2PTR(fd)
// buffer I/O macros
-#define RBUFP(p,pos) (((uint8*)(p)) + (pos))
-#define RBUFB(p,pos) (*(uint8*)RBUFP((p),(pos)))
-#define RBUFW(p,pos) (*(uint16*)RBUFP((p),(pos)))
-#define RBUFL(p,pos) (*(uint32*)RBUFP((p),(pos)))
-#define RBUFQ(p,pos) (*(uint64*)RBUFP((p),(pos)))
+#define RBUFP(p,pos) (((const uint8*)(p)) + (pos))
+#define RBUFB(p,pos) (*(const uint8*)RBUFP((p),(pos)))
+#define RBUFW(p,pos) (*(const uint16*)RBUFP((p),(pos)))
+#define RBUFL(p,pos) (*(const uint32*)RBUFP((p),(pos)))
+#define RBUFQ(p,pos) (*(const uint64*)RBUFP((p),(pos)))
#define WBUFP(p,pos) (((uint8*)(p)) + (pos))
#define WBUFB(p,pos) (*(uint8*)WBUFP((p),(pos)))
diff --git a/src/common/sql.c b/src/common/sql.c
index b1e77e636..ed93169ea 100644
--- a/src/common/sql.c
+++ b/src/common/sql.c
@@ -467,7 +467,7 @@ static int Sql_P_BindSqlDataType(MYSQL_BIND* bind, enum SqlDataType buffer_type,
case SQLDT_BLOB: bind->buffer_type = MYSQL_TYPE_BLOB;
break;
default:
- ShowDebug("Sql_P_BindSqlDataType: unsupported buffer type (%d)\n", buffer_type);
+ ShowDebug("Sql_P_BindSqlDataType: unsupported buffer type (%u)\n", buffer_type);
return SQL_ERROR;
}
bind->buffer = buffer;
@@ -870,7 +870,7 @@ void hercules_mysql_error_handler(unsigned int ecode) {
case 2003:/* Can't connect to MySQL (this error only happens here when failing to reconnect) */
if( mysql_reconnect_type == 1 ) {
if( ++retry > mysql_reconnect_count ) {
- ShowFatalError("MySQL has been unreachable for too long, %d reconnects were attempted. Shutting Down\n", retry);
+ ShowFatalError("MySQL has been unreachable for too long, %u reconnects were attempted. Shutting Down\n", retry);
exit(EXIT_FAILURE);
}
}
@@ -972,7 +972,7 @@ void Sql_HerculesUpdateCheck(Sql* self) {
fclose(ifp);
if( performed ) {
- ShowSQL("- detected %d new "CL_WHITE"SQL updates"CL_RESET"\n",performed);
+ ShowSQL("- detected %u new "CL_WHITE"SQL updates"CL_RESET"\n",performed);
ShowMessage("%s",StrBuf->Value(&buf));
ShowSQL("To manually skip, type: 'sql update skip <file name>'\n");
}
diff --git a/src/login/account_sql.c b/src/login/account_sql.c
index 1de0fb5e9..cb6fdba99 100644
--- a/src/login/account_sql.c
+++ b/src/login/account_sql.c
@@ -728,7 +728,7 @@ void mmo_save_accreg2(AccountDB* self, int fd, int account_id, int char_id) {
switch (RFIFOB(fd, cursor++)) {
/* int */
case 0:
- if( SQL_ERROR == SQL->Query(sql_handle, "REPLACE INTO `%s` (`account_id`,`key`,`index`,`value`) VALUES ('%d','%s','%u','%d')", db->global_acc_reg_num_db, account_id, key, index, RFIFOL(fd, cursor)) )
+ if( SQL_ERROR == SQL->Query(sql_handle, "REPLACE INTO `%s` (`account_id`,`key`,`index`,`value`) VALUES ('%d','%s','%u','%u')", db->global_acc_reg_num_db, account_id, key, index, RFIFOL(fd, cursor)) )
Sql_ShowDebug(sql_handle);
cursor += 4;
break;
diff --git a/src/login/ipban_sql.c b/src/login/ipban_sql.c
index 9d059ccd2..301d22c18 100644
--- a/src/login/ipban_sql.c
+++ b/src/login/ipban_sql.c
@@ -259,7 +259,7 @@ void ipban_log(uint32 ip)
if (failures >= login->config->dynamic_pass_failure_ban_limit)
{
uint8* p = (uint8*)&ip;
- if (SQL_ERROR == SQL->Query(sql_handle, "INSERT INTO `%s`(`list`,`btime`,`rtime`,`reason`) VALUES ('%u.%u.%u.*', NOW() , NOW() + INTERVAL %d MINUTE ,'Password error ban')",
+ if (SQL_ERROR == SQL->Query(sql_handle, "INSERT INTO `%s`(`list`,`btime`,`rtime`,`reason`) VALUES ('%u.%u.%u.*', NOW() , NOW() + INTERVAL %u MINUTE ,'Password error ban')",
ipban_table, p[3], p[2], p[1], login->config->dynamic_pass_failure_ban_duration))
{
Sql_ShowDebug(sql_handle);
diff --git a/src/login/login.c b/src/login/login.c
index 71cdded02..d724cccfb 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -494,12 +494,12 @@ void login_fromchar_parse_account_update(int fd, int id, const char *const ip)
RFIFOSKIP(fd,10);
if( !accounts->load_num(accounts, &acc, account_id) )
- ShowNotice("Char-server '%s': Error of Status change (account: %d not found, suggested status %d, ip: %s).\n", server[id].name, account_id, state, ip);
+ ShowNotice("Char-server '%s': Error of Status change (account: %d not found, suggested status %u, ip: %s).\n", server[id].name, account_id, state, ip);
else
if( acc.state == state )
- ShowNotice("Char-server '%s': Error of Status change - actual status is already the good status (account: %d, status %d, ip: %s).\n", server[id].name, account_id, state, ip);
+ ShowNotice("Char-server '%s': Error of Status change - actual status is already the good status (account: %d, status %u, ip: %s).\n", server[id].name, account_id, state, ip);
else {
- ShowNotice("Char-server '%s': Status change (account: %d, new status %d, ip: %s).\n", server[id].name, account_id, state, ip);
+ ShowNotice("Char-server '%s': Status change (account: %d, new status %u, ip: %s).\n", server[id].name, account_id, state, ip);
acc.state = state;
// Save
@@ -683,7 +683,7 @@ void login_fromchar_parse_request_account_reg2(int fd)
void login_fromchar_parse_update_wan_ip(int fd, int id)
{
server[id].ip = ntohl(RFIFOL(fd,2));
- ShowInfo("Updated IP of Server #%d to %d.%d.%d.%d.\n",id, CONVIP(server[id].ip));
+ ShowInfo("Updated IP of Server #%d to %u.%u.%u.%u.\n",id, CONVIP(server[id].ip));
RFIFOSKIP(fd,6);
}
@@ -1118,7 +1118,7 @@ int login_mmo_auth(struct login_session_data* sd, bool isServer) {
}
if( acc.state != 0 ) {
- ShowNotice("Connection refused (account: %s, pass: %s, state: %d, ip: %s)\n", sd->userid, sd->passwd, acc.state, ip);
+ ShowNotice("Connection refused (account: %s, pass: %s, state: %u, ip: %s)\n", sd->userid, sd->passwd, acc.state, ip);
return acc.state - 1;
}
diff --git a/src/login/loginlog_sql.c b/src/login/loginlog_sql.c
index f26d9890f..356bba3b4 100644
--- a/src/login/loginlog_sql.c
+++ b/src/login/loginlog_sql.c
@@ -59,7 +59,7 @@ unsigned long loginlog_failedattempts(uint32 ip, unsigned int minutes)
if( !enabled )
return 0;
- if( SQL_ERROR == SQL->Query(sql_handle, "SELECT count(*) FROM `%s` WHERE `ip` = '%s' AND `rcode` = '1' AND `time` > NOW() - INTERVAL %d MINUTE",
+ if( SQL_ERROR == SQL->Query(sql_handle, "SELECT count(*) FROM `%s` WHERE `ip` = '%s' AND `rcode` = '1' AND `time` > NOW() - INTERVAL %u MINUTE",
log_login_db, sockt->ip2str(ip,NULL), minutes) )// how many times failed account? in one ip.
Sql_ShowDebug(sql_handle);
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index eb48adc1d..a9b071fda 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -223,8 +223,8 @@ ACMD(send)
// read message type as hex number (without the 0x)
if (!*message
- || !((sscanf(message, "len %x", &type)==1 && (len=1, true))
- || sscanf(message, "%x", &type)==1)
+ || !((sscanf(message, "len %x", (unsigned int*)&type)==1 && (len=1, true))
+ || sscanf(message, "%x", (unsigned int*)&type)==1)
) {
clif->message(fd, msg_fd(fd,900)); // Usage:
clif->message(fd, msg_fd(fd,901)); // @send len <packet hex number>
@@ -252,7 +252,7 @@ ACMD(send)
} while(0) //define SKIP_VALUE
#define GET_VALUE(p,num) do { \
- if(sscanf((p), "x%lx", &(num)) < 1 && sscanf((p), "%ld ", &(num)) < 1){\
+ if(sscanf((p), "x%lx", (long unsigned int*)&(num)) < 1 && sscanf((p), "%ld ", &(num)) < 1){\
PARSE_ERROR("Invalid number in:",(p));\
return false;\
}\
@@ -547,7 +547,7 @@ ACMD(jumpto) {
return false;
}
- if((pl_sd=map->nick2sd((char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
+ if((pl_sd=map->nick2sd((const char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
@@ -2272,11 +2272,11 @@ ACMD(gat) {
for (y = 2; y >= -2; y--) {
safesnprintf(atcmd_output, sizeof(atcmd_output), "%s (x= %d, y= %d) %02X %02X %02X %02X %02X",
map->list[sd->bl.m].name, sd->bl.x - 2, sd->bl.y + y,
- map->getcell(sd->bl.m, &sd->bl, sd->bl.x - 2, sd->bl.y + y, CELL_GETTYPE),
- map->getcell(sd->bl.m, &sd->bl, sd->bl.x - 1, sd->bl.y + y, CELL_GETTYPE),
- map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y + y, CELL_GETTYPE),
- map->getcell(sd->bl.m, &sd->bl, sd->bl.x + 1, sd->bl.y + y, CELL_GETTYPE),
- map->getcell(sd->bl.m, &sd->bl, sd->bl.x + 2, sd->bl.y + y, CELL_GETTYPE));
+ (unsigned int)map->getcell(sd->bl.m, &sd->bl, sd->bl.x - 2, sd->bl.y + y, CELL_GETTYPE),
+ (unsigned int)map->getcell(sd->bl.m, &sd->bl, sd->bl.x - 1, sd->bl.y + y, CELL_GETTYPE),
+ (unsigned int)map->getcell(sd->bl.m, &sd->bl, sd->bl.x, sd->bl.y + y, CELL_GETTYPE),
+ (unsigned int)map->getcell(sd->bl.m, &sd->bl, sd->bl.x + 1, sd->bl.y + y, CELL_GETTYPE),
+ (unsigned int)map->getcell(sd->bl.m, &sd->bl, sd->bl.x + 2, sd->bl.y + y, CELL_GETTYPE));
clif->message(fd, atcmd_output);
}
@@ -2747,7 +2747,7 @@ ACMD(recall) {
return false;
}
- if((pl_sd=map->nick2sd((char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
+ if((pl_sd=map->nick2sd((const char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
@@ -3072,7 +3072,7 @@ ACMD(kick)
return false;
}
- if((pl_sd=map->nick2sd((char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
+ if((pl_sd=map->nick2sd((const char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
@@ -5123,7 +5123,7 @@ ACMD(follow) {
return true;
}
- if ((pl_sd = map->nick2sd((char *)message)) == NULL)
+ if ((pl_sd = map->nick2sd((const char *)message)) == NULL)
{
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
@@ -5601,7 +5601,7 @@ ACMD(changegm) {
return false;
}
- if ((pl_sd=map->nick2sd((char *) message)) == NULL || pl_sd->status.guild_id != sd->status.guild_id) {
+ if ((pl_sd=map->nick2sd((const char *) message)) == NULL || pl_sd->status.guild_id != sd->status.guild_id) {
clif->message(fd, msg_fd(fd,1184)); // Target character must be online and be a guild member.
return false;
}
@@ -5621,7 +5621,7 @@ ACMD(changeleader) {
return false;
}
- if (party->changeleader(sd, map->nick2sd((char *) message)))
+ if (party->changeleader(sd, map->nick2sd((const char *) message)))
return true;
return false;
}
@@ -6380,7 +6380,7 @@ ACMD(trade) {
return false;
}
- if ( (pl_sd = map->nick2sd((char *)message)) == NULL ) {
+ if ( (pl_sd = map->nick2sd((const char *)message)) == NULL ) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
@@ -6423,7 +6423,7 @@ ACMD(unmute) {
return false;
}
- if ((pl_sd = map->nick2sd((char *)message)) == NULL)
+ if ((pl_sd = map->nick2sd((const char *)message)) == NULL)
{
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
@@ -7667,7 +7667,7 @@ ACMD(showdelay)
*------------------------------------------*/
ACMD(invite) {
unsigned int did = sd->duel_group;
- struct map_session_data *target_sd = map->nick2sd((char *)message);
+ struct map_session_data *target_sd = map->nick2sd((const char *)message);
if (did == 0)
{
@@ -7740,7 +7740,7 @@ ACMD(duel) {
duel->create(sd, maxpl);
} else {
struct map_session_data *target_sd;
- target_sd = map->nick2sd((char *)message);
+ target_sd = map->nick2sd((const char *)message);
if (target_sd != NULL) {
unsigned int newduel;
if ((newduel = duel->create(sd, 2)) != -1) {
@@ -7882,7 +7882,7 @@ ACMD(clone) {
return false;
}
- if ((pl_sd=map->nick2sd((char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
+ if ((pl_sd=map->nick2sd((const char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
clif->message(fd, msg_fd(fd,3)); // Character not found.
return false;
}
diff --git a/src/map/battle.c b/src/map/battle.c
index 44adef051..4cf9a5b54 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -4783,12 +4783,10 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
//Assuming that 99% of the cases we will not need to check for the flag.rh... we don't.
//ATK_RATE scales the damage. 100 = no change. 50 is halved, 200 is doubled, etc
#define ATK_RATE( a ) do { int64 temp__ = (a); wd.damage= wd.damage*temp__/100 ; if(flag.lh) wd.damage2= wd.damage2*temp__/100; } while(0)
-#define ATK_RATE2( a , b ) do { wd.damage= wd.damage*(a)/100 ; if(flag.lh) wd.damage2= wd.damage2*(b)/100; } while(0)
#define ATK_RATER(a) ( wd.damage = wd.damage*(a)/100 )
#define ATK_RATEL(a) ( wd.damage2 = wd.damage2*(a)/100 )
//Adds dmg%. 100 = +100% (double) damage. 10 = +10% damage
#define ATK_ADDRATE( a ) do { int64 temp__ = (a); wd.damage+= wd.damage*temp__/100; if(flag.lh) wd.damage2+= wd.damage2*temp__/100; } while(0)
-#define ATK_ADDRATE2( a , b ) do { wd.damage+= wd.damage*(a)/100 ; if(flag.lh) wd.damage2+= wd.damage2*(b)/100; } while(0)
//Adds an absolute value to damage. 100 = +100 damage
#define ATK_ADD( a ) do { int64 temp__ = (a); wd.damage += temp__; if (flag.lh) wd.damage2 += temp__; } while(0)
#define ATK_ADD2( a , b ) do { wd.damage += (a); if (flag.lh) wd.damage2 += (b); } while(0)
@@ -6373,11 +6371,9 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
return wd.dmg_lv;
}
#undef ATK_RATE
-#undef ATK_RATE2
#undef ATK_RATER
#undef ATK_RATEL
#undef ATK_ADDRATE
-#undef ATK_ADDRATE2
#undef ATK_ADD
#undef ATK_ADD2
#undef GET_NORMAL_ATTACK
diff --git a/src/map/battleground.c b/src/map/battleground.c
index d25aef851..311690ec3 100644
--- a/src/map/battleground.c
+++ b/src/map/battleground.c
@@ -495,7 +495,8 @@ void bg_config_read(void) {
}
libconfig->destroy(&bg_conf);
}
-struct bg_arena *bg_name2arena (char *name) {
+struct bg_arena *bg_name2arena(const char *name)
+{
int i;
nullpo_retr(NULL, name);
for(i = 0; i < bg->arenas; i++) {
@@ -827,9 +828,9 @@ enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_
if ( ( tick = pc_readglobalreg(sd, script->add_str(bg->gdelay_var)) ) && tsec < tick ) {
char response[100];
if( (tick-tsec) > 60 )
- sprintf(response, "You are a deserter! Wait %d minute(s) before you can apply again",(tick-tsec)/60);
+ sprintf(response, "You are a deserter! Wait %u minute(s) before you can apply again", (tick - tsec) / 60);
else
- sprintf(response, "You are a deserter! Wait %d seconds before you can apply again",(tick-tsec));
+ sprintf(response, "You are a deserter! Wait %u seconds before you can apply again", (tick - tsec));
clif->messagecolor_self(sd->fd, COLOR_RED, response);
return BGQA_FAIL_DESERTER;
}
@@ -837,9 +838,9 @@ enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_
if ( ( tick = pc_readglobalreg(sd, script->add_str(arena->delay_var)) ) && tsec < tick ) {
char response[100];
if( (tick-tsec) > 60 )
- sprintf(response, "You can't reapply to this arena so fast. Apply to the different arena or wait %d minute(s)",(tick-tsec)/60);
+ sprintf(response, "You can't reapply to this arena so fast. Apply to the different arena or wait %u minute(s)", (tick - tsec) / 60);
else
- sprintf(response, "You can't reapply to this arena so fast. Apply to the different arena or wait %d seconds",(tick-tsec));
+ sprintf(response, "You can't reapply to this arena so fast. Apply to the different arena or wait %u seconds", (tick - tsec));
clif->messagecolor_self(sd->fd, COLOR_RED, response);
return BGQA_FAIL_COOLDOWN;
}
@@ -906,7 +907,7 @@ enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_
case BGQT_INDIVIDUAL:/* already did */
break;
default:
- ShowDebug("bg_canqueue: unknown/unsupported type %d\n",type);
+ ShowDebug("bg_canqueue: unknown/unsupported type %u\n", type);
return BGQA_DUPLICATE_REQUEST;
}
return BGQA_SUCCESS;
diff --git a/src/map/battleground.h b/src/map/battleground.h
index 639d91635..bb77db125 100644
--- a/src/map/battleground.h
+++ b/src/map/battleground.h
@@ -108,7 +108,7 @@ struct battleground_interface {
void (*init) (bool minimal);
void (*final) (void);
/* */
- struct bg_arena *(*name2arena) (char *name);
+ struct bg_arena *(*name2arena) (const char *name);
void (*queue_add) (struct map_session_data *sd, struct bg_arena *arena, enum bg_queue_types type);
enum BATTLEGROUNDS_QUEUE_ACK (*can_queue) (struct map_session_data *sd, struct bg_arena *arena, enum bg_queue_types type);
int (*id2pos) (int queue_id, int account_id);
diff --git a/src/map/channel.c b/src/map/channel.c
index 45b59898c..28ef854da 100644
--- a/src/map/channel.c
+++ b/src/map/channel.c
@@ -792,7 +792,7 @@ void read_channels_config(void)
}
}
- ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' channels in '"CL_WHITE"%s"CL_RESET"'.\n", db_size(channel->db), config_filename);
+ ShowStatus("Done reading '"CL_WHITE"%u"CL_RESET"' channels in '"CL_WHITE"%s"CL_RESET"'.\n", db_size(channel->db), config_filename);
}
libconfig->destroy(&channels_conf);
}
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 258d550d4..4de82ef07 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -110,7 +110,9 @@ struct chrif_interface *chrif;
#define chrif_check(a) do { if(!chrif->isconnected()) return a; } while(0)
/// Resets all the data.
-void chrif_reset(void) {
+void chrif_reset(void) __attribute__ ((noreturn));
+void chrif_reset(void)
+{
// TODO kick everyone out and reset everything [FlavioJS]
exit(EXIT_FAILURE);
}
@@ -362,7 +364,7 @@ void chrif_recvmap(int fd) {
}
if (battle_config.etc_log)
- ShowStatus("Received maps from %d.%d.%d.%d:%d (%d maps)\n", CONVIP(ip), port, j);
+ ShowStatus("Received maps from %u.%u.%u.%u:%u (%d maps)\n", CONVIP(ip), port, j);
chrif->other_mapserver_count++;
}
@@ -379,7 +381,7 @@ void chrif_removemap(int fd) {
chrif->other_mapserver_count--;
if(battle_config.etc_log)
- ShowStatus("remove map of server %d.%d.%d.%d:%d (%d maps)\n", CONVIP(ip), port, j);
+ ShowStatus("remove map of server %u.%u.%u.%u:%u (%d maps)\n", CONVIP(ip), port, j);
}
// received after a character has been "final saved" on the char-server
@@ -1410,7 +1412,7 @@ int chrif_parse(int fd) {
if (result == 1) continue; // Treated in intif
if (result == 2) return 0; // Didn't have enough data (len==-1)
- ShowWarning("chrif_parse: session #%d, intif->parse failed (unrecognized command 0x%.4x).\n", fd, cmd);
+ ShowWarning("chrif_parse: session #%d, intif->parse failed (unrecognized command 0x%.4x).\n", fd, (unsigned int)cmd);
sockt->eof(fd);
return 0;
}
@@ -1451,7 +1453,7 @@ int chrif_parse(int fd) {
case 0x2b25: chrif->deadopt(RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)); break;
case 0x2b27: chrif->authfail(fd); break;
default:
- ShowError("chrif_parse : unknown packet (session #%d): 0x%x. Disconnecting.\n", fd, cmd);
+ ShowError("chrif_parse : unknown packet (session #%d): 0x%x. Disconnecting.\n", fd, (unsigned int)cmd);
sockt->eof(fd);
return 0;
}
diff --git a/src/map/clif.c b/src/map/clif.c
index 66a8e92b8..a7d73d91f 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -645,7 +645,7 @@ bool clif_send(const void* buf, int len, struct block_list* bl, enum send_target
break;
default:
- ShowError("clif_send: Unrecognized type %d\n",type);
+ ShowError("clif_send: Unrecognized type %u\n", type);
return false;
}
@@ -8475,7 +8475,7 @@ void clif_charnameack (int fd, struct block_list *bl)
memcpy(WBUFP(buf,6), BL_UCCAST(BL_ELEM, bl)->db->name, NAME_LENGTH);
break;
default:
- ShowError("clif_charnameack: bad type %d(%d)\n", bl->type, bl->id);
+ ShowError("clif_charnameack: bad type %u(%d)\n", bl->type, bl->id);
return;
}
@@ -12717,7 +12717,7 @@ void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd)
clif->guild_expulsionlist(sd);
break;
default:
- ShowError("clif: guild request info: unknown type %d\n", RFIFOL(fd,2));
+ ShowError("clif: guild request info: unknown type %u\n", RFIFOL(fd,2));
break;
}
}
@@ -15417,7 +15417,7 @@ void clif_parse_cashshop_buy(int fd, struct map_session_data *sd)
unsigned short* item_list = (unsigned short*)RFIFOP(fd,10);
if( len < 10 || len != 10 + count * 4) {
- ShowWarning("Player %u sent incorrect cash shop buy packet (len %u:%u)!\n", sd->status.char_id, len, 10 + count * 4);
+ ShowWarning("Player %d sent incorrect cash shop buy packet (len %d:%d)!\n", sd->status.char_id, len, 10 + count * 4);
return;
}
fail = npc->cashshop_buylist(sd,points,count,item_list);
@@ -16528,7 +16528,7 @@ void clif_parse_ReqOpenBuyingStore(int fd, struct map_session_data* sd) {
// TODO: Make this check global for all variable length packets.
if( packet_len < 89 )
{// minimum packet length
- ShowError("clif_parse_ReqOpenBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n", 89, packet_len, sd->bl.id);
+ ShowError("clif_parse_ReqOpenBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n", 89U, packet_len, sd->bl.id);
return;
}
@@ -16707,7 +16707,7 @@ void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) {
if( packet_len < 12 )
{// minimum packet length
- ShowError("clif_parse_ReqTradeBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n", 12, packet_len, sd->bl.id);
+ ShowError("clif_parse_ReqTradeBuyingStore: Malformed packet (expected length=%u, length=%u, account_id=%d).\n", 12U, packet_len, sd->bl.id);
return;
}
@@ -16720,7 +16720,7 @@ void clif_parse_ReqTradeBuyingStore(int fd, struct map_session_data* sd) {
if( packet_len%blocksize )
{
- ShowError("clif_parse_ReqTradeBuyingStore: Unexpected item list size %u (account_id=%d, buyer_id=%u, block size=%u)\n", packet_len, sd->bl.id, account_id, blocksize);
+ ShowError("clif_parse_ReqTradeBuyingStore: Unexpected item list size %u (account_id=%d, buyer_id=%d, block size=%u)\n", packet_len, sd->bl.id, account_id, blocksize);
return;
}
count = packet_len/blocksize;
@@ -16827,7 +16827,7 @@ void clif_parse_SearchStoreInfo(int fd, struct map_session_data* sd) {
if( packet_len < 15 )
{// minimum packet length
- ShowError("clif_parse_SearchStoreInfo: Malformed packet (expected length=%u, length=%u, account_id=%d).\n", 15, packet_len, sd->bl.id);
+ ShowError("clif_parse_SearchStoreInfo: Malformed packet (expected length=%u, length=%u, account_id=%d).\n", 15U, packet_len, sd->bl.id);
return;
}
@@ -17009,10 +17009,10 @@ void clif_parse_debug(int fd,struct map_session_data *sd) {
if( packet_len == -1 ) {// variable length
packet_len = RFIFOW(fd,2); // clif_parse ensures, that this amount of data is already received
}
- ShowDebug("Packet debug of 0x%04X (length %d), %s session #%d, %d/%d (AID/CID)\n", cmd, packet_len, sd->state.active ? "authed" : "unauthed", fd, sd->status.account_id, sd->status.char_id);
+ ShowDebug("Packet debug of 0x%04X (length %d), %s session #%d, %d/%d (AID/CID)\n", (unsigned int)cmd, packet_len, sd->state.active ? "authed" : "unauthed", fd, sd->status.account_id, sd->status.char_id);
} else {
packet_len = (int)RFIFOREST(fd);
- ShowDebug("Packet debug of 0x%04X (length %d), session #%d\n", cmd, packet_len, fd);
+ ShowDebug("Packet debug of 0x%04X (length %d), session #%d\n", (unsigned int)cmd, packet_len, fd);
}
ShowDump(RFIFOP(fd,0), packet_len);
@@ -18757,7 +18757,7 @@ int clif_parse(int fd) {
// filter out invalid / unsupported packets
if (cmd > MAX_PACKET_DB || cmd < MIN_PACKET_DB || packet_db[cmd].len == 0) {
ShowWarning("clif_parse: Received unsupported packet (packet 0x%04x (0x%04x), %"PRIuS" bytes received), disconnecting session #%d.\n",
- cmd, RFIFOW(fd,0), RFIFOREST(fd), fd);
+ (unsigned int)cmd, RFIFOW(fd,0), RFIFOREST(fd), fd);
#ifdef DUMP_INVALID_PACKET
ShowDump(RFIFOP(fd,0), RFIFOREST(fd));
#endif
@@ -18773,7 +18773,7 @@ int clif_parse(int fd) {
packet_len = RFIFOW(fd,2);
if (packet_len < 4 || packet_len > 32768) {
- ShowWarning("clif_parse: Received packet 0x%04x specifies invalid packet_len (%d), disconnecting session #%d.\n", cmd, packet_len, fd);
+ ShowWarning("clif_parse: Received packet 0x%04x specifies invalid packet_len (%d), disconnecting session #%d.\n", (unsigned int)cmd, packet_len, fd);
#ifdef DUMP_INVALID_PACKET
ShowDump(RFIFOP(fd,0), RFIFOREST(fd));
#endif
@@ -18861,12 +18861,12 @@ static void __attribute__ ((unused)) packetdb_addpacket(short cmd, int len, ...)
pFunc func;
if (cmd > MAX_PACKET_DB) {
- ShowError("Packet Error: packet 0x%x is greater than the maximum allowed (0x%x), skipping...\n", cmd, MAX_PACKET_DB);
+ ShowError("Packet Error: packet 0x%x is greater than the maximum allowed (0x%x), skipping...\n", (unsigned int)cmd, (unsigned int)MAX_PACKET_DB);
return;
}
if (cmd < MIN_PACKET_DB) {
- ShowError("Packet Error: packet 0x%x is lower than the minimum allowed (0x%x), skipping...\n", cmd, MIN_PACKET_DB);
+ ShowError("Packet Error: packet 0x%x is lower than the minimum allowed (0x%x), skipping...\n", (unsigned int)cmd, (unsigned int)MIN_PACKET_DB);
return;
}
diff --git a/src/map/instance.c b/src/map/instance.c
index 5e8256c88..a6700d486 100644
--- a/src/map/instance.c
+++ b/src/map/instance.c
@@ -106,7 +106,7 @@ int instance_create(int owner_id, const char *name, enum instance_owner_type typ
icptr = &g->instances;
break;
default:
- ShowError("instance_create: unknown type %d for owner_id %d and name %s.\n", type,owner_id,name);
+ ShowError("instance_create: unknown type %u for owner_id %d and name %s.\n", type, owner_id, name);
return -1;
}
@@ -591,7 +591,7 @@ void instance_destroy(int instance_id) {
icptr = &g->instances;
break;
default:
- ShowError("instance_destroy: unknown type %d for owner_id %d and name '%s'.\n", instance->list[instance_id].owner_type,instance->list[instance_id].owner_id,instance->list[instance_id].name);
+ ShowError("instance_destroy: unknown type %u for owner_id %d and name '%s'.\n", instance->list[instance_id].owner_type, instance->list[instance_id].owner_id, instance->list[instance_id].name);
break;
}
diff --git a/src/map/intif.c b/src/map/intif.c
index 1968ebe67..9722b8f9a 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -1156,7 +1156,7 @@ void intif_parse_LoadGuildStorage(int fd)
sd=map->id2sd( RFIFOL(fd,4) );
if( flag ){ //If flag != 0, we attach a player and open the storage
if(sd==NULL){
- ShowError("intif_parse_LoadGuildStorage: user not found %d\n",RFIFOL(fd,4));
+ ShowError("intif_parse_LoadGuildStorage: user not found %u\n", RFIFOL(fd,4));
return;
}
}
@@ -1194,20 +1194,20 @@ void intif_parse_SaveGuildStorage(int fd)
void intif_parse_PartyCreated(int fd)
{
if(battle_config.etc_log)
- ShowInfo("intif: party created by account %d\n\n", RFIFOL(fd,2));
+ ShowInfo("intif: party created by account %u\n\n", RFIFOL(fd,2));
party->created(RFIFOL(fd,2), RFIFOL(fd,6),RFIFOB(fd,10),RFIFOL(fd,11), (char *)RFIFOP(fd,15));
}
// Receive party info
void intif_parse_PartyInfo(int fd) {
if (RFIFOW(fd,2) == 12) {
- ShowWarning("intif: party noinfo (char_id=%d party_id=%d)\n", RFIFOL(fd,4), RFIFOL(fd,8));
+ ShowWarning("intif: party noinfo (char_id=%u party_id=%u)\n", RFIFOL(fd,4), RFIFOL(fd,8));
party->recv_noinfo(RFIFOL(fd,8), RFIFOL(fd,4));
return;
}
if (RFIFOW(fd,2) != 8+sizeof(struct party))
- ShowError("intif: party info: data size mismatch (char_id=%d party_id=%d packet_len=%d expected_len=%"PRIuS")\n",
+ ShowError("intif: party info: data size mismatch (char_id=%u party_id=%u packet_len=%d expected_len=%"PRIuS")\n",
RFIFOL(fd,4), RFIFOL(fd,8), RFIFOW(fd,2), 8+sizeof(struct party));
party->recv_info((struct party *)RFIFOP(fd,8), RFIFOL(fd,4));
}
@@ -1216,7 +1216,7 @@ void intif_parse_PartyInfo(int fd) {
void intif_parse_PartyMemberAdded(int fd)
{
if(battle_config.etc_log)
- ShowInfo("intif: party member added Party (%d), Account(%d), Char(%d)\n",RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10));
+ ShowInfo("intif: party member added Party (%u), Account(%u), Char(%u)\n", RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10));
party->member_added(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10), RFIFOB(fd, 14));
}
@@ -1230,7 +1230,7 @@ void intif_parse_PartyOptionChanged(int fd)
void intif_parse_PartyMemberWithdraw(int fd)
{
if(battle_config.etc_log)
- ShowInfo("intif: party member withdraw: Party(%d), Account(%d), Char(%d)\n",RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10));
+ ShowInfo("intif: party member withdraw: Party(%u), Account(%u), Char(%u)\n", RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10));
party->member_withdraw(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10));
}
@@ -1258,20 +1258,20 @@ void intif_parse_GuildCreated(int fd) {
// ACK guild infos
void intif_parse_GuildInfo(int fd) {
if (RFIFOW(fd,2) == 8) {
- ShowWarning("intif: guild noinfo %d\n",RFIFOL(fd,4));
+ ShowWarning("intif: guild noinfo %u\n", RFIFOL(fd,4));
guild->recv_noinfo(RFIFOL(fd,4));
return;
}
if (RFIFOW(fd,2)!=sizeof(struct guild)+4)
- ShowError("intif: guild info: data size mismatch - Gid: %d recv size: %d Expected size: %"PRIuS"\n",
- RFIFOL(fd,4),RFIFOW(fd,2),sizeof(struct guild)+4);
+ ShowError("intif: guild info: data size mismatch - Gid: %u recv size: %d Expected size: %"PRIuS"\n",
+ RFIFOL(fd,4), RFIFOW(fd,2), sizeof(struct guild)+4);
guild->recv_info((struct guild *)RFIFOP(fd,4));
}
// ACK adding guild member
void intif_parse_GuildMemberAdded(int fd) {
if(battle_config.etc_log)
- ShowInfo("intif: guild member added %d %d %d %d\n",RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14));
+ ShowInfo("intif: guild member added %u %u %u %d\n", RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOB(fd,14));
guild->member_added(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14));
}
@@ -1357,8 +1357,8 @@ void intif_parse_GuildMemberInfoChanged(int fd) {
// ACK change of guild title
void intif_parse_GuildPosition(int fd) {
if (RFIFOW(fd,2)!=sizeof(struct guild_position)+12)
- ShowError("intif: guild info: data size mismatch (%d) %d != %"PRIuS"\n",
- RFIFOL(fd,4),RFIFOW(fd,2),sizeof(struct guild_position)+12);
+ ShowError("intif: guild info: data size mismatch (%u) %d != %"PRIuS"\n",
+ RFIFOL(fd,4), RFIFOW(fd,2), sizeof(struct guild_position) + 12);
guild->position_changed(RFIFOL(fd,4),RFIFOL(fd,8),(struct guild_position *)RFIFOP(fd,12));
}
@@ -1476,7 +1476,7 @@ void intif_parse_RecvHomunculusData(int fd) {
/* Really? Whats the point, shouldn't be sent when successful then [Ind] */
void intif_parse_SaveHomunculusOk(int fd) {
if(RFIFOB(fd,6) != 1)
- ShowError("homunculus data save failure for account %d\n", RFIFOL(fd,2));
+ ShowError("homunculus data save failure for account %u\n", RFIFOL(fd,2));
}
/* Really? Whats the point, shouldn't be sent when successful then [Ind] */
@@ -1691,7 +1691,7 @@ void intif_parse_MailGetAttach(int fd) {
sd = map->charid2sd( RFIFOL(fd,4) );
if (sd == NULL) {
- ShowError("intif_parse_MailGetAttach: char not found %d\n",RFIFOL(fd,4));
+ ShowError("intif_parse_MailGetAttach: char not found %u\n", RFIFOL(fd,4));
return;
}
@@ -1769,7 +1769,7 @@ void intif_parse_MailReturn(int fd) {
short fail = RFIFOB(fd,10);
if( sd == NULL ) {
- ShowError("intif_parse_MailReturn: char not found %d\n",RFIFOL(fd,2));
+ ShowError("intif_parse_MailReturn: char not found %u\n", RFIFOL(fd, 2));
return;
}
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index da72ab05a..451f447fb 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -1280,7 +1280,7 @@ void itemdb_read_combos(void)
if (!strchr(p,',')) {
/* is there even a single column? */
- ShowError("itemdb_read_combos: Insufficient columns in line %d of \"%s\", skipping.\n", lines, filepath);
+ ShowError("itemdb_read_combos: Insufficient columns in line %u of \"%s\", skipping.\n", lines, filepath);
continue;
}
@@ -1294,13 +1294,13 @@ void itemdb_read_combos(void)
p++;
if (str[1][0] != '{') {
- ShowError("itemdb_read_combos(#1): Invalid format (Script column) in line %d of \"%s\", skipping.\n", lines, filepath);
+ ShowError("itemdb_read_combos(#1): Invalid format (Script column) in line %u of \"%s\", skipping.\n", lines, filepath);
continue;
}
/* no ending key anywhere (missing \}\) */
if ( str[1][strlen(str[1])-1] != '}' ) {
- ShowError("itemdb_read_combos(#2): Invalid format (Script column) in line %d of \"%s\", skipping.\n", lines, filepath);
+ ShowError("itemdb_read_combos(#2): Invalid format (Script column) in line %u of \"%s\", skipping.\n", lines, filepath);
continue;
} else {
int items[MAX_ITEMS_PER_COMBO];
@@ -1308,14 +1308,14 @@ void itemdb_read_combos(void)
struct item_combo *combo = NULL;
if((retcount = itemdb->combo_split_atoi(str[0], items)) < 2) {
- ShowError("itemdb_read_combos: line %d of \"%s\" doesn't have enough items to make for a combo (min:2), skipping.\n", lines, filepath);
+ ShowError("itemdb_read_combos: line %u of \"%s\" doesn't have enough items to make for a combo (min:2), skipping.\n", lines, filepath);
continue;
}
/* validate */
for(v = 0; v < retcount; v++) {
if( !itemdb->exists(items[v]) ) {
- ShowError("itemdb_read_combos: line %d of \"%s\" contains unknown item ID %d, skipping.\n", lines, filepath,items[v]);
+ ShowError("itemdb_read_combos: line %u of \"%s\" contains unknown item ID %d, skipping.\n", lines, filepath, items[v]);
break;
}
}
@@ -1456,7 +1456,7 @@ int itemdb_validate_entry(struct item_data *entry, int n, const char *source) {
if (entry->flag.trade_restriction > ITR_ALL) {
ShowWarning("itemdb_validate_entry: Invalid trade restriction flag 0x%x for item %d (%s) in '%s', defaulting to none.\n",
- entry->flag.trade_restriction, entry->nameid, entry->jname, source);
+ (unsigned int)entry->flag.trade_restriction, entry->nameid, entry->jname, source);
entry->flag.trade_restriction = ITR_NONE;
}
diff --git a/src/map/log.c b/src/map/log.c
index 942acb706..f757faf43 100644
--- a/src/map/log.c
+++ b/src/map/log.c
@@ -66,7 +66,7 @@ char log_picktype2char(e_log_pick_type type) {
}
// should not get here, fallback
- ShowDebug("log_picktype2char: Unknown pick type %d.\n", type);
+ ShowDebug("log_picktype2char: Unknown pick type %u.\n", type);
return 'X';
}
@@ -81,7 +81,7 @@ char log_chattype2char(e_log_chat_type type) {
}
// should not get here, fallback
- ShowDebug("log_chattype2char: Unknown chat type %d.\n", type);
+ ShowDebug("log_chattype2char: Unknown chat type %u.\n", type);
return 'O';
}
diff --git a/src/map/map.c b/src/map/map.c
index c17dd9b0e..f2e47be74 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -5017,7 +5017,7 @@ void read_map_zone_db(void) {
zone_e = libconfig->setting_get_elem(zones, i);
if (!libconfig->setting_lookup_string(zone_e, "name", &zonename)) {
- ShowError("map_zone_db: missing zone name, skipping... (%s:%d)\n",
+ ShowError("map_zone_db: missing zone name, skipping... (%s:%u)\n",
config_setting_source_file(zone_e), config_setting_source_line(zone_e));
libconfig->setting_remove_elem(zones,i);/* remove from the tree */
--zone_count;
diff --git a/src/map/mapreg_sql.c b/src/map/mapreg_sql.c
index 9bf67196e..46962ac14 100644
--- a/src/map/mapreg_sql.c
+++ b/src/map/mapreg_sql.c
@@ -97,7 +97,7 @@ bool mapreg_setreg(int64 uid, int val) {
if (name[1] != '@' && !mapreg->skip_insert) {// write new variable to database
char tmp_str[(SCRIPT_VARNAME_LENGTH+1)*2+1];
SQL->EscapeStringLen(map->mysql_handle, tmp_str, name, strnlen(name, SCRIPT_VARNAME_LENGTH+1));
- if( SQL_ERROR == SQL->Query(map->mysql_handle, "INSERT INTO `%s`(`varname`,`index`,`value`) VALUES ('%s','%d','%d')", mapreg->table, tmp_str, i, val) )
+ if( SQL_ERROR == SQL->Query(map->mysql_handle, "INSERT INTO `%s`(`varname`,`index`,`value`) VALUES ('%s','%u','%d')", mapreg->table, tmp_str, i, val) )
Sql_ShowDebug(map->mysql_handle);
}
i64db_put(mapreg->regs.vars, uid, m);
@@ -111,7 +111,7 @@ bool mapreg_setreg(int64 uid, int val) {
i64db_remove(mapreg->regs.vars, uid);
if( name[1] != '@' ) {// Remove from database because it is unused.
- if( SQL_ERROR == SQL->Query(map->mysql_handle, "DELETE FROM `%s` WHERE `varname`='%s' AND `index`='%d'", mapreg->table, name, i) )
+ if( SQL_ERROR == SQL->Query(map->mysql_handle, "DELETE FROM `%s` WHERE `varname`='%s' AND `index`='%u'", mapreg->table, name, i) )
Sql_ShowDebug(map->mysql_handle);
}
}
@@ -136,7 +136,7 @@ bool mapreg_setregstr(int64 uid, const char* str) {
if( i )
script->array_update(&mapreg->regs, uid, true);
if(name[1] != '@') {
- if( SQL_ERROR == SQL->Query(map->mysql_handle, "DELETE FROM `%s` WHERE `varname`='%s' AND `index`='%d'", mapreg->table, name, i) )
+ if (SQL_ERROR == SQL->Query(map->mysql_handle, "DELETE FROM `%s` WHERE `varname`='%s' AND `index`='%u'", mapreg->table, name, i))
Sql_ShowDebug(map->mysql_handle);
}
if( (m = i64db_get(mapreg->regs.vars, uid)) ) {
@@ -170,7 +170,7 @@ bool mapreg_setregstr(int64 uid, const char* str) {
char tmp_str2[255*2+1];
SQL->EscapeStringLen(map->mysql_handle, tmp_str, name, strnlen(name, SCRIPT_VARNAME_LENGTH+1));
SQL->EscapeStringLen(map->mysql_handle, tmp_str2, str, strnlen(str, 255));
- if( SQL_ERROR == SQL->Query(map->mysql_handle, "INSERT INTO `%s`(`varname`,`index`,`value`) VALUES ('%s','%d','%s')", mapreg->table, tmp_str, i, tmp_str2) )
+ if( SQL_ERROR == SQL->Query(map->mysql_handle, "INSERT INTO `%s`(`varname`,`index`,`value`) VALUES ('%s','%u','%s')", mapreg->table, tmp_str, i, tmp_str2) )
Sql_ShowDebug(map->mysql_handle);
}
i64db_put(mapreg->regs.vars, uid, m);
diff --git a/src/map/mob.c b/src/map/mob.c
index 2ae54ba69..b2f52f634 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -744,7 +744,7 @@ int mob_spawn_bg(const char* mapname, short x, short y, const char* mobname, int
data.class_ = class_;
if( (x <= 0 || y <= 0) && !map->search_freecell(NULL, m, &x, &y, -1,-1, 1) ) {
- ShowWarning("mob_spawn_bg: Couldn't locate a spawn cell for guardian class %d (bg_id %d) at map %s\n",class_, bg_id, map->list[m].name);
+ ShowWarning("mob_spawn_bg: Couldn't locate a spawn cell for guardian class %d (bg_id %u) at map %s\n", class_, bg_id, map->list[m].name);
return 0;
}
@@ -4681,7 +4681,7 @@ void mob_readchatdb(void) {
if( j < 2 || str[2]==NULL)
{
- ShowError("mob_readchatdb: Insufficient number of fields for skill at %s, line %d\n", arc, lines);
+ ShowError("mob_readchatdb: Insufficient number of fields for skill at %s, line %u\n", arc, lines);
continue;
}
diff --git a/src/map/npc.c b/src/map/npc.c
index 23b0b9555..837bc6871 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1564,8 +1564,8 @@ void npc_market_fromsql(void) {
* Saves persistent NPC Market Data into SQL
**/
void npc_market_tosql(struct npc_data *nd, unsigned short index) {
- if( SQL_ERROR == SQL->Query(map->mysql_handle, "REPLACE INTO `%s` VALUES ('%s','%d','%d')",
- map->npc_market_data_db, nd->exname, nd->u.scr.shop->item[index].nameid, nd->u.scr.shop->item[index].qty) )
+ if (SQL_ERROR == SQL->Query(map->mysql_handle, "REPLACE INTO `%s` VALUES ('%s','%d','%u')",
+ map->npc_market_data_db, nd->exname, nd->u.scr.shop->item[index].nameid, nd->u.scr.shop->item[index].qty))
Sql_ShowDebug(map->mysql_handle);
}
/**
@@ -1771,7 +1771,7 @@ int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int po
if ((int64)shop[i].value * amount > INT_MAX) {
ShowWarning("npc_cashshop_buy: Item '%s' (%d) price overflow attempt!\n", item->name, nameid);
- ShowDebug("(NPC:'%s' (%s,%d,%d), player:'%s' (%d/%d), value:%d, amount:%d)\n",
+ ShowDebug("(NPC:'%s' (%s,%d,%d), player:'%s' (%d/%d), value:%u, amount:%d)\n",
nd->exname, map->list[nd->bl.m].name, nd->bl.x, nd->bl.y,
sd->status.name, sd->status.account_id, sd->status.char_id,
shop[i].value, amount);
@@ -2501,7 +2501,7 @@ void npc_parsename(struct npc_data* nd, const char* name, const char* start, con
if( p ) { // <Display name>::<Unique name>
size_t len = p-name;
if( len > NAME_LENGTH ) {
- ShowWarning("npc_parsename: Display name of '%s' is too long (len=%u) in file '%s', line '%d'. Truncating to %u characters.\n", name, (unsigned int)len, filepath, strline(buffer,start-buffer), NAME_LENGTH);
+ ShowWarning("npc_parsename: Display name of '%s' is too long (len=%u) in file '%s', line '%d'. Truncating to %d characters.\n", name, (unsigned int)len, filepath, strline(buffer,start-buffer), NAME_LENGTH);
safestrncpy(nd->name, name, sizeof(nd->name));
} else {
memcpy(nd->name, name, len);
@@ -2509,12 +2509,12 @@ void npc_parsename(struct npc_data* nd, const char* name, const char* start, con
}
len = strlen(p+2);
if( len > NAME_LENGTH )
- ShowWarning("npc_parsename: Unique name of '%s' is too long (len=%u) in file '%s', line '%d'. Truncating to %u characters.\n", name, (unsigned int)len, filepath, strline(buffer,start-buffer), NAME_LENGTH);
+ ShowWarning("npc_parsename: Unique name of '%s' is too long (len=%u) in file '%s', line '%d'. Truncating to %d characters.\n", name, (unsigned int)len, filepath, strline(buffer,start-buffer), NAME_LENGTH);
safestrncpy(nd->exname, p+2, sizeof(nd->exname));
} else {// <Display name>
size_t len = strlen(name);
if( len > NAME_LENGTH )
- ShowWarning("npc_parsename: Name '%s' is too long (len=%u) in file '%s', line '%d'. Truncating to %u characters.\n", name, (unsigned int)len, filepath, strline(buffer,start-buffer), NAME_LENGTH);
+ ShowWarning("npc_parsename: Name '%s' is too long (len=%u) in file '%s', line '%d'. Truncating to %d characters.\n", name, (unsigned int)len, filepath, strline(buffer,start-buffer), NAME_LENGTH);
safestrncpy(nd->name, name, sizeof(nd->name));
safestrncpy(nd->exname, name, sizeof(nd->exname));
}
@@ -4536,7 +4536,7 @@ int npc_script_event(struct map_session_data* sd, enum npce_event type)
if (type == NPCE_MAX)
return 0;
if (!sd) {
- ShowError("npc_script_event: NULL sd. Event Type %d\n", type);
+ ShowError("npc_script_event: NULL sd. Event Type %u\n", type);
return 0;
}
for (i = 0; i<script_event[type].event_count; i++)
diff --git a/src/map/pc.c b/src/map/pc.c
index fb6fc523c..919205b81 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1212,7 +1212,7 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
//display login notice
ShowInfo("'"CL_WHITE"%s"CL_RESET"' logged in."
" (AID/CID: '"CL_WHITE"%d/%d"CL_RESET"',"
- " IP: '"CL_WHITE"%d.%d.%d.%d"CL_RESET"',"
+ " IP: '"CL_WHITE"%u.%u.%u.%u"CL_RESET"',"
" Group '"CL_WHITE"%d"CL_RESET"').\n",
sd->status.name, sd->status.account_id, sd->status.char_id,
CONVIP(ip), sd->group_id);
@@ -7196,7 +7196,7 @@ int pc_resetstate(struct map_session_data* sd)
// New statpoint table used here - Dexity
if (sd->status.base_level > MAX_LEVEL) {
//pc->statp[] goes out of bounds, can't reset!
- ShowError("pc_resetstate: Can't reset stats of %d:%d, the base level (%d) is greater than the max level supported (%d)\n",
+ ShowError("pc_resetstate: Can't reset stats of %d:%d, the base level (%u) is greater than the max level supported (%d)\n",
sd->status.account_id, sd->status.char_id, sd->status.base_level, MAX_LEVEL);
return 0;
}
@@ -9565,7 +9565,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
pos = pc->equippoint(sd,n); //With a few exceptions, item should go in all specified slots.
if(battle_config.battle_log)
- ShowInfo("equip %d(%d) %x:%x\n",sd->status.inventory[n].nameid,n,id?id->equip:0,req_pos);
+ ShowInfo("equip %d(%d) %x:%x\n", sd->status.inventory[n].nameid, n, (unsigned int)(id ? id->equip : 0), (unsigned int)req_pos);
if(!pc->isequip(sd,n) || !(pos&req_pos) || sd->status.inventory[n].equip != 0 || sd->status.inventory[n].attribute==1 ) { // [Valaris]
// FIXME: pc->isequip: equip level failure uses 2 instead of 0
clif->equipitemack(sd,n,0,EIA_FAIL); // fail
@@ -9773,7 +9773,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag)
}
if(battle_config.battle_log)
- ShowInfo("unequip %d %x:%x\n",n,pc->equippoint(sd,n),sd->status.inventory[n].equip);
+ ShowInfo("unequip %d %x:%x\n", n, (unsigned int)(pc->equippoint(sd, n)), sd->status.inventory[n].equip);
if(!sd->status.inventory[n].equip){ //Nothing to unequip
clif->unequipitemack(sd,n,0,UIA_FAIL);
@@ -10927,7 +10927,7 @@ int pc_readdb(void) {
}
maxlv = atoi(split[0]);
if (maxlv > MAX_LEVEL) {
- ShowWarning("pc_readdb: Specified max level %u for job %d is beyond server's limit (%u).\n ", maxlv, job_id, MAX_LEVEL);
+ ShowWarning("pc_readdb: Specified max level %u for job %d is beyond server's limit (%d).\n ", maxlv, job_id, MAX_LEVEL);
maxlv = MAX_LEVEL;
}
count++;
@@ -11353,7 +11353,7 @@ void pc_autotrade_update(struct map_session_data *sd, enum e_pc_autotrade_update
if( sd->vending[i].amount == 0 )
continue;
- if (SQL_ERROR == SQL->Query(map->mysql_handle, "INSERT INTO `%s` (`char_id`,`itemkey`,`amount`,`price`) VALUES ('%d','%d','%d','%d')",
+ if (SQL_ERROR == SQL->Query(map->mysql_handle, "INSERT INTO `%s` (`char_id`,`itemkey`,`amount`,`price`) VALUES ('%d','%d','%d','%u')",
map->autotrade_data_db,
sd->status.char_id,
sd->status.cart[sd->vending[i].index].id,
diff --git a/src/map/pc_groups.c b/src/map/pc_groups.c
index 72935adc3..b325a8ed7 100644
--- a/src/map/pc_groups.c
+++ b/src/map/pc_groups.c
@@ -110,7 +110,7 @@ static void read_config(void) {
snprintf(temp, sizeof(temp), "Group %d", id);
if ((name = config_setting_add(group, "name", CONFIG_TYPE_STRING)) == NULL ||
!config_setting_set_string(name, temp)) {
- ShowError("pc_groups:read_config: failed to set missing group name, id=%d, skipping... (%s:%d)\n",
+ ShowError("pc_groups:read_config: failed to set missing group name, id=%d, skipping... (%s:%u)\n",
id, config_setting_source_file(group), config_setting_source_line(group));
--i;
--group_count;
@@ -446,7 +446,7 @@ void do_init_pc_groups(void) {
for(i = 0; i < len; i++) {
unsigned int p;
if( ( p = pc_groups_add_permission(pc_g_defaults[i].name) ) != pc_g_defaults[i].permission )
- ShowError("do_init_pc_groups: %s error : %d != %d\n",pc_g_defaults[i].name,p,pc_g_defaults[i].permission);
+ ShowError("do_init_pc_groups: %s error : %u != %u\n", pc_g_defaults[i].name, p, pc_g_defaults[i].permission);
}
/**
diff --git a/src/map/quest.c b/src/map/quest.c
index 7e2421c79..bf0a76b16 100644
--- a/src/map/quest.c
+++ b/src/map/quest.c
@@ -409,7 +409,7 @@ int quest_check(struct map_session_data *sd, int quest_id, enum quest_check_type
}
return 0;
default:
- ShowError("quest_check_quest: Unknown parameter %d",type);
+ ShowError("quest_check_quest: Unknown parameter %u", type);
break;
}
diff --git a/src/map/script.c b/src/map/script.c
index 4b3bf960c..946b50955 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -235,9 +235,9 @@ void script_reportsrc(struct script_state *st) {
break;
default:
if( bl->m >= 0 )
- ShowDebug("Source (Non-NPC type %d): name %s at %s (%d,%d)\n", bl->type, status->get_name(bl), map->list[bl->m].name, bl->x, bl->y);
+ ShowDebug("Source (Non-NPC type %u): name %s at %s (%d,%d)\n", bl->type, status->get_name(bl), map->list[bl->m].name, bl->x, bl->y);
else
- ShowDebug("Source (Non-NPC type %d): name %s (invisible/not on a map)\n", bl->type, status->get_name(bl));
+ ShowDebug("Source (Non-NPC type %u): name %s (invisible/not on a map)\n", bl->type, status->get_name(bl));
break;
}
}
@@ -265,7 +265,7 @@ void script_reportdata(struct script_data* data)
case C_NAME:// reference
if( reference_tovariable(data) ) {// variable
const char* name = reference_getname(data);
- ShowDebug("Data: variable name='%s' index=%d\n", name, reference_getindex(data));
+ ShowDebug("Data: variable name='%s' index=%u\n", name, reference_getindex(data));
} else if( reference_toconstant(data) ) {// constant
ShowDebug("Data: constant name='%s' value=%d\n", reference_getname(data), reference_getconstant(data));
} else if( reference_toparam(data) ) {// param
@@ -1566,32 +1566,32 @@ const char* parse_curly_close(const char* p)
char label[256];
int l;
// Remove temporary variables
- sprintf(label,"__setr $@__SW%x_VAL,0;",script->syntax.curly[pos].index);
+ sprintf(label, "__setr $@__SW%x_VAL,0;", (unsigned int)script->syntax.curly[pos].index);
script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL;
script->parse_line(label);
script->syntax.curly_count--;
// Go to the end pointer unconditionally
- sprintf(label,"goto __SW%x_FIN;",script->syntax.curly[pos].index);
+ sprintf(label,"goto __SW%x_FIN;", (unsigned int)script->syntax.curly[pos].index);
script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL;
script->parse_line(label);
script->syntax.curly_count--;
// You are here labeled
- sprintf(label,"__SW%x_%x",script->syntax.curly[pos].index,script->syntax.curly[pos].count);
+ sprintf(label,"__SW%x_%x", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count);
l=script->add_str(label);
script->set_label(l,script->pos, p);
if(script->syntax.curly[pos].flag) {
//Exists default
- sprintf(label,"goto __SW%x_DEF;",script->syntax.curly[pos].index);
+ sprintf(label,"goto __SW%x_DEF;", (unsigned int)script->syntax.curly[pos].index);
script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL;
script->parse_line(label);
script->syntax.curly_count--;
}
// Label end
- sprintf(label,"__SW%x_FIN",script->syntax.curly[pos].index);
+ sprintf(label,"__SW%x_FIN", (unsigned int)script->syntax.curly[pos].index);
l=script->add_str(label);
script->set_label(l,script->pos, p);
linkdb_final(&script->syntax.curly[pos].case_label); // free the list of case label
@@ -1621,16 +1621,16 @@ const char* parse_syntax(const char* p)
int pos = script->syntax.curly_count - 1;
while(pos >= 0) {
if(script->syntax.curly[pos].type == TYPE_DO) {
- sprintf(label,"goto __DO%x_FIN;",script->syntax.curly[pos].index);
+ sprintf(label, "goto __DO%x_FIN;", (unsigned int)script->syntax.curly[pos].index);
break;
} else if(script->syntax.curly[pos].type == TYPE_FOR) {
- sprintf(label,"goto __FR%x_FIN;",script->syntax.curly[pos].index);
+ sprintf(label, "goto __FR%x_FIN;", (unsigned int)script->syntax.curly[pos].index);
break;
} else if(script->syntax.curly[pos].type == TYPE_WHILE) {
- sprintf(label,"goto __WL%x_FIN;",script->syntax.curly[pos].index);
+ sprintf(label, "goto __WL%x_FIN;", (unsigned int)script->syntax.curly[pos].index);
break;
} else if(script->syntax.curly[pos].type == TYPE_SWITCH) {
- sprintf(label,"goto __SW%x_FIN;",script->syntax.curly[pos].index);
+ sprintf(label, "goto __SW%x_FIN;", (unsigned int)script->syntax.curly[pos].index);
break;
}
pos--;
@@ -1664,13 +1664,13 @@ const char* parse_syntax(const char* p)
char *np;
if(script->syntax.curly[pos].count != 1) {
//Jump for FALLTHRU
- sprintf(label,"goto __SW%x_%xJ;",script->syntax.curly[pos].index,script->syntax.curly[pos].count);
+ sprintf(label,"goto __SW%x_%xJ;", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count);
script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL;
script->parse_line(label);
script->syntax.curly_count--;
// You are here labeled
- sprintf(label,"__SW%x_%x",script->syntax.curly[pos].index,script->syntax.curly[pos].count);
+ sprintf(label,"__SW%x_%x", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count);
l=script->add_str(label);
script->set_label(l,script->pos, p);
}
@@ -1702,7 +1702,7 @@ const char* parse_syntax(const char* p)
if(*p != ':')
disp_error_message("parse_syntax: expect ':'",p);
sprintf(label,"if(%d != $@__SW%x_VAL) goto __SW%x_%x;",
- v,script->syntax.curly[pos].index,script->syntax.curly[pos].index,script->syntax.curly[pos].count+1);
+ v, (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count+1);
script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL;
// Bad I do not parse twice
p2 = script->parse_line(label);
@@ -1710,7 +1710,7 @@ const char* parse_syntax(const char* p)
script->syntax.curly_count--;
if(script->syntax.curly[pos].count != 1) {
// Label after the completion of FALLTHRU
- sprintf(label,"__SW%x_%xJ",script->syntax.curly[pos].index,script->syntax.curly[pos].count);
+ sprintf(label, "__SW%x_%xJ", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count);
l=script->add_str(label);
script->set_label(l,script->pos,p);
}
@@ -1719,7 +1719,7 @@ const char* parse_syntax(const char* p)
disp_error_message("parse_syntax: dup 'case'",p);
linkdb_insert(&script->syntax.curly[pos].case_label, (void*)h64BPTRSIZE(v), (void*)1);
- sprintf(label,"__setr $@__SW%x_VAL,0;",script->syntax.curly[pos].index);
+ sprintf(label, "__setr $@__SW%x_VAL,0;", (unsigned int)script->syntax.curly[pos].index);
script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL;
script->parse_line(label);
@@ -1733,14 +1733,14 @@ const char* parse_syntax(const char* p)
int pos = script->syntax.curly_count - 1;
while(pos >= 0) {
if(script->syntax.curly[pos].type == TYPE_DO) {
- sprintf(label,"goto __DO%x_NXT;",script->syntax.curly[pos].index);
+ sprintf(label, "goto __DO%x_NXT;", (unsigned int)script->syntax.curly[pos].index);
script->syntax.curly[pos].flag = 1; //Flag put the link for continue
break;
} else if(script->syntax.curly[pos].type == TYPE_FOR) {
- sprintf(label,"goto __FR%x_NXT;",script->syntax.curly[pos].index);
+ sprintf(label, "goto __FR%x_NXT;", (unsigned int)script->syntax.curly[pos].index);
break;
} else if(script->syntax.curly[pos].type == TYPE_WHILE) {
- sprintf(label,"goto __WL%x_NXT;",script->syntax.curly[pos].index);
+ sprintf(label, "goto __WL%x_NXT;", (unsigned int)script->syntax.curly[pos].index);
break;
}
pos--;
@@ -1777,18 +1777,18 @@ const char* parse_syntax(const char* p)
if(*p != ':') {
disp_error_message("parse_syntax: need ':'",p);
}
- sprintf(label,"__SW%x_%x",script->syntax.curly[pos].index,script->syntax.curly[pos].count);
+ sprintf(label, "__SW%x_%x", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count);
l=script->add_str(label);
script->set_label(l,script->pos,p);
// Skip to the next link w/o condition
- sprintf(label,"goto __SW%x_%x;",script->syntax.curly[pos].index,script->syntax.curly[pos].count+1);
+ sprintf(label, "goto __SW%x_%x;", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count + 1);
script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL;
script->parse_line(label);
script->syntax.curly_count--;
// The default label
- sprintf(label,"__SW%x_DEF",script->syntax.curly[pos].index);
+ sprintf(label, "__SW%x_DEF", (unsigned int)script->syntax.curly[pos].index);
l=script->add_str(label);
script->set_label(l,script->pos,p);
@@ -1806,7 +1806,7 @@ const char* parse_syntax(const char* p)
script->syntax.curly[script->syntax.curly_count].index = script->syntax.index++;
script->syntax.curly[script->syntax.curly_count].flag = 0;
// Label of the (do) form here
- sprintf(label,"__DO%x_BGN",script->syntax.curly[script->syntax.curly_count].index);
+ sprintf(label, "__DO%x_BGN", (unsigned int)script->syntax.curly[script->syntax.curly_count].index);
l=script->add_str(label);
script->set_label(l,script->pos,p);
script->syntax.curly_count++;
@@ -1837,7 +1837,7 @@ const char* parse_syntax(const char* p)
script->syntax.curly_count--;
// Form the start of label decision
- sprintf(label,"__FR%x_J",script->syntax.curly[pos].index);
+ sprintf(label, "__FR%x_J", (unsigned int)script->syntax.curly[pos].index);
l=script->add_str(label);
script->set_label(l,script->pos,p);
@@ -1847,7 +1847,7 @@ const char* parse_syntax(const char* p)
;
} else {
// Skip to the end point if the condition is false
- sprintf(label,"__FR%x_FIN",script->syntax.curly[pos].index);
+ sprintf(label, "__FR%x_FIN", (unsigned int)script->syntax.curly[pos].index);
script->addl(script->add_str("__jump_zero"));
script->addc(C_ARG);
p=script->parse_expr(p);
@@ -1860,13 +1860,13 @@ const char* parse_syntax(const char* p)
p++;
// Skip to the beginning of the loop
- sprintf(label,"goto __FR%x_BGN;",script->syntax.curly[pos].index);
+ sprintf(label, "goto __FR%x_BGN;", (unsigned int)script->syntax.curly[pos].index);
script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL;
script->parse_line(label);
script->syntax.curly_count--;
// Labels to form the next loop
- sprintf(label,"__FR%x_NXT",script->syntax.curly[pos].index);
+ sprintf(label, "__FR%x_NXT", (unsigned int)script->syntax.curly[pos].index);
l=script->add_str(label);
script->set_label(l,script->pos,p);
@@ -1879,13 +1879,13 @@ const char* parse_syntax(const char* p)
script->parse_syntax_for_flag = 0;
// Skip to the determination process conditions
- sprintf(label,"goto __FR%x_J;",script->syntax.curly[pos].index);
+ sprintf(label, "goto __FR%x_J;", (unsigned int)script->syntax.curly[pos].index);
script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL;
script->parse_line(label);
script->syntax.curly_count--;
// Loop start labeling
- sprintf(label,"__FR%x_BGN",script->syntax.curly[pos].index);
+ sprintf(label, "__FR%x_BGN", (unsigned int)script->syntax.curly[pos].index);
l=script->add_str(label);
script->set_label(l,script->pos,p);
return p;
@@ -1926,7 +1926,7 @@ const char* parse_syntax(const char* p)
++script->syntax.curly_count;
// Jump over the function code
- sprintf(label, "goto __FN%x_FIN;", script->syntax.curly[script->syntax.curly_count-1].index);
+ sprintf(label, "goto __FN%x_FIN;", (unsigned int)script->syntax.curly[script->syntax.curly_count-1].index);
script->syntax.curly[script->syntax.curly_count].type = TYPE_NULL;
++script->syntax.curly_count;
script->parse_line(label);
@@ -1965,7 +1965,7 @@ const char* parse_syntax(const char* p)
script->syntax.curly[script->syntax.curly_count].count = 1;
script->syntax.curly[script->syntax.curly_count].index = script->syntax.index++;
script->syntax.curly[script->syntax.curly_count].flag = 0;
- sprintf(label,"__IF%x_%x",script->syntax.curly[script->syntax.curly_count].index,script->syntax.curly[script->syntax.curly_count].count);
+ sprintf(label, "__IF%x_%x", (unsigned int)script->syntax.curly[script->syntax.curly_count].index, (unsigned int)script->syntax.curly[script->syntax.curly_count].count);
script->syntax.curly_count++;
script->addl(script->add_str("__jump_zero"));
script->addc(C_ARG);
@@ -1989,7 +1989,7 @@ const char* parse_syntax(const char* p)
script->syntax.curly[script->syntax.curly_count].count = 1;
script->syntax.curly[script->syntax.curly_count].index = script->syntax.index++;
script->syntax.curly[script->syntax.curly_count].flag = 0;
- sprintf(label,"$@__SW%x_VAL",script->syntax.curly[script->syntax.curly_count].index);
+ sprintf(label, "$@__SW%x_VAL", (unsigned int)script->syntax.curly[script->syntax.curly_count].index);
script->syntax.curly_count++;
script->addl(script->add_str("__setr"));
script->addc(C_ARG);
@@ -2017,12 +2017,12 @@ const char* parse_syntax(const char* p)
script->syntax.curly[script->syntax.curly_count].index = script->syntax.index++;
script->syntax.curly[script->syntax.curly_count].flag = 0;
// Form the start of label decision
- sprintf(label,"__WL%x_NXT",script->syntax.curly[script->syntax.curly_count].index);
+ sprintf(label, "__WL%x_NXT", (unsigned int)script->syntax.curly[script->syntax.curly_count].index);
l=script->add_str(label);
script->set_label(l,script->pos,p);
// Skip to the end point if the condition is false
- sprintf(label,"__WL%x_FIN",script->syntax.curly[script->syntax.curly_count].index);
+ sprintf(label, "__WL%x_FIN", (unsigned int)script->syntax.curly[script->syntax.curly_count].index);
script->syntax.curly_count++;
script->addl(script->add_str("__jump_zero"));
script->addc(C_ARG);
@@ -2068,13 +2068,13 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
script->parse_nextline(false, p);
// Skip to the last location if
- sprintf(label,"goto __IF%x_FIN;",script->syntax.curly[pos].index);
+ sprintf(label, "goto __IF%x_FIN;", (unsigned int)script->syntax.curly[pos].index);
script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL;
script->parse_line(label);
script->syntax.curly_count--;
// Put the label of the location
- sprintf(label,"__IF%x_%x",script->syntax.curly[pos].index,script->syntax.curly[pos].count);
+ sprintf(label, "__IF%x_%x", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count);
l=script->add_str(label);
script->set_label(l,script->pos,p);
@@ -2091,7 +2091,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
if(*p != '(') {
disp_error_message("need '('",p);
}
- sprintf(label,"__IF%x_%x",script->syntax.curly[pos].index,script->syntax.curly[pos].count);
+ sprintf(label, "__IF%x_%x", (unsigned int)script->syntax.curly[pos].index, (unsigned int)script->syntax.curly[pos].count);
script->addl(script->add_str("__jump_zero"));
script->addc(C_ARG);
p=script->parse_expr(p);
@@ -2112,7 +2112,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
// Close if
script->syntax.curly_count--;
// Put the label of the final location
- sprintf(label,"__IF%x_FIN",script->syntax.curly[pos].index);
+ sprintf(label, "__IF%x_FIN", (unsigned int)script->syntax.curly[pos].index);
l=script->add_str(label);
script->set_label(l,script->pos,p);
if(script->syntax.curly[pos].flag == 1) {
@@ -2125,7 +2125,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
if(script->syntax.curly[pos].flag) {
// (Come here continue) to form the label here
- sprintf(label,"__DO%x_NXT",script->syntax.curly[pos].index);
+ sprintf(label, "__DO%x_NXT", (unsigned int)script->syntax.curly[pos].index);
l=script->add_str(label);
script->set_label(l,script->pos,p);
}
@@ -2145,7 +2145,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
// do-block end is a new line
script->parse_nextline(false, p);
- sprintf(label,"__DO%x_FIN",script->syntax.curly[pos].index);
+ sprintf(label, "__DO%x_FIN", (unsigned int)script->syntax.curly[pos].index);
script->addl(script->add_str("__jump_zero"));
script->addc(C_ARG);
p=script->parse_expr(p);
@@ -2154,13 +2154,13 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
script->addc(C_FUNC);
// Skip to the starting point
- sprintf(label,"goto __DO%x_BGN;",script->syntax.curly[pos].index);
+ sprintf(label, "goto __DO%x_BGN;", (unsigned int)script->syntax.curly[pos].index);
script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL;
script->parse_line(label);
script->syntax.curly_count--;
// Form label of the end point conditions
- sprintf(label,"__DO%x_FIN",script->syntax.curly[pos].index);
+ sprintf(label, "__DO%x_FIN", (unsigned int)script->syntax.curly[pos].index);
l=script->add_str(label);
script->set_label(l,script->pos,p);
p = script->skip_space(p);
@@ -2176,13 +2176,13 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
script->parse_nextline(false, p);
// Skip to the next loop
- sprintf(label,"goto __FR%x_NXT;",script->syntax.curly[pos].index);
+ sprintf(label, "goto __FR%x_NXT;", (unsigned int)script->syntax.curly[pos].index);
script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL;
script->parse_line(label);
script->syntax.curly_count--;
// End for labeling
- sprintf(label,"__FR%x_FIN",script->syntax.curly[pos].index);
+ sprintf(label, "__FR%x_FIN", (unsigned int)script->syntax.curly[pos].index);
l=script->add_str(label);
script->set_label(l,script->pos,p);
script->syntax.curly_count--;
@@ -2192,13 +2192,13 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
script->parse_nextline(false, p);
// Skip to the decision while
- sprintf(label,"goto __WL%x_NXT;",script->syntax.curly[pos].index);
+ sprintf(label, "goto __WL%x_NXT;", (unsigned int)script->syntax.curly[pos].index);
script->syntax.curly[script->syntax.curly_count++].type = TYPE_NULL;
script->parse_line(label);
script->syntax.curly_count--;
// End while labeling
- sprintf(label,"__WL%x_FIN",script->syntax.curly[pos].index);
+ sprintf(label, "__WL%x_FIN", (unsigned int)script->syntax.curly[pos].index);
l=script->add_str(label);
script->set_label(l,script->pos,p);
script->syntax.curly_count--;
@@ -2211,7 +2211,7 @@ const char* parse_syntax_close_sub(const char* p,int* flag)
script->syntax.curly_count--;
// Put the label of the location
- sprintf(label,"__FN%x_FIN",script->syntax.curly[pos].index);
+ sprintf(label, "__FN%x_FIN", (unsigned int)script->syntax.curly[pos].index);
l=script->add_str(label);
script->set_label(l,script->pos,p);
script->syntax.curly_count--;
@@ -3615,7 +3615,7 @@ void script_free_state(struct script_state* st) {
struct map_session_data *sd = st->rid ? map->id2sd(st->rid) : NULL;
if(st->bk_st) {// backup was not restored
- ShowDebug("script_free_state: Previous script state lost (rid=%d, oid=%d, state=%d, bk_npcid=%d).\n", st->bk_st->rid, st->bk_st->oid, st->bk_st->state, st->bk_npcid);
+ ShowDebug("script_free_state: Previous script state lost (rid=%d, oid=%d, state=%u, bk_npcid=%d).\n", st->bk_st->rid, st->bk_st->oid, st->bk_st->state, st->bk_npcid);
}
if(sd && sd->st == st) { //Current script is aborted.
@@ -4262,7 +4262,7 @@ void script_detach_state(struct script_state* st, bool dequeue_event) {
npc->event_dequeue(sd);
}
} else if(st->bk_st) { // rid was set to 0, before detaching the script state
- ShowError("script_detach_state: Found previous script state without attached player (rid=%d, oid=%d, state=%d, bk_npcid=%d)\n", st->bk_st->rid, st->bk_st->oid, st->bk_st->state, st->bk_npcid);
+ ShowError("script_detach_state: Found previous script state without attached player (rid=%d, oid=%d, state=%u, bk_npcid=%d)\n", st->bk_st->rid, st->bk_st->oid, st->bk_st->state, st->bk_npcid);
script->reportsrc(st->bk_st);
script->free_state(st->bk_st);
@@ -4282,7 +4282,7 @@ void script_attach_state(struct script_state* st) {
{
if(st->bk_st)
{// there is already a backup
- ShowDebug("script_free_state: Previous script state lost (rid=%d, oid=%d, state=%d, bk_npcid=%d).\n", st->bk_st->rid, st->bk_st->oid, st->bk_st->state, st->bk_npcid);
+ ShowDebug("script_free_state: Previous script state lost (rid=%d, oid=%d, state=%u, bk_npcid=%d).\n", st->bk_st->rid, st->bk_st->oid, st->bk_st->state, st->bk_npcid);
}
st->bk_st = sd->st;
st->bk_npcid = sd->npc_id;
@@ -4431,7 +4431,7 @@ void run_script_main(struct script_state *st) {
break;
default:
- ShowError("unknown command : %d @ %d\n",c,st->pos);
+ ShowError("unknown command : %u @ %d\n", c, st->pos);
st->state=END;
break;
}
@@ -6651,7 +6651,7 @@ BUILDIN(getarraysize)
return true;
}
int script_array_index_cmp(const void *a, const void *b) {
- return ( *(unsigned int*)a - *(unsigned int*)b );
+ return ( *(const unsigned int*)a - *(const unsigned int*)b );
}
/// Deletes count or all the elements in an array, from the starting index.
@@ -7002,7 +7002,7 @@ BUILDIN(checkweight)
// item id
id = itemdb->exists(script_getnum(st, i));
} else {
- ShowError("buildin_checkweight: invalid type for argument '%d'.\n", i);
+ ShowError("buildin_checkweight: invalid type for argument '%u'.\n", i);
script_pushint(st,0);
return false;
}
@@ -9793,7 +9793,7 @@ BUILDIN(monster)
size = script_getnum(st, 9);
if (size > 3)
{
- ShowWarning("buildin_monster: Attempted to spawn non-existing size %d for monster class %d\n", size, class_);
+ ShowWarning("buildin_monster: Attempted to spawn non-existing size %u for monster class %d\n", size, class_);
return false;
}
}
@@ -9802,7 +9802,7 @@ BUILDIN(monster)
{
ai = script_getnum(st, 10);
if (ai > AI_FLORA) {
- ShowWarning("buildin_monster: Attempted to spawn non-existing ai %d for monster class %d\n", ai, class_);
+ ShowWarning("buildin_monster: Attempted to spawn non-existing ai %u for monster class %d\n", ai, class_);
return false;
}
}
@@ -9898,7 +9898,7 @@ BUILDIN(areamonster) {
if (script_hasdata(st, 11)) {
size = script_getnum(st, 11);
if (size > 3) {
- ShowWarning("buildin_monster: Attempted to spawn non-existing size %d for monster class %d\n", size, class_);
+ ShowWarning("buildin_monster: Attempted to spawn non-existing size %u for monster class %d\n", size, class_);
return false;
}
}
@@ -9906,7 +9906,7 @@ BUILDIN(areamonster) {
if (script_hasdata(st, 12)) {
ai = script_getnum(st, 12);
if (ai > AI_FLORA) {
- ShowWarning("buildin_monster: Attempted to spawn non-existing ai %d for monster class %d\n", ai, class_);
+ ShowWarning("buildin_monster: Attempted to spawn non-existing ai %u for monster class %d\n", ai, class_);
return false;
}
}
@@ -11007,7 +11007,7 @@ BUILDIN(getstatus)
case 4: script_pushint(st, sd->sc.data[id]->val4); break;
case 5:
{
- struct TimerData* td = (struct TimerData*)timer->get(sd->sc.data[id]->timer);
+ const struct TimerData* td = (const struct TimerData*)timer->get(sd->sc.data[id]->timer);
if( td ) {
// return the amount of time remaining
@@ -12219,7 +12219,7 @@ BUILDIN(flagemblem)
if( nd == NULL ) {
ShowError("script:flagemblem: npc %d not found\n", st->oid);
} else if( nd->subtype != SCRIPT ) {
- ShowError("script:flagemblem: unexpected subtype %d for npc %d '%s'\n", nd->subtype, st->oid, nd->exname);
+ ShowError("script:flagemblem: unexpected subtype %u for npc %d '%s'\n", nd->subtype, st->oid, nd->exname);
} else {
bool changed = ( nd->u.scr.guild_id != g_id )?true:false;
nd->u.scr.guild_id = g_id;
@@ -15936,7 +15936,7 @@ int buildin_query_sql_sub(struct script_state* st, Sql* handle)
}
}
if( i == max_rows && max_rows < SQL->NumRows(handle) ) {
- ShowWarning("script:query_sql: Only %d/%u rows have been stored.\n", max_rows, (unsigned int)SQL->NumRows(handle));
+ ShowWarning("script:query_sql: Only %u/%u rows have been stored.\n", max_rows, (unsigned int)SQL->NumRows(handle));
script->reportsrc(st);
}
@@ -16726,7 +16726,7 @@ BUILDIN(unitattack) {
BL_UCAST(BL_PET, unit_bl)->target_id = target_bl->id;
break;
default:
- ShowError("script:unitattack: unsupported source unit type %d\n", unit_bl->type);
+ ShowError("script:unitattack: unsupported source unit type %u\n", unit_bl->type);
script_pushint(st, 0);
return false;
}
@@ -17084,7 +17084,7 @@ BUILDIN(checkcell) {
cell_chk type = (cell_chk)script_getnum(st,5);
if ( m == -1 ) {
- ShowWarning("checkcell: Attempted to run on unexsitent map '%s', type %d, x/y %d,%d\n",script_getstr(st,2),type,x,y);
+ ShowWarning("checkcell: Attempted to run on unexsitent map '%s', type %u, x/y %d,%d\n", script_getstr(st,2), type, x, y);
return true;
}
@@ -17110,7 +17110,7 @@ BUILDIN(setcell) {
int x,y;
if ( m == -1 ) {
- ShowWarning("setcell: Attempted to run on unexistent map '%s', type %d, x1/y1 - %d,%d | x2/y2 - %d,%d\n",script_getstr(st, 2),type,x1,y1,x2,y2);
+ ShowWarning("setcell: Attempted to run on unexistent map '%s', type %u, x1/y1 - %d,%d | x2/y2 - %d,%d\n", script_getstr(st, 2), type, x1, y1, x2, y2);
return true;
}
@@ -19696,7 +19696,7 @@ BUILDIN(checkbound)
/* returns 0 when successful, 1 otherwise */
BUILDIN(bg_match_over) {
bool canceled = script_hasdata(st,3) ? true : false;
- struct bg_arena *arena = bg->name2arena((char*)script_getstr(st, 2));
+ struct bg_arena *arena = bg->name2arena((const char*)script_getstr(st, 2));
if( arena ) {
bg->match_over(arena,canceled);
diff --git a/src/map/skill.c b/src/map/skill.c
index c70b94cd5..a13e3a071 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -5123,7 +5123,7 @@ int skill_castend_id(int tid, int64 tick, int id, intptr_t data) {
unit->set_walkdelay(src, tick, battle_config.default_walk_delay+skill->get_walkdelay(ud->skill_id, ud->skill_lv), 1);
if(battle_config.skill_log && battle_config.skill_log&src->type)
- ShowInfo("Type %d, ID %d skill castend id [id =%d, lv=%d, target ID %d]\n",
+ ShowInfo("Type %u, ID %d skill castend id [id =%d, lv=%d, target ID %d]\n",
src->type, src->id, ud->skill_id, ud->skill_lv, target->id);
map->freeblock_lock();
@@ -10023,7 +10023,7 @@ int skill_castend_pos(int tid, int64 tick, int id, intptr_t data)
}
if(battle_config.skill_log && battle_config.skill_log&src->type)
- ShowInfo("Type %d, ID %d skill castend pos [id =%d, lv=%d, (%d,%d)]\n",
+ ShowInfo("Type %u, ID %d skill castend pos [id =%d, lv=%d, (%d,%d)]\n",
src->type, src->id, ud->skill_id, ud->skill_lv, ud->skillx, ud->skilly);
if (ud->walktimer != INVALID_TIMER)
@@ -11950,7 +11950,7 @@ int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int6
case UNT_MANHOLE:
return 0;
default:
- ShowError("skill_unit_onplace_timer: interval error (unit id %x)\n", sg->unit_id);
+ ShowError("skill_unit_onplace_timer: interval error (unit id %x)\n", (unsigned int)sg->unit_id);
return 0;
}
}
@@ -16519,7 +16519,7 @@ struct skill_unit_group_tickset *skill_unitgrouptickset_search(struct block_list
}
if (j == -1) {
- ShowWarning ("skill_unitgrouptickset_search: tickset is full. ( failed for skill '%s' on unit %d )\n",skill->get_name(group->skill_id),bl->type);
+ ShowWarning ("skill_unitgrouptickset_search: tickset is full. ( failed for skill '%s' on unit %u )\n", skill->get_name(group->skill_id), bl->type);
j = id % MAX_SKILLUNITGROUPTICKSET;
}
diff --git a/src/map/status.c b/src/map/status.c
index 39df5c693..c4c0e39a2 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -11016,7 +11016,7 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) {
st = status->get_status_data(bl);
if (!sc || (sce = sc->data[type]) == NULL) {
- ShowDebug("status_change_timer: Null pointer id: %d data: %"PRIdPTR" bl-type: %d\n", id, data, bl->type);
+ ShowDebug("status_change_timer: Null pointer id: %d data: %"PRIdPTR" bl-type: %u\n", id, data, bl->type);
return 0;
}
diff --git a/src/map/storage.c b/src/map/storage.c
index f938a41ad..ceac85916 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -52,8 +52,8 @@ struct guild_storage_interface *gstorage;
*------------------------------------------*/
int storage_comp_item(const void *i1_, const void *i2_)
{
- struct item *i1 = (struct item *)i1_;
- struct item *i2 = (struct item *)i2_;
+ const struct item *i1 = (const struct item *)i1_;
+ const struct item *i2 = (const struct item *)i2_;
if (i1->nameid == i2->nameid)
return 0;
diff --git a/src/map/unit.c b/src/map/unit.c
index bea0913d2..9a698b77e 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -937,7 +937,7 @@ int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type)
if (x<0 || y<0) {
//Random map position.
if (!map->search_freecell(NULL, m, &x, &y, -1, -1, 1)) {
- ShowWarning("unit_warp failed. Unit Id:%d/Type:%d, target position map %d (%s) at [%d,%d]\n", bl->id, bl->type, m, map->list[m].name, x, y);
+ ShowWarning("unit_warp failed. Unit Id:%d/Type:%u, target position map %d (%s) at [%d,%d]\n", bl->id, bl->type, m, map->list[m].name, x, y);
return 2;
}
@@ -947,7 +947,7 @@ int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type)
if (!map->search_freecell(NULL, m, &x, &y, 4, 4, 1)) {
//Can't find a nearby cell
- ShowWarning("unit_warp failed. Unit Id:%d/Type:%d, target position map %d (%s) at [%d,%d]\n", bl->id, bl->type, m, map->list[m].name, x, y);
+ ShowWarning("unit_warp failed. Unit Id:%d/Type:%u, target position map %d (%s) at [%d,%d]\n", bl->id, bl->type, m, map->list[m].name, x, y);
return 2;
}
}
diff --git a/src/map/vending.c b/src/map/vending.c
index 6e74e6c3e..2346932ba 100644
--- a/src/map/vending.c
+++ b/src/map/vending.c
@@ -119,8 +119,8 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid,
z = 0; // zeny counter
w = 0; // weight counter
for( i = 0; i < count; i++ ) {
- short amount = *(uint16*)(data + 4*i + 0);
- short idx = *(uint16*)(data + 4*i + 2);
+ short amount = *(const uint16*)(data + 4*i + 0);
+ short idx = *(const uint16*)(data + 4*i + 2);
idx -= 2;
if( amount <= 0 )
@@ -185,8 +185,8 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid,
pc->getzeny(vsd, (int)z, LOG_TYPE_VENDING, sd);
for( i = 0; i < count; i++ ) {
- short amount = *(uint16*)(data + 4*i + 0);
- short idx = *(uint16*)(data + 4*i + 2);
+ short amount = *(const uint16*)(data + 4*i + 0);
+ short idx = *(const uint16*)(data + 4*i + 2);
idx -= 2;
// vending item
@@ -266,9 +266,9 @@ void vending_openvending(struct map_session_data* sd, const char* message, const
// filter out invalid items
i = 0;
for( j = 0; j < count; j++ ) {
- short index = *(uint16*)(data + 8*j + 0);
- short amount = *(uint16*)(data + 8*j + 2);
- unsigned int value = *(uint32*)(data + 8*j + 4);
+ short index = *(const uint16*)(data + 8*j + 0);
+ short amount = *(const uint16*)(data + 8*j + 2);
+ unsigned int value = *(const uint32*)(data + 8*j + 4);
index -= 2; // offset adjustment (client says that the first cart position is 2)
diff --git a/src/plugins/db2sql.c b/src/plugins/db2sql.c
index ee6b0548a..7f2d184e3 100644
--- a/src/plugins/db2sql.c
+++ b/src/plugins/db2sql.c
@@ -153,7 +153,7 @@ int itemdb2sql_sub(struct config_setting_t *entry, int n, const char *source)
StrBuf->Printf(&buf, "'%s',", e_name);
// type
- StrBuf->Printf(&buf, "'%u',", it->flag.delay_consume?IT_DELAYCONSUME:it->type);
+ StrBuf->Printf(&buf, "'%d',", it->flag.delay_consume ? IT_DELAYCONSUME : it->type);
// price_buy
StrBuf->Printf(&buf, "'%d',", it->value_buy);
@@ -162,22 +162,22 @@ int itemdb2sql_sub(struct config_setting_t *entry, int n, const char *source)
StrBuf->Printf(&buf, "'%d',", it->value_sell);
// weight
- StrBuf->Printf(&buf, "'%u',", it->weight);
+ StrBuf->Printf(&buf, "'%d',", it->weight);
// atk
- StrBuf->Printf(&buf, "'%u',", it->atk);
+ StrBuf->Printf(&buf, "'%d',", it->atk);
// matk
- StrBuf->Printf(&buf, "'%u',", it->matk);
+ StrBuf->Printf(&buf, "'%d',", it->matk);
// defence
- StrBuf->Printf(&buf, "'%u',", it->def);
+ StrBuf->Printf(&buf, "'%d',", it->def);
// range
- StrBuf->Printf(&buf, "'%u',", it->range);
+ StrBuf->Printf(&buf, "'%d',", it->range);
// slots
- StrBuf->Printf(&buf, "'%u',", it->slot);
+ StrBuf->Printf(&buf, "'%d',", it->slot);
// equip_jobs
if (libconfig->setting_lookup_int(entry, "Job", &i32)) // This is an unsigned value, do not check for >= 0
@@ -194,47 +194,47 @@ int itemdb2sql_sub(struct config_setting_t *entry, int n, const char *source)
StrBuf->Printf(&buf, "'%u',", ui32);
// equip_genders
- StrBuf->Printf(&buf, "'%u',", it->sex);
+ StrBuf->Printf(&buf, "'%d',", it->sex);
// equip_locations
- StrBuf->Printf(&buf, "'%u',", it->equip);
+ StrBuf->Printf(&buf, "'%d',", it->equip);
// weapon_level
- StrBuf->Printf(&buf, "'%u',", it->wlv);
+ StrBuf->Printf(&buf, "'%d',", it->wlv);
// equip_level_min
- StrBuf->Printf(&buf, "'%u',", it->elv);
+ StrBuf->Printf(&buf, "'%d',", it->elv);
// equip_level_max
if ((t = libconfig->setting_get_member(entry, "EquipLv")) && config_setting_is_aggregate(t) && libconfig->setting_length(t) >= 2)
- StrBuf->Printf(&buf, "'%u',", it->elvmax);
+ StrBuf->Printf(&buf, "'%d',", it->elvmax);
else
StrBuf->AppendStr(&buf, "NULL,");
// refineable
- StrBuf->Printf(&buf, "'%u',", it->flag.no_refine?0:1);
+ StrBuf->Printf(&buf, "'%d',", it->flag.no_refine?0:1);
// view
- StrBuf->Printf(&buf, "'%u',", it->look);
+ StrBuf->Printf(&buf, "'%d',", it->look);
// bindonequip
- StrBuf->Printf(&buf, "'%u',", it->flag.bindonequip?1:0);
+ StrBuf->Printf(&buf, "'%d',", it->flag.bindonequip?1:0);
// forceserial
- StrBuf->Printf(&buf, "'%u',", it->flag.force_serial?1:0);
+ StrBuf->Printf(&buf, "'%d',", it->flag.force_serial?1:0);
// buyingstore
- StrBuf->Printf(&buf, "'%u',", it->flag.buyingstore?1:0);
+ StrBuf->Printf(&buf, "'%d',", it->flag.buyingstore?1:0);
// delay
- StrBuf->Printf(&buf, "'%u',", it->delay);
+ StrBuf->Printf(&buf, "'%d',", it->delay);
// trade_flag
- StrBuf->Printf(&buf, "'%u',", it->flag.trade_restriction);
+ StrBuf->Printf(&buf, "'%d',", it->flag.trade_restriction);
// trade_group
if (it->flag.trade_restriction != ITR_NONE && it->gm_lv_trade_override > 0 && it->gm_lv_trade_override < 100) {
- StrBuf->Printf(&buf, "'%u',", it->gm_lv_trade_override);
+ StrBuf->Printf(&buf, "'%d',", it->gm_lv_trade_override);
} else {
StrBuf->AppendStr(&buf, "NULL,");
}
@@ -266,7 +266,7 @@ int itemdb2sql_sub(struct config_setting_t *entry, int n, const char *source)
// sprite
if (it->flag.available) {
- StrBuf->Printf(&buf, "'%u',", it->view_id);
+ StrBuf->Printf(&buf, "'%d',", it->view_id);
} else {
StrBuf->AppendStr(&buf, "NULL,");
}
@@ -437,7 +437,7 @@ int mobdb2sql_sub(struct config_setting_t *mobt, int n, const char *source)
StrBuf->Init(&buf);
// id
- StrBuf->Printf(&buf, "%u,", md->mob_id);
+ StrBuf->Printf(&buf, "%d,", md->mob_id);
// Sprite
SQL->EscapeString(NULL, e_name, md->sprite);
@@ -476,10 +476,10 @@ int mobdb2sql_sub(struct config_setting_t *mobt, int n, const char *source)
StrBuf->Printf(&buf, "%u,", md->status.rhw.atk2);
// DEF
- StrBuf->Printf(&buf, "%u,", md->status.def);
+ StrBuf->Printf(&buf, "%d,", md->status.def);
// MDEF
- StrBuf->Printf(&buf, "%u,", md->status.mdef);
+ StrBuf->Printf(&buf, "%d,", md->status.mdef);
// STR
StrBuf->Printf(&buf, "%u,", md->status.str);
@@ -500,10 +500,10 @@ int mobdb2sql_sub(struct config_setting_t *mobt, int n, const char *source)
StrBuf->Printf(&buf, "%u,", md->status.luk);
// Range2
- StrBuf->Printf(&buf, "%u,", md->range2);
+ StrBuf->Printf(&buf, "%d,", md->range2);
// Range3
- StrBuf->Printf(&buf, "%u,", md->range3);
+ StrBuf->Printf(&buf, "%d,", md->range3);
// Scale
StrBuf->Printf(&buf, "%u,", md->status.size);
@@ -512,7 +512,7 @@ int mobdb2sql_sub(struct config_setting_t *mobt, int n, const char *source)
StrBuf->Printf(&buf, "%u,", md->status.race);
// Element
- StrBuf->Printf(&buf, "%u,", md->status.def_ele + 20 * md->status.ele_lv);
+ StrBuf->Printf(&buf, "%d,", md->status.def_ele + 20 * md->status.ele_lv);
// Mode
StrBuf->Printf(&buf, "0x%X,", md->status.mode);
@@ -534,9 +534,9 @@ int mobdb2sql_sub(struct config_setting_t *mobt, int n, const char *source)
for (i = 0; i < 3; i++) {
// MVP{i}id
- StrBuf->Printf(&buf, "%u,", md->mvpitem[i].nameid);
+ StrBuf->Printf(&buf, "%d,", md->mvpitem[i].nameid);
// MVP{i}per
- StrBuf->Printf(&buf, "%u,", md->mvpitem[i].p);
+ StrBuf->Printf(&buf, "%d,", md->mvpitem[i].p);
}
// Scan for cards
@@ -550,15 +550,15 @@ int mobdb2sql_sub(struct config_setting_t *mobt, int n, const char *source)
if (card_idx == i)
continue;
// Drop{i}id
- StrBuf->Printf(&buf, "%u,", md->dropitem[i].nameid);
+ StrBuf->Printf(&buf, "%d,", md->dropitem[i].nameid);
// Drop{i}per
- StrBuf->Printf(&buf, "%u,", md->dropitem[i].p);
+ StrBuf->Printf(&buf, "%d,", md->dropitem[i].p);
}
// DropCardid
- StrBuf->Printf(&buf, "%u,", md->dropitem[card_idx].nameid);
+ StrBuf->Printf(&buf, "%d,", md->dropitem[card_idx].nameid);
// DropCardper
- StrBuf->Printf(&buf, "%u", md->dropitem[card_idx].p);
+ StrBuf->Printf(&buf, "%d", md->dropitem[card_idx].p);
fprintf(tosql.fp, "REPLACE INTO `%s` VALUES (%s);\n", tosql.db_name, StrBuf->Value(&buf));
diff --git a/src/plugins/sample.c b/src/plugins/sample.c
index 1ddecdc66..8fba2f4df 100644
--- a/src/plugins/sample.c
+++ b/src/plugins/sample.c
@@ -80,10 +80,10 @@ void sample_packet0f3(int fd) {
data->lastMSGPosition.y = sd->status.last_point.y;
data->someNumber = rand()%777;
- ShowInfo("Created Appended sockt->session[] data, %d %d %d %d\n",data->lastMSGPosition.map,data->lastMSGPosition.x,data->lastMSGPosition.y,data->someNumber);
+ ShowInfo("Created Appended sockt->session[] data, %d %d %d %u\n",data->lastMSGPosition.map,data->lastMSGPosition.x,data->lastMSGPosition.y,data->someNumber);
addToSession(sockt->session[fd],data,0,true);
} else {
- ShowInfo("Existent Appended sockt->session[] data, %d %d %d %d\n",data->lastMSGPosition.map,data->lastMSGPosition.x,data->lastMSGPosition.y,data->someNumber);
+ ShowInfo("Existent Appended sockt->session[] data, %d %d %d %u\n",data->lastMSGPosition.map,data->lastMSGPosition.x,data->lastMSGPosition.y,data->someNumber);
if( rand()%4 == 2 ) {
ShowInfo("Removing Appended sockt->session[] data\n");
removeFromSession(sockt->session[fd],0);
@@ -99,10 +99,10 @@ void sample_packet0f3(int fd) {
data->lastMSGPosition.y = sd->status.last_point.y;
data->someNumber = rand()%777;
- ShowInfo("Created Appended map_session_data data, %d %d %d %d\n",data->lastMSGPosition.map,data->lastMSGPosition.x,data->lastMSGPosition.y,data->someNumber);
+ ShowInfo("Created Appended map_session_data data, %d %d %d %u\n",data->lastMSGPosition.map,data->lastMSGPosition.x,data->lastMSGPosition.y,data->someNumber);
addToMSD(sd,data,0,true);
} else {
- ShowInfo("Existent Appended map_session_data data, %d %d %d %d\n",data->lastMSGPosition.map,data->lastMSGPosition.x,data->lastMSGPosition.y,data->someNumber);
+ ShowInfo("Existent Appended map_session_data data, %d %d %d %u\n",data->lastMSGPosition.map,data->lastMSGPosition.x,data->lastMSGPosition.y,data->someNumber);
if( rand()%4 == 2 ) {
ShowInfo("Removing Appended map_session_data data\n");
removeFromMSD(sd,0);