summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--src/common/malloc.c2
-rw-r--r--src/common/sql.c2
-rw-r--r--src/common/timer.c12
-rw-r--r--src/login/account_txt.c2
-rw-r--r--src/map/atcommand.c2
-rw-r--r--src/map/battle.c2
-rw-r--r--src/map/clif.c4
-rw-r--r--src/map/guild.c2
-rw-r--r--src/map/mob.c6
-rw-r--r--src/map/npc.c8
-rw-r--r--src/map/pc.c2
-rw-r--r--src/map/pet.c4
-rw-r--r--src/map/script.c2
-rw-r--r--src/map/unit.c2
15 files changed, 28 insertions, 26 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index cb3065d5e..ec33c8c49 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -3,6 +3,8 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
+2008/11/22
+ * Hunted down the simpler 64bit pointer truncations. [FlavioJS]
2008/11/18
* Rev. 13375 Autotrade characters will no longer get caught by Urgent Recall. (bugreport:2447) [L0ne_W0lf]
2008/11/11
diff --git a/src/common/malloc.c b/src/common/malloc.c
index c64f757bd..b566e689f 100644
--- a/src/common/malloc.c
+++ b/src/common/malloc.c
@@ -428,7 +428,7 @@ void _mfree(void *ptr, const char *file, int line, const char *func )
hash_unfill[ block->unit_hash ] = block;
}
head->size = block->unit_unfill;
- block->unit_unfill = (unsigned short)(((unsigned long)head - (unsigned long)block->data) / block->unit_size);
+ block->unit_unfill = (unsigned short)(((uintptr)head - (uintptr)block->data) / block->unit_size);
}
}
}
diff --git a/src/common/sql.c b/src/common/sql.c
index 0e8e7c2ae..5a70cc86a 100644
--- a/src/common/sql.c
+++ b/src/common/sql.c
@@ -212,7 +212,7 @@ static int Sql_P_Keepalive(Sql* self)
// establish keepalive
ping_interval = timeout - 30; // 30-second reserve
//add_timer_func_list(Sql_P_KeepaliveTimer, "Sql_P_KeepaliveTimer");
- return add_timer_interval(gettick() + ping_interval*1000, Sql_P_KeepaliveTimer, 0, (int)self, ping_interval*1000);
+ return add_timer_interval(gettick() + ping_interval*1000, Sql_P_KeepaliveTimer, 0, (intptr)self, ping_interval*1000);
}
diff --git a/src/common/timer.c b/src/common/timer.c
index 9cdeaca53..c199c1bda 100644
--- a/src/common/timer.c
+++ b/src/common/timer.c
@@ -63,9 +63,9 @@ int add_timer_func_list(TimerFunc func, char* name)
for( tfl=tfl_root; tfl != NULL; tfl=tfl->next )
{// check suspicious cases
if( func == tfl->func )
- ShowWarning("add_timer_func_list: duplicating function %08x(%s) as %s.\n",(int)tfl->func,tfl->name,name);
+ ShowWarning("add_timer_func_list: duplicating function %p(%s) as %s.\n",tfl->func,tfl->name,name);
else if( strcmp(name,tfl->name) == 0 )
- ShowWarning("add_timer_func_list: function %08X has the same name as %08X(%s)\n",(int)func,(int)tfl->func,tfl->name);
+ ShowWarning("add_timer_func_list: function %p has the same name as %p(%s)\n",func,tfl->func,tfl->name);
}
CREATE(tfl,struct timer_func_list,1);
tfl->next = tfl_root;
@@ -256,7 +256,7 @@ int add_timer_interval(unsigned int tick, TimerFunc func, int id, intptr data, i
if( interval < 1 )
{
- ShowError("add_timer_interval: invalid interval (tick=%u %08x[%s] id=%d data=%d diff_tick=%d)\n", tick, (int)func, search_timer_func_list(func), id, data, DIFF_TICK(tick, gettick()));
+ ShowError("add_timer_interval: invalid interval (tick=%u %p[%s] id=%d data=%d diff_tick=%d)\n", tick, func, search_timer_func_list(func), id, data, DIFF_TICK(tick, gettick()));
return INVALID_TIMER;
}
@@ -285,12 +285,12 @@ int delete_timer(int tid, TimerFunc func)
{
if( tid < 0 || tid >= timer_data_num )
{
- ShowError("delete_timer error : no such timer %d (%08x(%s))\n", tid, (int)func, search_timer_func_list(func));
+ ShowError("delete_timer error : no such timer %d (%p(%s))\n", tid, func, search_timer_func_list(func));
return -1;
}
if( timer_data[tid].func != func )
{
- ShowError("delete_timer error : function mismatch %08x(%s) != %08x(%s)\n", (int)timer_data[tid].func, search_timer_func_list(timer_data[tid].func), (int)func, search_timer_func_list(func));
+ ShowError("delete_timer error : function mismatch %p(%s) != %p(%s)\n", timer_data[tid].func, search_timer_func_list(timer_data[tid].func), func, search_timer_func_list(func));
return -2;
}
@@ -324,7 +324,7 @@ int settick_timer(int tid, unsigned int tick)
{// skip timers with the same tick
if( old_tick != timer_data[timer_heap[old_pos]].tick )
{
- ShowError("settick_timer: no such timer %d (%08x(%s))\n", tid, (int)timer_data[tid].func, search_timer_func_list(timer_data[tid].func));
+ ShowError("settick_timer: no such timer %d (%p(%s))\n", tid, timer_data[tid].func, search_timer_func_list(timer_data[tid].func));
return -1;
}
++old_pos;
diff --git a/src/login/account_txt.c b/src/login/account_txt.c
index f177a1a2e..6777c2062 100644
--- a/src/login/account_txt.c
+++ b/src/login/account_txt.c
@@ -183,7 +183,7 @@ static bool account_db_txt_init(AccountDB* self)
// initialize data saving timer
add_timer_func_list(mmo_auth_sync_timer, "mmo_auth_sync_timer");
- db->save_timer = add_timer_interval(gettick() + AUTH_SAVING_INTERVAL, mmo_auth_sync_timer, 0, (int)db, AUTH_SAVING_INTERVAL);
+ db->save_timer = add_timer_interval(gettick() + AUTH_SAVING_INTERVAL, mmo_auth_sync_timer, 0, (intptr)db, AUTH_SAVING_INTERVAL);
return true;
}
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index cb438701c..48e9a0720 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -8739,7 +8739,7 @@ int atcommand_commands(const int fd, struct map_session_data* sd, const char* co
slen = (unsigned int)strlen(atcommand_info[i].command);
// flush the text buffer if this command won't fit into it
- if( ((CHATBOX_SIZE-1+(int)line_buff)-(int)cur) < (int)slen )
+ if( slen + cur - line_buff >= CHATBOX_SIZE )
{
clif_displaymessage(fd,line_buff);
cur = line_buff;
diff --git a/src/map/battle.c b/src/map/battle.c
index 850a0aea9..879e6c0db 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -206,7 +206,7 @@ int battle_delay_damage (unsigned int tick, int amotion, struct block_list *src,
dat->distance = distance_bl(src, target)+10; //Attack should connect regardless unless you teleported.
if (src->type != BL_PC && amotion > 1000)
amotion = 1000; //Aegis places a damage-delay cap of 1 sec to non player attacks. [Skotlex]
- add_timer(tick+amotion, battle_delay_damage_sub, src->id, (int)dat);
+ add_timer(tick+amotion, battle_delay_damage_sub, src->id, (intptr)dat);
return 0;
}
diff --git a/src/map/clif.c b/src/map/clif.c
index 81902f4e4..46e9c0fb9 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -633,7 +633,7 @@ int clif_clearunit_area(struct block_list* bl, uint8 type)
static int clif_clearunit_delayed_sub(int tid, unsigned int tick, int id, intptr data)
{
- struct block_list *bl = (struct block_list *)id;
+ struct block_list *bl = (struct block_list *)data;
clif_clearunit_area(bl, 0);
aFree(bl);
return 0;
@@ -644,7 +644,7 @@ int clif_clearunit_delayed(struct block_list* bl, unsigned int tick)
struct block_list *tbl;
tbl = (struct block_list*)aMalloc(sizeof (struct block_list));
memcpy (tbl, bl, sizeof (struct block_list));
- add_timer(tick, clif_clearunit_delayed_sub, (int)tbl, 0);
+ add_timer(tick, clif_clearunit_delayed_sub, 0, (intptr)tbl);
return 0;
}
diff --git a/src/map/guild.c b/src/map/guild.c
index a12d1544d..8f9137943 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -1874,7 +1874,7 @@ int guild_castlealldataload(int len,struct guild_castle *gc)
}
// update mapserver castle data with new info
- memcpy(&c->guild_id, &gc->guild_id, sizeof(struct guild_castle) - ((int)&c->guild_id - (int)c));
+ memcpy(&c->guild_id, &gc->guild_id, sizeof(struct guild_castle) - ((uintptr)&c->guild_id - (uintptr)c));
if( c->guild_id )
{
diff --git a/src/map/mob.c b/src/map/mob.c
index 1daeda3b0..de1ad7294 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1632,7 +1632,7 @@ static int mob_delay_item_drop(int tid, unsigned int tick, int id, intptr data)
{
struct item_drop_list *list;
struct item_drop *ditem, *ditem_prev;
- list=(struct item_drop_list *)id;
+ list=(struct item_drop_list *)data;
ditem = list->item;
while (ditem) {
map_addflooritem(&ditem->item_data,ditem->item_data.amount,
@@ -2218,7 +2218,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
mob_item_drop(md, dlist, mob_setlootitem(&md->lootitem[i]), 1, 10000, 0);
}
if (dlist->item) //There are drop items.
- add_timer(tick + (!battle_config.delay_battle_damage?500:0), mob_delay_item_drop, (int)dlist, 0);
+ add_timer(tick + (!battle_config.delay_battle_damage?500:0), mob_delay_item_drop, 0, (intptr)dlist);
else //No drops
ers_free(item_drop_list_ers, dlist);
} else if (md->lootitem && md->lootitem_count) { //Loot MUST drop!
@@ -2232,7 +2232,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
dlist->item = NULL;
for(i = 0; i < md->lootitem_count; i++)
mob_item_drop(md, dlist, mob_setlootitem(&md->lootitem[i]), 1, 10000, 0);
- add_timer(tick + (!battle_config.delay_battle_damage?500:0), mob_delay_item_drop, (int)dlist, 0);
+ add_timer(tick + (!battle_config.delay_battle_damage?500:0), mob_delay_item_drop, 0, (intptr)dlist);
}
if(mvp_sd && md->db->mexp > 0 && !md->special_state.ai)
diff --git a/src/map/npc.c b/src/map/npc.c
index 592bd88f1..a347cd128 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -434,9 +434,9 @@ int npc_timerevent(int tid, unsigned int tick, int id, intptr data)
- nd->u.scr.timer_event[ ted->next-1 ].timer;
ted->time+=next;
if (sd)
- sd->npc_timer_id = add_timer(tick+next,npc_timerevent,id,(int)ted);
+ sd->npc_timer_id = add_timer(tick+next,npc_timerevent,id,(intptr)ted);
else
- nd->u.scr.timerid = add_timer(tick+next,npc_timerevent,id,(int)ted);
+ nd->u.scr.timerid = add_timer(tick+next,npc_timerevent,id,(intptr)ted);
} else {
if (sd)
sd->npc_timer_id = -1;
@@ -500,9 +500,9 @@ int npc_timerevent_start(struct npc_data* nd, int rid)
next = nd->u.scr.timer_event[j].timer - nd->u.scr.timer;
ted->time = nd->u.scr.timer_event[j].timer;
if (sd)
- sd->npc_timer_id = add_timer(gettick()+next,npc_timerevent,nd->bl.id,(int)ted);
+ sd->npc_timer_id = add_timer(gettick()+next,npc_timerevent,nd->bl.id,(intptr)ted);
else
- nd->u.scr.timerid = add_timer(gettick()+next,npc_timerevent,nd->bl.id,(int)ted);
+ nd->u.scr.timerid = add_timer(gettick()+next,npc_timerevent,nd->bl.id,(intptr)ted);
return 0;
}
/*==========================================
diff --git a/src/map/pc.c b/src/map/pc.c
index 4efdff069..d4483a3f7 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -6393,7 +6393,7 @@ int pc_addeventtimer(struct map_session_data *sd,int tick,const char *name)
if( i == MAX_EVENTTIMER )
return 0;
- sd->eventtimer[i] = add_timer(gettick()+tick, pc_eventtimer, sd->bl.id, (int)aStrdup(name));
+ sd->eventtimer[i] = add_timer(gettick()+tick, pc_eventtimer, sd->bl.id, (intptr)aStrdup(name));
sd->eventcount++;
return 1;
diff --git a/src/map/pet.c b/src/map/pet.c
index 8c9ce1610..7089875c9 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -955,7 +955,7 @@ static int pet_delay_item_drop(int tid, unsigned int tick, int id, intptr data)
{
struct item_drop_list *list;
struct item_drop *ditem, *ditem_prev;
- list=(struct item_drop_list *)id;
+ list=(struct item_drop_list *)data;
ditem = list->item;
while (ditem) {
map_addflooritem(&ditem->item_data,ditem->item_data.amount,
@@ -1012,7 +1012,7 @@ int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd)
pd->ud.canact_tick = gettick()+10000; // 10*1000msの間拾わない
if (dlist->item)
- add_timer(gettick()+540,pet_delay_item_drop,(int)dlist,0);
+ add_timer(gettick()+540,pet_delay_item_drop,0,(intptr)dlist);
else
ers_free(item_drop_list_ers, dlist);
return 1;
diff --git a/src/map/script.c b/src/map/script.c
index 127ebcde1..2786f082b 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -3150,7 +3150,7 @@ void run_script_main(struct script_state *st)
//Delay execution
st->sleep.charid = sd?sd->status.char_id:0;
st->sleep.timer = add_timer(gettick()+st->sleep.tick,
- run_script_timer, st->sleep.charid, (int)st);
+ run_script_timer, st->sleep.charid, (intptr)st);
linkdb_insert(&sleep_db, (void*)st->oid, st);
//Restore previous script
if (sd) {
diff --git a/src/map/unit.c b/src/map/unit.c
index 7373ebab1..812c70b47 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -803,7 +803,7 @@ int unit_set_walkdelay(struct block_list *bl, unsigned int tick, int delay, int
//Resume running after can move again [Kevin]
if(ud->state.running)
{
- add_timer(ud->canmove_tick, unit_resume_running, bl->id, (int)ud);
+ add_timer(ud->canmove_tick, unit_resume_running, bl->id, (intptr)ud);
}
else
{