diff options
author | amber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-03-29 06:18:21 +0000 |
---|---|---|
committer | amber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-03-29 06:18:21 +0000 |
commit | c1a8f6f0ac98a694e670bae4c8f74db126e0e8e8 (patch) | |
tree | 57a37cf82ced0b0b998b99e5dfdc27d62932420a | |
parent | 7bfe35400c79bf97a5b0bed9f170912c37cf9452 (diff) | |
download | hercules-c1a8f6f0ac98a694e670bae4c8f74db126e0e8e8.tar.gz hercules-c1a8f6f0ac98a694e670bae4c8f74db126e0e8e8.tar.bz2 hercules-c1a8f6f0ac98a694e670bae4c8f74db126e0e8e8.tar.xz hercules-c1a8f6f0ac98a694e670bae4c8f74db126e0e8e8.zip |
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
-rw-r--r-- | Changelog-SVN.txt | 2 | ||||
-rw-r--r-- | src/char_sql/char.c | 7 | ||||
-rw-r--r-- | src/char_sql/char.h | 2 | ||||
-rw-r--r-- | src/char_sql/int_guild.c | 6 | ||||
-rw-r--r-- | src/char_sql/inter.c | 2 | ||||
-rw-r--r-- | src/common/db.h | 10 | ||||
-rw-r--r-- | src/common/malloc.c | 6 | ||||
-rw-r--r-- | src/common/malloc.h | 2 | ||||
-rw-r--r-- | src/common/socket.c | 6 | ||||
-rw-r--r-- | src/common/timer.c | 14 | ||||
-rw-r--r-- | src/login_sql/login.c | 2 | ||||
-rw-r--r-- | src/map/clif.c | 4 | ||||
-rw-r--r-- | src/map/itemdb.c | 8 | ||||
-rw-r--r-- | src/map/map.c | 6 | ||||
-rw-r--r-- | src/map/npc.c | 2 | ||||
-rw-r--r-- | src/map/pc.c | 2 | ||||
-rw-r--r-- | src/map/script.c | 54 | ||||
-rw-r--r-- | src/txt-converter/char/char-converter.c | 72 | ||||
-rw-r--r-- | src/txt-converter/common/mmo.h | 4 |
19 files changed, 108 insertions, 103 deletions
diff --git a/Changelog-SVN.txt b/Changelog-SVN.txt index 7f32d47cb..d20b19142 100644 --- a/Changelog-SVN.txt +++ b/Changelog-SVN.txt @@ -1,6 +1,8 @@ Date Added 03/29 + * Fixed a lot of compile time problems with our mixed C++/C + conformance [1328: MouseJstr] * Fixed use of storage variable to conform to ANSI C spec [1327: MouseJstr] * Added CIA-bot to the #athena channel [MouseJstr] diff --git a/src/char_sql/char.c b/src/char_sql/char.c index ab20b893b..75bf663d0 100644 --- a/src/char_sql/char.c +++ b/src/char_sql/char.c @@ -67,6 +67,7 @@ char party_db[256] = "party"; char pet_db[256] = "pet"; char login_db[256] = "login"; char friend_db[256] = "friends"; +int db_use_sqldbs; char login_db_account_id[32] = "account_id"; char login_db_level[32] = "level"; @@ -3138,7 +3139,7 @@ int char_lan_config_read(const char *lancfgName){ static int char_db_final(void *key,void *data,va_list ap) { - struct mmo_charstatus *p = data; + struct mmo_charstatus *p = (struct mmo_charstatus *) data; if (p) aFree(p); return 0; } @@ -3280,8 +3281,8 @@ int char_config_read(const char *cfgName) { if (sscanf(line,"%[^:]: %[^\r\n]", w1, w2) != 2) continue; - remove_control_chars(w1); - remove_control_chars(w2); + remove_control_chars((unsigned char *) w1); + remove_control_chars((unsigned char *) w2); if (strcmpi(w1, "userid") == 0) { memcpy(userid, w2, 24); } else if (strcmpi(w1, "passwd") == 0) { diff --git a/src/char_sql/char.h b/src/char_sql/char.h index 74bb28cf1..ddd873374 100644 --- a/src/char_sql/char.h +++ b/src/char_sql/char.h @@ -71,7 +71,7 @@ extern char guild_storage_db[256]; extern char party_db[256]; extern char pet_db[256]; -int db_use_sqldbs; // added for sql item_db read for char server [Valaris] +extern int db_use_sqldbs; // added for sql item_db read for char server [Valaris] extern char login_db_level[32]; extern char login_db_account_id[32]; diff --git a/src/char_sql/int_guild.c b/src/char_sql/int_guild.c index b5d20590a..5ec700a54 100644 --- a/src/char_sql/int_guild.c +++ b/src/char_sql/int_guild.c @@ -532,7 +532,7 @@ int inter_guildcastle_tosql(struct guild_castle *gc) return 0; } //printf("[Guild Castle %02i]: Save...\n",gc->castle_id); - 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); @@ -714,13 +714,13 @@ int guild_infoevent_db_final (void *k, void *data, va_list ap) { return 0; } int guild_castleinfoevent_db_final (void *k, void *data, va_list ap) { return 0; } int guild_db_final (void *k, void *data, va_list ap) { - struct guild *g = data; + struct guild *g = (struct guild *) data; if (g) aFree(g); return 0; } int castle_db_final (void *k, void *data, va_list ap) { - struct guild_castle *gc = data; + struct guild_castle *gc = (struct guild_castle *) data; if (gc) aFree(gc); return 0; } diff --git a/src/char_sql/inter.c b/src/char_sql/inter.c index 13ce0acbe..1a2a2d751 100644 --- a/src/char_sql/inter.c +++ b/src/char_sql/inter.c @@ -300,7 +300,7 @@ int inter_init(const char *file) // finalize int wis_db_final (void *k, void *data, va_list ap) { - struct WisData *p = data; + struct WisData *p = (struct WisData *) data; if (p) aFree(p); return 0; } diff --git a/src/common/db.h b/src/common/db.h index 8b37e15ad..6980099cf 100644 --- a/src/common/db.h +++ b/src/common/db.h @@ -18,6 +18,11 @@ struct dbn { struct dbn *prev; }; +struct db_free { + struct dbn *z; + struct dbn **root; +}; + struct dbt { int (*cmp)(struct dbt*,void*,void*); unsigned int (*hash)(struct dbt*,void*); @@ -30,10 +35,7 @@ struct dbt { int alloc_line; // DB?s // db_foreach 内部でdb_erase される対策として、 // db_foreach が終わるまでロックすることにする - struct db_free { - struct dbn *z; - struct dbn **root; - } *free_list; + struct db_free *free_list; int free_count; int free_max; int free_lock; diff --git a/src/common/malloc.c b/src/common/malloc.c index 747423b47..b562ca3c0 100644 --- a/src/common/malloc.c +++ b/src/common/malloc.c @@ -65,15 +65,15 @@ void* aRealloc_( void *p, size_t size, const char *file, int line, const char *f return ret; } -void* aStrdup_( const void *p, const char *file, int line, const char *func ) +char* aStrdup_( const void *p, const char *file, int line, const char *func ) { - void *ret; + char *ret; // printf("%s:%d: in func %s: strdup %p\n",file,line,func,p); #ifdef MEMWATCH ret=mwStrdup(p,file,line); #else - ret=strdup(p); + ret= strdup((char *) p); #endif if(ret==NULL){ printf("%s:%d: in func %s: strdup error out of memory!\n",file,line,func); diff --git a/src/common/malloc.h b/src/common/malloc.h index c59c08a4e..1bc0eb292 100644 --- a/src/common/malloc.h +++ b/src/common/malloc.h @@ -63,7 +63,7 @@ void* aCalloc_( size_t num, size_t size, const char *file, int line, const char *func ); void* aRealloc_( void *p, size_t size, const char *file, int line, const char *func ); void aFree_( void *p, const char *file, int line, const char *func ); - void* aStrdup_( const void *p, const char *file, int line, const char *func ); + char* aStrdup_( const void *p, const char *file, int line, const char *func ); # define aMalloc(n) aMalloc_(n,ALC_MARK) # define aMallocA(n) aMalloc_(n,ALC_MARK) diff --git a/src/common/socket.c b/src/common/socket.c index 1c4d5931a..70432eddf 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -678,7 +678,7 @@ static int connect_check_(unsigned int ip) { hist = hist->next; } // IPリストに無いので新規作成 - hist_new = aCalloc(1,sizeof(struct _connect_history)); + hist_new = (struct _connect_history *) aCalloc(1,sizeof(struct _connect_history)); hist_new->ip = ip; hist_new->tick = gettick(); if(connect_history[ip & 0xFFFF] != NULL) { @@ -791,12 +791,12 @@ int socket_config_read(const char *cfgName) { if(strcmpi(w2,"allow,deny")==0) access_order=ACO_ALLOW_DENY; if(strcmpi(w2,"mutual-failure")==0) access_order=ACO_MUTUAL_FAILTURE; } else if(strcmpi(w1,"allow")==0){ - access_allow = aRealloc(access_allow,(access_allownum+1)*sizeof(struct _access_control)); + access_allow = (struct _access_control *) aRealloc(access_allow,(access_allownum+1)*sizeof(struct _access_control)); if(access_ipmask(w2,&access_allow[access_allownum])) { access_allownum++; } } else if(strcmpi(w1,"deny")==0){ - access_deny = aRealloc(access_deny,(access_denynum+1)*sizeof(struct _access_control)); + access_deny = (struct _access_control *) aRealloc(access_deny,(access_denynum+1)*sizeof(struct _access_control)); if(access_ipmask(w2,&access_deny[access_denynum])) { access_denynum++; } diff --git a/src/common/timer.c b/src/common/timer.c index 6bf5cdbda..6a740d47a 100644 --- a/src/common/timer.c +++ b/src/common/timer.c @@ -54,9 +54,9 @@ int add_timer_func_list(int (*func)(int,unsigned int,int,int), char* name) { struct timer_func_list* tfl; //CALLOC(tfl, struct timer_func_list, 1); - tfl = aCalloc( sizeof(struct timer_func_list) , 1); + tfl = (struct timer_func_list*) aCalloc( sizeof(struct timer_func_list) , 1); //MALLOC(tfl->name, char, strlen(name) + 1); - tfl->name = aMalloc( strlen(name) + 1 ); + tfl->name = (char *) aMalloc( strlen(name) + 1 ); tfl->next = tfl_root; tfl->func = func; @@ -112,11 +112,11 @@ static void push_timer_heap(int index) { if (timer_heap_max == 0) { timer_heap_max = 256; //CALLOC(timer_heap, int, 256); - timer_heap = aCalloc( sizeof(int) , 256); + timer_heap = (int *) aCalloc( sizeof(int) , 256); } else { timer_heap_max += 256; //REALLOC(timer_heap, int, timer_heap_max); - timer_heap = aRealloc( timer_heap, sizeof(int) * timer_heap_max); + timer_heap = (int *) aRealloc( timer_heap, sizeof(int) * timer_heap_max); memset(timer_heap + (timer_heap_max - 256), 0, sizeof(int) * 256); } } @@ -178,11 +178,11 @@ int add_timer(unsigned int tick,int (*func)(int,unsigned int,int,int),int id,int if (timer_data_max == 0) { timer_data_max = 256; //CALLOC(timer_data, struct TimerData, timer_data_max); - timer_data = aCalloc( sizeof(struct TimerData) , timer_data_max); + timer_data = (struct TimerData*) aCalloc( sizeof(struct TimerData) , timer_data_max); } else { timer_data_max += 256; //REALLOC(timer_data, struct TimerData, timer_data_max); - timer_data = aRealloc( timer_data, sizeof(struct TimerData) * timer_data_max); + timer_data = (struct TimerData *) aRealloc( timer_data, sizeof(struct TimerData) * timer_data_max); memset(timer_data + (timer_data_max - 256), 0, sizeof(struct TimerData) * 256); } } @@ -267,7 +267,7 @@ int do_timer(unsigned int tick) { if (free_timer_list_pos >= free_timer_list_max) { free_timer_list_max += 256; //REALLOC(free_timer_list, int, free_timer_list_max); - free_timer_list = aRealloc(free_timer_list, sizeof(int) * free_timer_list_max); + free_timer_list = (int *) aRealloc(free_timer_list, sizeof(int) * free_timer_list_max); memset(free_timer_list + (free_timer_list_max - 256), 0, 256 * sizeof(int)); } free_timer_list[free_timer_list_pos++] = i; diff --git a/src/login_sql/login.c b/src/login_sql/login.c index 071b6d32c..85f08391d 100644 --- a/src/login_sql/login.c +++ b/src/login_sql/login.c @@ -1829,7 +1829,7 @@ int flush_timer(int tid, unsigned int tick, int id, int data){ //-------------------------------------- static int online_db_final(void *key,void *data,va_list ap) { - int *p = data; + int *p = (int *) data; if (p) aFree(p); return 0; } 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<str_num;i++){ @@ -1308,7 +1308,7 @@ char* parse_script(unsigned char *src,int line) printf("\n"); #endif - return script_buf; + return (char *) script_buf; } // @@ -1445,7 +1445,7 @@ static int set_reg(struct map_session_data *sd,int num,char *name,void *v) int set_var(struct map_session_data *sd, char *name, void *val) { - return set_reg(sd, add_str(name), name, val); + return set_reg(sd, add_str((unsigned char *) name), name, val); } /*========================================== @@ -1525,7 +1525,7 @@ void push_str(struct script_stack *stack,int type,unsigned char *str) // if(battle_config.etc_log) // printf("push (%d,%x)-> %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;i<st->end;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;i<MAX_PARTY;i++){ if(p->member[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; diff --git a/src/txt-converter/char/char-converter.c b/src/txt-converter/char/char-converter.c index 30782412c..217bf2b15 100644 --- a/src/txt-converter/char/char-converter.c +++ b/src/txt-converter/char/char-converter.c @@ -39,7 +39,7 @@ char db_server_id[32] = "ragnarok"; char db_server_pw[32] = "ragnarok"; char db_server_logindb[32] = "ragnarok"; -struct storage *storage=NULL; +struct storage *storage_=NULL; struct mmo_map_server server[MAX_MAP_SERVERS]; int server_fd[MAX_MAP_SERVERS]; @@ -182,13 +182,13 @@ int storage_tosql(int account_id,struct storage *p){ //printf ("all storage item was deleted ok\n"); for(i=0;i<MAX_STORAGE;i++) { - //printf ("save storage num: %d (%d:%d)\n",i, p->storage[i].nameid , p->storage[i].amount); + //printf ("save storage num: %d (%d:%d)\n",i, p->storage_[i].nameid , p->storage_[i].amount); - if( (p->storage[i].nameid) && (p->storage[i].amount) ){ + if( (p->storage_[i].nameid) && (p->storage_[i].amount) ){ sprintf(tmp_sql,"INSERT INTO `storage` (`account_id`,`nameid`,`amount`,`equip`,`identify`,`refine`,`attribute`,`card0`,`card1`,`card2`,`card3`,`broken`) VALUES ('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", - p->account_id, p->storage[i].nameid, p->storage[i].amount, p->storage[i].equip, - p->storage[i].identify, p->storage[i].refine, p->storage[i].attribute, - p->storage[i].card[0], p->storage[i].card[1], p->storage[i].card[2], p->storage[i].card[3], p->storage[i].broken ); + p->account_id, p->storage_[i].nameid, p->storage_[i].amount, p->storage_[i].equip, + p->storage_[i].identify, p->storage_[i].refine, p->storage_[i].attribute, + p->storage_[i].card[0], p->storage_[i].card[1], p->storage_[i].card[2], p->storage_[i].card[3], p->storage_[i].broken ); //printf ("%s\n",tmp_sql); if(mysql_query(&mysql_handle, tmp_sql) ) { printf("DB server Error - %s\n", mysql_error(&mysql_handle) ); @@ -219,18 +219,18 @@ int storage_fromstr(char *str, struct storage *p) &tmp_int[0], &tmp_int[1], &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], &tmp_int[11], &len) == 12) { - p->storage[i].id = tmp_int[0]; - p->storage[i].nameid = tmp_int[1]; - p->storage[i].amount = tmp_int[2]; - p->storage[i].equip = tmp_int[3]; - p->storage[i].identify = tmp_int[4]; - p->storage[i].refine = tmp_int[5]; - p->storage[i].attribute = tmp_int[6]; - p->storage[i].card[0] = tmp_int[7]; - p->storage[i].card[1] = tmp_int[8]; - p->storage[i].card[2] = tmp_int[9]; - p->storage[i].card[3] = tmp_int[10]; - p->storage[i].broken = tmp_int[11]; + p->storage_[i].id = tmp_int[0]; + p->storage_[i].nameid = tmp_int[1]; + p->storage_[i].amount = tmp_int[2]; + p->storage_[i].equip = tmp_int[3]; + p->storage_[i].identify = tmp_int[4]; + p->storage_[i].refine = tmp_int[5]; + p->storage_[i].attribute = tmp_int[6]; + p->storage_[i].card[0] = tmp_int[7]; + p->storage_[i].card[1] = tmp_int[8]; + p->storage_[i].card[2] = tmp_int[9]; + p->storage_[i].card[3] = tmp_int[10]; + p->storage_[i].broken = tmp_int[11]; next += len; if (str[next] == ' ') next++; @@ -240,18 +240,18 @@ int storage_fromstr(char *str, struct storage *p) &tmp_int[0], &tmp_int[1], &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], &len) == 11) { - p->storage[i].id = tmp_int[0]; - p->storage[i].nameid = tmp_int[1]; - p->storage[i].amount = tmp_int[2]; - p->storage[i].equip = tmp_int[3]; - p->storage[i].identify = tmp_int[4]; - p->storage[i].refine = tmp_int[5]; - p->storage[i].attribute = tmp_int[6]; - p->storage[i].card[0] = tmp_int[7]; - p->storage[i].card[1] = tmp_int[8]; - p->storage[i].card[2] = tmp_int[9]; - p->storage[i].card[3] = tmp_int[10]; - p->storage[i].broken = 0; + p->storage_[i].id = tmp_int[0]; + p->storage_[i].nameid = tmp_int[1]; + p->storage_[i].amount = tmp_int[2]; + p->storage_[i].equip = tmp_int[3]; + p->storage_[i].identify = tmp_int[4]; + p->storage_[i].refine = tmp_int[5]; + p->storage_[i].attribute = tmp_int[6]; + p->storage_[i].card[0] = tmp_int[7]; + p->storage_[i].card[1] = tmp_int[8]; + p->storage_[i].card[2] = tmp_int[9]; + p->storage_[i].card[3] = tmp_int[10]; + p->storage_[i].broken = 0; next += len; if (str[next] == ' ') next++; @@ -705,14 +705,14 @@ int mmo_char_init(void){ set=sscanf(line,"%d,%d",&tmp_int[0],&tmp_int[1]); if(set==2) { if(i==0){ - storage = (struct storage*)malloc(sizeof(struct storage)); + storage_ = (struct storage*)malloc(sizeof(struct storage)); }else{ - storage = (struct storage*)realloc(storage,sizeof(struct storage)*(i+1)); + storage_ = (struct storage*)realloc(storage_,sizeof(struct storage)*(i+1)); } - memset(&storage[i],0,sizeof(struct storage)); - storage[i].account_id=tmp_int[0]; - storage_fromstr(line,&storage[i]); - storage_tosql(tmp_int[0],&storage[i]); //to sql. (dump) + memset(&storage_[i],0,sizeof(struct storage)); + storage_[i].account_id=tmp_int[0]; + storage_fromstr(line,&storage_[i]); + storage_tosql(tmp_int[0],&storage_[i]); //to sql. (dump) i++; } } diff --git a/src/txt-converter/common/mmo.h b/src/txt-converter/common/mmo.h index e8ef2b987..28462e99d 100644 --- a/src/txt-converter/common/mmo.h +++ b/src/txt-converter/common/mmo.h @@ -135,14 +135,14 @@ struct storage { int account_id; short storage_status; short storage_amount; - struct item storage[MAX_STORAGE]; + struct item storage_[MAX_STORAGE]; }; struct guild_storage { int guild_id; short storage_status; short storage_amount; - struct item storage[MAX_GUILD_STORAGE]; + struct item storage_[MAX_GUILD_STORAGE]; }; struct map_session_data; |