summaryrefslogtreecommitdiff
path: root/src/login_sql
diff options
context:
space:
mode:
authortoms <toms@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-07-29 23:06:03 +0000
committertoms <toms@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-07-29 23:06:03 +0000
commit7f024c8c6073c4fa1a4130c499a7f783e5a55ca1 (patch)
tree0ce117b29e4080cc80e7becafe43c0b4f215dbd6 /src/login_sql
parent84e7380a76a1e3f5740c0a144d79405ddc4c82a2 (diff)
downloadhercules-7f024c8c6073c4fa1a4130c499a7f783e5a55ca1.tar.gz
hercules-7f024c8c6073c4fa1a4130c499a7f783e5a55ca1.tar.bz2
hercules-7f024c8c6073c4fa1a4130c499a7f783e5a55ca1.tar.xz
hercules-7f024c8c6073c4fa1a4130c499a7f783e5a55ca1.zip
Removed ugly struct cast in login.c
New version of buildin_query_sql which accept more than one column and can return the number of rows. See script_commands.txt for more details. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7975 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/login_sql')
-rw-r--r--src/login_sql/login.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/login_sql/login.c b/src/login_sql/login.c
index 395f091bf..78f7da3ca 100644
--- a/src/login_sql/login.c
+++ b/src/login_sql/login.c
@@ -578,7 +578,7 @@ int mmo_auth( struct mmo_account* account , int fd){
char ip[16];
- unsigned char *sin_addr = (unsigned char *)&session[fd]->client_addr.sin_addr;
+ unsigned char * sin_addr = (unsigned char *)&session[fd]->client_addr.sin_addr.s_addr;
char r_ip[16]; // [Zido]
char ip_dnsbl[256]; // [Zido]
@@ -905,7 +905,7 @@ int parse_fromchar(int fd){
MYSQL_RES* sql_res;
MYSQL_ROW sql_row = NULL;
- unsigned char *p = (unsigned char *) &session[fd]->client_addr.sin_addr;
+ unsigned char *p = (unsigned char *) &session[fd]->client_addr.sin_addr.s_addr;
char ip[16];
sprintf(ip, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
@@ -1508,10 +1508,8 @@ int parse_login(int fd) {
int packet_len;
int result, i;
- unsigned char *p = (unsigned char *) &session[fd]->client_addr.sin_addr;
- //Since we can't cast a structure to a long, we take the base address as
- //a pointer and cast it (somehow... this seems so wrong to do)
- unsigned long ipl = *((unsigned long *) &session[fd]->client_addr.sin_addr);
+ unsigned char *p = (unsigned char *) &session[fd]->client_addr.sin_addr.s_addr;
+ unsigned long ipl = session[fd]->client_addr.sin_addr.s_addr;
char ip[16];
sprintf(ip, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]);