more compile errors

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@1040 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
(no author) 2005-02-05 06:02:39 +00:00
parent cad63e563c
commit c372b3de89
7 changed files with 58 additions and 56 deletions

View File

@ -1,6 +1,7 @@
Date Added Date Added
02/04 02/04
* Fixed more compile signed/unsigned errors [SVN 1040: MouseJstr]
* TXT convertors now read the import command in inter_athena.conf * TXT convertors now read the import command in inter_athena.conf
[SVN 1038: Ajarn] [SVN 1038: Ajarn]
* Fixed some compile errors [SVN 1037: MouseJstr] * Fixed some compile errors [SVN 1037: MouseJstr]

View File

@ -1,6 +1,6 @@
CC = gcc -pipe # CC = gcc -pipe
# CC = g++ CC = g++
# CC = gcc -pipe -DGCOLLECT # CC = gcc -pipe -DGCOLLECT
# CC = gcc -pipe -DDMALLOC -DDMALLOC_FUNC_CHECK # CC = gcc -pipe -DDMALLOC -DDMALLOC_FUNC_CHECK
# CC = /usr/local/bin/gcc -fbounds-checking -pipe -DBCHECK # CC = /usr/local/bin/gcc -fbounds-checking -pipe -DBCHECK

View File

@ -29,7 +29,7 @@ int chat_createchat(struct map_session_data *sd,int limit,int pub,char* pass,cha
nullpo_retr(0, sd); 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->limit = limit;
cd->pub = pub; cd->pub = pub;
@ -78,7 +78,7 @@ int chat_joinchat(struct map_session_data *sd,int chatid,char* pass)
clif_joinchatfail(sd,0); clif_joinchatfail(sd,0);
return 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); clif_joinchatfail(sd,1);
return 0; 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); 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; cd->limit = cd->trigger = limit;
if(trigger>0) if(trigger>0)

View File

