summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/HPM.c2
-rw-r--r--src/common/HPMDataCheck.h2
-rw-r--r--src/common/HPMSymbols.inc.h2
-rw-r--r--src/common/atomic.h2
-rw-r--r--src/common/cbasetypes.h29
-rw-r--r--src/common/conf.c88
-rw-r--r--src/common/conf.h16
-rw-r--r--src/common/console.c2
-rw-r--r--src/common/core.c2
-rw-r--r--src/common/core.h2
-rw-r--r--src/common/db.c2
-rw-r--r--src/common/db.h2
-rw-r--r--src/common/ers.c2
-rw-r--r--src/common/ers.h2
-rw-r--r--src/common/mapindex.c2
-rw-r--r--src/common/mapindex.h2
-rw-r--r--src/common/md5calc.c32
-rw-r--r--src/common/md5calc.h2
-rw-r--r--src/common/memmgr.c2
-rw-r--r--src/common/memmgr.h2
-rw-r--r--src/common/mmo.h21
-rw-r--r--src/common/nullpo.c2
-rw-r--r--src/common/nullpo.h2
-rw-r--r--src/common/showmsg.c2
-rw-r--r--src/common/showmsg.h2
-rw-r--r--src/common/socket.h2
-rw-r--r--src/common/timer.c2
-rw-r--r--src/common/timer.h2
-rw-r--r--src/common/utils.c2
-rw-r--r--src/common/utils.h2
-rw-r--r--src/common/winapi.h2
31 files changed, 171 insertions, 67 deletions
diff --git a/src/common/HPM.c b/src/common/HPM.c
index 1fad7102f..c84b447e8 100644
--- a/src/common/HPM.c
+++ b/src/common/HPM.c
@@ -867,7 +867,7 @@ bool hplugins_get_battle_conf(const char *w1, int *value)
{
int i;
- nullpo_retr(w1, value);
+ nullpo_retr(false, w1);
nullpo_retr(false, value);
ARR_FIND(0, VECTOR_LENGTH(HPM->config_listeners[HPCT_BATTLE]), i, strcmpi(w1, VECTOR_INDEX(HPM->config_listeners[HPCT_BATTLE], i).key) == 0);
diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h
index d0e23811c..0a4af75dd 100644
--- a/src/common/HPMDataCheck.h
+++ b/src/common/HPMDataCheck.h
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2014-2016 Hercules Dev Team
+ * Copyright (C) 2014-2017 Hercules Dev Team
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/common/HPMSymbols.inc.h b/src/common/HPMSymbols.inc.h
index 8dd0f1cd7..d4a103b88 100644
--- a/src/common/HPMSymbols.inc.h
+++ b/src/common/HPMSymbols.inc.h
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2013-2016 Hercules Dev Team
+ * Copyright (C) 2013-2017 Hercules Dev Team
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/common/atomic.h b/src/common/atomic.h
index 82d579bf4..b370052a9 100644
--- a/src/common/atomic.h
+++ b/src/common/atomic.h
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) rAthena Project (www.rathena.org)
*
* Hercules is free software: you can redistribute it and/or modify
diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h
index 98c3552c4..2c36c23bc 100644
--- a/src/common/cbasetypes.h
+++ b/src/common/cbasetypes.h
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -109,6 +109,14 @@
# define __attribute__(x)
#endif
+/// Feature/extension checking macros
+#ifndef __has_extension /* Available in clang and gcc >= 3 */
+#define __has_extension(x) 0
+#endif
+#ifndef __has_feature /* Available in clang and gcc >= 5 */
+#define __has_feature(x) __has_extension(x)
+#endif
+
//////////////////////////////////////////////////////////////////////////
// portable printf/scanf format macros and integer definitions
// NOTE: Visual C++ uses <inttypes.h> and <stdint.h> provided in /3rdparty
@@ -441,4 +449,23 @@ typedef char bool;
/** Support macros for marking structs as unavailable */
#define UNAVAILABLE_STRUCT int8 HERC__unavailable_struct
+/** Static assertion (only on compilers that support it) */
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
+// C11 version
+#define STATIC_ASSERT(ex, msg) _Static_assert(ex, msg)
+#elif __has_feature(c_static_assert)
+// Clang support (as per http://clang.llvm.org/docs/LanguageExtensions.html)
+#define STATIC_ASSERT(ex, msg) _Static_assert(ex, msg)
+#elif defined(__GNUC__) && GCC_VERSION >= 40700
+// GCC >= 4.7 is known to support it
+#define STATIC_ASSERT(ex, msg) _Static_assert(ex, msg)
+#elif defined(_MSC_VER)
+// MSVC doesn't support it, but it accepts the C++ style version
+#define STATIC_ASSERT(ex, msg) static_assert(ex, msg)
+#else
+// Otherise just ignore it until it's supported
+#define STATIC_ASSERT(ex, msg)
+#endif
+
+
#endif /* COMMON_CBASETYPES_H */
diff --git a/src/common/conf.c b/src/common/conf.c
index 9188affa4..96b9bff9f 100644
--- a/src/common/conf.c
+++ b/src/common/conf.c
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
@@ -373,6 +373,80 @@ int config_lookup_mutable_string(const struct config_t *config, const char *name
return CONFIG_FALSE;
}
+/**
+ * Wrapper for config_setting_get_int64() using defined-size variables
+ *
+ * @see config_setting_get_int64_real()
+ */
+int64 config_setting_get_int64_real(const struct config_setting_t *setting)
+{
+ return (int64)config_setting_get_int64(setting);
+}
+
+/**
+ * Wrapper for config_setting_lookup_int64() using defined-size variables
+ *
+ * @see config_setting_lookup_int64()
+ */
+int config_setting_lookup_int64_real(const struct config_setting_t *setting, const char *name, int64 *value)
+{
+ long long int lli = 0;
+
+ if (config_setting_lookup_int64(setting, name, &lli) != CONFIG_TRUE)
+ return CONFIG_FALSE;
+
+ *value = (int64)lli;
+
+ return CONFIG_TRUE;
+}
+
+/**
+ * Wrapper for config_setting_set_int64() using defined-size variables
+ *
+ * @see config_setting_set_int64()
+ */
+int config_setting_set_int64_real(struct config_setting_t *setting, int64 value)
+{
+ return config_setting_set_int64(setting, (long long int)value);
+}
+
+/**
+ * Wrapper for config_setting_get_int64_elem() using defined-size variables
+ *
+ * @see config_setting_get_int64_elem()
+ */
+int64 config_setting_get_int64_elem_real(const struct config_setting_t *setting, int idx)
+{
+ return (int64)config_setting_get_int64_elem(setting, idx);
+}
+
+/**
+ * Wrapper for config_setting_set_int64_elem() using defined-size variables
+ *
+ * @see config_setting_set_int64_elem()
+ */
+struct config_setting_t *config_setting_set_int64_elem_real(struct config_setting_t *setting, int idx, int64 value)
+{
+ return config_setting_set_int64_elem(setting, idx, (long long int)value);
+}
+
+/**
+ * Wrapper for config_lookup_int64() using defined-size variables
+ *
+ * @see config_lookup_int64()
+ */
+int config_lookup_int64_real(const struct config_t *config, const char *filepath, int64 *value)
+{
+ long long int lli = 0;
+
+ if (config_lookup_int64(config, filepath, &lli) != CONFIG_TRUE)
+ return CONFIG_FALSE;
+
+ *value = (int64)lli;
+
+ return CONFIG_TRUE;
+}
+
void libconfig_defaults(void) {
libconfig = &libconfig_s;
@@ -393,20 +467,20 @@ void libconfig_defaults(void) {
libconfig->destroy = config_destroy;
/* */
libconfig->setting_get_int = config_setting_get_int;
- libconfig->setting_get_int64 = config_setting_get_int64;
+ libconfig->setting_get_int64 = config_setting_get_int64_real;
libconfig->setting_get_float = config_setting_get_float;
libconfig->setting_get_bool = config_setting_get_bool;
libconfig->setting_get_string = config_setting_get_string;
/* */
libconfig->setting_lookup = config_setting_lookup;
libconfig->setting_lookup_int = config_setting_lookup_int;
- libconfig->setting_lookup_int64 = config_setting_lookup_int64;
+ libconfig->setting_lookup_int64 = config_setting_lookup_int64_real;
libconfig->setting_lookup_float = config_setting_lookup_float;
libconfig->setting_lookup_bool = config_setting_lookup_bool;
libconfig->setting_lookup_string = config_setting_lookup_string;
/* */
libconfig->setting_set_int = config_setting_set_int;
- libconfig->setting_set_int64 = config_setting_set_int64;
+ libconfig->setting_set_int64 = config_setting_set_int64_real;
libconfig->setting_set_float = config_setting_set_float;
libconfig->setting_set_bool = config_setting_set_bool;
libconfig->setting_set_string = config_setting_set_string;
@@ -415,13 +489,13 @@ void libconfig_defaults(void) {
libconfig->setting_get_format = config_setting_get_format;
/* */
libconfig->setting_get_int_elem = config_setting_get_int_elem;
- libconfig->setting_get_int64_elem = config_setting_get_int64_elem;
+ libconfig->setting_get_int64_elem = config_setting_get_int64_elem_real;
libconfig->setting_get_float_elem = config_setting_get_float_elem;
libconfig->setting_get_bool_elem = config_setting_get_bool_elem;
libconfig->setting_get_string_elem = config_setting_get_string_elem;
/* */
libconfig->setting_set_int_elem = config_setting_set_int_elem;
- libconfig->setting_set_int64_elem = config_setting_set_int64_elem;
+ libconfig->setting_set_int64_elem = config_setting_set_int64_elem_real;
libconfig->setting_set_float_elem = config_setting_set_float_elem;
libconfig->setting_set_bool_elem = config_setting_set_bool_elem;
libconfig->setting_set_string_elem = config_setting_set_string_elem;
@@ -441,7 +515,7 @@ void libconfig_defaults(void) {
libconfig->lookup = config_lookup;
/* */
libconfig->lookup_int = config_lookup_int;
- libconfig->lookup_int64 = config_lookup_int64;
+ libconfig->lookup_int64 = config_lookup_int64_real;
libconfig->lookup_float = config_lookup_float;
libconfig->lookup_bool = config_lookup_bool;
libconfig->lookup_string = config_lookup_string;
diff --git a/src/common/conf.h b/src/common/conf.h
index f2bfcac62..bd6acc4be 100644
--- a/src/common/conf.h
+++ b/src/common/conf.h
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
@@ -46,7 +46,7 @@ struct libconfig_interface {
void (*destroy) (struct config_t *config);
int (*setting_get_int) (const struct config_setting_t *setting);
- long long (*setting_get_int64) (const struct config_setting_t *setting);
+ int64 (*setting_get_int64) (const struct config_setting_t *setting);
double (*setting_get_float) (const struct config_setting_t *setting);
int (*setting_get_bool) (const struct config_setting_t *setting);
@@ -55,12 +55,12 @@ struct libconfig_interface {
struct config_setting_t * (*setting_lookup) (struct config_setting_t *setting, const char *name);
int (*setting_lookup_int) (const struct config_setting_t *setting, const char *name, int *value);
- int (*setting_lookup_int64) (const struct config_setting_t *setting, const char *name, long long *value);
+ int (*setting_lookup_int64) (const struct config_setting_t *setting, const char *name, int64 *value);
int (*setting_lookup_float) (const struct config_setting_t *setting, const char *name, double *value);
int (*setting_lookup_bool) (const struct config_setting_t *setting, const char *name, int *value);
int (*setting_lookup_string) (const struct config_setting_t *setting, const char *name, const char **value);
- int (*setting_set_int) (struct config_setting_t *setting ,int value);
- int (*setting_set_int64) (struct config_setting_t *setting, long long value);
+ int (*setting_set_int) (struct config_setting_t *setting, int value);
+ int (*setting_set_int64) (struct config_setting_t *setting, int64 value);
int (*setting_set_float) (struct config_setting_t *setting, double value);
int (*setting_set_bool) (struct config_setting_t *setting, int value);
int (*setting_set_string) (struct config_setting_t *setting, const char *value);
@@ -69,12 +69,12 @@ struct libconfig_interface {
short (*setting_get_format) (const struct config_setting_t *setting);
int (*setting_get_int_elem) (const struct config_setting_t *setting, int idx);
- long long (*setting_get_int64_elem) (const struct config_setting_t *setting, int idx);
+ int64 (*setting_get_int64_elem) (const struct config_setting_t *setting, int idx);
double (*setting_get_float_elem) (const struct config_setting_t *setting, int idx);
int (*setting_get_bool_elem) (const struct config_setting_t *setting, int idx);
const char * (*setting_get_string_elem) (const struct config_setting_t *setting, int idx);
struct config_setting_t * (*setting_set_int_elem) (struct config_setting_t *setting, int idx, int value);
- struct config_setting_t * (*setting_set_int64_elem) (struct config_setting_t *setting, int idx, long long value);
+ struct config_setting_t * (*setting_set_int64_elem) (struct config_setting_t *setting, int idx, int64 value);
struct config_setting_t * (*setting_set_float_elem) (struct config_setting_t *setting, int idx, double value);
struct config_setting_t * (*setting_set_bool_elem) (struct config_setting_t *setting, int idx, int value);
struct config_setting_t * (*setting_set_string_elem) (struct config_setting_t *setting, int idx, const char *value);
@@ -93,7 +93,7 @@ struct libconfig_interface {
struct config_setting_t * (*lookup) (const struct config_t *config, const char *filepath);
int (*lookup_int) (const struct config_t *config, const char *filepath, int *value);
- int (*lookup_int64) (const struct config_t *config, const char *filepath, long long *value);
+ int (*lookup_int64) (const struct config_t *config, const char *filepath, int64 *value);
int (*lookup_float) (const struct config_t *config, const char *filepath, double *value);
int (*lookup_bool) (const struct config_t *config, const char *filepath, int *value);
int (*lookup_string) (const struct config_t *config, const char *filepath, const char **value);
diff --git a/src/common/console.c b/src/common/console.c
index 654f26cb3..0f79b9494 100644
--- a/src/common/console.c
+++ b/src/common/console.c
@@ -100,7 +100,7 @@ void display_title(void)
*/
void display_gplnotice(void)
{
- ShowInfo("Hercules, Copyright (C) 2012-2015, Hercules Dev Team and others.\n");
+ ShowInfo("Hercules, Copyright (C) 2012-2016, Hercules Dev Team and others.\n");
ShowInfo("Licensed under the GNU General Public License, version 3 or later.\n");
}
diff --git a/src/common/core.c b/src/common/core.c
index 74c63a6d6..9a131d042 100644
--- a/src/common/core.c
+++ b/src/common/core.c
@@ -404,6 +404,8 @@ int cmdline_exec(int argc, char **argv, unsigned int options)
struct CmdlineArgData *data = NULL;
const char *arg = argv[i];
if (arg[0] != '-') { // All arguments must begin with '-'
+ if ((options&(CMDLINE_OPT_SILENT|CMDLINE_OPT_PREINIT)) != 0)
+ continue;
ShowError("Invalid option '%s'.\n", argv[i]);
exit(EXIT_FAILURE);
}
diff --git a/src/common/core.h b/src/common/core.h
index 4aaa6cfac..a8726fcef 100644
--- a/src/common/core.h
+++ b/src/common/core.h
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
diff --git a/src/common/db.c b/src/common/db.c
index 5f69e2f70..91592fdac 100644
--- a/src/common/db.c
+++ b/src/common/db.c
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
diff --git a/src/common/db.h b/src/common/db.h
index 4cbc66ade..2918e5acb 100644
--- a/src/common/db.h
+++ b/src/common/db.h
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
diff --git a/src/common/ers.c b/src/common/ers.c
index 3e1cdc25b..f2256cf30 100644
--- a/src/common/ers.c
+++ b/src/common/ers.c
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
diff --git a/src/common/ers.h b/src/common/ers.h
index 1689345dc..5f9516ad6 100644
--- a/src/common/ers.h
+++ b/src/common/ers.h
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
diff --git a/src/common/mapindex.c b/src/common/mapindex.c
index c09e6260d..e16eb4216 100644
--- a/src/common/mapindex.c
+++ b/src/common/mapindex.c
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
diff --git a/src/common/mapindex.h b/src/common/mapindex.h
index 0ebbeb04b..91f59aeaf 100644
--- a/src/common/mapindex.h
+++ b/src/common/mapindex.h
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
diff --git a/src/common/md5calc.c b/src/common/md5calc.c
index bd6b48f10..d2fc32371 100644
--- a/src/common/md5calc.c
+++ b/src/common/md5calc.c
@@ -168,16 +168,15 @@ static void md5_Round_Calculate(const unsigned char *block,
}
/// @copydoc md5_interface::binary()
-static void md5_string2binary(const char *string, unsigned char *output)
+static void md5_buf2binary(const uint8 *buf, const int buf_size, uint8 *output)
{
//var
/*8bit*/
unsigned char padding_message[64]; //Extended message 512bit 64byte
- const unsigned char *pstring; // The position of string in the present scanning notes is held.
+ const uint8 *pbuf; // The position of string in the present scanning notes is held.
/*32bit*/
- unsigned int string_byte_len, //The byte chief of string is held.
- string_bit_len, //The bit length of string is held.
+ unsigned int buf_bit_len, //The bit length of string is held.
copy_len, //The number of bytes which is used by 1-3 and which remained
msg_digest[4]; //Message digest 128bit 4byte
unsigned int *A = &msg_digest[0], //The message digest in accordance with RFC (reference)
@@ -195,16 +194,15 @@ 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 = (const unsigned char *)string; // The position of the present character sequence is set.
+ pbuf = buf; // 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)
- md5_Round_Calculate(pstring, A,B,C,D);
+ for (i=buf_size; 64<=i; i-=64,pbuf+=64)
+ md5_Round_Calculate(pbuf, A,B,C,D);
//1-3
- copy_len = string_byte_len % 64; //The number of bytes which remained is computed.
- strncpy((char *)padding_message, (const char *)pstring, copy_len); // A message is copied to an extended bit sequence.
+ copy_len = buf_size % 64; //The number of bytes which remained is computed.
+ strncpy((char *)padding_message, (const char *)pbuf, 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.
@@ -216,12 +214,12 @@ static void md5_string2binary(const char *string, unsigned char *output)
}
//Step 2.Append Length (the information on length is added)
- string_bit_len = string_byte_len * 8; //From the byte chief to bit length (32 bytes of low rank)
- memcpy(&padding_message[56], &string_bit_len, 4); //32 bytes of low rank is set.
+ buf_bit_len = buf_size * 8; //From the byte chief to bit length (32 bytes of low rank)
+ memcpy(&padding_message[56], &buf_bit_len, 4); //32 bytes of low rank is set.
//When bit length cannot be expressed in 32 bytes of low rank, it is a beam raising to a higher rank.
- if (UINT_MAX / 8 < string_byte_len) {
- unsigned int high = (string_byte_len - UINT_MAX / 8) * 8;
+ if (UINT_MAX / 8 < (unsigned int)buf_size) {
+ unsigned int high = (buf_size - UINT_MAX / 8) * 8;
memcpy(&padding_message[60], &high, 4);
} else {
memset(&padding_message[60], 0, 4); //In this case, it is good for a higher rank at 0.
@@ -237,12 +235,12 @@ static void md5_string2binary(const char *string, unsigned char *output)
/// @copydoc md5_interface::string()
void md5_string(const char *string, char *output)
{
- unsigned char digest[16];
+ uint8 digest[16];
nullpo_retv(string);
nullpo_retv(output);
- md5->binary(string,digest);
+ md5->binary((const uint8 *)string, (int)strlen(string), digest);
snprintf(output, 33, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
digest[ 0], digest[ 1], digest[ 2], digest[ 3],
digest[ 4], digest[ 5], digest[ 6], digest[ 7],
@@ -267,7 +265,7 @@ void md5_salt(int len, char *output)
void md5_defaults(void)
{
md5 = &md5_s;
- md5->binary = md5_string2binary;
+ md5->binary = md5_buf2binary;
md5->string = md5_string;
md5->salt = md5_salt;
}
diff --git a/src/common/md5calc.h b/src/common/md5calc.h
index b4d4995f9..f55ebe312 100644
--- a/src/common/md5calc.h
+++ b/src/common/md5calc.h
@@ -46,7 +46,7 @@ struct md5_interface {
* @param[in] string The source string.
* @param[out] output Output buffer (at least 16 bytes available).
*/
- void (*binary) (const char *string, unsigned char *output);
+ void (*binary) (const uint8 *buf, const int buf_size, uint8 *output);
/**
* Generates a random salt.
diff --git a/src/common/memmgr.c b/src/common/memmgr.c
index dfea24465..b80b4d4e9 100644
--- a/src/common/memmgr.c
+++ b/src/common/memmgr.c
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
diff --git a/src/common/memmgr.h b/src/common/memmgr.h
index a5b7e4e7d..6381c5bfa 100644
--- a/src/common/memmgr.h
+++ b/src/common/memmgr.h
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 93151d3ca..9c29b8a0e 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -259,12 +259,12 @@
// The following system marks a different job ID system used by the map server,
// which makes a lot more sense than the normal one. [Skotlex]
// These marks the "level" of the job.
-#define JOBL_2_1 0x100 //256
-#define JOBL_2_2 0x200 //512
-#define JOBL_2 0x300
-#define JOBL_UPPER 0x1000 //4096
-#define JOBL_BABY 0x2000 //8192
-#define JOBL_THIRD 0x4000 //16384
+#define JOBL_2_1 0x0100
+#define JOBL_2_2 0x0200
+#define JOBL_2 0x0300 // JOBL_2_1 | JOBL_2_2
+#define JOBL_UPPER 0x1000
+#define JOBL_BABY 0x2000
+#define JOBL_THIRD 0x4000
#define SCRIPT_VARNAME_LENGTH 32 ///< Maximum length of a script variable
@@ -566,7 +566,7 @@ struct mmo_charstatus {
int zeny;
int bank_vault;
- short class_;
+ int16 class;
int status_point, skill_point;
int hp,max_hp,sp,max_sp;
unsigned int option;
@@ -670,7 +670,7 @@ struct party_member {
int account_id;
int char_id;
char name[NAME_LENGTH];
- unsigned short class_;
+ int16 class;
unsigned short map;
unsigned short lv;
unsigned leader : 1,
@@ -689,7 +689,9 @@ struct party {
struct map_session_data;
struct guild_member {
int account_id, char_id;
- short hair,hair_color,gender,class_,lv;
+ short hair,hair_color,gender;
+ int16 class;
+ short lv;
uint64 exp;
int exp_payper;
short online,position;
@@ -777,6 +779,7 @@ struct fame_list {
};
enum fame_list_type {
+ RANKTYPE_UNKNOWN = -1,
RANKTYPE_BLACKSMITH = 0,
RANKTYPE_ALCHEMIST = 1,
RANKTYPE_TAEKWON = 2,
diff --git a/src/common/nullpo.c b/src/common/nullpo.c
index 5b1be14ea..6525793bf 100644
--- a/src/common/nullpo.c
+++ b/src/common/nullpo.c
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
diff --git a/src/common/nullpo.h b/src/common/nullpo.h
index 098e669f3..28d058dc0 100644
--- a/src/common/nullpo.h
+++ b/src/common/nullpo.h
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
diff --git a/src/common/showmsg.c b/src/common/showmsg.c
index d8864684d..23679e762 100644
--- a/src/common/showmsg.c
+++ b/src/common/showmsg.c
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
diff --git a/src/common/showmsg.h b/src/common/showmsg.h
index 303c8dd28..eee6b467b 100644
--- a/src/common/showmsg.h
+++ b/src/common/showmsg.h
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
diff --git a/src/common/socket.h b/src/common/socket.h
index 947ea8d3e..e3a309f20 100644
--- a/src/common/socket.h
+++ b/src/common/socket.h
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
diff --git a/src/common/timer.c b/src/common/timer.c
index f820ebe12..4f2b86a32 100644
--- a/src/common/timer.c
+++ b/src/common/timer.c
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
diff --git a/src/common/timer.h b/src/common/timer.h
index 2161f5e31..88c891dff 100644
--- a/src/common/timer.h
+++ b/src/common/timer.h
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
diff --git a/src/common/utils.c b/src/common/utils.c
index d393a6c23..bcfc153e3 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
diff --git a/src/common/utils.h b/src/common/utils.h
index c5f64124f..9d3c323ef 100644
--- a/src/common/utils.h
+++ b/src/common/utils.h
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
diff --git a/src/common/winapi.h b/src/common/winapi.h
index 724f052a0..b410e00cd 100644
--- a/src/common/winapi.h
+++ b/src/common/winapi.h
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify