diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/map/chat.c | 6 | ||||
-rw-r--r-- | src/map/itemdb.c | 20 | ||||
-rw-r--r-- | src/map/mob.c | 6 | ||||
-rw-r--r-- | src/map/npc.c | 16 | ||||
-rw-r--r-- | src/map/script.c | 61 |
5 files changed, 55 insertions, 54 deletions
diff --git a/src/map/chat.c b/src/map/chat.c index cfd2660e0..3bd29fec3 100644 --- a/src/map/chat.c +++ b/src/map/chat.c @@ -29,7 +29,7 @@ int chat_createchat(struct map_session_data *sd,int limit,int pub,char* pass,cha nullpo_retr(0, sd); - cd = aCalloc(1,sizeof(struct chat_data)); + cd = (struct chat_data *) aCalloc(1,sizeof(struct chat_data)); cd->limit = limit; cd->pub = pub; @@ -78,7 +78,7 @@ int chat_joinchat(struct map_session_data *sd,int chatid,char* pass) clif_joinchatfail(sd,0); return 0; } - if(cd->pub==0 && strncmp(pass,cd->pass,8)){ + if(cd->pub==0 && strncmp(pass,(char *) cd->pass,8)){ clif_joinchatfail(sd,1); return 0; } @@ -268,7 +268,7 @@ int chat_createnpcchat(struct npc_data *nd,int limit,int pub,int trigger,char* t nullpo_retr(1, nd); - cd = aCalloc(1,sizeof(struct chat_data)); + cd = (struct chat_data *) aCalloc(1,sizeof(struct chat_data)); cd->limit = cd->trigger = limit; if(trigger>0) diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 971f6cacf..5e19b1aca 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -136,7 +136,7 @@ int itemdb_searchrandomid(int flags) */ struct item_data* itemdb_exists(int nameid) { - return numdb_search(item_db,nameid); + return (struct item_data *) numdb_search(item_db,nameid); } /*========================================== * DBの検索 @@ -146,7 +146,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; id=(struct item_data *)aCalloc(1,sizeof(struct item_data)); @@ -373,10 +373,10 @@ static int itemdb_readdb(void) if((p=strchr(np,'{'))==NULL) continue; - id->use_script = parse_script(p,lines); + id->use_script = parse_script((unsigned char *) p,lines); if((p=strchr(p+1,'{'))==NULL) continue; - id->equip_script = parse_script(p,lines); + id->equip_script = parse_script((unsigned char *) p,lines); } fclose(fp); sprintf(tmp_output,"Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n",ln,filename[i]); @@ -415,7 +415,7 @@ static int itemdb_read_randomitem() struct random_item_data *pd=data[i].pdata; int *pc=data[i].pcount; int *pdefault=data[i].pdefault; - char *fn=data[i].filename; + char *fn=(char *) data[i].filename; *pdefault = 0; if( (fp=fopen(fn,"r"))==NULL ){ @@ -519,7 +519,7 @@ static int itemdb_read_itemnametable(void) char *buf,*p; int s; - buf=grfio_reads("data\\idnum2itemdisplaynametable.txt",&s); + buf=(char *) grfio_reads("data\\idnum2itemdisplaynametable.txt",&s); if(buf==NULL) return -1; @@ -562,7 +562,7 @@ static int itemdb_read_cardillustnametable(void) char *buf,*p; int s; - buf=grfio_reads("data\\num2cardillustnametable.txt",&s); + buf=(char *) grfio_reads("data\\num2cardillustnametable.txt",&s); if(buf==NULL) return -1; @@ -601,7 +601,7 @@ static int itemdb_read_itemslottable(void) char *buf,*p; int s; - buf=grfio_read("data\\itemslottable.txt"); + buf=(char *) grfio_read("data\\itemslottable.txt"); if(buf==NULL) return -1; s=grfio_size("data\\itemslottable.txt"); @@ -636,7 +636,7 @@ static int itemdb_read_itemslotcounttable(void) char *buf,*p; int s; - buf=grfio_read("data\\itemslotcounttable.txt"); + buf=(char *) grfio_read("data\\itemslotcounttable.txt"); if(buf==NULL) return -1; s=grfio_size("data\\itemslotcounttable.txt"); @@ -909,7 +909,7 @@ static int itemdb_final(void *key,void *data,va_list ap) { struct item_data *id; - nullpo_retr(0, id=data); + nullpo_retr(0, id= (struct item_data *) data); if(id->use_script) aFree(id->use_script); diff --git a/src/map/mob.c b/src/map/mob.c index b8eac5d67..1068b515a 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -288,7 +288,7 @@ int mob_spawn_guardian(struct map_session_data *sd,char *mapname, for(count=0;count<amount;count++){ struct guild_castle *gc; - md=aCalloc(sizeof(struct mob_data), 1); + md=(struct mob_data *) aCalloc(sizeof(struct mob_data), 1); if(md==NULL){ printf("mob_spawn_guardian: out of memory !\n"); exit(1); @@ -1868,7 +1868,7 @@ static int mob_ai_hard(int tid,unsigned int tick,int id,int data) */ static int mob_ai_sub_lazy(void * key,void * data,va_list app) { - struct mob_data *md=data; + struct mob_data *md=(struct mob_data *)data; unsigned int tick; va_list ap; @@ -2693,7 +2693,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) struct map_session_data *tmpsd; int i; for(i=0;i<fd_max;i++){ - if(session[i] && (tmpsd=session[i]->session_data) && tmpsd->state.auth) { + if(session[i] && (tmpsd= (struct map_session_data *) session[i]->session_data) && tmpsd->state.auth) { if(md->bl.m == tmpsd->bl.m) { sd = tmpsd; break; diff --git a/src/map/npc.c b/src/map/npc.c index 0519b9925..95788a2cd 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1655,13 +1655,13 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line } if (srcbuf[0]!='{') { if (strchr((char *) line,'{')) { - strcpy(srcbuf,strchr((const char *) line,'{')); + strcpy((char *) srcbuf,strchr((const char *) line,'{')); startline=*lines; } } else - strcat(srcbuf,line); + strcat((char *) srcbuf,(const char *) line); } - script=parse_script(srcbuf,startline); + script=(unsigned char *) parse_script((unsigned char *) srcbuf,startline); if (script==NULL) { // script parse error? aFree(srcbuf); @@ -1681,7 +1681,7 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line printf("bad duplicate name! (not exist) : %s\n",srcname); return 0; } - script=nd2->u.scr.script; + script=(unsigned char *)nd2->u.scr.script; label_dup=nd2->u.scr.label_list; label_dupnum=nd2->u.scr.label_list_num; src_id=nd2->bl.id; @@ -1744,7 +1744,7 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line nd->flag=0; nd->class_=class_; nd->speed=200; - nd->u.scr.script=script; + nd->u.scr.script=(char *) script; nd->u.scr.src_id=src_id; nd->chat_id=0; nd->option = 0; @@ -1893,7 +1893,7 @@ static int npc_parse_function(char *w1,char *w2,char *w3,char *w4,char *first_li } else strcat(srcbuf,line); } - script=parse_script(srcbuf,startline); + script= parse_script((unsigned char *) srcbuf,startline); if (script==NULL) { // script parse error? aFree(srcbuf); @@ -2160,7 +2160,7 @@ static int npc_read_indoors(void) char *buf,*p; int s, m; - buf=grfio_reads("data\\indoorrswtable.txt",&s); + buf=(char *) grfio_reads("data\\indoorrswtable.txt",&s); if(buf==NULL) return -1; @@ -2191,7 +2191,7 @@ static int npc_read_indoors(void) static int ev_db_final(void *key,void *data,va_list ap) { aFree(data); - if(strstr(key,"::")!=NULL) + if(strstr((const char *) key,"::")!=NULL) aFree(key); return 0; } diff --git a/src/map/script.c b/src/map/script.c index 0b4374887..07f642dc6 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -52,7 +52,7 @@ static int script_pos,script_size; char *str_buf; int str_pos,str_size; -static struct { +static struct str_data_struct { int type; int str; int backpatch; @@ -306,7 +306,7 @@ int mapreg_setreg(int num,int val); int mapreg_setregstr(int num,const char *str); struct { - int (*func)(); + int (*func)(struct script_state *); char *name; char *arg; } buildin_func[]={ @@ -559,7 +559,7 @@ static int search_str(const unsigned char *p) int i; i=str_hash[calc_hash(p)]; while(i){ - if(strcmp(str_buf+str_data[i].str,p)==0){ + if(strcmp(str_buf+str_data[i].str,(char *) p)==0){ return i; } i=str_data[i].next; @@ -577,10 +577,10 @@ static int add_str(const unsigned char *p) int i; char *lowcase; - lowcase=aStrdup(p); + lowcase=aStrdup((char *) p); for(i=0;lowcase[i];i++) lowcase[i]=tolower(lowcase[i]); - if((i=search_str(lowcase))>=0){ + if((i=search_str((unsigned char *) lowcase))>=0){ aFree(lowcase); return i; } @@ -592,7 +592,7 @@ static int add_str(const unsigned char *p) } else { i=str_hash[i]; for(;;){ - if(strcmp(str_buf+str_data[i].str,p)==0){ + if(strcmp(str_buf+str_data[i].str,(char *) p)==0){ return i; } if(str_data[i].next==0) @@ -603,22 +603,22 @@ static int add_str(const unsigned char *p) } if(str_num>=str_data_size){ str_data_size+=128; - str_data=aRealloc(str_data,sizeof(str_data[0])*str_data_size); + str_data=(struct str_data_struct *) aRealloc(str_data,sizeof(str_data[0])*str_data_size); memset(str_data + (str_data_size - 128), '\0', 128); } - while(str_pos+(int)strlen(p)+1>=str_size){ + while(str_pos+(int)strlen((char *) p)+1>=str_size){ str_size+=256; str_buf=(char *)aRealloc(str_buf,str_size); memset(str_buf + (str_size - 256), '\0', 256); } - strcpy(str_buf+str_pos,p); + strcpy(str_buf+str_pos, (char *) p); str_data[str_num].type=C_NOP; str_data[str_num].str=str_pos; str_data[str_num].next=0; str_data[str_num].func=NULL; str_data[str_num].backpatch=-1; str_data[str_num].label=-1; - str_pos+=strlen(p)+1; + str_pos+=strlen( (char *) p)+1; return str_num++; } @@ -631,7 +631,7 @@ static void check_script_buf(int size) { if(script_pos+size>=script_size){ script_size+=SCRIPT_BLOCK_SIZE; - script_buf=(char *)aRealloc(script_buf,script_size); + script_buf=(unsigned char *)aRealloc(script_buf,script_size); memset(script_buf + script_size - SCRIPT_BLOCK_SIZE, '\0', SCRIPT_BLOCK_SIZE); } @@ -792,7 +792,7 @@ static void disp_error_message(const char *mes,const unsigned char *pos) for(line=startline,p=startptr;p && *p;line++){ linestart=p; - lineend=strchr(p,'\n'); + lineend=(unsigned char *) strchr((char *) p,'\n'); if(lineend){ c=*lineend; *lineend=0; @@ -842,9 +842,9 @@ unsigned char* parse_simpleexpr(unsigned char *p) } } else if(isdigit(*p) || ((*p=='-' || *p=='+') && isdigit(p[1]))){ char *np; - i=strtoul(p,&np,0); + i=strtoul((char *) p,&np,0); add_scripti(i); - p=np; + p=(unsigned char *) np; } else if(*p=='"'){ add_scriptc(C_STR); p++; @@ -871,12 +871,12 @@ unsigned char* parse_simpleexpr(unsigned char *p) disp_error_message("unexpected character",p); exit(1); } - p2=skip_word(p); + p2=(char *) skip_word(p); c=*p2; *p2=0; // 名前をadd_strする l=add_str(p); parse_cmd=l; // warn_*_mismatch_paramnumのために必要 - if(l==search_str("if")) // warn_cmd_no_commaのために必要 + if(l== search_str((unsigned char *) "if")) // warn_cmd_no_commaのために必要 parse_cmd_if++; /* // 廃止予定のl14/l15,およびプレフィックスlの警告 @@ -887,11 +887,12 @@ unsigned char* parse_simpleexpr(unsigned char *p) disp_error_message("prefix 'l' is DEPRECATED. use prefix '@' instead.",p2); } */ - *p2=c; p=p2; + *p2=c; + p=(unsigned char *) p2; if(str_data[l].type!=C_FUNC && c=='['){ // array(name[i] => getelementofarray(name,i) ) - add_scriptl(search_str("getelementofarray")); + add_scriptl(search_str((unsigned char *) "getelementofarray")); add_scriptc(C_ARG); add_scriptl(l); p=parse_subexpr(p+1,-1); @@ -929,14 +930,14 @@ unsigned char* parse_subexpr(unsigned char *p,int limit) p=skip_space(p); if(*p=='-'){ - tmpp=skip_space(p+1); + tmpp=(char *) skip_space((unsigned char *) (p+1)); if(*tmpp==';' || *tmpp==','){ add_scriptl(LABEL_NEXTLINE); p++; return p; } } - tmpp=p; + tmpp=(char *) p; if((op=C_NEG,*p=='-') || (op=C_LNOT,*p=='!') || (op=C_NOT,*p=='~')){ p=parse_subexpr(p+1,100); add_scriptc(op); @@ -968,13 +969,13 @@ unsigned char* parse_subexpr(unsigned char *p,int limit) const char *plist[128]; if( str_data[func].type!=C_FUNC ){ - disp_error_message("expect function",tmpp); + disp_error_message("expect function",(unsigned char *) tmpp); exit(0); } add_scriptc(C_ARG); do { - plist[i]=p; + plist[i]=(char *) p; p=parse_subexpr(p,-1); p=skip_space(p); if(*p==',') p++; @@ -984,7 +985,7 @@ unsigned char* parse_subexpr(unsigned char *p,int limit) p=skip_space(p); i++; } while(*p && *p!=')' && i<128); - plist[i]=p; + plist[i]=(char *) p; if(*(p++)!=')'){ disp_error_message("func request '(' ')'",p); exit(1); @@ -995,7 +996,7 @@ unsigned char* parse_subexpr(unsigned char *p,int limit) int j=0; for(j=0;arg[j];j++) if(arg[j]=='*')break; if( (arg[j]==0 && i!=j) || (arg[j]=='*' && i<j) ){ - disp_error_message("illegal number of parameters",plist[(i<j)?i:j]); + disp_error_message("illegal number of parameters",(unsigned char *) (plist[(i<j)?i:j])); } } } else { @@ -1052,19 +1053,19 @@ unsigned char* parse_line(unsigned char *p) parse_cmd_if=0; // warn_cmd_no_commaのために必要 // 最初は関数名 - p2=p; + p2=(char *) p; p=parse_simpleexpr(p); p=skip_space(p); cmd=parse_cmd; if( str_data[cmd].type!=C_FUNC ){ - disp_error_message("expect command",p2); + disp_error_message("expect command",(unsigned char *) p2); // exit(0); } add_scriptc(C_ARG); while(p && *p && *p!=';' && i<128){ - plist[i]=p; + plist[i]=(char *) p; p=parse_expr(p); p=skip_space(p); @@ -1076,7 +1077,7 @@ unsigned char* parse_line(unsigned char *p) p=skip_space(p); i++; } - plist[i]=p; + plist[i]=(char *) p; if(!p || *(p++)!=';'){ disp_error_message("need ';'",p); exit(1); @@ -1088,7 +1089,7 @@ unsigned char* parse_line(unsigned char *p) int j=0; for(j=0;arg[j];j++) if(arg[j]=='*')break; if( (arg[j]==0 && i!=j) || (arg[j]=='*' && i<j) ){ - disp_error_message("illegal number of parameters",plist[(i<j)?i:j]); + disp_error_message("illegal number of parameters",(unsigned char *) (plist[(i<j)?i:j])); } } @@ -1104,7 +1105,7 @@ static void add_buildin_func(void) { int i,n; for(i=0;buildin_func[i].func;i++){ - n=add_str(buildin_func[i].name); + n=add_str((unsigned char *) buildin_func[i].name); str_data[n].type=C_FUNC; str_data[n].val=i; str_data[n].func=buildin_func[i].func; |