Forráskód Böngészése

A lot of changes. login and char server compile under both TXT and SQL under g++. Same for the convertors (login and char). One change that I felt iffy about, but it worked, was the char* buf -> unsinged char* bug in clif.c

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@975 54d463be-8e91-2dee-dedb-b68131a5f0ec
(no author) 20 éve
szülő
commit
dea15d7c9a

+ 2 - 0
Changelog.txt

@@ -1,6 +1,8 @@
 Date	Added
 
 01/23
+	* char-server (SQL & TXT), login-server (SQL & TXT), and txt-coonvertors
+	  (char and login) all compile on g++ now [svn 975] [Ajarn]
 	* Fixed the sizeof errors in g++ [SVN 972] [Ajarn]
 	* Reverted back some of the char* changes [SVN 972] [Ajarn]
 	* Changed parse_script to now return char* [SVN 969] [Ajarn] 

+ 14 - 14
src/char/char.c

@@ -853,14 +853,14 @@ int make_new_char(int fd, unsigned char *dat) {
 
 	// remove control characters from the name
 	dat[23] = '\0';
-	if (remove_control_chars(dat)) {
+	if (remove_control_chars((char*)dat)) {
 		char_log("Make new char error (control char received in the name): (connection #%d, account: %d)." RETCODE,
 		         fd, sd->account_id);
 		return -1;
 	}
 
 	// check lenght of character name
-	if (strlen(dat) < 4) {
+	if (strlen((const char*)dat) < 4) {
 		char_log("Make new char error (character name too small): (connection #%d, account: %d, name: '%s')." RETCODE,
 		         fd, sd->account_id, dat);
 		return -1;
@@ -902,8 +902,8 @@ int make_new_char(int fd, unsigned char *dat) {
 	}
 
 	for(i = 0; i < char_num; i++) {
-		if ((name_ignoring_case != 0 && strcmp(char_dat[i].name, dat) == 0) ||
-			(name_ignoring_case == 0 && strcmpi(char_dat[i].name, dat) == 0)) {
+		if ((name_ignoring_case != 0 && strcmp(char_dat[i].name, (const char*)dat) == 0) ||
+			(name_ignoring_case == 0 && strcmpi(char_dat[i].name, (const char*)dat) == 0)) {
 			char_log("Make new char error (name already exists): (connection #%d, account: %d) slot %d, name: %s (actual name of other char: %d), stats: %d+%d+%d+%d+%d+%d=%d, hair: %d, hair color: %d." RETCODE,
 			         fd, sd->account_id, dat[30], dat, char_dat[i].name, dat[24], dat[25], dat[26], dat[27], dat[28], dat[29], dat[24] + dat[25] + dat[26] + dat[27] + dat[28] + dat[29], dat[33], dat[31]);
 			return -1;
@@ -915,7 +915,7 @@ int make_new_char(int fd, unsigned char *dat) {
 		}
 	}
 
-	if (strcmp(wisp_server_name, dat) == 0) {
+	if (strcmp(wisp_server_name, (const char*)dat) == 0) {
 		char_log("Make new char error (name used is wisp name for server): (connection #%d, account: %d) slot %d, name: %s (actual name of other char: %d), stats: %d+%d+%d+%d+%d+%d=%d, hair: %d, hair color: %d." RETCODE,
 		         fd, sd->account_id, dat[30], dat, char_dat[i].name, dat[24], dat[25], dat[26], dat[27], dat[28], dat[29], dat[24] + dat[25] + dat[26] + dat[27] + dat[28] + dat[29], dat[33], dat[31]);
 		return -1;
@@ -949,7 +949,7 @@ int make_new_char(int fd, unsigned char *dat) {
 	char_dat[i].char_id = char_id_count++;
 	char_dat[i].account_id = sd->account_id;
 	char_dat[i].char_num = dat[30];
-	strcpy(char_dat[i].name, dat);
+	strcpy(char_dat[i].name, (const char*)dat);
 	char_dat[i].class_ = 0;
 	char_dat[i].base_level = 1;
 	char_dat[i].job_level = 1;
@@ -1507,9 +1507,9 @@ int char_divorce(struct mmo_charstatus *cs) {
 //------------------------------------------------------------
 // E-mail check: return 0 (not correct) or 1 (valid). by [Yor]
 //------------------------------------------------------------
-int e_mail_check(unsigned char *email) {
+int e_mail_check(char *email) {
 	char ch;
-	unsigned char* last_arobas;
+	char* last_arobas;
 
 	// athena limits
 	if (strlen(email) < 3 || strlen(email) > 39)
@@ -1585,7 +1585,7 @@ static int char_delete(struct mmo_charstatus *cs) {
 	// —£�¥
 	if (cs->partner_id){
 		// —£�¥�î•ñ‚ðmap‚É’Ê’m
-		char buf[10];
+		unsigned char buf[10];
 		WBUFW(buf,0) = 0x2b12;
 		WBUFL(buf,2) = cs->char_id;
 		WBUFL(buf,6) = cs->partner_id;
@@ -1798,7 +1798,7 @@ int parse_tologin(int fd) {
 				if (i == MAX_MAP_SERVERS)
 					char_log("'ladmin': Receiving a message for broadcast, but no map-server is online." RETCODE);
 				else {
-					char buf[128];
+					unsigned char buf[128];
 					char message[RFIFOL(fd,4) + 1]; // +1 to add a null terminated if not exist in the packet
 					int lp;
 					char *p;
@@ -1946,7 +1946,7 @@ int parse_tologin(int fd) {
 			if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
 				return 0;
 		  {
-			char buf[32000];
+			unsigned char buf[32000];
 			if (gm_account != NULL)
 				aFree(gm_account);
 			gm_account = (struct gm_account*)aCalloc(sizeof(struct gm_account) * ((RFIFOW(fd,2) - 4) / 5), 1);
@@ -2559,7 +2559,7 @@ int parse_char(int fd) {
 			else
 				printf("Account Logged On; Account ID: %d.\n", RFIFOL(fd,2));
 			if (sd == NULL) {
-				sd = session[fd]->session_data = (struct char_session_data*)aCalloc(sizeof(struct char_session_data), 1);
+				sd = (struct char_session_data*)session[fd]->session_data = (struct char_session_data*)aCalloc(sizeof(struct char_session_data), 1);
 				memset(sd, 0, sizeof(struct char_session_data));
 				memcpy(sd->email, "no mail", 40); // put here a mail without '@' to refuse deletion if we don't receive the e-mail
 				sd->connect_until_time = 0; // unknow or illimited (not displaying on map-server)
@@ -2881,7 +2881,7 @@ int parse_char(int fd) {
 				if (server_fd[i] < 0)
 					break;
 			}
-			if (i == MAX_MAP_SERVERS || strcmp(RFIFOP(fd,2), userid) || strcmp(RFIFOP(fd,26), passwd)){
+			if (i == MAX_MAP_SERVERS || strcmp((char*)RFIFOP(fd,2), userid) || strcmp((char*)RFIFOP(fd,26), passwd)){
 				WFIFOB(fd,2) = 3;
 				WFIFOSET(fd,3);
 				RFIFOSKIP(fd,60);
@@ -3019,7 +3019,7 @@ int mapif_send(int fd, unsigned char *buf, unsigned int len) {
 
 int send_users_tologin(int tid, unsigned int tick, int id, int data) {
 	int users = count_users();
-	char buf[16];
+	unsigned char buf[16];
 
 	if (login_fd > 0 && session[login_fd]) {
 		// send number of user to login server

+ 7 - 7
src/char/int_guild.c

@@ -1419,21 +1419,21 @@ int mapif_parse_GuildCheck(int fd, int guild_id, int account_id, int char_id) {
 // ・エラーなら0(false)、そうでないなら1(true)をかえさなければならない
 int inter_guild_parse_frommap(int fd) {
 	switch(RFIFOW(fd,0)) {
-	case 0x3030: mapif_parse_CreateGuild(fd, RFIFOL(fd,4), RFIFOP(fd,8), (struct guild_member *)RFIFOP(fd,32)); break;
+	case 0x3030: mapif_parse_CreateGuild(fd, RFIFOL(fd,4), (char*)RFIFOP(fd,8), (struct guild_member *)RFIFOP(fd,32)); break;
 	case 0x3031: mapif_parse_GuildInfo(fd, RFIFOL(fd,2)); break;
 	case 0x3032: mapif_parse_GuildAddMember(fd, RFIFOL(fd,4), (struct guild_member *)RFIFOP(fd,8)); break;
-	case 0x3034: mapif_parse_GuildLeave(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOB(fd,14), RFIFOP(fd,15)); break;
+	case 0x3034: mapif_parse_GuildLeave(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOB(fd,14), (const char*)RFIFOP(fd,15)); break;
 	case 0x3035: mapif_parse_GuildChangeMemberInfoShort(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOB(fd,14), RFIFOW(fd,15), RFIFOW(fd,17)); break;
 	case 0x3036: mapif_parse_BreakGuild(fd, RFIFOL(fd,2)); break;
-	case 0x3037: mapif_parse_GuildMessage(fd, RFIFOL(fd,4), RFIFOL(fd,8), RFIFOP(fd,12), RFIFOW(fd,2)-12); break;
+	case 0x3037: mapif_parse_GuildMessage(fd, RFIFOL(fd,4), RFIFOL(fd,8), (char*)RFIFOP(fd,12), RFIFOW(fd,2)-12); break;
 	case 0x3038: mapif_parse_GuildCheck(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)); break;
-	case 0x3039: mapif_parse_GuildBasicInfoChange(fd, RFIFOL(fd,4), RFIFOW(fd,8), RFIFOP(fd,10), RFIFOW(fd,2)-10); break;
-	case 0x303A: mapif_parse_GuildMemberInfoChange(fd, RFIFOL(fd,4), RFIFOL(fd,8), RFIFOL(fd,12), RFIFOW(fd,16), RFIFOP(fd,18), RFIFOW(fd,2)-18); break;
+	case 0x3039: mapif_parse_GuildBasicInfoChange(fd, RFIFOL(fd,4), RFIFOW(fd,8), (const char*)RFIFOP(fd,10), RFIFOW(fd,2)-10); break;
+	case 0x303A: mapif_parse_GuildMemberInfoChange(fd, RFIFOL(fd,4), RFIFOL(fd,8), RFIFOL(fd,12), RFIFOW(fd,16), (const char*)RFIFOP(fd,18), RFIFOW(fd,2)-18); break;
 	case 0x303B: mapif_parse_GuildPosition(fd, RFIFOL(fd,4), RFIFOL(fd,8), (struct guild_position *)RFIFOP(fd,12)); break;
 	case 0x303C: mapif_parse_GuildSkillUp(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)); break;
 	case 0x303D: mapif_parse_GuildAlliance(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), RFIFOB(fd,18)); break;
-	case 0x303E: mapif_parse_GuildNotice(fd, RFIFOL(fd,2), RFIFOP(fd,6), RFIFOP(fd,66)); break;
-	case 0x303F: mapif_parse_GuildEmblem(fd, RFIFOW(fd,2)-12, RFIFOL(fd,4), RFIFOL(fd,8), RFIFOP(fd,12)); break;
+	case 0x303E: mapif_parse_GuildNotice(fd, RFIFOL(fd,2), (const char*)RFIFOP(fd,6), (const char*)RFIFOP(fd,66)); break;
+	case 0x303F: mapif_parse_GuildEmblem(fd, RFIFOW(fd,2)-12, RFIFOL(fd,4), RFIFOL(fd,8), (const char*)RFIFOP(fd,12)); break;
 	case 0x3040: mapif_parse_GuildCastleDataLoad(fd, RFIFOW(fd,2), RFIFOB(fd,4)); break;
 	case 0x3041: mapif_parse_GuildCastleDataSave(fd, RFIFOW(fd,2), RFIFOB(fd,4), RFIFOL(fd,5)); break;
 

+ 6 - 6
src/char/int_party.c

@@ -94,7 +94,7 @@ int inter_party_init() {
 			continue;
 		}
 
-		p = aCalloc(sizeof(struct party), 1);
+		p = (struct party*)aCalloc(sizeof(struct party), 1);
 		if (p == NULL){
 			printf("int_party: out of memory!\n");
 			exit(0);
@@ -572,15 +572,15 @@ int mapif_parse_PartyCheck(int fd, int party_id, int account_id, char *nick) {
 // ・エラーなら0(false)、そうでないなら1(true)をかえさなければならない
 int inter_party_parse_frommap(int fd) {
 	switch(RFIFOW(fd,0)) {
-	case 0x3020: mapif_parse_CreateParty(fd, RFIFOL(fd,2), RFIFOP(fd,6), RFIFOP(fd,30), RFIFOP(fd,54), RFIFOW(fd,70)); break;
+	case 0x3020: mapif_parse_CreateParty(fd, RFIFOL(fd,2), (char*)RFIFOP(fd,6), (char*)RFIFOP(fd,30), (char*)RFIFOP(fd,54), RFIFOW(fd,70)); break;
 	case 0x3021: mapif_parse_PartyInfo(fd, RFIFOL(fd,2)); break;
-	case 0x3022: mapif_parse_PartyAddMember(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOP(fd,10), RFIFOP(fd,34), RFIFOW(fd,50)); break;
+	case 0x3022: mapif_parse_PartyAddMember(fd, RFIFOL(fd,2), RFIFOL(fd,6), (char*)RFIFOP(fd,10), (char*)RFIFOP(fd,34), RFIFOW(fd,50)); break;
 	case 0x3023: mapif_parse_PartyChangeOption(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOW(fd,10), RFIFOW(fd,12)); break;
 	case 0x3024: mapif_parse_PartyLeave(fd, RFIFOL(fd,2), RFIFOL(fd,6)); break;
-	case 0x3025: mapif_parse_PartyChangeMap(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOP(fd,10), RFIFOB(fd,26), RFIFOW(fd,27)); break;
+	case 0x3025: mapif_parse_PartyChangeMap(fd, RFIFOL(fd,2), RFIFOL(fd,6), (char*)RFIFOP(fd,10), RFIFOB(fd,26), RFIFOW(fd,27)); break;
 	case 0x3026: mapif_parse_BreakParty(fd, RFIFOL(fd,2)); break;
-	case 0x3027: mapif_parse_PartyMessage(fd, RFIFOL(fd,4), RFIFOL(fd,8), RFIFOP(fd,12), RFIFOW(fd,2)-12); break;
-	case 0x3028: mapif_parse_PartyCheck(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOP(fd,10)); break;
+	case 0x3027: mapif_parse_PartyMessage(fd, RFIFOL(fd,4), RFIFOL(fd,8), (char*)RFIFOP(fd,12), RFIFOW(fd,2)-12); break;
+	case 0x3028: mapif_parse_PartyCheck(fd, RFIFOL(fd,2), RFIFOL(fd,6), (char*)RFIFOP(fd,10)); break;
 	default:
 		return 0;
 	}

+ 9 - 9
src/char/int_pet.c

@@ -41,16 +41,16 @@ int inter_pet_fromstr(char *str,struct s_pet *p)
 	int s;
 	int tmp_int[16];
 	char tmp_str[256];
-	
+
 	memset(p,0,sizeof(struct s_pet));
-	
+
 //	printf("sscanf pet main info\n");
 	s=sscanf(str,"%d,%d,%[^\t]\t%d,%d,%d,%d,%d,%d,%d,%d,%d",&tmp_int[0],&tmp_int[1],tmp_str,&tmp_int[2],
 		&tmp_int[3],&tmp_int[4],&tmp_int[5],&tmp_int[6],&tmp_int[7],&tmp_int[8],&tmp_int[9],&tmp_int[10]);
 
 	if(s!=12)
 		return 1;
-	
+
 	p->pet_id = tmp_int[0];
 	p->class_ = tmp_int[1];
 	memcpy(p->name,tmp_str,24);
@@ -88,7 +88,7 @@ int inter_pet_init()
 	if( (fp=fopen(pet_txt,"r"))==NULL )
 		return 1;
 	while(fgets(line,sizeof(line),fp)){
-		p=aCalloc(sizeof(struct s_pet), 1);
+		p = (struct s_pet*)aCalloc(sizeof(struct s_pet), 1);
 		if(p==NULL){
 			printf("int_pet: out of memory!\n");
 			exit(0);
@@ -242,11 +242,11 @@ int mapif_create_pet(int fd,int account_id,int char_id,short pet_class,short pet
 		p->intimate = 0;
 	else if(p->intimate > 1000)
 		p->intimate = 1000;
-	
+
 	numdb_insert(pet_db,p->pet_id,p);
-	
+
 	mapif_pet_created(fd,account_id,p);
-	
+
 	return 0;
 }
 
@@ -292,7 +292,7 @@ int mapif_save_pet(int fd,int account_id,struct s_pet *data)
 			p->pet_id = data->pet_id;
 			if(p->pet_id == 0)
 				data->pet_id = p->pet_id = pet_newid++;
-			numdb_insert(pet_db,p->pet_id,p);		
+			numdb_insert(pet_db,p->pet_id,p);
 		}
 		if(data->hungry < 0)
 			data->hungry = 0;
@@ -322,7 +322,7 @@ int mapif_delete_pet(int fd,int pet_id)
 int mapif_parse_CreatePet(int fd)
 {
 	mapif_create_pet(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOW(fd,10),RFIFOW(fd,12),RFIFOW(fd,14),RFIFOW(fd,16),RFIFOL(fd,18),
-		RFIFOL(fd,20),RFIFOB(fd,22),RFIFOB(fd,23),RFIFOP(fd,24));
+		RFIFOL(fd,20),RFIFOB(fd,22),RFIFOB(fd,23),(char*)RFIFOP(fd,24));
 	return 0;
 }
 

+ 10 - 10
src/char/int_storage.c

@@ -56,7 +56,7 @@ int storage_fromstr(char *str,struct storage *p)
 	if(set!=2)
 		return 1;
 	if(str[next]=='\n' || str[next]=='\r')
-		return 0;	
+		return 0;
 	next++;
 	for(i=0;str[next] && str[next]!='\t';i++){
 		if(sscanf(str + next, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d%n",
@@ -76,7 +76,7 @@ int storage_fromstr(char *str,struct storage *p)
 			p->storage[i].card[3] = tmp_int[10];
 			next += len;
 			if (str[next] == ' ')
-				next++;	
+				next++;
 		}
 
 		else if(sscanf(str + next, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d%n",
@@ -96,9 +96,9 @@ int storage_fromstr(char *str,struct storage *p)
 			p->storage[i].card[3] = tmp_int[10];
 			next += len;
 			if (str[next] == ' ')
-				next++;	
+				next++;
 		}
-		
+
 		else return 1;
 	}
 	return 0;
@@ -138,7 +138,7 @@ int guild_storage_fromstr(char *str,struct guild_storage *p)
 	if(set!=2)
 		return 1;
 	if(str[next]=='\n' || str[next]=='\r')
-		return 0;	
+		return 0;
 	next++;
 	for(i=0;str[next] && str[next]!='\t';i++){
 	if(sscanf(str + next, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d%n",
@@ -158,7 +158,7 @@ int guild_storage_fromstr(char *str,struct guild_storage *p)
 			p->storage[i].card[3] = tmp_int[10];
 			next += len;
 			if (str[next] == ' ')
-				next++;	
+				next++;
 		}
 
 		else if(sscanf(str + next, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d%n",
@@ -178,9 +178,9 @@ int guild_storage_fromstr(char *str,struct guild_storage *p)
 			p->storage[i].card[3] = tmp_int[10];
 			next += len;
 			if (str[next] == ' ')
-				next++;	
+				next++;
 		}
-		
+
 		else return 1;
 	}
 	return 0;
@@ -242,7 +242,7 @@ int inter_storage_init()
 	}
 	while(fgets(line,65535,fp)){
 		sscanf(line,"%d",&tmp_int);
-		s=aCalloc(sizeof(struct storage), 1);
+		s = (struct storage*)aCalloc(sizeof(struct storage), 1);
 		if(s==NULL){
 			printf("int_storage: out of memory!\n");
 			exit(0);
@@ -270,7 +270,7 @@ int inter_storage_init()
 	}
 	while(fgets(line,65535,fp)){
 		sscanf(line,"%d",&tmp_int);
-		gs=aCalloc(sizeof(struct guild_storage), 1);
+		gs = (struct guild_storage*)aCalloc(sizeof(struct guild_storage), 1);
 		if(gs==NULL){
 			printf("int_storage: out of memory!\n");
 			exit(0);

+ 9 - 9
src/char/inter.c

@@ -114,7 +114,7 @@ int inter_accreg_init() {
 	while(fgets(line, sizeof(line)-1, fp)){
 		line[sizeof(line)-1] = '\0';
 
-		reg = aCalloc(sizeof(struct accreg), 1);
+		reg = (struct accreg*)aCalloc(sizeof(struct accreg), 1);
 		if (reg == NULL) {
 			printf("inter: accreg: out of memory!\n");
 			exit(0);
@@ -325,7 +325,7 @@ int mapif_account_reg(int fd, unsigned char *src) {
 
 // アカウント変数要求返信
 int mapif_account_reg_reply(int fd,int account_id) {
-	struct accreg *reg = numdb_search(accreg_db,account_id);
+	struct accreg *reg = (struct accreg*)numdb_search(accreg_db,account_id);
 
 	WFIFOW(fd,0) = 0x3804;
 	WFIFOL(fd,4) = account_id;
@@ -366,7 +366,7 @@ int check_ttl_wisdata() {
 		wis_delnum = 0;
 		numdb_foreach(wis_db, check_ttl_wisdata_sub, tick);
 		for(i = 0; i < wis_delnum; i++) {
-			struct WisData *wd = numdb_search(wis_db, wis_dellist[i]);
+			struct WisData *wd = (struct WisData*)numdb_search(wis_db, wis_dellist[i]);
 			printf("inter: wis data id=%d time out : from %s to %s\n", wd->id, wd->src, wd->dst);
 			// removed. not send information after a timeout. Just no answer for the player
 			//mapif_wis_end(wd, 1); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
@@ -403,7 +403,7 @@ int mapif_parse_WisRequest(int fd) {
 	}
 
 	// search if character exists before to ask all map-servers
-	if ((index = search_character_index(RFIFOP(fd,28))) == -1) {
+	if ((index = search_character_index((char*)RFIFOP(fd,28))) == -1) {
 		unsigned char buf[27];
 		WBUFW(buf, 0) = 0x3802;
 		memcpy(WBUFP(buf, 2), RFIFOP(fd, 4), 24);
@@ -413,9 +413,9 @@ int mapif_parse_WisRequest(int fd) {
 	} else {
 		// to be sure of the correct name, rewrite it
 		memset(RFIFOP(fd,28), 0, 24);
-		strncpy(RFIFOP(fd,28), search_character_name(index), 24);
+		strncpy((char*)RFIFOP(fd,28), search_character_name(index), 24);
 		// if source is destination, don't ask other servers.
-		if (strcmp(RFIFOP(fd,4),RFIFOP(fd,28)) == 0) {
+		if (strcmp((char*)RFIFOP(fd,4),(char*)RFIFOP(fd,28)) == 0) {
 			unsigned char buf[27];
 			WBUFW(buf, 0) = 0x3802;
 			memcpy(WBUFP(buf, 2), RFIFOP(fd, 4), 24);
@@ -450,7 +450,7 @@ int mapif_parse_WisRequest(int fd) {
 // Wisp/page transmission result
 int mapif_parse_WisReply(int fd) {
 	int id = RFIFOL(fd,2), flag = RFIFOB(fd,6);
-	struct WisData *wd = numdb_search(wis_db, id);
+	struct WisData *wd = (struct WisData*)numdb_search(wis_db, id);
 
 	if (wd == NULL)
 		return 0;	// This wisp was probably suppress before, because it was timeout of because of target was found on another map-server
@@ -478,10 +478,10 @@ int mapif_parse_WisToGM(int fd) {
 // アカウント変数保存要求
 int mapif_parse_AccReg(int fd) {
 	int j, p;
-	struct accreg *reg = numdb_search(accreg_db, RFIFOL(fd,4));
+	struct accreg *reg = (struct accreg*)numdb_search(accreg_db, RFIFOL(fd,4));
 
 	if (reg == NULL) {
-		if ((reg = aCalloc(sizeof(struct accreg), 1)) == NULL) {
+		if ((reg = (struct accreg*)aCalloc(sizeof(struct accreg), 1)) == NULL) {
 			printf("inter: accreg: out of memory !\n");
 			exit(0);
 		}

+ 2 - 2
src/char_sql/char.c

@@ -2654,7 +2654,7 @@ int parse_char(int fd) {
 
 				//Divorce [Wizputer]
 				if (sql_row[1] != 0) {
-					char buf[64];
+					unsigned char buf[64];
 					sprintf(tmp_sql,"UPDATE `%s` SET `partner_id`='0' WHERE `char_id`='%d'",char_db,atoi(sql_row[1]));
 					if(mysql_query(&mysql_handle, tmp_sql)) {
 						printf("DB server Error - %s\n", mysql_error(&mysql_handle));
@@ -2900,7 +2900,7 @@ int mapif_send(int fd, unsigned char *buf, unsigned int len) {
 
 int send_users_tologin(int tid, unsigned int tick, int id, int data) {
 	int users = count_users();
-	char buf[16];
+	unsigned char buf[16];
 
 	if (login_fd > 0 && session[login_fd]) {
 		// send number of user to login server

+ 18 - 18
src/char_sql/int_guild.c

@@ -329,11 +329,11 @@ struct guild * inter_guild_fromsql(int guild_id)
 
 	if (guild_id==0) return 0;
 
-	g = numdb_search(guild_db_,guild_id);
+	g = (struct guild*)numdb_search(guild_db_,guild_id);
 	if (g != NULL)
 		return g;
 
-	g = (struct guild *) aMalloc(sizeof(struct guild));
+	g = (struct guild*)aMalloc(sizeof(struct guild));
 	memset(g,0,sizeof(struct guild));
 
 //	printf("Retrieve guild information from sql ......\n");
@@ -527,9 +527,9 @@ int inter_guildcastle_tosql(struct guild_castle *gc)
 	if (gc==NULL) return 0;
 	//printf("Save to guild_castle\n");
 
-	gcopy = numdb_search(castle_db_,gc->castle_id);
+	gcopy = (struct guild_castle*)numdb_search(castle_db_,gc->castle_id);
 	if (gcopy == NULL) {
-	  gcopy = (struct guild_castle *) aMalloc(sizeof(struct guild_castle));
+	  gcopy = (struct guild_castle*)aMalloc(sizeof(struct guild_castle));
 	  numdb_insert(castle_db_, gc->castle_id, gcopy);
 	} else {
             if ((gc->guild_id  == gcopy->guild_id ) && (  gc->economy  == gcopy->economy ) && ( gc->defense  == gcopy->defense ) && ( gc->triggerE  == gcopy->triggerE ) && ( gc->triggerD  == gcopy->triggerD ) && ( gc->nextTime  == gcopy->nextTime ) && ( gc->payTime  == gcopy->payTime ) && ( gc->createTime  == gcopy->createTime ) && ( gc->visibleC  == gcopy->visibleC ) && ( gc->visibleG0  == gcopy->visibleG0 ) && ( gc->visibleG1  == gcopy->visibleG1 ) && ( gc->visibleG2  == gcopy->visibleG2 ) && ( gc->visibleG3  == gcopy->visibleG3 ) && ( gc->visibleG4  == gcopy->visibleG4 ) && ( gc->visibleG5  == gcopy->visibleG5 ) && ( gc->visibleG6  == gcopy->visibleG6 ) && ( gc->visibleG7  == gcopy->visibleG7 ) && ( gc->Ghp0  == gcopy->Ghp0 ) && ( gc->Ghp1  == gcopy->Ghp1 ) && ( gc->Ghp2  == gcopy->Ghp2 ) && ( gc->Ghp3  == gcopy->Ghp3 ) && ( gc->Ghp4  == gcopy->Ghp4 ) && ( gc->Ghp5  == gcopy->Ghp5 ) && ( gc->Ghp6  == gcopy->Ghp6 ) && ( gc->Ghp7 == gcopy->Ghp7 ))
@@ -573,13 +573,13 @@ int inter_guildcastle_tosql(struct guild_castle *gc)
 // Read guild_castle from sql
 int inter_guildcastle_fromsql(int castle_id,struct guild_castle *gc)
 {
-        struct guild_castle *gcopy;
+    struct guild_castle *gcopy;
 	if (gc==NULL) return 0;
 	//printf("Read from guild_castle\n");
 
-	gcopy = numdb_search(castle_db_, castle_id);
+	gcopy = (struct guild_castle*)numdb_search(castle_db_, castle_id);
 	if (gcopy == NULL) {
-	  gcopy = (struct guild_castle *) aMalloc(sizeof(struct guild_castle));
+	  gcopy = (struct guild_castle*)aMalloc(sizeof(struct guild_castle));
 	  numdb_insert(castle_db_, gc->castle_id, gcopy);
 	} else {
 	  memcpy(gc, gcopy, sizeof(struct guild_castle));
@@ -678,9 +678,9 @@ int inter_guild_sql_init()
         guild_castleinfoevent_db_=numdb_init();
 
 	printf("interserver guild memory initialize.... (%d byte)\n",sizeof(struct guild));
-	guild_pt = aCalloc(sizeof(struct guild), 1);
-	guild_pt2= aCalloc(sizeof(struct guild), 1);
-	guildcastle_pt=aCalloc(sizeof(struct guild_castle), 1);
+	guild_pt = (struct guild*)aCalloc(sizeof(struct guild), 1);
+	guild_pt2= (struct guild*)aCalloc(sizeof(struct guild), 1);
+	guildcastle_pt = (struct guild_castle*)aCalloc(sizeof(struct guild_castle), 1);
 
 	inter_guild_readdb(); // Read exp
 
@@ -1094,7 +1094,7 @@ int mapif_guild_castle_alldataload(int fd) {
 			gc->Ghp7 = atoi(sql_row[25]);
 			memcpy(WFIFOP(fd,len), gc, sizeof(struct guild_castle));
 
-                        gcopy = numdb_search(castle_db_,gc->castle_id);
+                        gcopy = (struct guild_castle*)numdb_search(castle_db_,gc->castle_id);
                         if (gcopy == NULL) {
                             gcopy = (struct guild_castle *) aMalloc(sizeof(struct guild_castle));
                             numdb_insert(castle_db_, gc->castle_id, gcopy);
@@ -1671,21 +1671,21 @@ int mapif_parse_GuildCheck(int fd,int guild_id,int account_id,int char_id)
 int inter_guild_parse_frommap(int fd)
 {
 	switch(RFIFOW(fd,0)){
-	case 0x3030: mapif_parse_CreateGuild(fd,RFIFOL(fd,4),RFIFOP(fd,8),(struct guild_member *)RFIFOP(fd,32)); break;
+	case 0x3030: mapif_parse_CreateGuild(fd,RFIFOL(fd,4),(char*)RFIFOP(fd,8),(struct guild_member *)RFIFOP(fd,32)); break;
 	case 0x3031: mapif_parse_GuildInfo(fd,RFIFOL(fd,2)); break;
 	case 0x3032: mapif_parse_GuildAddMember(fd,RFIFOL(fd,4),(struct guild_member *)RFIFOP(fd,8)); break;
-	case 0x3034: mapif_parse_GuildLeave(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14),RFIFOP(fd,15)); break;
+	case 0x3034: mapif_parse_GuildLeave(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14),(const char*)RFIFOP(fd,15)); break;
 	case 0x3035: mapif_parse_GuildChangeMemberInfoShort(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOB(fd,14),RFIFOW(fd,15),RFIFOW(fd,17)); break;
 	case 0x3036: mapif_parse_BreakGuild(fd,RFIFOL(fd,2)); break;
-	case 0x3037: mapif_parse_GuildMessage(fd,RFIFOL(fd,4),RFIFOL(fd,8),RFIFOP(fd,12),RFIFOW(fd,2)-12); break;
+	case 0x3037: mapif_parse_GuildMessage(fd,RFIFOL(fd,4),RFIFOL(fd,8),(char*)RFIFOP(fd,12),RFIFOW(fd,2)-12); break;
 	case 0x3038: mapif_parse_GuildCheck(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10)); break;
-	case 0x3039: mapif_parse_GuildBasicInfoChange(fd,RFIFOL(fd,4),RFIFOW(fd,8),RFIFOP(fd,10),RFIFOW(fd,2)-10); break;
-	case 0x303A: mapif_parse_GuildMemberInfoChange(fd,RFIFOL(fd,4),RFIFOL(fd,8),RFIFOL(fd,12),RFIFOW(fd,16),RFIFOP(fd,18),RFIFOW(fd,2)-18); break;
+	case 0x3039: mapif_parse_GuildBasicInfoChange(fd,RFIFOL(fd,4),RFIFOW(fd,8),(const char*)RFIFOP(fd,10),RFIFOW(fd,2)-10); break;
+	case 0x303A: mapif_parse_GuildMemberInfoChange(fd,RFIFOL(fd,4),RFIFOL(fd,8),RFIFOL(fd,12),RFIFOW(fd,16),(const char*)RFIFOP(fd,18),RFIFOW(fd,2)-18); break;
 	case 0x303B: mapif_parse_GuildPosition(fd,RFIFOL(fd,4),RFIFOL(fd,8),(struct guild_position *)RFIFOP(fd,12)); break;
 	case 0x303C: mapif_parse_GuildSkillUp(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10)); break;
 	case 0x303D: mapif_parse_GuildAlliance(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOL(fd,14),RFIFOB(fd,18)); break;
-	case 0x303E: mapif_parse_GuildNotice(fd,RFIFOL(fd,2),RFIFOP(fd,6),RFIFOP(fd,66)); break;
-	case 0x303F: mapif_parse_GuildEmblem(fd,RFIFOW(fd,2)-12,RFIFOL(fd,4),RFIFOL(fd,8),RFIFOP(fd,12)); break;
+	case 0x303E: mapif_parse_GuildNotice(fd,RFIFOL(fd,2),(const char*)RFIFOP(fd,6),(const char*)RFIFOP(fd,66)); break;
+	case 0x303F: mapif_parse_GuildEmblem(fd,RFIFOW(fd,2)-12,RFIFOL(fd,4),RFIFOL(fd,8),(const char*)RFIFOP(fd,12)); break;
 	case 0x3040: mapif_parse_GuildCastleDataLoad(fd,RFIFOW(fd,2),RFIFOB(fd,4)); break;
 	case 0x3041: mapif_parse_GuildCastleDataSave(fd,RFIFOW(fd,2),RFIFOB(fd,4),RFIFOL(fd,5)); break;
 

+ 83 - 83
src/char_sql/int_party.c

@@ -8,7 +8,7 @@
 #include <string.h>
 #include "char.h"
 #include "../common/strlib.h"
-#include "socket.h"	
+#include "socket.h"
 
 static struct party *party_pt;
 static int party_newid=100;
@@ -23,24 +23,24 @@ int mapif_parse_PartyLeave(int fd,int party_id,int account_id);
 int inter_party_tosql(int party_id,struct party *p)
 {
 	// 'party' ('party_id','name','exp','item','leader')
-	
+
 	char t_name[100];
 	char t_member[24];
 	int party_member = 0, party_online_member = 0;
 	int party_exist = 0;
 	int leader_id = 0;
 	int i = 0;
-	
+
 	printf("(\033[1;64m%d\033[0m)    Request save party - ",party_id);
-	
+
 	jstrescapecpy(t_name, p->name);
-	
+
 	if (p==NULL || party_id==0 || p->party_id ==0 || party_id!=p->party_id) {
 		printf("- Party pointer or party_id error \n");
 		return 0;
 	}
-	
-	// Check if party exists	
+
+	// Check if party exists
 	sprintf(tmp_sql,"SELECT count(*) FROM `%s` WHERE `party_id`='%d'",party_db, party_id); // TBR
 	if(mysql_query(&mysql_handle, tmp_sql) ) {
 		printf("DB server Error - %s\n", mysql_error(&mysql_handle) );
@@ -57,29 +57,29 @@ int inter_party_tosql(int party_id,struct party *p)
 	if (party_exist >0){
 		// Check members in party
 		sprintf(tmp_sql,"SELECT count(*) FROM `%s` WHERE `party_id`='%d'",char_db, party_id); // TBR
-		if(mysql_query(&mysql_handle, tmp_sql) ) { 
+		if(mysql_query(&mysql_handle, tmp_sql) ) {
 			printf("DB server Error - %s\n", mysql_error(&mysql_handle) );
 			return 0;
 		}
 		sql_res = mysql_store_result(&mysql_handle) ;
 		if (sql_res!=NULL && mysql_num_rows(sql_res)>0) {
 			sql_row = mysql_fetch_row(sql_res);
-			
+
 			party_member =  atoi (sql_row[0]);
 		//	printf("- Check members in party %d : %d \n",party_id,party_member);
 
 		}
 		mysql_free_result(sql_res) ; //resource free
-	
+
 		party_online_member = 0;
 		i=0;
 		while (i<MAX_PARTY){
 			if (p->member[i].account_id>0) party_online_member++;
 			i++;
 		}
-		
+
 		//if (party_online_member==0) printf("- No member online \n"); else printf("- Some member %d online \n", party_online_member);
-			
+
 		if (party_member <= 0 && party_online_member == 0) {
 
 			// Delete the party, if has no member.
@@ -92,29 +92,29 @@ int inter_party_tosql(int party_id,struct party *p)
 			return 0;
 		} else {
 			// Update party information, if exists
-			
+
 			int i=0;
-				
+
 			for (i=0;i<MAX_PARTY;i++){
 
 				if (p->member[i].account_id>0){
 					sprintf(tmp_sql,"UPDATE `%s` SET `party_id`='%d' WHERE `account_id`='%d' AND `name`='%s'",
-						char_db, party_id, p->member[i].account_id,jstrescapecpy(t_member,p->member[i].name));	
+						char_db, party_id, p->member[i].account_id,jstrescapecpy(t_member,p->member[i].name));
 					//printf("%s",tmp_sql);
 					if(mysql_query(&mysql_handle, tmp_sql) ) {
 						printf("DB server Error (update `char`)- %s\n", mysql_error(&mysql_handle) );
 					}
 				}
 			}
-			
-			
+
+
 			sprintf(tmp_sql,"UPDATE `%s` SET `name`='%s', `exp`='%d', `item`='%d', `leader_id`=`leader_id` WHERE `party_id`='%d'",
-				party_db, t_name,p->exp,p->item,party_id);	
+				party_db, t_name,p->exp,p->item,party_id);
 			if(mysql_query(&mysql_handle, tmp_sql) ) {
 				printf("DB server Error (inset/update `party`)- %s\n", mysql_error(&mysql_handle) );
 			}
 
-			
+
 		//	printf("- Update party %d information \n",party_id);
 		}
 	} else {
@@ -128,18 +128,18 @@ int inter_party_tosql(int party_id,struct party *p)
 			printf("DB server Error (inset/update `party`)- %s\n", mysql_error(&mysql_handle) );
 			return 0;
 		}
-		
+
 		sprintf(tmp_sql,"UPDATE `%s` SET `party_id`='%d'  WHERE `account_id`='%d' AND `name`='%s'",
-			char_db, party_id,leader_id, jstrescapecpy(t_member,p->member[i].name));	
+			char_db, party_id,leader_id, jstrescapecpy(t_member,p->member[i].name));
 		if(mysql_query(&mysql_handle, tmp_sql) ) {
 			printf("DB server Error (inset/update `party`)- %s\n", mysql_error(&mysql_handle) );
 		}
-		
-		//printf("- Insert new party %d  \n",party_id);	
+
+		//printf("- Insert new party %d  \n",party_id);
 	}
-	
+
 	printf("Party save success\n");
-	return 0;	
+	return 0;
 
 }
 
@@ -148,15 +148,15 @@ int inter_party_fromsql(int party_id,struct party *p)
 {
 	int leader_id=0;
 	printf("(\033[1;64m%d\033[0m)    Request load party - ",party_id);
-	
+
 	memset(p, 0, sizeof(struct party));
-	
+
 	sprintf(tmp_sql,"SELECT `party_id`, `name`,`exp`,`item`, `leader_id` FROM `%s` WHERE `party_id`='%d'",party_db, party_id); // TBR
 	if(mysql_query(&mysql_handle, tmp_sql) ) {
 		printf("DB server Error (select `party`)- %s\n", mysql_error(&mysql_handle) );
 		return 0;
 	}
-	
+
 	sql_res = mysql_store_result(&mysql_handle) ;
 	if (sql_res!=NULL && mysql_num_rows(sql_res)>0) {
 		sql_row = mysql_fetch_row(sql_res);
@@ -171,9 +171,9 @@ int inter_party_fromsql(int party_id,struct party *p)
 	//	printf("- Cannot find party %d \n",party_id);
 		return 0;
 	}
-		
+
 	mysql_free_result(sql_res);
-	
+
 	// Load members
 	sprintf(tmp_sql,"SELECT `account_id`, `name`,`base_level`,`last_map`,`online` FROM `%s` WHERE `party_id`='%d'",char_db, party_id); // TBR
 	if(mysql_query(&mysql_handle, tmp_sql) ) {
@@ -195,20 +195,20 @@ int inter_party_fromsql(int party_id,struct party *p)
 	//	printf("- %d members found in party %d \n",i,party_id);
 	}
 	mysql_free_result(sql_res);
-		
-	
+
+
 	printf("Party load success\n");
 	return 0;
-	
+
 }
 
 int inter_party_sql_init(){
 	int i;
-	
+
 	//memory alloc
 	printf("interserver party memory initialize.... (%d byte)\n",sizeof(struct party));
-	party_pt = aCalloc(sizeof(struct party), 1);
-	
+	party_pt = (struct party*)aCalloc(sizeof(struct party), 1);
+
 	sprintf (tmp_sql , "SELECT count(*) FROM `%s`",party_db);
 	if(mysql_query(&mysql_handle, tmp_sql) ) {
 		printf("DB server Error - %s\n", mysql_error(&mysql_handle) );
@@ -225,16 +225,16 @@ int inter_party_sql_init(){
 		if(mysql_query(&mysql_handle, tmp_sql) ) {
 			printf("DB server Error - %s\n", mysql_error(&mysql_handle) );
 		}
-		
+
 		sql_res = mysql_store_result(&mysql_handle) ;
-		
+
 		sql_row = mysql_fetch_row(sql_res);
 		party_newid = atoi (sql_row[0])+1;
 		mysql_free_result(sql_res);
 	}
-	
+
 	printf("set party_newid: %d.......\n",party_newid);
-	
+
 	return 0;
 }
 
@@ -245,8 +245,8 @@ struct party* search_partyname(char *str)
 	struct party *p=NULL;
 	int leader_id = 0;
 	char t_name[24];
-	
-	sprintf(tmp_sql,"SELECT `party_id`, `name`,`exp`,`item`,`leader_id` FROM `%s` WHERE `name`='%s'",party_db, jstrescapecpy(t_name,str));	
+
+	sprintf(tmp_sql,"SELECT `party_id`, `name`,`exp`,`item`,`leader_id` FROM `%s` WHERE `name`='%s'",party_db, jstrescapecpy(t_name,str));
 	if(mysql_query(&mysql_handle, tmp_sql) ) {
 			printf("DB server Error (select `party`)- %s\n", mysql_error(&mysql_handle) );
 	}
@@ -477,12 +477,12 @@ int mapif_parse_CreateParty(int fd,int account_id,char *name,char *nick,char *ma
 	p->member[0].leader=1;
 	p->member[0].online=1;
 	p->member[0].lv=lv;
-	
+
 	inter_party_tosql(p->party_id,p);
-	
+
 	mapif_party_created(fd,account_id,p);
 	mapif_party_info(fd,p);
-	
+
 	return 0;
 }
 // ƒp�[ƒeƒB�î•ñ—v‹�
@@ -494,7 +494,7 @@ int mapif_parse_PartyInfo(int fd,int party_id)
 		return 0;
 	}
 	inter_party_fromsql(party_id, p);
-	
+
 	if(p->party_id >= 0)
 		mapif_party_info(fd,p);
 	else
@@ -506,23 +506,23 @@ int mapif_parse_PartyAddMember(int fd,int party_id,int account_id,char *nick,cha
 {
 	struct party *p;
 	int i;
-	
+
 	p = party_pt;
 	if(p==NULL){
 		printf("int_party: out of memory !\n");
 		return 0;
 	}
 	inter_party_fromsql(party_id, p);
-	
+
 	if(p->party_id <= 0){
 		mapif_party_memberadded(fd,party_id,account_id,1);
 		return 0;
 	}
-	
+
 	for(i=0;i<MAX_PARTY;i++){
 		if(p->member[i].account_id==0){
 			int flag=0;
-			
+
 			p->member[i].account_id=account_id;
 			memcpy(p->member[i].name,nick,24);
 			memcpy(p->member[i].map,map,16);
@@ -538,7 +538,7 @@ int mapif_parse_PartyAddMember(int fd,int party_id,int account_id,char *nick,cha
 			}
 			if(flag)
 				mapif_party_optionchanged(fd,p,0,0);
-				
+
 			inter_party_tosql(party_id, p);
 			return 0;
 		}
@@ -552,25 +552,25 @@ int mapif_parse_PartyChangeOption(int fd,int party_id,int account_id,int exp,int
 {
 	struct party *p;
 	int flag=0;
-	
+
 	p = party_pt;
 	if(p==NULL){
 		printf("int_party: out of memory !\n");
 		return 0;
 	}
-	
+
 	inter_party_fromsql(party_id, p);
-	
+
 	if(p->party_id <= 0){
 		return 0;
 	}
-	
+
 	p->exp=exp;
 	if( exp>0 && !party_check_exp_share(p) ){
 		flag|=0x01;
 		p->exp=0;
 	}
-	
+
 	p->item=item;
 
 	mapif_party_optionchanged(fd,p,account_id,flag);
@@ -586,27 +586,27 @@ int mapif_parse_PartyLeave(int fd,int party_id,int account_id)
 		printf("int_party: out of memory !\n");
 		return 0;
 	}
-	
+
 	inter_party_fromsql(party_id, p);
-	
+
 	if(p->party_id >= 0){
 		int i,j;
 		for(i=0;i<MAX_PARTY;i++){
-			
+
 			if(p->member[i].account_id==account_id){
 				//printf("p->member[i].account_id = %d , account_id = %d \n",p->member[i].account_id,account_id);
 				mapif_party_leaved(party_id,account_id,p->member[i].name);
-				
-				
-				
+
+
+
 				// Update char information, does the name need encoding?
-				sprintf(tmp_sql,"UPDATE `%s` SET `party_id`='0' WHERE `party_id`='%d' AND `name`='%s'", 
+				sprintf(tmp_sql,"UPDATE `%s` SET `party_id`='0' WHERE `party_id`='%d' AND `name`='%s'",
 					char_db, party_id, jstrescapecpy(t_member,p->member[i].name));
 				if(mysql_query(&mysql_handle, tmp_sql) ) {
 					printf("DB server Error (update `char`)- %s\n", mysql_error(&mysql_handle) );
 				}
-//				printf("Delete member %s from MySQL \n", p->member[i].name);	
-						
+//				printf("Delete member %s from MySQL \n", p->member[i].name);
+
 				if (p->member[i].leader==1){
 					for(j=0;j<MAX_PARTY;j++)
 					{
@@ -614,12 +614,12 @@ int mapif_parse_PartyLeave(int fd,int party_id,int account_id)
 						if(p->member[j].account_id>0&&j!=i){
 							mapif_party_leaved(party_id,p->member[j].account_id,p->member[j].name);
 							// Update char information, does the name need encoding?
-							sprintf(tmp_sql,"UPDATE `%s` SET `party_id`='0' WHERE `party_id`='%d' AND `name`='%s'", 
+							sprintf(tmp_sql,"UPDATE `%s` SET `party_id`='0' WHERE `party_id`='%d' AND `name`='%s'",
 								char_db, party_id, jstrescapecpy(t_member,p->member[i].name));
 							if(mysql_query(&mysql_handle, tmp_sql) ) {
 								printf("DB server Error (update `char`)- %s\n", mysql_error(&mysql_handle) );
 							}
-//							printf("Delete member %s from MySQL \n", p->member[j].name);	
+//							printf("Delete member %s from MySQL \n", p->member[j].name);
 						}
 					}
 					// Delete the party, if has no member.
@@ -628,9 +628,9 @@ int mapif_parse_PartyLeave(int fd,int party_id,int account_id)
 						printf("DB server Error - %s\n", mysql_error(&mysql_handle) );
 					}
 //					printf("Leader breaks party %d \n",party_id);
-					memset(p, 0, sizeof(struct party));					
+					memset(p, 0, sizeof(struct party));
 				}else memset(&p->member[i],0,sizeof(struct party_member));
-				
+
 				break;
 
 			}
@@ -642,8 +642,8 @@ int mapif_parse_PartyLeave(int fd,int party_id,int account_id)
 			inter_party_tosql(party_id,p);	// Break the party if no member
 		*/
 	}else{
-		sprintf(tmp_sql,"UPDATE `%s` SET `party_id`='0' WHERE `party_id`='%d' AND `account_id`='%d' AND `online`='1'", 
-			char_db, party_id, account_id);	
+		sprintf(tmp_sql,"UPDATE `%s` SET `party_id`='0' WHERE `party_id`='%d' AND `account_id`='%d' AND `online`='1'",
+			char_db, party_id, account_id);
 		if(mysql_query(&mysql_handle, tmp_sql) ) {
 			printf("DB server Error (update `char`)- %s\n", mysql_error(&mysql_handle) );
 		}
@@ -655,21 +655,21 @@ int mapif_parse_PartyChangeMap(int fd,int party_id,int account_id,char *map,int
 {
 	struct party *p;
 	int i;
-	
+
 	p = party_pt;
 	if(p==NULL){
 		printf("int_party: out of memory !\n");
 		return 0;
 	}
 	inter_party_fromsql(party_id, p);
-	
+
 	if(p->party_id <= 0){
 		return 0;
 	}
 	for(i=0;i<MAX_PARTY;i++){
 		if(p->member[i].account_id==account_id){
 			int flag=0;
-			
+
 			memcpy(p->member[i].map,map,16);
 			p->member[i].online=online;
 			p->member[i].lv=lv;
@@ -691,20 +691,20 @@ int mapif_parse_PartyChangeMap(int fd,int party_id,int account_id,char *map,int
 int mapif_parse_BreakParty(int fd,int party_id)
 {
 	struct party *p;
-	
+
 	p = party_pt;
 	if(p==NULL){
 		printf("int_party: out of memory !\n");
 		return 0;
 	}
-	
+
 	inter_party_fromsql(party_id, p);
-	
+
 	if(p->party_id <= 0){
 		return 0;
 	}
 	inter_party_tosql(party_id,p);
-	
+
 	mapif_party_broken(fd,party_id);
 	return 0;
 }
@@ -727,15 +727,15 @@ int mapif_parse_PartyCheck(int fd,int party_id,int account_id,char *nick)
 int inter_party_parse_frommap(int fd)
 {
 	switch(RFIFOW(fd,0)){
-	case 0x3020: mapif_parse_CreateParty(fd,RFIFOL(fd,2),RFIFOP(fd,6),RFIFOP(fd,30),RFIFOP(fd,54),RFIFOW(fd,70)); break;
+	case 0x3020: mapif_parse_CreateParty(fd,RFIFOL(fd,2),(char*)RFIFOP(fd,6),(char*)RFIFOP(fd,30),(char*)RFIFOP(fd,54),RFIFOW(fd,70)); break;
 	case 0x3021: mapif_parse_PartyInfo(fd,RFIFOL(fd,2)); break;
-	case 0x3022: mapif_parse_PartyAddMember(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOP(fd,10),RFIFOP(fd,34),RFIFOW(fd,50)); break;
+	case 0x3022: mapif_parse_PartyAddMember(fd,RFIFOL(fd,2),RFIFOL(fd,6),(char*)RFIFOP(fd,10),(char*)RFIFOP(fd,34),RFIFOW(fd,50)); break;
 	case 0x3023: mapif_parse_PartyChangeOption(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOW(fd,10),RFIFOW(fd,12)); break;
 	case 0x3024: mapif_parse_PartyLeave(fd,RFIFOL(fd,2),RFIFOL(fd,6)); break;
-	case 0x3025: mapif_parse_PartyChangeMap(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOP(fd,10),RFIFOB(fd,26),RFIFOW(fd,27)); break;
+	case 0x3025: mapif_parse_PartyChangeMap(fd,RFIFOL(fd,2),RFIFOL(fd,6),(char*)RFIFOP(fd,10),RFIFOB(fd,26),RFIFOW(fd,27)); break;
 	case 0x3026: mapif_parse_BreakParty(fd,RFIFOL(fd,2)); break;
-	case 0x3027: mapif_parse_PartyMessage(fd,RFIFOL(fd,4),RFIFOL(fd,8),RFIFOP(fd,12),RFIFOW(fd,2)-12); break;
-	case 0x3028: mapif_parse_PartyCheck(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOP(fd,10)); break;
+	case 0x3027: mapif_parse_PartyMessage(fd,RFIFOL(fd,4),RFIFOL(fd,8),(char*)RFIFOP(fd,12),RFIFOW(fd,2)-12); break;
+	case 0x3028: mapif_parse_PartyCheck(fd,RFIFOL(fd,2),RFIFOL(fd,6),(char*)RFIFOP(fd,10)); break;
 	default:
 		return 0;
 	}

+ 27 - 27
src/char_sql/int_pet.c

@@ -18,11 +18,11 @@ static int pet_newid = 100;
 int inter_pet_tosql(int pet_id, struct s_pet *p) {
 	//`pet` (`pet_id`, `class`,`name`,`account_id`,`char_id`,`level`,`egg_id`,`equip`,`intimate`,`hungry`,`rename_flag`,`incuvate`)
 	char t_name[100];
-	
+
 	printf("request save pet: %d.......\n",pet_id);
-	
+
 	jstrescapecpy(t_name, p->name);
-	
+
 	if(p->hungry < 0)
 		p->hungry = 0;
 	else if(p->hungry > 100)
@@ -36,7 +36,7 @@ int inter_pet_tosql(int pet_id, struct s_pet *p) {
 			printf("DB server Error - %s\n", mysql_error(&mysql_handle) );
 	}
 	sql_res = mysql_store_result(&mysql_handle) ;
-	if (sql_res!=NULL && mysql_num_rows(sql_res)>0) 
+	if (sql_res!=NULL && mysql_num_rows(sql_res)>0)
 		//row reside -> updating
 		sprintf(tmp_sql, "UPDATE `%s` SET `class`='%d',`name`='%s',`account_id`='%d',`char_id`='%d',`level`='%d',`egg_id`='%d',`equip`='%d',`intimate`='%d',`hungry`='%d',`rename_flag`='%d',`incuvate`='%d' WHERE `pet_id`='%d'",
 			pet_db, p->class_, t_name, p->account_id, p->char_id, p->level, p->egg_id,
@@ -49,19 +49,19 @@ int inter_pet_tosql(int pet_id, struct s_pet *p) {
 	if(mysql_query(&mysql_handle, tmp_sql) ) {
 		printf("DB server Error (inset/update `pet`)- %s\n", mysql_error(&mysql_handle) );
 	}
-	
+
 	printf("pet save success.......\n");
 	return 0;
 }
 
 int inter_pet_fromsql(int pet_id, struct s_pet *p){
-	
+
 	printf("request load pet: %d.......\n",pet_id);
-	
+
 	memset(p, 0, sizeof(struct s_pet));
-	
+
 	//`pet` (`pet_id`, `class`,`name`,`account_id`,`char_id`,`level`,`egg_id`,`equip`,`intimate`,`hungry`,`rename_flag`,`incuvate`)
-	
+
 	sprintf(tmp_sql,"SELECT `pet_id`, `class`,`name`,`account_id`,`char_id`,`level`,`egg_id`,`equip`,`intimate`,`hungry`,`rename_flag`,`incuvate` FROM `%s` WHERE `pet_id`='%d'",pet_db, pet_id);
 	if(mysql_query(&mysql_handle, tmp_sql) ) {
 			printf("DB server Error (select `pet`)- %s\n", mysql_error(&mysql_handle) );
@@ -70,7 +70,7 @@ int inter_pet_fromsql(int pet_id, struct s_pet *p){
 	sql_res = mysql_store_result(&mysql_handle) ;
 	if (sql_res!=NULL && mysql_num_rows(sql_res)>0) {
 		sql_row = mysql_fetch_row(sql_res);
-		
+
 		p->pet_id = pet_id;
 		p->class_ = atoi(sql_row[1]);
 		memcpy(p->name, sql_row[2],24);
@@ -92,20 +92,20 @@ int inter_pet_fromsql(int pet_id, struct s_pet *p){
 		p->intimate = 0;
 	else if(p->intimate > 1000)
 		p->intimate = 1000;
-	
+
 	mysql_free_result(sql_res);
-	
+
 	printf("pet load success.......\n");
 	return 0;
 }
 //----------------------------------------------
-	
+
 int inter_pet_sql_init(){
 	int i;
-		
+
 	//memory alloc
 	printf("interserver pet memory initialize.... (%d byte)\n",sizeof(struct s_pet));
-	pet_pt = aCalloc(sizeof(struct s_pet), 1);
+	pet_pt = (struct s_pet*)aCalloc(sizeof(struct s_pet), 1);
 
 	sprintf (tmp_sql , "SELECT count(*) FROM `%s`", pet_db);
 	if(mysql_query(&mysql_handle, tmp_sql) ) {
@@ -124,22 +124,22 @@ int inter_pet_sql_init(){
 		if(mysql_query(&mysql_handle, tmp_sql) ) {
 			printf("DB server Error - %s\n", mysql_error(&mysql_handle) );
 		}
-		
+
 		sql_res = mysql_store_result(&mysql_handle) ;
-		
+
 		sql_row = mysql_fetch_row(sql_res);
 		pet_newid = atoi (sql_row[0])+1; //should SET MAX existing PET ID + 1 [Lupus]
 		mysql_free_result(sql_res);
 	}
-	
+
 	printf("set pet_newid: %d.......\n",pet_newid);
-	
+
 	return 0;
 }
 //----------------------------------
 int inter_pet_delete(int pet_id){
 	printf("request delete pet: %d.......\n",pet_id);
-	
+
 	sprintf(tmp_sql,"DELETE FROM `%s` WHERE `pet_id`='%d'",pet_db, pet_id);
 	if(mysql_query(&mysql_handle, tmp_sql) ) {
 			printf("DB server Error - %s\n", mysql_error(&mysql_handle) );
@@ -232,19 +232,19 @@ int mapif_create_pet(int fd, int account_id, int char_id, short pet_class, short
 		pet_pt->intimate = 0;
 	else if(pet_pt->intimate > 1000)
 		pet_pt->intimate = 1000;
-	
+
 	inter_pet_tosql(pet_pt->pet_id,pet_pt);
-	
+
 	mapif_pet_created(fd, account_id, pet_pt);
-	
+
 	return 0;
 }
 
 int mapif_load_pet(int fd, int account_id, int char_id, int pet_id){
 	memset(pet_pt, 0, sizeof(struct s_pet));
-	
+
 	inter_pet_fromsql(pet_id, pet_pt);
-	
+
 	if(pet_pt!=NULL) {
 		if(pet_pt->incuvate == 1) {
 			pet_pt->account_id = pet_pt->char_id = 0;
@@ -267,7 +267,7 @@ int mapif_save_pet(int fd, int account_id, struct s_pet *data) {
 	if(sizeof(struct s_pet)!=len-8) {
 		printf("inter pet: data size error %d %d\n", sizeof(struct s_pet), len-8);
 	}
-	
+
 	else{
 		if(data->hungry < 0)
 			data->hungry = 0;
@@ -292,7 +292,7 @@ int mapif_delete_pet(int fd, int pet_id){
 
 int mapif_parse_CreatePet(int fd){
 	mapif_create_pet(fd, RFIFOL(fd, 2), RFIFOL(fd, 6), RFIFOW(fd, 10), RFIFOW(fd, 12), RFIFOW(fd, 14), RFIFOW(fd, 16), RFIFOL(fd, 18),
-		RFIFOL(fd, 20), RFIFOB(fd, 22), RFIFOB(fd, 23), RFIFOP(fd, 24));
+		RFIFOL(fd, 20), RFIFOB(fd, 22), RFIFOB(fd, 23), (char*)RFIFOP(fd, 24));
 	return 0;
 }
 

+ 17 - 17
src/char_sql/int_storage.c

@@ -24,7 +24,7 @@ int storage_tosql(int account_id,struct storage *p){
 	struct itemtemp mapitem;
 	for(i=0;i<MAX_STORAGE;i++){
 		if(p->storage[i].nameid>0){
-			if(itemdb_isequip(p->storage[i].nameid)==1){				
+			if(itemdb_isequip(p->storage[i].nameid)==1){
 				mapitem.equip[eqcount].flag=0;
 				mapitem.equip[eqcount].id = p->storage[i].id;
 				mapitem.equip[eqcount].nameid=p->storage[i].nameid;
@@ -39,7 +39,7 @@ int storage_tosql(int account_id,struct storage *p){
 				mapitem.equip[eqcount].card[3] = p->storage[i].card[3];
 				eqcount++;
 			}
-			else if(itemdb_isequip(p->storage[i].nameid)==0){				
+			else if(itemdb_isequip(p->storage[i].nameid)==0){
 				mapitem.notequip[noteqcount].flag=0;
 				mapitem.notequip[noteqcount].id = p->storage[i].id;
 				mapitem.notequip[noteqcount].nameid=p->storage[i].nameid;
@@ -66,18 +66,18 @@ int storage_tosql(int account_id,struct storage *p){
 // DB -> storage data conversion
 int storage_fromsql(int account_id, struct storage *p){
 	int i=0;
-	
+
 	memset(p,0,sizeof(struct storage)); //clean up memory
 	p->storage_amount = 0;
 	p->account_id = account_id;
-	
+
 	// storage {`account_id`/`id`/`nameid`/`amount`/`equip`/`identify`/`refine`/`attribute`/`card0`/`card1`/`card2`/`card3`}
 	sprintf(tmp_sql,"SELECT `id`,`nameid`,`amount`,`equip`,`identify`,`refine`,`attribute`,`card0`,`card1`,`card2`,`card3` FROM `%s` WHERE `account_id`='%d'",storage_db, account_id);
 	if(mysql_query(&mysql_handle, tmp_sql) ) {
 			printf("DB server Error - %s\n", mysql_error(&mysql_handle) );
 	}
 	sql_res = mysql_store_result(&mysql_handle) ;
-	
+
 	if (sql_res) {
 		while((sql_row = mysql_fetch_row(sql_res))) {	//start to fetch
 			p->storage[i].id= atoi(sql_row[0]);
@@ -95,7 +95,7 @@ int storage_fromsql(int account_id, struct storage *p){
 		}
 		mysql_free_result(sql_res);
 	}
-	
+
 	printf ("storage load complete from DB - id: %d (total: %d)\n", account_id, p->storage_amount);
 	return 1;
 }
@@ -108,7 +108,7 @@ int guild_storage_tosql(int guild_id, struct guild_storage *p){
 	struct itemtemp mapitem;
 	for(i=0;i<MAX_GUILD_STORAGE;i++){
 		if(p->storage[i].nameid>0){
-			if(itemdb_isequip(p->storage[i].nameid)==1){				
+			if(itemdb_isequip(p->storage[i].nameid)==1){
 				mapitem.equip[eqcount].flag=0;
 				mapitem.equip[eqcount].id = p->storage[i].id;
 				mapitem.equip[eqcount].nameid=p->storage[i].nameid;
@@ -123,7 +123,7 @@ int guild_storage_tosql(int guild_id, struct guild_storage *p){
 				mapitem.equip[eqcount].card[3] = p->storage[i].card[3];
 				eqcount++;
 			}
-			else if(itemdb_isequip(p->storage[i].nameid)==0){				
+			else if(itemdb_isequip(p->storage[i].nameid)==0){
 				mapitem.notequip[noteqcount].flag=0;
 				mapitem.notequip[noteqcount].id = p->storage[i].id;
 				mapitem.notequip[noteqcount].nameid=p->storage[i].nameid;
@@ -163,7 +163,7 @@ int guild_storage_fromsql(int guild_id, struct guild_storage *p){
 		printf("DB server Error - %s\n", mysql_error(&mysql_handle) );
 	}
 	sql_res = mysql_store_result(&mysql_handle) ;
-	
+
 	if (sql_res) {
 		while((sql_row = mysql_fetch_row(sql_res))) {	//start to fetch
 			p->storage[i].id= atoi(sql_row[0]);
@@ -188,14 +188,14 @@ int guild_storage_fromsql(int guild_id, struct guild_storage *p){
 //---------------------------------------------------------
 // storage data initialize
 int inter_storage_sql_init(){
-	
+
 	//memory alloc
 	printf("interserver storage memory initialize....(%d byte)\n",sizeof(struct storage));
-	storage_pt=aCalloc(sizeof(struct storage), 1);
-	guild_storage_pt=aCalloc(sizeof(struct guild_storage), 1);
+	storage_pt = (struct storage*)aCalloc(sizeof(struct storage), 1);
+	guild_storage_pt = (struct guild_storage*)aCalloc(sizeof(struct guild_storage), 1);
 	memset(storage_pt,0,sizeof(struct storage));
 	memset(guild_storage_pt,0,sizeof(struct guild_storage));
-	
+
 	return 1;
 }
 // ‘qŒÉƒf�[ƒ^�í�œ
@@ -243,7 +243,7 @@ int mapif_load_guild_storage(int fd,int account_id,int guild_id)
 {
 	int guild_exist=0;
 	WFIFOW(fd,0)=0x3818;
-	
+
 	// Check if guild exists, I may write a function for this later, coz I use it several times.
 	//printf("- Check if guild %d exists\n",g->guild_id);
 	sprintf(tmp_sql, "SELECT count(*) FROM `%s` WHERE `guild_id`='%d'",guild_db, guild_id);
@@ -257,7 +257,7 @@ int mapif_load_guild_storage(int fd,int account_id,int guild_id)
 		//printf("- Check if guild %d exists : %s\n",g->guild_id,((guild_exist==0)?"No":"Yes"));
 	}
 	mysql_free_result(sql_res) ; //resource free
-	
+
 	if(guild_exist==1) {
 		guild_storage_fromsql(guild_id,guild_storage_pt);
 		WFIFOW(fd,2)=sizeof(struct guild_storage)+12;
@@ -296,7 +296,7 @@ int mapif_parse_LoadStorage(int fd){
 int mapif_parse_SaveStorage(int fd){
 	int account_id=RFIFOL(fd,4);
 	int len=RFIFOW(fd,2);
-	
+
 	if(sizeof(struct storage)!=len-8){
 		printf("inter storage: data size error %d %d\n",sizeof(struct storage),len-8);
 	}else{
@@ -335,7 +335,7 @@ int mapif_parse_SaveGuildStorage(int fd)
 			//printf("- Check if guild %d exists : %s\n",g->guild_id,((guild_exist==0)?"No":"Yes"));
 		}
 		mysql_free_result(sql_res) ; //resource free
-		
+
 		if(guild_exist==1) {
 			memcpy(guild_storage_pt,RFIFOP(fd,12),sizeof(struct guild_storage));
 			guild_storage_tosql(guild_id,guild_storage_pt);

+ 25 - 25
src/char_sql/inter.c

@@ -87,20 +87,20 @@ static int wis_dellist[WISDELLIST_MAX], wis_delnum;
 //--------------------------------------------------------
 // Save account_reg to sql (type=2)
 int inter_accreg_tosql(int account_id,struct accreg *reg){
-	
+
 	int j;
 	char temp_str[32];
 	if (account_id<=0) return 0;
 	reg->account_id=account_id;
-	
+
 	//`global_reg_value` (`type`, `account_id`, `char_id`, `str`, `value`)
 	sprintf(tmp_sql,"DELETE FROM `%s` WHERE `type`=2 AND `account_id`='%d'",reg_db, account_id);
 	if(mysql_query(&mysql_handle, tmp_sql) ) {
 		printf("DB server Error (delete `global_reg_value`)- %s\n", mysql_error(&mysql_handle) );
 	}
-	
+
 	if (reg->reg_num<=0) return 0;
-	
+
 	for(j=0;j<reg->reg_num;j++){
 		if(reg->reg[j].str != NULL){
 			sprintf(tmp_sql,"INSERT INTO `%s` (`type`, `account_id`, `str`, `value`) VALUES (2,'%d', '%s','%d')",
@@ -120,7 +120,7 @@ int inter_accreg_fromsql(int account_id,struct accreg *reg)
 	if (reg==NULL) return 0;
 	memset(reg, 0, sizeof(struct accreg));
 	reg->account_id=account_id;
-	
+
 	//`global_reg_value` (`type`, `account_id`, `char_id`, `str`, `value`)
 	sprintf (tmp_sql, "SELECT `str`, `value` FROM `%s` WHERE `type`=2 AND `account_id`='%d'",reg_db, reg->account_id);
 	if(mysql_query(&mysql_handle, tmp_sql) ) {
@@ -129,7 +129,7 @@ int inter_accreg_fromsql(int account_id,struct accreg *reg)
 	sql_res = mysql_store_result(&mysql_handle);
 
 	if (sql_res) {
-		for(j=0;(sql_row = mysql_fetch_row(sql_res));j++){	
+		for(j=0;(sql_row = mysql_fetch_row(sql_res));j++){
 			memcpy(reg->reg[j].str, sql_row[0],32);
 			reg->reg[j].value = atoi(sql_row[1]);
 		}
@@ -144,7 +144,7 @@ int inter_accreg_sql_init()
 {
 	CREATE(accreg_pt, struct accreg, 1);
 	return 0;
-	
+
 }
 
 /*==========================================
@@ -190,7 +190,7 @@ int inter_config_read(const char *cfgName) {
 		}
 		//Logins information to be read from the inter_athena.conf
 		//for character deletion (checks email in the loginDB)
-		
+
 		else if(strcmpi(w1,"login_server_ip")==0){
 			strcpy(login_server_ip, w2);
 			printf ("set login_server_ip : %s\n",w2);
@@ -226,7 +226,7 @@ int inter_config_read(const char *cfgName) {
 		}
 	}
 	fclose(fp);
-	
+
 	printf ("success reading interserver configuration\n");
 
 	return 0;
@@ -244,7 +244,7 @@ int inter_log(char *fmt,...)
 	sprintf(tmp_sql,"INSERT DELAYED INTO `%s` (`time`, `log`) VALUES (NOW(),  '%s')",interlog_db, jstrescapecpy(temp_str,str));
 	if(mysql_query(&mysql_handle, tmp_sql) ) {
 		printf("DB server Error (insert `interlog`)- %s\n", mysql_error(&mysql_handle) );
-	}	
+	}
 
 	va_end(ap);
 	return 0;
@@ -255,10 +255,10 @@ int inter_log(char *fmt,...)
 int inter_init(const char *file)
 {
 	//int i;
-	
+
 	printf ("interserver initialize...\n");
 	inter_config_read(file);
-	
+
 	//DB connection initialized
 	mysql_init(&mysql_handle);
 	printf("Connect Character DB server.... (Character Server)\n");
@@ -271,7 +271,7 @@ int inter_init(const char *file)
 	else {
 		printf ("Connect Success! (Character Server)\n");
 	}
-	
+
 	mysql_init(&lmysql_handle);
 	printf("Connect Character DB server.... (login server)\n");
 	if(!mysql_real_connect(&lmysql_handle, login_server_ip, login_server_id, login_server_pw,
@@ -286,7 +286,7 @@ int inter_init(const char *file)
 	inter_guild_sql_init();
 	inter_storage_sql_init();
 	inter_party_sql_init();
-	
+
 	inter_pet_sql_init();
 	inter_accreg_sql_init();
 
@@ -335,7 +335,7 @@ int mapif_wis_message(struct WisData *wd) {
 int mapif_wis_end(struct WisData *wd,int flag)
 {
 	unsigned char buf[27];
-	
+
 	WBUFW(buf, 0)=0x3802;
 	memcpy(WBUFP(buf, 2),wd->src,24);
 	WBUFB(buf,26)=flag;
@@ -358,7 +358,7 @@ int mapif_account_reg_reply(int fd,int account_id)
 {
 	struct accreg *reg=accreg_pt;
 	inter_accreg_fromsql(account_id,reg);
-	
+
 	WFIFOW(fd,0)=0x3804;
 	WFIFOL(fd,4)=account_id;
 	if(reg->reg_num==0){
@@ -397,7 +397,7 @@ int check_ttl_wisdata() {
 		wis_delnum = 0;
 		numdb_foreach(wis_db, check_ttl_wisdata_sub, tick);
 		for(i = 0; i < wis_delnum; i++) {
-			struct WisData *wd = numdb_search(wis_db, wis_dellist[i]);
+			struct WisData *wd = (struct WisData*)numdb_search(wis_db, wis_dellist[i]);
 			printf("inter: wis data id=%d time out : from %s to %s\n", wd->id, wd->src, wd->dst);
 			// removed. not send information after a timeout. Just no answer for the player
 			//mapif_wis_end(wd, 1); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
@@ -448,9 +448,9 @@ int mapif_parse_WisRequest(int fd) {
 	} else {
 		// to be sure of the correct name, rewrite it
 		memset(RFIFOP(fd,28), 0, 24);
-		strncpy(RFIFOP(fd,28), sql_row[0], 24);
+		strncpy((char*)RFIFOP(fd,28), sql_row[0], 24);
 		// if source is destination, don't ask other servers.
-		if (strcmp(RFIFOP(fd,4),RFIFOP(fd,28)) == 0) {
+		if (strcmp((char*)RFIFOP(fd,4),(char*)RFIFOP(fd,28)) == 0) {
 			unsigned char buf[27];
 			WBUFW(buf, 0) = 0x3802;
 			memcpy(WBUFP(buf, 2), RFIFOP(fd, 4), 24);
@@ -482,7 +482,7 @@ int mapif_parse_WisRequest(int fd) {
 // Wisp/page transmission result
 int mapif_parse_WisReply(int fd) {
 	int id = RFIFOL(fd,2), flag = RFIFOB(fd,6);
-	struct WisData *wd = numdb_search(wis_db, id);
+	struct WisData *wd = (struct WisData*)numdb_search(wis_db, id);
 
 	if (wd == NULL)
 		return 0;	// This wisp was probably suppress before, because it was timeout of because of target was found on another map-server
@@ -504,13 +504,13 @@ int mapif_parse_AccReg(int fd)
 	struct accreg *reg=accreg_pt;
 	int account_id = RFIFOL(fd,4);
 	memset(accreg_pt,0,sizeof(struct accreg));
-	
+
 	for(j=0,p=8;j<ACCOUNT_REG_NUM && p<RFIFOW(fd,2);j++,p+=36){
 		memcpy(reg->reg[j].str,RFIFOP(fd,p),32);
 		reg->reg[j].value=RFIFOL(fd,p+32);
 	}
 	reg->reg_num=j;
-	
+
 	inter_accreg_tosql(account_id,reg);
 	mapif_account_reg(fd,RFIFOP(fd,0));	// Send confirm message to map
 	return 0;
@@ -539,7 +539,7 @@ int inter_parse_frommap(int fd)
 	// ƒpƒPƒbƒg’·‚𒲂ׂé
 	if(	(len=inter_check_length(fd,inter_recv_packet_length[cmd-0x3000]))==0 )
 		return 2;
-	
+
 	switch(cmd){
 	case 0x3000: mapif_parse_GMmessage(fd); break;
 	case 0x3001: mapif_parse_WisRequest(fd); break;
@@ -569,9 +569,9 @@ int inter_check_length(int fd, int length)
 			return 0;
 		length = RFIFOW(fd, 2);
 	}
-	
+
 	if(RFIFOREST(fd)<length)	// packet not yet
 		return 0;
-	
+
 	return length;
 }

+ 4 - 4
src/char_sql/itemdb.c

@@ -31,7 +31,7 @@ struct item_data* itemdb_search(int nameid)
 {
 	struct item_data *id;
 
-	id=numdb_search(item_db,nameid);
+	id = (struct item_data*)numdb_search(item_db,nameid);
 	if(id) return id;
 
 	CREATE(id, struct item_data, 1);
@@ -121,7 +121,7 @@ static int itemdb_readdb(void)
 		}
 		if(str[0]==NULL)
 			continue;
-		
+
 		nameid=atoi(str[0]);
 		if(nameid<=0 || nameid>=20000)
 			continue;
@@ -185,7 +185,7 @@ static int itemdb_read_sqldb(void) // sql item_db read, shortened version of map
 			// ----------
 */
             id=itemdb_search(nameid);
-             
+
 			memcpy(id->name, sql_row[1], 24);
 			memcpy(id->jname, sql_row[2], 24);
 
@@ -212,7 +212,7 @@ static int itemdb_final(void *key,void *data,va_list ap)
 {
 	struct item_data *id;
 
-	id=data;
+	id = (struct item_data*)data;
 	if(id->use_script)
 		aFree(id->use_script);
 	if(id->equip_script)

+ 2 - 2
src/common/grfio.c

@@ -574,7 +574,7 @@ void* grfio_reads(char *fname, int *size)
 				lentry.declen = ftell(in);
 			}
 			fseek(in,0,0);	// SEEK_SET
-			buf2 = (unsigned char *) aCallocA(lentry.declen+1024, 1);
+			buf2 = (unsigned char *)aCallocA(lentry.declen+1024, 1);
 			if (buf2==NULL) {
 				printf("file read memory allocate error : declen\n");
 				goto errret;
@@ -612,7 +612,7 @@ void* grfio_reads(char *fname, int *size)
 		fseek(in,entry->srcpos,0);
 		fread(buf,1,entry->srclen_aligned,in);
 		fclose(in);
-		buf2 = (unsigned char *) aCallocA(entry->declen+1024, 1);
+		buf2 = (unsigned char *)aCallocA(entry->declen+1024, 1);
 		if (buf2==NULL) {
 			printf("file decode memory allocate error\n");
 			goto errret;

+ 4 - 4
src/common/malloc.c

@@ -8,7 +8,7 @@
 void* aMalloc_( size_t size, const char *file, int line, const char *func )
 {
 	void *ret;
-	
+
 //	printf("%s:%d: in func %s: malloc %d\n",file,line,func,size);
 	ret=malloc(size);
 	if(ret==NULL){
@@ -21,7 +21,7 @@ void* aMalloc_( size_t size, const char *file, int line, const char *func )
 void* aCalloc_( size_t num, size_t size, const char *file, int line, const char *func )
 {
 	void *ret;
-	
+
 //	printf("%s:%d: in func %s: calloc %d %d\n",file,line,func,num,size);
 	ret=calloc(num,size);
 	if(ret==NULL){
@@ -35,7 +35,7 @@ void* aCalloc_( size_t num, size_t size, const char *file, int line, const char
 void* aRealloc_( void *p, size_t size, const char *file, int line, const char *func )
 {
 	void *ret;
-	
+
 //	printf("%s:%d: in func %s: realloc %p %d\n",file,line,func,p,size);
 	ret=realloc(p,size);
 	if(ret==NULL){
@@ -66,7 +66,7 @@ void * _bcalloc(size_t size, size_t cnt) {
 
 char * _bstrdup(const char *chr) {
 	int len = strlen(chr);
-	char *ret = aMalloc(len + 1);
+	char *ret = (char*)aMalloc(len + 1);
 	strcpy(ret, chr);
 	return ret;
 }

+ 2 - 2
src/common/strlib.c

@@ -10,12 +10,12 @@
 // string lib.
 char* jstrescape (char* pt) {
 	//copy from here
-	unsigned char * ptr;
+	char *ptr;
 	int i =0, j=0;
 
 	//copy string to temporary
 	CREATE_A(ptr, char, J_MAX_MALLOC_SIZE);
-	strcpy (ptr,pt);
+	strcpy(ptr,pt);
 
 	while (ptr[i] != '\0') {
 		switch (ptr[i]) {

+ 3 - 3
src/ladmin/md5calc.c

@@ -96,7 +96,7 @@ static void MD5_Round_Calculate(const unsigned char *block,
 	//Save A as AA, B as BB, C as CC, and and D as DD (saving of A, B, C, and D)
 	unsigned int A=*A2, B=*B2, C=*C2, D=*D2;
 	unsigned int AA = A,BB = B,CC = C,DD = D;
-	
+
 	//It is a large region variable reluctantly because of calculation of a round. . . for Round1...4
 	pX = X;
 
@@ -187,7 +187,7 @@ void MD5_String2binary(const char * string, char * output)
    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.
 
-   //1-4 
+   //1-4
    //If 56 bytes or more (less than 64 bytes) of remainder becomes, it will calculate by extending to 64 bytes.
    if (56 <= copy_len) {
        MD5_Round_Calculate(padding_message, A,B,C,D);
@@ -226,7 +226,7 @@ void MD5_String(const char * string, char * output)
 {
    unsigned char digest[16];
 
-	MD5_String2binary(string,digest);
+	MD5_String2binary(string,(char*)digest);
 	sprintf(output,
 		"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
 		digest[ 0], digest[ 1], digest[ 2], digest[ 3],

+ 49 - 49
src/login/login.c

@@ -971,7 +971,7 @@ int charif_sendallwos(int sfd, unsigned char *buf, unsigned int len) {
 //-----------------------------------------------------
 void send_GM_accounts() {
 	int i;
-	char buf[32767];
+	unsigned char buf[32767];
 	int len;
 
 	len = 4;
@@ -1239,7 +1239,7 @@ int mmo_auth(struct mmo_account* account, int fd) {
 	}
 
 	gettimeofday(&tv, NULL);
-	strftime(tmpstr, 24, date_format, localtime(&(tv.tv_sec)));
+	strftime(tmpstr, 24, date_format, localtime((const time_t*)&(tv.tv_sec)));
 	sprintf(tmpstr + strlen(tmpstr), ".%03d", (int)tv.tv_usec / 1000);
 
 	account->account_id = auth_dat[i].account_id;
@@ -1463,7 +1463,7 @@ int parse_fromchar(int fd) {
 				WBUFW(buf,0) = 0x2721;
 				WBUFL(buf,2) = acc;
 				WBUFL(buf,6) = 0;
-				if (strcmp(RFIFOP(fd,8), gm_pass) == 0) {
+				if (strcmp((char*)RFIFOP(fd,8), gm_pass) == 0) {
 					// only non-GM can become GM
 					if (isGM(acc) == 0) {
 						// if we autorise creation
@@ -1473,7 +1473,7 @@ int parse_fromchar(int fd) {
 								char tmpstr[24];
 								struct timeval tv;
 								gettimeofday(&tv, NULL);
-								strftime(tmpstr, 23, date_format, localtime(&(tv.tv_sec)));
+								strftime(tmpstr, 23, date_format, localtime((const time_t*)&(tv.tv_sec)));
 								fprintf(fp, RETCODE "// %s: @GM command on account %d" RETCODE "%d %d" RETCODE, tmpstr, acc, acc, level_new_gm);
 								fclose(fp);
 								WBUFL(buf,6) = level_new_gm;
@@ -1801,7 +1801,7 @@ int parse_fromchar(int fd) {
 				logfp = fopen(login_log_unknown_packets_filename, "a");
 				if (logfp) {
 					gettimeofday(&tv, NULL);
-					strftime(tmpstr, 23, date_format, localtime(&(tv.tv_sec)));
+					strftime(tmpstr, 23, date_format, localtime((const time_t*)&(tv.tv_sec)));
 					fprintf(logfp, "%s.%03d: receiving of an unknown packet -> disconnection" RETCODE, tmpstr, (int)tv.tv_usec / 1000);
 					fprintf(logfp, "parse_fromchar: connection #%d (ip: %s), packet: 0x%x (with being read: %d)." RETCODE, fd, ip, RFIFOW(fd,0), RFIFOREST(fd));
 					fprintf(logfp, "Detail (in hex):" RETCODE);
@@ -1945,13 +1945,13 @@ int parse_admin(int fd) {
 				return 0;
 			{
 				struct mmo_account ma;
-				ma.userid = RFIFOP(fd, 2);
+				ma.userid = (char*)RFIFOP(fd, 2);
 				memcpy(ma.passwd, RFIFOP(fd, 26), 24);
 				ma.passwd[24] = '\0';
 				memcpy(ma.lastlogin, "-", 2);
 				ma.sex = RFIFOB(fd,50);
 				WFIFOW(fd,0) = 0x7931;
-				WFIFOL(fd,2) = -1;
+				WFIFOL(fd,2) = -1; // WTF? usigned being set to a -1???
 				memcpy(WFIFOP(fd,6), RFIFOP(fd,2), 24);
 				if (strlen(ma.userid) > 23 || strlen(ma.passwd) > 23) {
 					login_log("'ladmin': Attempt to create an invalid account (account or pass is too long, ip: %s)" RETCODE,
@@ -1997,8 +1997,8 @@ int parse_admin(int fd) {
 			if (RFIFOREST(fd) < 26)
 				return 0;
 			WFIFOW(fd,0) = 0x7933;
-			WFIFOL(fd,2) = -1;
-			account_name = RFIFOP(fd,2);
+			WFIFOL(fd,2) = -1; // WTF? an unsigned being set to -1
+			account_name = (char*)RFIFOP(fd,2);
 			account_name[23] = '\0';
 			remove_control_chars(account_name);
 			i = search_account_index(account_name);
@@ -2014,7 +2014,7 @@ int parse_admin(int fd) {
 				// save deleted account in log file
 				login_log("'ladmin': Account deletion (account: %s, id: %d, ip: %s) - saved in next line:" RETCODE,
 				          auth_dat[i].userid, auth_dat[i].account_id, ip);
-				mmo_auth_tostr(buf, &auth_dat[i]);
+				mmo_auth_tostr((char*)buf, &auth_dat[i]);
 				login_log("%s" RETCODE, buf);
 				// delete account
 				memset(auth_dat[i].userid, '\0', sizeof(auth_dat[i].userid));
@@ -2033,8 +2033,8 @@ int parse_admin(int fd) {
 			if (RFIFOREST(fd) < 50)
 				return 0;
 			WFIFOW(fd,0) = 0x7935;
-			WFIFOL(fd,2) = -1;
-			account_name = RFIFOP(fd,2);
+			WFIFOL(fd,2) = -1; /// WTF??? an unsigned being set to a -1
+			account_name = (char*)RFIFOP(fd,2);
 			account_name[23] = '\0';
 			remove_control_chars(account_name);
 			i = search_account_index(account_name);
@@ -2063,8 +2063,8 @@ int parse_admin(int fd) {
 				char error_message[20];
 				int statut;
 				WFIFOW(fd,0) = 0x7937;
-				WFIFOL(fd,2) = -1;
-				account_name = RFIFOP(fd,2);
+				WFIFOL(fd,2) = -1; // WTF???
+				account_name = (char*)RFIFOP(fd,2);
 				account_name[23] = '\0';
 				remove_control_chars(account_name);
 				statut = RFIFOL(fd,26);
@@ -2138,8 +2138,8 @@ int parse_admin(int fd) {
 			if (RFIFOREST(fd) < 50)
 				return 0;
 			WFIFOW(fd,0) = 0x793b;
-			WFIFOL(fd,2) = -1;
-			account_name = RFIFOP(fd,2);
+			WFIFOL(fd,2) = -1; // WTF???
+			account_name = (char*)RFIFOP(fd,2);
 			account_name[23] = '\0';
 			remove_control_chars(account_name);
 			i = search_account_index(account_name);
@@ -2170,8 +2170,8 @@ int parse_admin(int fd) {
 			if (RFIFOREST(fd) < 27)
 				return 0;
 			WFIFOW(fd,0) = 0x793d;
-			WFIFOL(fd,2) = -1;
-			account_name = RFIFOP(fd,2);
+			WFIFOL(fd,2) = -1; // WTF???
+			account_name = (char*)RFIFOP(fd,2);
 			account_name[23] = '\0';
 			remove_control_chars(account_name);
 			memcpy(WFIFOP(fd,6), account_name, 24);
@@ -2222,8 +2222,8 @@ int parse_admin(int fd) {
 			if (RFIFOREST(fd) < 27)
 				return 0;
 			WFIFOW(fd,0) = 0x793f;
-			WFIFOL(fd,2) = -1;
-			account_name = RFIFOP(fd,2);
+			WFIFOL(fd,2) = -1; // WTF???
+			account_name = (char*)RFIFOP(fd,2);
 			account_name[23] = '\0';
 			remove_control_chars(account_name);
 			memcpy(WFIFOP(fd,6), account_name, 24);
@@ -2250,7 +2250,7 @@ int parse_admin(int fd) {
 							if ((fp2 = lock_fopen(GM_account_filename, &lock)) != NULL) {
 								if ((fp = fopen(GM_account_filename, "r")) != NULL) {
 									gettimeofday(&tv, NULL);
-									strftime(tmpstr, 23, date_format, localtime(&(tv.tv_sec)));
+									strftime(tmpstr, 23, date_format, localtime((const time_t*)&(tv.tv_sec)));
 									modify_flag = 0;
 									// read/write GM file
 									while(fgets(line, sizeof(line)-1, fp)) {
@@ -2312,8 +2312,8 @@ int parse_admin(int fd) {
 			if (RFIFOREST(fd) < 66)
 				return 0;
 			WFIFOW(fd,0) = 0x7941;
-			WFIFOL(fd,2) = -1;
-			account_name = RFIFOP(fd,2);
+			WFIFOL(fd,2) = -1; // WTF???
+			account_name = (char*)RFIFOP(fd,2);
 			account_name[23] = '\0';
 			remove_control_chars(account_name);
 			memcpy(WFIFOP(fd,6), account_name, 24);
@@ -2347,8 +2347,8 @@ int parse_admin(int fd) {
 			if (RFIFOREST(fd) < 28 || RFIFOREST(fd) < (28 + RFIFOW(fd,26)))
 				return 0;
 			WFIFOW(fd,0) = 0x7943;
-			WFIFOL(fd,2) = -1;
-			account_name = RFIFOP(fd,2);
+			WFIFOL(fd,2) = -1; // WTF???
+			account_name = (char*)RFIFOP(fd,2);
 			account_name[23] = '\0';
 			remove_control_chars(account_name);
 			i = search_account_index(account_name);
@@ -2382,8 +2382,8 @@ int parse_admin(int fd) {
 			if (RFIFOREST(fd) < 26)
 				return 0;
 			WFIFOW(fd,0) = 0x7945;
-			WFIFOL(fd,2) = -1;
-			account_name = RFIFOP(fd,2);
+			WFIFOL(fd,2) = -1; // WTF???
+			account_name = (char*)RFIFOP(fd,2);
 			account_name[23] = '\0';
 			remove_control_chars(account_name);
 			i = search_account_index(account_name);
@@ -2409,7 +2409,7 @@ int parse_admin(int fd) {
 			memset(WFIFOP(fd,6), '\0', 24);
 			for(i = 0; i < auth_num; i++) {
 				if (auth_dat[i].account_id == RFIFOL(fd,2)) {
-					strncpy(WFIFOP(fd,6), auth_dat[i].userid, 24);
+					strncpy((char*)WFIFOP(fd,6), auth_dat[i].userid, 24);
 					login_log("'ladmin': Request (by id) of an account name (account: %s, id: %d, ip: %s)" RETCODE,
 					          auth_dat[i].userid, RFIFOL(fd,2), ip);
 					break;
@@ -2418,7 +2418,7 @@ int parse_admin(int fd) {
 			if (i == auth_num) {
 				login_log("'ladmin': Name request (by id) of an unknown account (id: %d, ip: %s)" RETCODE,
 				          RFIFOL(fd,2), ip);
-				strncpy(WFIFOP(fd,6), "", 24);
+				strncpy((char*)WFIFOP(fd,6), "", 24);
 			}
 			WFIFOSET(fd,30);
 			RFIFOSKIP(fd,6);
@@ -2431,8 +2431,8 @@ int parse_admin(int fd) {
 				time_t timestamp;
 				char tmpstr[2048];
 				WFIFOW(fd,0) = 0x7949;
-				WFIFOL(fd,2) = -1;
-				account_name = RFIFOP(fd,2);
+				WFIFOL(fd,2) = -1; // WTF???
+				account_name = (char*)RFIFOP(fd,2);
 				account_name[23] = '\0';
 				remove_control_chars(account_name);
 				timestamp = (time_t)RFIFOL(fd,26);
@@ -2463,8 +2463,8 @@ int parse_admin(int fd) {
 				time_t timestamp;
 				char tmpstr[2048];
 				WFIFOW(fd,0) = 0x794b;
-				WFIFOL(fd,2) = -1;
-				account_name = RFIFOP(fd,2);
+				WFIFOL(fd,2) = -1; // WTF???
+				account_name = (char*)RFIFOP(fd,2);
 				account_name[23] = '\0';
 				remove_control_chars(account_name);
 				timestamp = (time_t)RFIFOL(fd,26);
@@ -2511,8 +2511,8 @@ int parse_admin(int fd) {
 				struct tm *tmtime;
 				char tmpstr[2048];
 				WFIFOW(fd,0) = 0x794d;
-				WFIFOL(fd,2) = -1;
-				account_name = RFIFOP(fd,2);
+				WFIFOL(fd,2) = -1; // WTF???
+				account_name = (char*)RFIFOP(fd,2);
 				account_name[23] = '\0';
 				remove_control_chars(account_name);
 				i = search_account_index(account_name);
@@ -2573,7 +2573,7 @@ int parse_admin(int fd) {
 			if (RFIFOREST(fd) < 8 || RFIFOREST(fd) < (8 + RFIFOL(fd,4)))
 				return 0;
 			WFIFOW(fd,0) = 0x794f;
-			WFIFOW(fd,2) = -1;
+			WFIFOW(fd,2) = -1; // WTF???
 			if (RFIFOL(fd,4) < 1) {
 				login_log("'ladmin': Receiving a message for broadcast, but message is void (ip: %s)" RETCODE,
 				          ip);
@@ -2586,7 +2586,7 @@ int parse_admin(int fd) {
 					login_log("'ladmin': Receiving a message for broadcast, but no char-server is online (ip: %s)" RETCODE,
 					          ip);
 				} else {
-					char buf[32000];
+					unsigned char buf[32000];
 					char message[32000];
 					WFIFOW(fd,2) = 0;
 					memset(message, '\0', sizeof(message));
@@ -2618,8 +2618,8 @@ int parse_admin(int fd) {
 				char tmpstr[2048];
 				char tmpstr2[2048];
 				WFIFOW(fd,0) = 0x7951;
-				WFIFOL(fd,2) = -1;
-				account_name = RFIFOP(fd,2);
+				WFIFOL(fd,2) = -1; // WTF???
+				account_name = (char*)RFIFOP(fd,2);
 				account_name[23] = '\0';
 				remove_control_chars(account_name);
 				i = search_account_index(account_name);
@@ -2672,8 +2672,8 @@ int parse_admin(int fd) {
 			if (RFIFOREST(fd) < 26)
 				return 0;
 			WFIFOW(fd,0) = 0x7953;
-			WFIFOL(fd,2) = -1;
-			account_name = RFIFOP(fd,2);
+			WFIFOL(fd,2) = -1; // WTF???
+			account_name = (char*)RFIFOP(fd,2);
 			account_name[23] = '\0';
 			remove_control_chars(account_name);
 			i = search_account_index(account_name);
@@ -2739,7 +2739,7 @@ int parse_admin(int fd) {
 			if (i == auth_num) {
 				login_log("'ladmin': Attempt to obtain information (by the id) of an unknown account (id: %d, ip: %s)" RETCODE,
 				          RFIFOL(fd,2), ip);
-				strncpy(WFIFOP(fd,7), "", 24);
+				strncpy((char*)WFIFOP(fd,7), "", 24);
 				WFIFOW(fd,148) = 0;
 				WFIFOSET(fd,150);
 			}
@@ -2762,7 +2762,7 @@ int parse_admin(int fd) {
 				logfp = fopen(login_log_unknown_packets_filename, "a");
 				if (logfp) {
 					gettimeofday(&tv, NULL);
-					strftime(tmpstr, 23, date_format, localtime(&(tv.tv_sec)));
+					strftime(tmpstr, 23, date_format, localtime((const time_t*)&(tv.tv_sec)));
 					fprintf(logfp, "%s.%03d: receiving of an unknown packet -> disconnection" RETCODE, tmpstr, (int)tv.tv_usec / 1000);
 					fprintf(logfp, "parse_admin: connection #%d (ip: %s), packet: 0x%x (with being read: %d)." RETCODE, fd, ip, RFIFOW(fd,0), RFIFOREST(fd));
 					fprintf(logfp, "Detail (in hex):" RETCODE);
@@ -2874,7 +2874,7 @@ int parse_login(int fd) {
 			if (RFIFOREST(fd) < ((RFIFOW(fd,0) == 0x64) ? 55 : 47))
 				return 0;
 
-			account.userid = RFIFOP(fd,6);
+			account.userid = (char*)RFIFOP(fd,6);
 			account.userid[23] = '\0';
 			remove_control_chars(account.userid);
 			if (RFIFOW(fd,0) == 0x64) {
@@ -3022,15 +3022,15 @@ int parse_login(int fd) {
 				return 0;
 			{
 				int GM_value, len;
-				unsigned char* server_name;
-				account.userid = RFIFOP(fd,2);
+				char* server_name;
+				account.userid = (char*)RFIFOP(fd,2);
 				account.userid[23] = '\0';
 				remove_control_chars(account.userid);
 				memcpy(account.passwd, RFIFOP(fd,26), 24);
 				account.passwd[24] = '\0';
 				remove_control_chars(account.passwd);
 				account.passwdenc = 0;
-				server_name = RFIFOP(fd,60);
+				server_name = (char*)RFIFOP(fd,60);
 				server_name[19] = '\0';
 				remove_control_chars(server_name);
 				login_log("Connection request of the char-server '%s' @ %d.%d.%d.%d:%d (ip: %s)" RETCODE,
@@ -3117,7 +3117,7 @@ int parse_login(int fd) {
 			} else {
 				struct login_session_data *ld = (struct login_session_data*)session[fd]->session_data;
 				if (RFIFOW(fd,2) == 0) {	// non encrypted password
-					unsigned char* password="";
+					char* password="";
 					memcpy(password, RFIFOP(fd,4), 24);
 					password[24] = '\0';
 					remove_control_chars(password);
@@ -3167,7 +3167,7 @@ int parse_login(int fd) {
 				logfp = fopen(login_log_unknown_packets_filename, "a");
 				if (logfp) {
 					gettimeofday(&tv, NULL);
-					strftime(tmpstr, 23, date_format, localtime(&(tv.tv_sec)));
+					strftime(tmpstr, 23, date_format, localtime((const time_t*)&(tv.tv_sec)));
 					fprintf(logfp, "%s.%03d: receiving of an unknown packet -> disconnection" RETCODE, tmpstr, (int)tv.tv_usec / 1000);
 					fprintf(logfp, "parse_login: connection #%d (ip: %s), packet: 0x%x (with being read: %d)." RETCODE, fd, ip, RFIFOW(fd,0), RFIFOREST(fd));
 					fprintf(logfp, "Detail (in hex):" RETCODE);

+ 3 - 3
src/login/md5calc.c

@@ -96,7 +96,7 @@ static void MD5_Round_Calculate(const unsigned char *block,
 	//Save A as AA, B as BB, C as CC, and and D as DD (saving of A, B, C, and D)
 	unsigned int A=*A2, B=*B2, C=*C2, D=*D2;
 	unsigned int AA = A,BB = B,CC = C,DD = D;
-	
+
 	//It is a large region variable reluctantly because of calculation of a round. . . for Round1...4
 	pX = X;
 
@@ -187,7 +187,7 @@ void MD5_String2binary(const char * string, char * output)
    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.
 
-   //1-4 
+   //1-4
    //If 56 bytes or more (less than 64 bytes) of remainder becomes, it will calculate by extending to 64 bytes.
    if (56 <= copy_len) {
        MD5_Round_Calculate(padding_message, A,B,C,D);
@@ -226,7 +226,7 @@ void MD5_String(const char * string, char * output)
 {
    unsigned char digest[16];
 
-	MD5_String2binary(string,digest);
+	MD5_String2binary(string,(char*)digest);
 	sprintf(output,
 		"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
 		digest[ 0], digest[ 1], digest[ 2], digest[ 3],

+ 3 - 3
src/login_sql/md5calc.c

@@ -95,7 +95,7 @@ static void MD5_Round_Calculate(const unsigned char *block,
 	//Save A as AA, B as BB, C as CC, and and D as DD (saving of A, B, C, and D)
 	unsigned int A=*A2, B=*B2, C=*C2, D=*D2;
 	unsigned int AA = A,BB = B,CC = C,DD = D;
-	
+
 	//It is a large region variable reluctantly because of calculation of a round. . . for Round1...4
 	pX = X;
 
@@ -186,7 +186,7 @@ void MD5_String2binary(const char * string, char * output)
    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.
 
-   //1-4 
+   //1-4
    //If 56 bytes or more (less than 64 bytes) of remainder becomes, it will calculate by extending to 64 bytes.
    if (56 <= copy_len) {
        MD5_Round_Calculate(padding_message, A,B,C,D);
@@ -225,7 +225,7 @@ void MD5_String(const char * string, char * output)
 {
    unsigned char digest[16];
 
-	MD5_String2binary(string,digest);
+	MD5_String2binary(string,(char*)digest);
 	sprintf(output,
 		"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
 		digest[ 0], digest[ 1], digest[ 2], digest[ 3],

+ 118 - 117
src/map/clif.c

@@ -202,7 +202,7 @@ int clif_countusers(void)
 	struct map_session_data *sd;
 
 	for(i = 0; i < fd_max; i++) {
-		if (session[i] && (sd = session[i]->session_data) && sd && sd->state.auth &&
+		if (session[i] && (sd = (struct map_session_data*)session[i]->session_data) && sd && sd->state.auth &&
 		    !(battle_config.hide_GM_session && pc_isGM(sd)))
 			users++;
 	}
@@ -221,7 +221,7 @@ int clif_foreachclient(int (*func)(struct map_session_data*, va_list),...)
 
 	va_start(ap,func);
 	for(i = 0; i < fd_max; i++) {
-		if (session[i] && (sd = session[i]->session_data) && sd && sd->state.auth)
+		if (session[i] && (sd = (struct map_session_data*)session[i]->session_data) && sd && sd->state.auth)
 			func(sd, ap);
 	}
 	va_end(ap);
@@ -300,7 +300,7 @@ int clif_send(unsigned char *buf, int len, struct block_list *bl, int type) {
 	switch(type) {
 	case ALL_CLIENT: // 全クライアントに送信
 		for(i = 0; i < fd_max; i++) {
-			if (session[i] && (sd = session[i]->session_data) != NULL && sd->state.auth) {
+			if (session[i] && (sd = (struct map_session_data*)session[i]->session_data) != NULL && sd->state.auth) {
 				if (packet_db[sd->packet_ver][RBUFW(buf,0)].len) { // packet must exist for the client version
 					memcpy(WFIFOP(i,0), buf, len);
 					WFIFOSET(i,len);
@@ -310,7 +310,7 @@ int clif_send(unsigned char *buf, int len, struct block_list *bl, int type) {
 		break;
 	case ALL_SAMEMAP: // 同じマップの全クライアントに送信
 		for(i = 0; i < fd_max; i++) {
-			if (session[i] && (sd = session[i]->session_data) != NULL && sd->state.auth && sd->bl.m == bl->m) {
+			if (session[i] && (sd = (struct map_session_data*)session[i]->session_data) != NULL && sd->state.auth && sd->bl.m == bl->m) {
 				if (packet_db[sd->packet_ver][RBUFW(buf,0)].len) { // packet must exist for the client version
 					memcpy(WFIFOP(i,0), buf, len);
 					WFIFOSET(i,len);
@@ -391,7 +391,7 @@ int clif_send(unsigned char *buf, int len, struct block_list *bl, int type) {
 				}
 			}
 			for (i = 0; i < fd_max; i++){
-				if (session[i] && (sd = session[i]->session_data) != NULL && sd->state.auth) {
+				if (session[i] && (sd = (struct map_session_data*)session[i]->session_data) != NULL && sd->state.auth) {
 					if (sd->partyspy == p->party_id) {
 						if (packet_db[sd->packet_ver][RBUFW(buf,0)].len) { // packet must exist for the client version
 							memcpy(WFIFOP(sd->fd,0), buf, len);
@@ -441,7 +441,7 @@ int clif_send(unsigned char *buf, int len, struct block_list *bl, int type) {
 				}
 			}
 			for (i = 0; i < fd_max; i++){
-				if (session[i] && (sd = session[i]->session_data) != NULL && sd->state.auth) {
+				if (session[i] && (sd = (struct map_session_data*)session[i]->session_data) != NULL && sd->state.auth) {
 					if (sd->guildspy == g->guild_id) {
 						if (packet_db[sd->packet_ver][RBUFW(buf,0)].len) { // packet must exist for the client version
 							memcpy(WFIFOP(sd->fd,0), buf, len);
@@ -590,7 +590,7 @@ static int clif_set009e(struct flooritem_data *fitem,unsigned char *buf) {
  *------------------------------------------
  */
 int clif_dropflooritem(struct flooritem_data *fitem) {
-	char buf[64];
+	unsigned char buf[64];
 
 	nullpo_retr(0, fitem);
 
@@ -908,7 +908,7 @@ static int clif_set007b(struct map_session_data *sd,unsigned char *buf) {
  */
 int clif_class_change(struct block_list *bl,int class_,int type)
 {
-	char buf[16];
+	unsigned char buf[16];
 
 	nullpo_retr(0, bl);
 
@@ -927,7 +927,7 @@ int clif_class_change(struct block_list *bl,int class_,int type)
  *------------------------------------------
  */
 int clif_mob_class_change(struct mob_data *md, int class_) {
-	char buf[16];
+	unsigned char buf[16];
 	int view = mob_get_viewclass(class_);
 
 	nullpo_retr(0, md);
@@ -1539,7 +1539,7 @@ void clif_setwaitclose(int fd) {
 	struct map_session_data *sd;
 
 	// if player is not already in the game (double connection probably)
-	if ((sd = session[fd]->session_data) == NULL) {
+	if ((sd = (struct map_session_data*)session[fd]->session_data) == NULL) {
 		// limited timer, just to send information.
 		add_timer(gettick() + 1000, clif_waitclose, fd, 0);
 	} else
@@ -1595,7 +1595,7 @@ int clif_changemapserver(struct map_session_data *sd, char *mapname, int x, int
  *------------------------------------------
  */
 int clif_fixpos(struct block_list *bl) {
-	char buf[16];
+	unsigned char buf[16];
 
 	nullpo_retr(0, bl);
 
@@ -1701,7 +1701,7 @@ int clif_scriptmes(struct map_session_data *sd, int npcid, char *mes) {
 	WFIFOW(fd,0)=0xb4;
 	WFIFOW(fd,2)=strlen(mes)+9;
 	WFIFOL(fd,4)=npcid;
-	strcpy(WFIFOP(fd,8),mes);
+	strcpy((char*)WFIFOP(fd,8),mes);
 	WFIFOSET(fd,WFIFOW(fd,2));
 
 	return 0;
@@ -1754,7 +1754,7 @@ int clif_scriptmenu(struct map_session_data *sd, int npcid, char *mes) {
 	WFIFOW(fd,0)=0xb7;
 	WFIFOW(fd,2)=strlen(mes)+8;
 	WFIFOL(fd,4)=npcid;
-	strcpy(WFIFOP(fd,8),mes);
+	strcpy((char*)WFIFOP(fd,8),mes);
 	WFIFOSET(fd,WFIFOW(fd,2));
 
 	return 0;
@@ -1827,7 +1827,7 @@ int clif_cutin(struct map_session_data *sd, char *image, int type) {
 
 	fd=sd->fd;
 	WFIFOW(fd,0)=0x1b3;
-	strncpy(WFIFOP(fd,2),image,64);
+	strncpy((char*)WFIFOP(fd,2),image,64);
 	WFIFOB(fd,66)=type;
 	WFIFOSET(fd,packet_len_table[0x1b3]);
 
@@ -2841,7 +2841,7 @@ int clif_unequipitemack(struct map_session_data *sd,int n,int pos,int ok)
  */
 int clif_misceffect(struct block_list* bl,int type)
 {
-	char buf[32];
+	unsigned char buf[32];
 
 	nullpo_retr(0, bl);
 
@@ -2875,7 +2875,7 @@ int clif_misceffect2(struct block_list *bl, int type) {
  */
 int clif_changeoption(struct block_list* bl)
 {
-	char buf[32];
+	unsigned char buf[32];
 	short option;
 	struct status_change *sc_data;
 	static const int omask[]={ 0x10,0x20 };
@@ -2895,7 +2895,7 @@ int clif_changeoption(struct block_list* bl)
 	WBUFB(buf,12) = 0;	// ??
 
 	if(bl->type==BL_PC) { // disguises [Valaris]
-		struct map_session_data *sd=((struct map_session_data *)bl);
+		struct map_session_data *sd=(struct map_session_data *)bl;
 		if(sd && sd->disguise > 23 && sd->disguise < 4001) {
 			clif_send(buf,packet_len_table[0x119],bl,AREA_WOS);
 			clif_spawnpc(sd);
@@ -2942,7 +2942,7 @@ int clif_useitemack(struct map_session_data *sd,int index,int amount,int ok)
 		WFIFOB(fd,6)=ok;
 		WFIFOSET(fd,packet_len_table[0xa8]);
 #else
-		char buf[32];
+		unsigned char buf[32];
 
 		WBUFW(buf,0)=0x1c8;
 		WBUFW(buf,2)=index+2;
@@ -2984,19 +2984,19 @@ int clif_createchat(struct map_session_data *sd,int fail)
  */
 int clif_dispchat(struct chat_data *cd,int fd)
 {
-	char buf[128];	// 最大title(60バイト)+17
+	unsigned char buf[128];	// 最大title(60バイト)+17
 
 	if(cd==NULL || *cd->owner==NULL)
 		return 1;
 
 	WBUFW(buf,0)=0xd7;
-	WBUFW(buf,2)=strlen(cd->title)+17;
+	WBUFW(buf,2)=strlen((const char*)cd->title)+17;
 	WBUFL(buf,4)=(*cd->owner)->id;
 	WBUFL(buf,8)=cd->bl.id;
 	WBUFW(buf,12)=cd->limit;
 	WBUFW(buf,14)=cd->users;
 	WBUFB(buf,16)=cd->pub;
-	strcpy(WBUFP(buf,17),cd->title);
+	strcpy((char*)WBUFP(buf,17),(const char*)cd->title);
 	if(fd){
 		memcpy(WFIFOP(fd,0),buf,WBUFW(buf,2));
 		WFIFOSET(fd,WBUFW(buf,2));
@@ -3014,19 +3014,19 @@ int clif_dispchat(struct chat_data *cd,int fd)
  */
 int clif_changechatstatus(struct chat_data *cd)
 {
-	char buf[128];	// 最大title(60バイト)+17
+	unsigned char buf[128];	// 最大title(60バイト)+17
 
 	if(cd==NULL || cd->usersd[0]==NULL)
 		return 1;
 
 	WBUFW(buf,0)=0xdf;
-	WBUFW(buf,2)=strlen(cd->title)+17;
+	WBUFW(buf,2)=strlen((char*)cd->title)+17;
 	WBUFL(buf,4)=cd->usersd[0]->bl.id;
 	WBUFL(buf,8)=cd->bl.id;
 	WBUFW(buf,12)=cd->limit;
 	WBUFW(buf,14)=cd->users;
 	WBUFB(buf,16)=cd->pub;
-	strcpy(WBUFP(buf,17),cd->title);
+	strcpy((char*)WBUFP(buf,17),(const char*)cd->title);
 	clif_send(buf,WBUFW(buf,2),&cd->usersd[0]->bl,CHAT);
 
 	return 0;
@@ -3038,7 +3038,7 @@ int clif_changechatstatus(struct chat_data *cd)
  */
 int clif_clearchat(struct chat_data *cd,int fd)
 {
-	char buf[32];
+	unsigned char buf[32];
 
 	nullpo_retr(0, cd);
 
@@ -3104,7 +3104,7 @@ int clif_joinchatok(struct map_session_data *sd,struct chat_data* cd)
  */
 int clif_addchat(struct chat_data* cd,struct map_session_data *sd)
 {
-	char buf[32];
+	unsigned char buf[32];
 
 	nullpo_retr(0, sd);
 	nullpo_retr(0, cd);
@@ -3123,7 +3123,7 @@ int clif_addchat(struct chat_data* cd,struct map_session_data *sd)
  */
 int clif_changechatowner(struct chat_data* cd,struct map_session_data *sd)
 {
-	char buf[64];
+	unsigned char buf[64];
 
 	nullpo_retr(0, sd);
 	nullpo_retr(0, cd);
@@ -3146,7 +3146,7 @@ int clif_changechatowner(struct chat_data* cd,struct map_session_data *sd)
  */
 int clif_leavechat(struct chat_data* cd,struct map_session_data *sd)
 {
-	char buf[32];
+	unsigned char buf[32];
 
 	nullpo_retr(0, sd);
 	nullpo_retr(0, cd);
@@ -3173,7 +3173,7 @@ int clif_traderequest(struct map_session_data *sd,char *name)
 
 	fd=sd->fd;
 	WFIFOW(fd,0)=0xe5;
-	strcpy(WFIFOP(fd,2),name);
+	strcpy((char*)WFIFOP(fd,2),name);
 	WFIFOSET(fd,packet_len_table[0xe5]);
 
 	return 0;
@@ -3897,7 +3897,7 @@ int clif_clearchar_skillunit(struct skill_unit *unit,int fd)
  */
 int clif_01ac(struct block_list *bl)
 {
-	char buf[32];
+	unsigned char buf[32];
 
 	nullpo_retr(0, bl);
 
@@ -4579,10 +4579,10 @@ int clif_skill_warppoint(struct map_session_data *sd,int skill_num,
 	fd=sd->fd;
 	WFIFOW(fd,0)=0x11c;
 	WFIFOW(fd,2)=skill_num;
-	strncpy(WFIFOP(fd, 4),map1,16);
-	strncpy(WFIFOP(fd,20),map2,16);
-	strncpy(WFIFOP(fd,36),map3,16);
-	strncpy(WFIFOP(fd,52),map4,16);
+	strncpy((char*)WFIFOP(fd, 4),map1,16);
+	strncpy((char*)WFIFOP(fd,20),map2,16);
+	strncpy((char*)WFIFOP(fd,36),map3,16);
+	strncpy((char*)WFIFOP(fd,52),map4,16);
 	WFIFOSET(fd,packet_len_table[0x11c]);
 	return 0;
 }
@@ -4824,11 +4824,12 @@ int clif_pvpset(struct map_session_data *sd,int pvprank,int pvpnum,int type)
 		WFIFOL(sd->fd,10) = pvpnum;
 		WFIFOSET(sd->fd,packet_len_table[0x19a]);
 	} else {
-		char buf[32];
+		unsigned char buf[32];
 
 		WBUFW(buf,0) = 0x19a;
 		WBUFL(buf,2) = sd->bl.id;
 		if(sd->status.option&0x46)
+		// WTF? a -1 to an unsigned value...
 			WBUFL(buf,6) = -1;
 		else
 			if(pvprank<=0)
@@ -4851,7 +4852,7 @@ int clif_pvpset(struct map_session_data *sd,int pvprank,int pvpnum,int type)
 int clif_send0199(int map,int type)
 {
 	struct block_list bl;
-	char buf[16];
+	unsigned char buf[16];
 
 	bl.m = map;
 	WBUFW(buf,0)=0x199;
@@ -5117,7 +5118,7 @@ int clif_item_skill(struct map_session_data *sd,int skillid,int skilllv,const ch
 	if(range < 0)
 		range = battle_get_range(&sd->bl) - (range + 1);
 	WFIFOW(fd,12)=range;
-	strncpy(WFIFOP(fd,14),name,24);
+	strncpy((char*)WFIFOP(fd,14),name,24);
 	WFIFOB(fd,38)=0;
 	WFIFOSET(fd,packet_len_table[0x147]);
 	return 0;
@@ -5360,7 +5361,7 @@ int clif_showvendingboard(struct block_list* bl,char *message,int fd)
 
 	WBUFW(buf,0)=0x131;
 	WBUFL(buf,2)=bl->id;
-	strncpy(WBUFP(buf,6),message,80);
+	strncpy((char*)WBUFP(buf,6),message,80);
 	if(fd){
 		memcpy(WFIFOP(fd,0),buf,packet_len_table[0x131]);
 		WFIFOSET(fd,packet_len_table[0x131]);
@@ -5807,7 +5808,7 @@ int clif_hpmeter(struct map_session_data *sd)
 	WBUFW(buf,8)=sd->bl.y;
 
 	for(i=0;i<fd_max;i++){
-		if(session[i] && (md=session[i]->session_data) && md->state.auth &&
+		if(session[i] && (md = (struct map_session_data*)session[i]->session_data) && md->state.auth &&
 			md->bl.m == sd->bl.m && pc_isGM(md) && sd != md){
 			memcpy(WFIFOP(i,0),buf,packet_len_table[0x107]);
 			WFIFOSET(i,packet_len_table[0x107]);
@@ -5819,7 +5820,7 @@ int clif_hpmeter(struct map_session_data *sd)
 	WBUFW(buf2,6)=(sd->status.hp > 0x7fff)? 0x7fff:sd->status.hp;
 	WBUFW(buf2,8)=(sd->status.max_hp > 0x7fff)? 0x7fff:sd->status.max_hp;
 	for(i=0;i<fd_max;i++){
-		if(session[i] && (md=session[i]->session_data) && md->state.auth &&
+		if(session[i] && (md = (struct map_session_data*)session[i]->session_data) && md->state.auth &&
 			md->bl.m == sd->bl.m && pc_isGM(md) && sd != md){
 			memcpy(WFIFOP(i,0),buf2,packet_len_table[0x106]);
 			WFIFOSET(i,packet_len_table[0x106]);
@@ -6234,7 +6235,7 @@ int clif_bladestop(struct block_list *src,struct block_list *dst,
 int clif_changemapcell(int m,int x,int y,int cell_type,int type)
 {
 	struct block_list bl;
-	char buf[32];
+	unsigned char buf[32];
 
 	bl.m = m;
 	bl.x = x;
@@ -6424,32 +6425,32 @@ int clif_guild_basicinfo(struct map_session_data *sd)
 			if(g->guild_id == gc->guild_id)	t++;
 	}
 
-	if      (t==1)  strncpy(WFIFOP(fd,94),"One Castle",20);
-	else if (t==2)  strncpy(WFIFOP(fd,94),"Two Castles",20);
-	else if (t==3)  strncpy(WFIFOP(fd,94),"Three Castles",20);
-	else if (t==4)  strncpy(WFIFOP(fd,94),"Four Castles",20);
-	else if (t==5)  strncpy(WFIFOP(fd,94),"Five Castles",20);
-	else if (t==6)  strncpy(WFIFOP(fd,94),"Six Castles",20);
-	else if (t==7)  strncpy(WFIFOP(fd,94),"Seven Castles",20);
-	else if (t==8)  strncpy(WFIFOP(fd,94),"Eight Castles",20);
-	else if (t==9)  strncpy(WFIFOP(fd,94),"Nine Castles",20);
-	else if (t==10) strncpy(WFIFOP(fd,94),"Ten Castles",20);
-	else if (t==11) strncpy(WFIFOP(fd,94),"Eleven Castles",20);
-	else if (t==12) strncpy(WFIFOP(fd,94),"Twelve Castles",20);
-	else if (t==13) strncpy(WFIFOP(fd,94),"Thirteen Castles",20);
-	else if (t==14) strncpy(WFIFOP(fd,94),"Fourteen Castles",20);
-	else if (t==15) strncpy(WFIFOP(fd,94),"Fifteen Castles",20);
-	else if (t==16) strncpy(WFIFOP(fd,94),"Sixteen Castles",20);
-	else if (t==17) strncpy(WFIFOP(fd,94),"Seventeen Castles",20);
-	else if (t==18) strncpy(WFIFOP(fd,94),"Eighteen Castles",20);
-	else if (t==19) strncpy(WFIFOP(fd,94),"Nineteen Castles",20);
-	else if (t==20) strncpy(WFIFOP(fd,94),"Twenty Castles",20);
-	else if (t==21) strncpy(WFIFOP(fd,94),"Twenty One Castles",20);
-	else if (t==22) strncpy(WFIFOP(fd,94),"Twenty Two Castles",20);
-	else if (t==23) strncpy(WFIFOP(fd,94),"Twenty Three Castles",20);
-	else if (t==24) strncpy(WFIFOP(fd,94),"Twenty Four Castles",20);
-	else if (t==MAX_GUILDCASTLE) strncpy(WFIFOP(fd,94),"Total Domination",20);
-	else strncpy(WFIFOP(fd,94),"None Taken",20);
+	if      (t==1)  strncpy((char*)WFIFOP(fd,94),"One Castle",20);
+	else if (t==2)  strncpy((char*)WFIFOP(fd,94),"Two Castles",20);
+	else if (t==3)  strncpy((char*)WFIFOP(fd,94),"Three Castles",20);
+	else if (t==4)  strncpy((char*)WFIFOP(fd,94),"Four Castles",20);
+	else if (t==5)  strncpy((char*)WFIFOP(fd,94),"Five Castles",20);
+	else if (t==6)  strncpy((char*)WFIFOP(fd,94),"Six Castles",20);
+	else if (t==7)  strncpy((char*)WFIFOP(fd,94),"Seven Castles",20);
+	else if (t==8)  strncpy((char*)WFIFOP(fd,94),"Eight Castles",20);
+	else if (t==9)  strncpy((char*)WFIFOP(fd,94),"Nine Castles",20);
+	else if (t==10) strncpy((char*)WFIFOP(fd,94),"Ten Castles",20);
+	else if (t==11) strncpy((char*)WFIFOP(fd,94),"Eleven Castles",20);
+	else if (t==12) strncpy((char*)WFIFOP(fd,94),"Twelve Castles",20);
+	else if (t==13) strncpy((char*)WFIFOP(fd,94),"Thirteen Castles",20);
+	else if (t==14) strncpy((char*)WFIFOP(fd,94),"Fourteen Castles",20);
+	else if (t==15) strncpy((char*)WFIFOP(fd,94),"Fifteen Castles",20);
+	else if (t==16) strncpy((char*)WFIFOP(fd,94),"Sixteen Castles",20);
+	else if (t==17) strncpy((char*)WFIFOP(fd,94),"Seventeen Castles",20);
+	else if (t==18) strncpy((char*)WFIFOP(fd,94),"Eighteen Castles",20);
+	else if (t==19) strncpy((char*)WFIFOP(fd,94),"Nineteen Castles",20);
+	else if (t==20) strncpy((char*)WFIFOP(fd,94),"Twenty Castles",20);
+	else if (t==21) strncpy((char*)WFIFOP(fd,94),"Twenty One Castles",20);
+	else if (t==22) strncpy((char*)WFIFOP(fd,94),"Twenty Two Castles",20);
+	else if (t==23) strncpy((char*)WFIFOP(fd,94),"Twenty Three Castles",20);
+	else if (t==24) strncpy((char*)WFIFOP(fd,94),"Twenty Four Castles",20);
+	else if (t==MAX_GUILDCASTLE) strncpy((char*)WFIFOP(fd,94),"Total Domination",20);
+	else strncpy((char*)WFIFOP(fd,94),"None Taken",20);
 
 	WFIFOSET(fd,packet_len_table[WFIFOW(fd,0)]);
 	clif_guild_emblem(sd,g);	// Guild emblem vanish fix [Valaris]
@@ -7251,7 +7252,7 @@ int clif_specialeffect(struct block_list *bl, int type, int flag) {
 		struct map_session_data *pl_sd;
 		int i;
 		for(i = 0; i < fd_max; i++) {
-			if (session[i] && (pl_sd = session[i]->session_data) != NULL &&
+			if (session[i] && (pl_sd = (struct map_session_data*)session[i]->session_data) != NULL &&
 				pl_sd->state.auth &&
 				(pc_isGM((struct map_session_data *)&bl) > pc_isGM((struct map_session_data *)&pl_sd->bl)))
 				clif_specialeffect(&pl_sd->bl, type, 1);
@@ -7261,7 +7262,7 @@ int clif_specialeffect(struct block_list *bl, int type, int flag) {
 		struct map_session_data *sd;
 		int i;
 		for(i = 0; i < fd_max; i++) {
-			if (session[i] && (sd = session[i]->session_data) != NULL && sd->state.auth && sd->bl.m == bl->m)
+			if (session[i] && (sd = (struct map_session_data*)session[i]->session_data) != NULL && sd->state.auth && sd->bl.m == bl->m)
 				clif_specialeffect(&sd->bl, type, 1);
 		}
 	}
@@ -7342,7 +7343,7 @@ void clif_parse_WantToConnection(int fd, struct map_session_data *sd)
 		if (sd != 0)
 			clif_setwaitclose(sd->fd); // Set session to EOF
 	} else {
-		sd = session[fd]->session_data = (struct map_session_data*)aCalloc(1, sizeof(struct map_session_data));
+		sd = (struct map_session_data*)session[fd]->session_data = (struct map_session_data*)aCalloc(1, sizeof(struct map_session_data));
 		sd->fd = fd;
 
 		if (IS_PACKET_DB_VER(cmd)) {
@@ -7885,27 +7886,27 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) {
  */
 void clif_parse_GlobalMessage(int fd, struct map_session_data *sd) { // S 008c <len>.w <str>.?B
 	char *message;
-	char *buf;
+	unsigned char *buf;
 
 	nullpo_retv(sd);
-	if ((is_atcommand(fd, sd, RFIFOP(fd,4), 0) != AtCommand_None) ||
-        (is_charcommand(fd, sd, RFIFOP(fd,4),0)!= CharCommand_None) ||
+	if ((is_atcommand(fd, sd, (char*)RFIFOP(fd,4), 0) != AtCommand_None) ||
+        (is_charcommand(fd, sd, (char*)RFIFOP(fd,4),0)!= CharCommand_None) ||
 	    (sd->sc_data &&
 	    (sd->sc_data[SC_BERSERK].timer != -1 || //バーサーク時は会話も不可
 	     sd->sc_data[SC_NOCHAT].timer != -1 ))) //チャット禁止
 		return;
 
 	message = (char*)aCallocA(RFIFOW(fd,2) + 128, sizeof(char));
-	buf = (char*)aCallocA(RFIFOW(fd,2) + 4, sizeof(char));
+	buf = (unsigned char*)aCallocA(RFIFOW(fd,2) + 4, sizeof(char));
 
 	//printf("clif_parse_GlobalMessage: message: '%s'.\n", RFIFOP(fd,4));
-	if (strncmp(RFIFOP(fd,4), sd->status.name, strlen(sd->status.name)) != 0) {
+	if (strncmp((char*)RFIFOP(fd,4), sd->status.name, strlen(sd->status.name)) != 0) {
 		printf("Hack on global message: character '%s' (account: %d), use an other name to send a (normal) message.\n", sd->status.name, sd->status.account_id);
 
 		// information is sended to all online GM
 		sprintf(message, "Hack on global message (normal message): character '%s' (account: %d) uses another name.", sd->status.name, sd->status.account_id);
 		intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, message, strlen(message) + 1);
-		if (strlen(RFIFOP(fd,4)) == 0)
+		if (strlen((char*)RFIFOP(fd,4)) == 0)
 			strcpy(message, " This player sends a void name and a void message.");
 		else
 			sprintf(message, " This player sends (name:message): '%s'.", RFIFOP(fd,4));
@@ -7946,16 +7947,16 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data *sd) { // S 008c <
 	if (pc_calc_base_job2 (sd->status.class_) == 23 ) {
 		int next = pc_nextbaseexp(sd)>0 ? pc_nextbaseexp(sd) : sd->status.base_exp;
 		if ((sd->status.base_exp*100/next)%10 == 0) {
-			estr_lower(RFIFOP(fd,4));
-			if (sd->state.snovice_flag == 0 && strstr(RFIFOP(fd,4), msg_txt(540)))
+			estr_lower((char*)RFIFOP(fd,4));
+			if (sd->state.snovice_flag == 0 && strstr((char*)RFIFOP(fd,4), msg_txt(540)))
 				sd->state.snovice_flag = 1;
 			else if (sd->state.snovice_flag == 1) {
 				sprintf(message, msg_txt(541), sd->status.name);
 				estr_lower(message);
-				if (strstr(RFIFOP(fd,4), message))
+				if (strstr((char*)RFIFOP(fd,4), message))
 					sd->state.snovice_flag = 2;
 			}
-			else if (sd->state.snovice_flag == 2 && strstr(RFIFOP(fd,4), msg_txt(542)))
+			else if (sd->state.snovice_flag == 2 && strstr((char*)RFIFOP(fd,4), msg_txt(542)))
 				sd->state.snovice_flag = 3;
 			else if (sd->state.snovice_flag == 3) {
 				int i;
@@ -8292,7 +8293,7 @@ void clif_parse_Wis(int fd, struct map_session_data *sd) { // S 0096 <len>.w <ni
 
 	//printf("clif_parse_Wis: message: '%s'.\n", RFIFOP(fd,28));
 
-	gm_command = (char*)aCallocA(strlen(RFIFOP(fd,28)) + 28, sizeof(char)); // 24+3+(RFIFOW(fd,2)-28)+1 or 24+3+(strlen(RFIFOP(fd,28))+1 (size can be wrong with hacker)
+	gm_command = (char*)aCallocA(strlen((const char*)RFIFOP(fd,28)) + 28, sizeof(char)); // 24+3+(RFIFOW(fd,2)-28)+1 or 24+3+(strlen(RFIFOP(fd,28))+1 (size can be wrong with hacker)
 
 	sprintf(gm_command, "%s : %s", sd->status.name, RFIFOP(fd,28));
 	if ((is_charcommand(fd, sd, gm_command, 0) != CharCommand_None) ||
@@ -8308,16 +8309,16 @@ void clif_parse_Wis(int fd, struct map_session_data *sd) { // S 0096 <len>.w <ni
 	if(gm_command) aFree(gm_command);
 
 	// searching destination character
-	dstsd = map_nick2sd(RFIFOP(fd,4));
+	dstsd = map_nick2sd((char*)RFIFOP(fd,4));
 	// player is not on this map-server
 	if (dstsd == NULL ||
 	// At this point, don't send wisp/page if it's not exactly the same name, because (example)
 	// if there are 'Test' player on an other map-server and 'test' player on this map-server,
 	// and if we ask for 'Test', we must not contact 'test' player
 	// so, we send information to inter-server, which is the only one which decide (and copy correct name).
-	    strcmp(dstsd->status.name, RFIFOP(fd,4)) != 0) // not exactly same name
+	    strcmp(dstsd->status.name, (const char*)RFIFOP(fd,4)) != 0) // not exactly same name
 		// send message to inter-server
-		intif_wis_message(sd, RFIFOP(fd,4), RFIFOP(fd,28), RFIFOW(fd,2)-28);
+		intif_wis_message(sd, (char*)RFIFOP(fd,4), (char*)RFIFOP(fd,28), RFIFOW(fd,2)-28);
 	// player is on this map-server
 	else {
 		// if you send to your self, don't send anything to others
@@ -8336,7 +8337,7 @@ void clif_parse_Wis(int fd, struct map_session_data *sd) { // S 0096 <len>.w <ni
 					}
 				// if source player not found in ignore list
 				if (i == MAX_IGNORE_LIST) {
-					clif_wis_message(dstsd->fd, sd->status.name, RFIFOP(fd,28), RFIFOW(fd,2) - 28);
+					clif_wis_message(dstsd->fd, sd->status.name, (char*)RFIFOP(fd,28), RFIFOW(fd,2) - 28);
 					clif_wis_end(fd, 0); // type: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
 				}
 			}
@@ -8356,7 +8357,7 @@ void clif_parse_GMmessage(int fd, struct map_session_data *sd) {
 
 	if ((battle_config.atc_gmonly == 0 || pc_isGM(sd)) &&
 	    (pc_isGM(sd) >= get_atcommand_level(AtCommand_Broadcast)))
-		intif_GMmessage(RFIFOP(fd,4), RFIFOW(fd,2)-4, 0);
+		intif_GMmessage((char*)RFIFOP(fd,4), RFIFOW(fd,2)-4, 0);
 }
 
 /*==========================================
@@ -8688,7 +8689,7 @@ void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd)
 void clif_parse_CreateChatRoom(int fd,struct map_session_data *sd)
 {
 	if(battle_config.basic_skill_check == 0 || pc_checkskill(sd,NV_BASIC) >= 4){
-		chat_createchat(sd,RFIFOW(fd,4),RFIFOB(fd,6),RFIFOP(fd,7),RFIFOP(fd,15),RFIFOW(fd,2)-15);
+		chat_createchat(sd,RFIFOW(fd,4),RFIFOB(fd,6),(char*)RFIFOP(fd,7),(char*)RFIFOP(fd,15),RFIFOW(fd,2)-15);
 	} else
 		clif_skill_fail(sd,1,0,3);
 }
@@ -8699,7 +8700,7 @@ void clif_parse_CreateChatRoom(int fd,struct map_session_data *sd)
  */
 void clif_parse_ChatAddMember(int fd,struct map_session_data *sd)
 {
-	chat_joinchat(sd,RFIFOL(fd,2),RFIFOP(fd,6));
+	chat_joinchat(sd,RFIFOL(fd,2),(char*)RFIFOP(fd,6));
 }
 
 /*==========================================
@@ -8708,7 +8709,7 @@ void clif_parse_ChatAddMember(int fd,struct map_session_data *sd)
  */
 void clif_parse_ChatRoomStatusChange(int fd,struct map_session_data *sd)
 {
-	chat_changechatstatus(sd,RFIFOW(fd,4),RFIFOB(fd,6),RFIFOP(fd,7),RFIFOP(fd,15),RFIFOW(fd,2)-15);
+	chat_changechatstatus(sd,RFIFOW(fd,4),RFIFOB(fd,6),(char*)RFIFOP(fd,7),(char*)RFIFOP(fd,15),RFIFOW(fd,2)-15);
 }
 
 /*==========================================
@@ -8717,7 +8718,7 @@ void clif_parse_ChatRoomStatusChange(int fd,struct map_session_data *sd)
  */
 void clif_parse_ChangeChatOwner(int fd,struct map_session_data *sd)
 {
-	chat_changechatowner(sd,RFIFOP(fd,6));
+	chat_changechatowner(sd,(char*)RFIFOP(fd,6));
 }
 
 /*==========================================
@@ -8726,7 +8727,7 @@ void clif_parse_ChangeChatOwner(int fd,struct map_session_data *sd)
  */
 void clif_parse_KickFromChat(int fd,struct map_session_data *sd)
 {
-	chat_kickchat(sd,RFIFOP(fd,2));
+	chat_kickchat(sd,(char*)RFIFOP(fd,2));
 }
 
 /*==========================================
@@ -9196,7 +9197,7 @@ void clif_parse_UseSkillMap(int fd,struct map_session_data *sd)
 	if(sd->invincible_timer != -1)
 		pc_delinvincibletimer(sd);
 
-	skill_castend_map(sd,RFIFOW(fd,2),RFIFOP(fd,4));
+	skill_castend_map(sd,RFIFOW(fd,2),(char*)RFIFOP(fd,4));
 }
 /*==========================================
  * メモ要求
@@ -9269,7 +9270,7 @@ void clif_parse_NpcStringInput(int fd,struct map_session_data *sd)
 		memcpy(sd->npc_str,RFIFOP(fd,8),sizeof(sd->npc_str));
 		sd->npc_str[sizeof(sd->npc_str)-1]=0;
 	} else
-		strcpy(sd->npc_str,RFIFOP(fd,8));
+		strcpy(sd->npc_str,(char*)RFIFOP(fd,8));
 	npc_scriptcont(sd,RFIFOL(fd,4));
 }
 
@@ -9590,7 +9591,7 @@ void clif_parse_CloseKafra(int fd, struct map_session_data *sd) {
  */
 void clif_parse_CreateParty(int fd, struct map_session_data *sd) {
 	if (battle_config.basic_skill_check == 0 || pc_checkskill(sd,NV_BASIC) >= 7) {
-		party_create(sd,RFIFOP(fd,2));
+		party_create(sd,(char*)RFIFOP(fd,2));
 	} else
 		clif_skill_fail(sd,1,0,4);
 }
@@ -9601,9 +9602,9 @@ void clif_parse_CreateParty(int fd, struct map_session_data *sd) {
  */
 void clif_parse_CreateParty2(int fd, struct map_session_data *sd) {
 	if (battle_config.basic_skill_check == 0 || pc_checkskill(sd,NV_BASIC) >= 7){
-		party_create(sd, RFIFOP(fd,2));
+		party_create(sd,(char*)RFIFOP(fd,2));
 	} else
-		clif_skill_fail(sd, 1, 0, 4);
+		clif_skill_fail(sd,1,0,4);
 }
 
 /*==========================================
@@ -9640,7 +9641,7 @@ void clif_parse_LeaveParty(int fd, struct map_session_data *sd) {
  *------------------------------------------
  */
 void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) {
-	party_removemember(sd,RFIFOL(fd,2),RFIFOP(fd,6));
+	party_removemember(sd,RFIFOL(fd,2),(char*)RFIFOP(fd,6));
 }
 
 /*==========================================
@@ -9657,16 +9658,16 @@ void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) {
  */
 void clif_parse_PartyMessage(int fd, struct map_session_data *sd) {
 	nullpo_retv(sd);
-	if (is_charcommand(fd, sd, RFIFOP(fd,4), 0) != CharCommand_None)
+	if (is_charcommand(fd, sd, (char*)RFIFOP(fd,4), 0) != CharCommand_None)
 		return;
-	if (is_atcommand(fd, sd, RFIFOP(fd,4), 0) != AtCommand_None)
+	if (is_atcommand(fd, sd, (char*)RFIFOP(fd,4), 0) != AtCommand_None)
 		return;
 	if(sd->sc_data &&
 		(sd->sc_data[SC_BERSERK].timer!=-1 ||	//バーサーク時は会話も不可
 		sd->sc_data[SC_NOCHAT].timer!=-1))		//チャット禁止
 		return;
 
-	party_send_message(sd, RFIFOP(fd,4), RFIFOW(fd,2)-4);
+	party_send_message(sd, (char*)RFIFOP(fd,4), RFIFOW(fd,2)-4);
 }
 
 /*==========================================
@@ -9702,7 +9703,7 @@ void clif_parse_PurchaseReq(int fd, struct map_session_data *sd) {
  *------------------------------------------
  */
 void clif_parse_OpenVending(int fd,struct map_session_data *sd) {
-	vending_openvending(sd, RFIFOW(fd,2), RFIFOP(fd,4), RFIFOB(fd,84), RFIFOP(fd,85));
+	vending_openvending(sd, RFIFOW(fd,2), (char*)RFIFOP(fd,4), RFIFOB(fd,84), RFIFOP(fd,85));
 }
 
 /*==========================================
@@ -9735,7 +9736,7 @@ void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) {
  *------------------------------------------
  */
 void clif_parse_CreateGuild(int fd,struct map_session_data *sd) {
-	guild_create(sd, RFIFOP(fd,6));
+	guild_create(sd, (char*)RFIFOP(fd,6));
 }
 
 /*==========================================
@@ -9785,7 +9786,7 @@ void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) {
 	int i;
 
 	for(i = 4; i < RFIFOW(fd,2); i += 40 ){
-		guild_change_position(sd, RFIFOL(fd,i), RFIFOL(fd,i+4), RFIFOL(fd,i+12), RFIFOP(fd,i+16));
+		guild_change_position(sd, RFIFOL(fd,i), RFIFOL(fd,i+4), RFIFOL(fd,i+12), (char*)RFIFOP(fd,i+16));
 	}
 }
 
@@ -9819,7 +9820,7 @@ void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd) {
  *------------------------------------------
  */
 void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) {
-	guild_change_emblem(sd,RFIFOW(fd,2)-4,RFIFOP(fd,4));
+	guild_change_emblem(sd,RFIFOW(fd,2)-4,(char*)RFIFOP(fd,4));
 }
 
 /*==========================================
@@ -9827,7 +9828,7 @@ void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd) {
  *------------------------------------------
  */
 void clif_parse_GuildChangeNotice(int fd,struct map_session_data *sd) {
-	guild_change_notice(sd,RFIFOL(fd,2),RFIFOP(fd,6),RFIFOP(fd,66));
+	guild_change_notice(sd,RFIFOL(fd,2),(char*)RFIFOP(fd,6),(char*)RFIFOP(fd,66));
 }
 
 /*==========================================
@@ -9851,7 +9852,7 @@ void clif_parse_GuildReplyInvite(int fd,struct map_session_data *sd) {
  *------------------------------------------
  */
 void clif_parse_GuildLeave(int fd,struct map_session_data *sd) {
-	guild_leave(sd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOP(fd,14));
+	guild_leave(sd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),(char*)RFIFOP(fd,14));
 }
 
 /*==========================================
@@ -9859,7 +9860,7 @@ void clif_parse_GuildLeave(int fd,struct map_session_data *sd) {
  *------------------------------------------
  */
 void clif_parse_GuildExplusion(int fd,struct map_session_data *sd) {
-	guild_explusion(sd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOP(fd,14));
+	guild_explusion(sd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),(char*)RFIFOP(fd,14));
 }
 
 /*==========================================
@@ -9868,16 +9869,16 @@ void clif_parse_GuildExplusion(int fd,struct map_session_data *sd) {
  */
 void clif_parse_GuildMessage(int fd,struct map_session_data *sd) {
 	nullpo_retv(sd);
-	if (is_charcommand(fd, sd, RFIFOP(fd, 4), 0) != CharCommand_None)
+	if (is_charcommand(fd, sd, (char*)RFIFOP(fd, 4), 0) != CharCommand_None)
 		return;
-	if (is_atcommand(fd, sd, RFIFOP(fd, 4), 0) != AtCommand_None)
+	if (is_atcommand(fd, sd, (char*)RFIFOP(fd, 4), 0) != AtCommand_None)
 		return;
 	if(sd->sc_data &&
 		(sd->sc_data[SC_BERSERK].timer!=-1 ||	//バーサーク時は会話も不可
 		sd->sc_data[SC_NOCHAT].timer!=-1))		//チャット禁止
 		return;
 
-	guild_send_message(sd, RFIFOP(fd,4), RFIFOW(fd,2)-4);
+	guild_send_message(sd, (char*)RFIFOP(fd,4), RFIFOW(fd,2)-4);
 }
 
 /*==========================================
@@ -9917,7 +9918,7 @@ void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) {
  *------------------------------------------
  */
 void clif_parse_GuildBreak(int fd, struct map_session_data *sd) {
-	guild_break(sd,RFIFOP(fd,2));
+	guild_break(sd,(char*)RFIFOP(fd,2));
 }
 
 // pet
@@ -9941,7 +9942,7 @@ void clif_parse_SendEmotion(int fd, struct map_session_data *sd) {
 }
 
 void clif_parse_ChangePetName(int fd, struct map_session_data *sd) {
-	pet_change_name(sd,RFIFOP(fd,2));
+	pet_change_name(sd,(char*)RFIFOP(fd,2));
 }
 
 // Kick (right click menu for GM "(name) force to quit")
@@ -10081,7 +10082,7 @@ void clif_parse_GMReqNoChatCount(int fd, struct map_session_data *sd)
 
 	WFIFOW(fd,0) = 0x1e0;
 	WFIFOL(fd,2) = tid;
-	sprintf(WFIFOP(fd,6),"%d",tid);
+	sprintf((char*)WFIFOP(fd,6),"%d",tid);
 //	memcpy(WFIFOP(fd,6), "TESTNAME", 24);
 	WFIFOSET(fd, packet_len_table[0x1e0]);
 
@@ -10095,7 +10096,7 @@ void clif_parse_PMIgnore(int fd, struct map_session_data *sd) {	// Rewritten by
 
 	memset(output, '\0', sizeof(output));
 
-	nick = RFIFOP(fd,2); // speed up
+	nick = (char*)RFIFOP(fd,2); // speed up
 	RFIFOB(fd,25) = '\0'; // to be sure that the player name have at maximum 23 characters
 	//printf("Ignore: char '%s' state: %d\n", nick, RFIFOB(fd,26));
 
@@ -10216,7 +10217,7 @@ void clif_parse_skillMessage(int fd, struct map_session_data *sd) {	// Added by
 	y = RFIFOB(fd,6);
 	x = RFIFOB(fd,8);
 
-	mes = RFIFOP(fd,10);
+	mes = (char*)RFIFOP(fd,10);
 
 	// skill 220 = graffiti
 //	printf("skill: %d %d location: %3d %3d message: %s\n", skillid, skilllv, x, y, (char*)mes);
@@ -10292,7 +10293,7 @@ void clif_parse_friends_list_add(int fd, struct map_session_data *sd) {
 	struct map_session_data *f_sd;
 	int i;
 
-	f_sd = map_nick2sd(RFIFOP(fd,2));
+	f_sd = map_nick2sd((char*)RFIFOP(fd,2));
 
 	// Friend doesn't exist (no player with this name)
 	if (f_sd == NULL) {
@@ -10504,7 +10505,7 @@ static int clif_parse(int fd) {
 	int packet_len = 0, cmd, packet_ver;
 	struct map_session_data *sd;
 
-	sd = session[fd]->session_data;
+	sd = (struct map_session_data*)session[fd]->session_data;
 
 	// 接続が切れてるので後始末
 	if (!chrif_isconnect() || session[fd]->eof) { // char鯖に繋がってない間は接続禁止 (!chrif_isconnect())