summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-12-10 19:48:55 +0100
committerHaru <haru@dotalux.com>2013-12-17 01:11:33 +0100
commit15a0f6dea6f4f3c5adc9a1bc9e7e8be81cc49c48 (patch)
treec5dd5b25003f8c21381c7a2e1f010dba71e40b90 /src/login
parenta23d072a66d2569ba13921522be3c82ae9aad576 (diff)
downloadhercules-15a0f6dea6f4f3c5adc9a1bc9e7e8be81cc49c48.tar.gz
hercules-15a0f6dea6f4f3c5adc9a1bc9e7e8be81cc49c48.tar.bz2
hercules-15a0f6dea6f4f3c5adc9a1bc9e7e8be81cc49c48.tar.xz
hercules-15a0f6dea6f4f3c5adc9a1bc9e7e8be81cc49c48.zip
Fixed several compiler warnings
- Warnings detected thanks to Xcode's compiler settings (more strict by default) and clang, warnings mostly but not only related to data sizes on 64 bit systems, that were silenced until now by very lax compiler settings. - This also decreases by a great deal the amount of warnings produced by MSVC in x64 mode (for the adventurous ones who tried that) - Also fixed (or silenced in case of false positives) the potential issues pointed out by the (awesome) clang static analyzer. - Patch co-produced with Ind, I'm merging and committing in his place! Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/login')
-rw-r--r--src/login/account_sql.c7
-rw-r--r--src/login/login.c10
-rw-r--r--src/login/login.h4
3 files changed, 10 insertions, 11 deletions
diff --git a/src/login/account_sql.c b/src/login/account_sql.c
index 533b3d860..283eb3a0d 100644
--- a/src/login/account_sql.c
+++ b/src/login/account_sql.c
@@ -543,16 +543,16 @@ static bool mmo_auth_fromsql(AccountDB_SQL* db, struct mmo_account* acc, int acc
SQL->GetData(sql_handle, 3, &data, NULL); acc->sex = data[0];
SQL->GetData(sql_handle, 4, &data, NULL); safestrncpy(acc->email, data, sizeof(acc->email));
SQL->GetData(sql_handle, 5, &data, NULL); acc->group_id = atoi(data);
- SQL->GetData(sql_handle, 6, &data, NULL); acc->state = strtoul(data, NULL, 10);
+ SQL->GetData(sql_handle, 6, &data, NULL); acc->state = (unsigned int)strtoul(data, NULL, 10);
SQL->GetData(sql_handle, 7, &data, NULL); acc->unban_time = atol(data);
SQL->GetData(sql_handle, 8, &data, NULL); acc->expiration_time = atol(data);
- SQL->GetData(sql_handle, 9, &data, NULL); acc->logincount = strtoul(data, NULL, 10);
+ SQL->GetData(sql_handle, 9, &data, NULL); acc->logincount = (unsigned int)strtoul(data, NULL, 10);
SQL->GetData(sql_handle, 10, &data, NULL); safestrncpy(acc->lastlogin, data, sizeof(acc->lastlogin));
SQL->GetData(sql_handle, 11, &data, NULL); safestrncpy(acc->last_ip, data, sizeof(acc->last_ip));
SQL->GetData(sql_handle, 12, &data, NULL); safestrncpy(acc->birthdate, data, sizeof(acc->birthdate));
SQL->GetData(sql_handle, 13, &data, NULL); acc->char_slots = (uint8)atoi(data);
SQL->GetData(sql_handle, 14, &data, NULL); safestrncpy(acc->pincode, data, sizeof(acc->pincode));
- SQL->GetData(sql_handle, 15, &data, NULL); acc->pincode_change = atol(data);
+ SQL->GetData(sql_handle, 15, &data, NULL); acc->pincode_change = (unsigned int)atol(data);
SQL->FreeResult(sql_handle);
@@ -568,7 +568,6 @@ static bool mmo_auth_fromsql(AccountDB_SQL* db, struct mmo_account* acc, int acc
while( SQL_SUCCESS == SQL->NextRow(sql_handle) )
{
- char* data;
SQL->GetData(sql_handle, 0, &data, NULL); safestrncpy(acc->account_reg2[i].str, data, sizeof(acc->account_reg2[i].str));
SQL->GetData(sql_handle, 1, &data, NULL); safestrncpy(acc->account_reg2[i].value, data, sizeof(acc->account_reg2[i].value));
++i;
diff --git a/src/login/login.c b/src/login/login.c
index 75247845d..feed7239b 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -140,8 +140,8 @@ static int waiting_disconnect_timer(int tid, int64 tick, int id, intptr_t data)
static int online_db_setoffline(DBKey key, DBData *data, va_list ap)
{
struct online_login_data* p = DB->data2ptr(data);
- int server = va_arg(ap, int);
- if( server == -1 )
+ int server_id = va_arg(ap, int);
+ if( server_id == -1 )
{
p->char_server = -1;
if( p->waiting_disconnect != INVALID_TIMER )
@@ -150,7 +150,7 @@ static int online_db_setoffline(DBKey key, DBData *data, va_list ap)
p->waiting_disconnect = INVALID_TIMER;
}
}
- else if( p->char_server == server )
+ else if( p->char_server == server_id )
p->char_server = -2; //Char server disconnected.
return 0;
}
@@ -948,7 +948,7 @@ int mmo_auth_new(const char* userid, const char* pass, const char sex, const cha
//-----------------------------------------------------
int mmo_auth(struct login_session_data* sd, bool isServer) {
struct mmo_account acc;
- int len;
+ size_t len;
char ip[16];
ip2str(session[sd->fd]->client_addr, ip);
@@ -1615,7 +1615,7 @@ int login_config_read(const char* cfgName)
else if(!strcmpi(w1, "check_client_version"))
login_config.check_client_version = (bool)config_switch(w2);
else if(!strcmpi(w1, "client_version_to_connect"))
- login_config.client_version_to_connect = strtoul(w2, NULL, 10);
+ login_config.client_version_to_connect = (unsigned int)strtoul(w2, NULL, 10);
else if(!strcmpi(w1, "use_MD5_passwords"))
login_config.use_md5_passwds = (bool)config_switch(w2);
else if(!strcmpi(w1, "group_id_to_connect"))
diff --git a/src/login/login.h b/src/login/login.h
index 15edb14dc..494912698 100644
--- a/src/login/login.h
+++ b/src/login/login.h
@@ -23,8 +23,8 @@ enum E_LOGINSERVER_ST
struct login_session_data {
int account_id;
- long login_id1;
- long login_id2;
+ int login_id1;
+ int login_id2;
char sex;// 'F','M','S'
char userid[NAME_LENGTH];