From c1a8f6f0ac98a694e670bae4c8f74db126e0e8e8 Mon Sep 17 00:00:00 2001 From: amber Date: Tue, 29 Mar 2005 06:18:21 +0000 Subject: Fixe compile time problems with our mixed C++/C conformance git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1328 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/clif.c | 4 ++-- src/map/itemdb.c | 8 ++++---- src/map/map.c | 6 +++--- src/map/npc.c | 2 +- src/map/pc.c | 2 +- src/map/script.c | 54 +++++++++++++++++++++++++++--------------------------- 6 files changed, 38 insertions(+), 38 deletions(-) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index 9e649df40..7ebf11b8a 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -4778,8 +4778,8 @@ void clif_GlobalMessage(struct block_list *bl,char *message) WBUFW(buf,0)=cmd; WBUFW(buf,2)=len+8; WBUFL(buf,4)=bl->id; - strncpy(WBUFP(buf,8),message,len); - clif_send(buf,WBUFW(buf,2),bl,AREA_CHAT_WOC); + strncpy((char *) WBUFP(buf,8),message,len); + clif_send((unsigned char *) buf,WBUFW(buf,2),bl,AREA_CHAT_WOC); } /*========================================== diff --git a/src/map/itemdb.c b/src/map/itemdb.c index c37274cb9..d575e8a77 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -851,10 +851,10 @@ static int itemdb_read_sqldb(void) if (sql_row[17] != NULL) { if (sql_row[17][0] == '{') - id->use_script = parse_script(sql_row[17], 0); + id->use_script = parse_script((unsigned char *) sql_row[17], 0); else { sprintf(script, "{%s}", sql_row[17]); - id->use_script = parse_script(script, 0); + id->use_script = parse_script((unsigned char *) script, 0); } } else @@ -865,10 +865,10 @@ static int itemdb_read_sqldb(void) if (sql_row[18] != NULL) { if (sql_row[18][0] == '{') - id->equip_script = parse_script(sql_row[18], 0); + id->equip_script = parse_script((unsigned char *) sql_row[18], 0); else { sprintf(script, "{%s}", sql_row[18]); - id->equip_script = parse_script(script, 0); + id->equip_script = parse_script((unsigned char *) script, 0); } } else diff --git a/src/map/map.c b/src/map/map.c index db2831cf5..19edfd08b 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -2012,7 +2012,7 @@ int map_eraseipport(char *name,unsigned long ip,int port) struct map_data_other_server *mdos; // unsigned char *p=(unsigned char *)&ip; - md=strdb_search(map_db,name); + md=(struct map_data *) strdb_search(map_db,name); if(md){ if(md->gat) // local -> check data return 0; @@ -3119,13 +3119,13 @@ int id_db_final(void *k,void *d,va_list ap) { return 0; } int map_db_final(void *k,void *d,va_list ap) { return 0; } int nick_db_final(void *k,void *d,va_list ap) { - char *p = d; + char *p = (char *) d; if (p) aFree(p); return 0; } int charid_db_final(void *k,void *d,va_list ap) { - struct charid2nick *p = d; + struct charid2nick *p = (struct charid2nick *) d; if (p) aFree(p); return 0; } diff --git a/src/map/npc.c b/src/map/npc.c index 6e22c69b3..95893ad11 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -875,7 +875,7 @@ int npc_checknear(struct map_session_data *sd,int id) */ int npc_globalmessage(const char *name,char *mes) { - struct npc_data *nd=strdb_search(npcname_db,name); + struct npc_data *nd=(struct npc_data *) strdb_search(npcname_db,name); char temp[100]; char ntemp[50]; char *ltemp; diff --git a/src/map/pc.c b/src/map/pc.c index c9b8755de..8b3a32c6f 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -6994,7 +6994,7 @@ int pc_read_gm_account(int fd) } lsql_res = mysql_store_result(&lmysql_handle); if (lsql_res) { - gm_account = aCallocA(sizeof(struct gm_account) * mysql_num_rows(lsql_res), 1); + gm_account = (struct gm_account *) aCallocA(sizeof(struct gm_account) * mysql_num_rows(lsql_res), 1); while ((lsql_row = mysql_fetch_row(lsql_res))) { gm_account[GM_num].account_id = atoi(lsql_row[0]); gm_account[GM_num].level = atoi(lsql_row[1]); diff --git a/src/map/script.c b/src/map/script.c index d7d5f433e..c39afc8f6 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -62,7 +62,7 @@ static struct str_data_struct { int str; int backpatch; int label; - int (*func)(); + int (*func)(script_state *); int val; int next; } *str_data; @@ -1190,7 +1190,7 @@ static void read_constdb(void) sscanf(line,"%[A-Za-z0-9_] %d %d",name,&val,&type)>=2){ for(i=0;name[i];i++) name[i]=tolower(name[i]); - n=add_str(name); + n=add_str((const unsigned char *) name); if(type==0) str_data[n].type=C_INT; else @@ -1281,7 +1281,7 @@ char* parse_script(unsigned char *src,int line) add_scriptc(C_NOP); script_size = script_pos; - script_buf=(char *)aRealloc(script_buf,script_pos + 1); + script_buf=(unsigned char *)aRealloc(script_buf,script_pos + 1); // 未解決のラベルを解決 for(i=LABEL_START;i %d\n",type,str,stack->sp); stack->stack_data[stack->sp].type=type; - stack->stack_data[stack->sp].u.str=str; + stack->stack_data[stack->sp].u.str=(char *) str; stack->sp++; } @@ -1537,10 +1537,10 @@ void push_copy(struct script_stack *stack,int pos) { switch(stack->stack_data[pos].type){ case C_CONSTSTR: - push_str(stack,C_CONSTSTR,stack->stack_data[pos].u.str); + push_str(stack,C_CONSTSTR,(unsigned char *) stack->stack_data[pos].u.str); break; case C_STR: - push_str(stack,C_STR,aStrdup(stack->stack_data[pos].u.str)); + push_str(stack,C_STR,(unsigned char *) aStrdup(stack->stack_data[pos].u.str)); break; default: push_val(stack,stack->stack_data[pos].type,stack->stack_data[pos].u.num); @@ -1609,7 +1609,7 @@ int buildin_callfunc(struct script_state *st) char *scr; char *str=conv_str(st,& (st->stack->stack_data[st->start+2])); - if( (scr=strdb_search(script_get_userfunc_db(),str)) ){ + if( (scr=(char *) strdb_search(script_get_userfunc_db(),str)) ){ int i,j; for(i=st->start+3,j=0;iend;i++,j++) push_copy(st->stack,i); @@ -1748,8 +1748,8 @@ int buildin_menu(struct script_state *st) st->state=END; } else { // goto動作 // ragemu互換のため - pc_setreg(sd,add_str("l15"),sd->npc_menu); - pc_setreg(sd,add_str("@menu"),sd->npc_menu); + pc_setreg(sd,add_str((unsigned char *) "l15"),sd->npc_menu); + pc_setreg(sd,add_str((unsigned char *) "@menu"),sd->npc_menu); sd->state.menu_or_input=0; if(sd->npc_menu>0 && sd->npc_menu<(st->end-st->start)/2){ int pos; @@ -1930,7 +1930,7 @@ int buildin_input(struct script_state *st) { struct map_session_data *sd=NULL; int num=(st->end>st->start+2)?st->stack->stack_data[st->start+2].u.num:0; - char *name=(st->end>st->start+2)?str_buf+str_data[num&0x00ffffff].str:""; + char *name=(char *) ((st->end>st->start+2)?str_buf+str_data[num&0x00ffffff].str:""); // char prefix=*name; char postfix=name[strlen(name)-1]; @@ -1961,7 +1961,7 @@ int buildin_input(struct script_state *st) set_reg(sd,num,name,(void*)sd->npc_amount); } else { // ragemu互換のため - pc_setreg(sd,add_str("l14"),sd->npc_amount); + pc_setreg(sd,add_str((unsigned char *) "l14"),sd->npc_amount); } } } else { @@ -2186,7 +2186,7 @@ int buildin_deletearray(struct script_state *st) } for(;i<(128-(num>>24));i++){ if( postfix!='$' ) set_reg(sd,num+(i<<24),name, 0); - if( postfix=='$' ) set_reg(sd,num+(i<<24),name, ""); + if( postfix=='$' ) set_reg(sd,num+(i<<24),name, (void *) ""); } return 0; } @@ -2704,9 +2704,9 @@ int buildin_getpartyname(struct script_state *st) party_id=conv_num(st,& (st->stack->stack_data[st->start+2])); name=buildin_getpartyname_sub(party_id); if(name!=0) - push_str(st->stack,C_STR,name); + push_str(st->stack,C_STR,(unsigned char *)name); else - push_str(st->stack,C_CONSTSTR,"null"); + push_str(st->stack,C_CONSTSTR, (unsigned char *) "null"); return 0; } @@ -2726,12 +2726,12 @@ int buildin_getpartymember(struct script_state *st) for(i=0;imember[i].account_id){ // printf("name:%s %d\n",p->member[i].name,i); - mapreg_setregstr(add_str("$@partymembername$")+(i<<24),p->member[i].name); + mapreg_setregstr(add_str((unsigned char *) "$@partymembername$")+(i<<24),p->member[i].name); j++; } } } - mapreg_setreg(add_str("$@partymembercount"),j); + mapreg_setreg(add_str((unsigned char *) "$@partymembercount"),j); return 0; } @@ -2758,9 +2758,9 @@ int buildin_getguildname(struct script_state *st) int guild_id=conv_num(st,& (st->stack->stack_data[st->start+2])); name=buildin_getguildname_sub(guild_id); if(name!=0) - push_str(st->stack,C_STR,name); + push_str(st->stack,C_STR,(unsigned char *) name); else - push_str(st->stack,C_CONSTSTR,"null"); + push_str(st->stack,C_CONSTSTR,(unsigned char *) "null"); return 0; } @@ -2788,9 +2788,9 @@ int buildin_getguildmaster(struct script_state *st) int guild_id=conv_num(st,& (st->stack->stack_data[st->start+2])); master=buildin_getguildmaster_sub(guild_id); if(master!=0) - push_str(st->stack,C_STR,master); + push_str(st->stack,C_STR,(unsigned char *) master); else - push_str(st->stack,C_CONSTSTR,"null"); + push_str(st->stack,C_CONSTSTR,(unsigned char *) "null"); return 0; } @@ -2827,23 +2827,23 @@ int buildin_strcharinfo(struct script_state *st) char *buf; buf=(char *)aCallocA(24,sizeof(char)); strncpy(buf,sd->status.name, 23); - push_str(st->stack,C_STR,buf); + push_str(st->stack,C_STR,(unsigned char *) buf); } if(num==1){ char *buf; buf=buildin_getpartyname_sub(sd->status.party_id); if(buf!=0) - push_str(st->stack,C_STR,buf); + push_str(st->stack,C_STR,(unsigned char *) buf); else - push_str(st->stack,C_CONSTSTR,""); + push_str(st->stack,C_CONSTSTR,(unsigned char *) ""); } if(num==2){ char *buf; buf=buildin_getguildname_sub(sd->status.guild_id); if(buf!=0) - push_str(st->stack,C_STR,buf); + push_str(st->stack,C_STR,(unsigned char *) buf); else - push_str(st->stack,C_CONSTSTR,""); + push_str(st->stack,C_CONSTSTR,(unsigned char *) ""); } return 0; -- cgit v1.2.3-70-g09d2