@ -136,7 +136,7 @@ int itemdb_searchrandomid(int flags)
*/ */
struct item_data* itemdb_exists(int nameid) struct item_data* itemdb_exists(int nameid)
{ {
return numdb_search(item_db,nameid); return (struct item_data *) numdb_search(item_db,nameid);
} }
/*========================================== /*==========================================
* DBÌŒŸ<EFBFBD>õ * DBÌŒŸ<EFBFBD>õ
@ -146,7 +146,7 @@ struct item_data* itemdb_search(int nameid)
{ {
struct item_data *id; struct item_data *id;
id=numdb_search(item_db,nameid); id=(struct item_data *) numdb_search(item_db,nameid);
if(id) return id; if(id) return id;
id=(struct item_data *)aCalloc(1,sizeof(struct item_data)); id=(struct item_data *)aCalloc(1,sizeof(struct item_data));
@ -373,10 +373,10 @@ static int itemdb_readdb(void)
if((p=strchr(np,'{'))==NULL) if((p=strchr(np,'{'))==NULL)
continue; continue;
id->use_script = parse_script(p,lines); id->use_script = parse_script((unsigned char *) p,lines);
if((p=strchr(p+1,'{'))==NULL) if((p=strchr(p+1,'{'))==NULL)
continue; continue;
id->equip_script = parse_script(p,lines); id->equip_script = parse_script((unsigned char *) p,lines);
} }
fclose(fp); fclose(fp);
sprintf(tmp_output,"Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n",ln,filename[i]); 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; struct random_item_data *pd=data[i].pdata;
int *pc=data[i].pcount; int *pc=data[i].pcount;
int *pdefault=data[i].pdefault; int *pdefault=data[i].pdefault;
char *fn=data[i].filename; char *fn=(char *) data[i].filename;
*pdefault = 0; *pdefault = 0;
if( (fp=fopen(fn,"r"))==NULL ){ if( (fp=fopen(fn,"r"))==NULL ){
@ -519,7 +519,7 @@ static int itemdb_read_itemnametable(void)
char *buf,*p; char *buf,*p;
int s; int s;
buf=grfio_reads("data\\idnum2itemdisplaynametable.txt",&s); buf=(char *) grfio_reads("data\\idnum2itemdisplaynametable.txt",&s);
if(buf==NULL) if(buf==NULL)
return -1; return -1;
@ -562,7 +562,7 @@ static int itemdb_read_cardillustnametable(void)
char *buf,*p; char *buf,*p;
int s; int s;
buf=grfio_reads("data\\num2cardillustnametable.txt",&s); buf=(char *) grfio_reads("data\\num2cardillustnametable.txt",&s);
if(buf==NULL) if(buf==NULL)
return -1; return -1;
@ -601,7 +601,7 @@ static int itemdb_read_itemslottable(void)
char *buf,*p; char *buf,*p;
int s; int s;
buf=grfio_read("data\\itemslottable.txt"); buf=(char *) grfio_read("data\\itemslottable.txt");
if(buf==NULL) if(buf==NULL)
return -1; return -1;
s=grfio_size("data\\itemslottable.txt"); s=grfio_size("data\\itemslottable.txt");
@ -636,7 +636,7 @@ static int itemdb_read_itemslotcounttable(void)
char *buf,*p; char *buf,*p;
int s; int s;
buf=grfio_read("data\\itemslotcounttable.txt"); buf=(char *) grfio_read("data\\itemslotcounttable.txt");
if(buf==NULL) if(buf==NULL)
return -1; return -1;
s=grfio_size("data\\itemslotcounttable.txt"); 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; struct item_data *id;
nullpo_retr(0, id=data); nullpo_retr(0, id= (struct item_data *) data);
if(id->use_script) if(id->use_script)
aFree(id->use_script); aFree(id->use_script);

View File

@ -288,7 +288,7 @@ int mob_spawn_guardian(struct map_session_data *sd,char *mapname,
for(count=0;count<amount;count++){ for(count=0;count<amount;count++){
struct guild_castle *gc; struct guild_castle *gc;
md=aCalloc(sizeof(struct mob_data), 1); md=(struct mob_data *) aCalloc(sizeof(struct mob_data), 1);
if(md==NULL){ if(md==NULL){
printf("mob_spawn_guardian: out of memory !\n"); printf("mob_spawn_guardian: out of memory !\n");
exit(1); 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) 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; unsigned int tick;
va_list ap; 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; struct map_session_data *tmpsd;
int i; int i;
for(i=0;i<fd_max;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) { if(md->bl.m == tmpsd->bl.m) {
sd = tmpsd; sd = tmpsd;
break; break;

View File

@ -1655,13 +1655,13 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line
} }
if (srcbuf[0]!='{') { if (srcbuf[0]!='{') {
if (strchr((char *) line,'{')) { if (strchr((char *) line,'{')) {
strcpy(srcbuf,strchr((const char *) line,'{')); strcpy((char *) srcbuf,strchr((const char *) line,'{'));
startline=*lines; startline=*lines;
} }
} else } 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) { if (script==NULL) {
// script parse error? // script parse error?
aFree(srcbuf); 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); printf("bad duplicate name! (not exist) : %s\n",srcname);
return 0; return 0;
} }
script=nd2->u.scr.script; script=(unsigned char *)nd2->u.scr.script;
label_dup=nd2->u.scr.label_list; label_dup=nd2->u.scr.label_list;
label_dupnum=nd2->u.scr.label_list_num; label_dupnum=nd2->u.scr.label_list_num;
src_id=nd2->bl.id; 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->flag=0;
nd->class_=class_; nd->class_=class_;
nd->speed=200; nd->speed=200;
nd->u.scr.script=script; nd->u.scr.script=(char *) script;
nd->u.scr.src_id=src_id; nd->u.scr.src_id=src_id;
nd->chat_id=0; nd->chat_id=0;
nd->option = 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 } else
strcat(srcbuf,line); strcat(srcbuf,line);
} }
script=parse_script(srcbuf,startline); script= parse_script((unsigned char *) srcbuf,startline);
if (script==NULL) { if (script==NULL) {
// script parse error? // script parse error?
aFree(srcbuf); aFree(srcbuf);
@ -2160,7 +2160,7 @@ static int npc_read_indoors(void)
char *buf,*p; char *buf,*p;
int s, m; int s, m;
buf=grfio_reads("data\\indoorrswtable.txt",&s); buf=(char *) grfio_reads("data\\indoorrswtable.txt",&s);
if(buf==NULL) if(buf==NULL)
return -1; return -1;
@ -2191,7 +2191,7 @@ static int npc_read_indoors(void)
static int ev_db_final(void *key,void *data,va_list ap) static int ev_db_final(void *key,void *data,va_list ap)
{ {
aFree(data); aFree(data);
if(strstr(key,"::")!=NULL) if(strstr((const char *) key,"::")!=NULL)
aFree(key); aFree(key);
return 0; return 0;
} }

View File

@ -52,7 +52,7 @@ static int script_pos,script_size;
char *str_buf; char *str_buf;
int str_pos,str_size; int str_pos,str_size;
static struct { static struct str_data_struct {
int type; int type;
int str; int str;
int backpatch; int backpatch;
@ -306,7 +306,7 @@ int mapreg_setreg(int num,int val);
int mapreg_setregstr(int num,const char *str); int mapreg_setregstr(int num,const char *str);
struct { struct {
int (*func)(); int (*func)(struct script_state *);
char *name; char *name;
char *arg; char *arg;
} buildin_func[]={ } buildin_func[]={
@ -559,7 +559,7 @@ static int search_str(const unsigned char *p)
int i; int i;
i=str_hash[calc_hash(p)]; i=str_hash[calc_hash(p)];
while(i){ 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; return i;
} }
i=str_data[i].next; i=str_data[i].next;
@ -577,10 +577,10 @@ static int add_str(const unsigned char *p)
int i; int i;
char *lowcase; char *lowcase;
lowcase=aStrdup(p); lowcase=aStrdup((char *) p);
for(i=0;lowcase[i];i++) for(i=0;lowcase[i];i++)
lowcase[i]=tolower(lowcase[i]); lowcase[i]=tolower(lowcase[i]);
if((i=search_str(lowcase))>=0){ if((i=search_str((unsigned char *) lowcase))>=0){
aFree(lowcase); aFree(lowcase);
return i; return i;
} }
@ -592,7 +592,7 @@ static int add_str(const unsigned char *p)
} else { } else {
i=str_hash[i]; i=str_hash[i];
for(;;){ for(;;){
if(strcmp(str_buf+str_data[i].str,p)==0){ if(strcmp(str_buf+str_data[i].str,(char *) p)==0){
return i; return i;
} }
if(str_data[i].next==0) if(str_data[i].next==0)
@ -603,22 +603,22 @@ static int add_str(const unsigned char *p)
} }
if(str_num>=str_data_size){ if(str_num>=str_data_size){
str_data_size+=128; 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); 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_size+=256;
str_buf=(char *)aRealloc(str_buf,str_size); str_buf=(char *)aRealloc(str_buf,str_size);
memset(str_buf + (str_size - 256), '\0', 256); 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].type=C_NOP;
str_data[str_num].str=str_pos; str_data[str_num].str=str_pos;
str_data[str_num].next=0; str_data[str_num].next=0;
str_data[str_num].func=NULL; str_data[str_num].func=NULL;
str_data[str_num].backpatch=-1; str_data[str_num].backpatch=-1;
str_data[str_num].label=-1; str_data[str_num].label=-1;
str_pos+=strlen(p)+1; str_pos+=strlen( (char *) p)+1;
return str_num++; return str_num++;
} }
@ -631,7 +631,7 @@ static void check_script_buf(int size)
{ {
if(script_pos+size>=script_size){ if(script_pos+size>=script_size){
script_size+=SCRIPT_BLOCK_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', memset(script_buf + script_size - SCRIPT_BLOCK_SIZE, '\0',
SCRIPT_BLOCK_SIZE); 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++){ for(line=startline,p=startptr;p && *p;line++){
linestart=p; linestart=p;
lineend=strchr(p,'\n'); lineend=(unsigned char *) strchr((char *) p,'\n');
if(lineend){ if(lineend){
c=*lineend; c=*lineend;
*lineend=0; *lineend=0;
@ -842,9 +842,9 @@ unsigned char* parse_simpleexpr(unsigned char *p)
} }
} else if(isdigit(*p) || ((*p=='-' || *p=='+') && isdigit(p[1]))){ } else if(isdigit(*p) || ((*p=='-' || *p=='+') && isdigit(p[1]))){
char *np; char *np;
i=strtoul(p,&np,0); i=strtoul((char *) p,&np,0);
add_scripti(i); add_scripti(i);
p=np; p=(unsigned char *) np;
} else if(*p=='"'){ } else if(*p=='"'){
add_scriptc(C_STR); add_scriptc(C_STR);
p++; p++;
@ -871,12 +871,12 @@ unsigned char* parse_simpleexpr(unsigned char *p)
disp_error_message("unexpected character",p); disp_error_message("unexpected character",p);
exit(1); exit(1);
} }
p2=skip_word(p); p2=(char *) skip_word(p);
c=*p2; *p2=0; // 名前をadd_strする c=*p2; *p2=0; // 名前をadd_strする
l=add_str(p); l=add_str(p);
parse_cmd=l; // warn_*_mismatch_paramnumのために必要 parse_cmd=l; // warn_*_mismatch_paramnumのために必要
if(l==search_str("if")) // warn_cmd_no_comma̽ßÉ•K—v if(l== search_str((unsigned char *) "if")) // warn_cmd_no_comma̽ßÉ•K—v
parse_cmd_if++; parse_cmd_if++;
/* /*
// 廃止予定のl14/l15,およびプレフィックスlの警告 // 廃止予定の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); 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=='['){ if(str_data[l].type!=C_FUNC && c=='['){
// array(name[i] => getelementofarray(name,i) ) // array(name[i] => getelementofarray(name,i) )
add_scriptl(search_str("getelementofarray")); add_scriptl(search_str((unsigned char *) "getelementofarray"));
add_scriptc(C_ARG); add_scriptc(C_ARG);
add_scriptl(l); add_scriptl(l);
p=parse_subexpr(p+1,-1); p=parse_subexpr(p+1,-1);
@ -929,14 +930,14 @@ unsigned char* parse_subexpr(unsigned char *p,int limit)
p=skip_space(p); p=skip_space(p);
if(*p=='-'){ if(*p=='-'){
tmpp=skip_space(p+1); tmpp=(char *) skip_space((unsigned char *) (p+1));
if(*tmpp==';' || *tmpp==','){ if(*tmpp==';' || *tmpp==','){
add_scriptl(LABEL_NEXTLINE); add_scriptl(LABEL_NEXTLINE);
p++; p++;
return p; return p;
} }
} }
tmpp=p; tmpp=(char *) p;
if((op=C_NEG,*p=='-') || (op=C_LNOT,*p=='!') || (op=C_NOT,*p=='~')){ if((op=C_NEG,*p=='-') || (op=C_LNOT,*p=='!') || (op=C_NOT,*p=='~')){
p=parse_subexpr(p+1,100); p=parse_subexpr(p+1,100);
add_scriptc(op); add_scriptc(op);
@ -968,13 +969,13 @@ unsigned char* parse_subexpr(unsigned char *p,int limit)
const char *plist[128]; const char *plist[128];
if( str_data[func].type!=C_FUNC ){ if( str_data[func].type!=C_FUNC ){
disp_error_message("expect function",tmpp); disp_error_message("expect function",(unsigned char *) tmpp);
exit(0); exit(0);
} }
add_scriptc(C_ARG); add_scriptc(C_ARG);
do { do {
plist[i]=p; plist[i]=(char *) p;
p=parse_subexpr(p,-1); p=parse_subexpr(p,-1);
p=skip_space(p); p=skip_space(p);
if(*p==',') p++; if(*p==',') p++;
@ -984,7 +985,7 @@ unsigned char* parse_subexpr(unsigned char *p,int limit)
p=skip_space(p); p=skip_space(p);
i++; i++;
} while(*p && *p!=')' && i<128); } while(*p && *p!=')' && i<128);
plist[i]=p; plist[i]=(char *) p;
if(*(p++)!=')'){ if(*(p++)!=')'){
disp_error_message("func request '(' ')'",p); disp_error_message("func request '(' ')'",p);
exit(1); exit(1);
@ -995,7 +996,7 @@ unsigned char* parse_subexpr(unsigned char *p,int limit)
int j=0; int j=0;
for(j=0;arg[j];j++) if(arg[j]=='*')break; for(j=0;arg[j];j++) if(arg[j]=='*')break;
if( (arg[j]==0 && i!=j) || (arg[j]=='*' && i<j) ){ 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 { } else {
@ -1052,19 +1053,19 @@ unsigned char* parse_line(unsigned char *p)
parse_cmd_if=0; // warn_cmd_no_commaのために必要 parse_cmd_if=0; // warn_cmd_no_commaのために必要
// 最初は関数名 // 最初は関数名
p2=p; p2=(char *) p;
p=parse_simpleexpr(p); p=parse_simpleexpr(p);
p=skip_space(p); p=skip_space(p);
cmd=parse_cmd; cmd=parse_cmd;
if( str_data[cmd].type!=C_FUNC ){ if( str_data[cmd].type!=C_FUNC ){
disp_error_message("expect command",p2); disp_error_message("expect command",(unsigned char *) p2);
// exit(0); // exit(0);
} }
add_scriptc(C_ARG); add_scriptc(C_ARG);
while(p && *p && *p!=';' && i<128){ while(p && *p && *p!=';' && i<128){
plist[i]=p; plist[i]=(char *) p;
p=parse_expr(p); p=parse_expr(p);
p=skip_space(p); p=skip_space(p);
@ -1076,7 +1077,7 @@ unsigned char* parse_line(unsigned char *p)
p=skip_space(p); p=skip_space(p);
i++; i++;
} }
plist[i]=p; plist[i]=(char *) p;
if(!p || *(p++)!=';'){ if(!p || *(p++)!=';'){
disp_error_message("need ';'",p); disp_error_message("need ';'",p);
exit(1); exit(1);
@ -1088,7 +1089,7 @@ unsigned char* parse_line(unsigned char *p)
int j=0; int j=0;
for(j=0;arg[j];j++) if(arg[j]=='*')break; for(j=0;arg[j];j++) if(arg[j]=='*')break;
if( (arg[j]==0 && i!=j) || (arg[j]=='*' && i<j) ){ 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; int i,n;
for(i=0;buildin_func[i].func;i++){ 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].type=C_FUNC;
str_data[n].val=i; str_data[n].val=i;
str_data[n].func=buildin_func[i].func; str_data[n].func=buildin_func[i].func;