Fix warnings in devel plugins introduced by #1302

develop
lethosor 2018-06-20 12:03:14 -04:00
parent 706f3f9f4c
commit 7036cc376b
5 changed files with 18 additions and 18 deletions

@ -113,7 +113,7 @@ command_result eventExample(color_ostream& out, vector<string>& parameters) {
//static int timerCount=0; //static int timerCount=0;
//static int timerDenom=0; //static int timerDenom=0;
void jobInitiated(color_ostream& out, void* job_) { void jobInitiated(color_ostream& out, void* job_) {
out.print("Job initiated! 0x%X\n", job_); out.print("Job initiated! %p\n", job_);
/* /*
df::job* job = (df::job*)job_; df::job* job = (df::job*)job_;
out.print(" completion_timer = %d\n", job->completion_timer); out.print(" completion_timer = %d\n", job->completion_timer);
@ -124,15 +124,15 @@ void jobInitiated(color_ostream& out, void* job_) {
} }
void jobCompleted(color_ostream& out, void* job) { void jobCompleted(color_ostream& out, void* job) {
out.print("Job completed! 0x%X\n", job); out.print("Job completed! %p\n", job);
} }
void timePassed(color_ostream& out, void* ptr) { void timePassed(color_ostream& out, void* ptr) {
out.print("Time: %d\n", (intptr_t)(ptr)); out.print("Time: %zi\n", (intptr_t)(ptr));
} }
void unitDeath(color_ostream& out, void* ptr) { void unitDeath(color_ostream& out, void* ptr) {
out.print("Death: %d\n", (intptr_t)(ptr)); out.print("Death: %zi\n", (intptr_t)(ptr));
} }
void itemCreate(color_ostream& out, void* ptr) { void itemCreate(color_ostream& out, void* ptr) {
@ -143,15 +143,15 @@ void itemCreate(color_ostream& out, void* ptr) {
df::item* item = df::global::world->items.all[item_index]; df::item* item = df::global::world->items.all[item_index];
df::item_type type = item->getType(); df::item_type type = item->getType();
df::coord pos = item->pos; df::coord pos = item->pos;
out.print("Item created: %d, %s, at (%d,%d,%d)\n", (intptr_t)(ptr), ENUM_KEY_STR(item_type, type).c_str(), pos.x, pos.y, pos.z); out.print("Item created: %zi, %s, at (%d,%d,%d)\n", (intptr_t)(ptr), ENUM_KEY_STR(item_type, type).c_str(), pos.x, pos.y, pos.z);
} }
void building(color_ostream& out, void* ptr) { void building(color_ostream& out, void* ptr) {
out.print("Building created/destroyed: %d\n", (intptr_t)ptr); out.print("Building created/destroyed: %zi\n", (intptr_t)ptr);
} }
void construction(color_ostream& out, void* ptr) { void construction(color_ostream& out, void* ptr) {
out.print("Construction created/destroyed: 0x%X\n", ptr); out.print("Construction created/destroyed: %p\n", ptr);
df::construction* constr = (df::construction*)ptr; df::construction* constr = (df::construction*)ptr;
df::coord pos = constr->pos; df::coord pos = constr->pos;
out.print(" (%d,%d,%d)\n", pos.x, pos.y, pos.z); out.print(" (%d,%d,%d)\n", pos.x, pos.y, pos.z);
@ -168,7 +168,7 @@ void syndrome(color_ostream& out, void* ptr) {
} }
void invasion(color_ostream& out, void* ptr) { void invasion(color_ostream& out, void* ptr) {
out.print("New invasion! %d\n", (intptr_t)ptr); out.print("New invasion! %zi\n", (intptr_t)ptr);
} }
void unitAttack(color_ostream& out, void* ptr) { void unitAttack(color_ostream& out, void* ptr) {

@ -100,7 +100,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
uint64_t delta = time2-timeLast; uint64_t delta = time2-timeLast;
// harmless potential data race here... // harmless potential data race here...
timeLast = time2; timeLast = time2;
out.print("Time delta = %d ms\n", delta); out.print("Time delta = %d ms\n", int(delta));
} }
if(trackmenu_flg) if(trackmenu_flg)
{ {
@ -169,10 +169,10 @@ command_result colormods (color_ostream &out, vector <string> & parameters)
for(df::creature_raw* rawlion : vec) for(df::creature_raw* rawlion : vec)
{ {
df::caste_raw * caste = rawlion->caste[0]; df::caste_raw * caste = rawlion->caste[0];
out.print("%s\nCaste addr 0x%x\n",rawlion->creature_id.c_str(), &caste->color_modifiers); out.print("%s\nCaste addr %p\n",rawlion->creature_id.c_str(), &caste->color_modifiers);
for(size_t j = 0; j < caste->color_modifiers.size();j++) for(size_t j = 0; j < caste->color_modifiers.size();j++)
{ {
out.print("mod %d: 0x%x\n", j, caste->color_modifiers[j]); out.print("mod %zd: %p\n", j, caste->color_modifiers[j]);
} }
} }
return CR_OK; return CR_OK;
@ -190,7 +190,7 @@ command_result ktimer (color_ostream &out, vector <string> & parameters)
CoreSuspender suspend; CoreSuspender suspend;
} }
uint64_t timeend = GetTimeMs64(); uint64_t timeend = GetTimeMs64();
out.print("Time to suspend = %d ms\n",timeend - timestart); out.print("Time to suspend = %d ms\n", int(timeend - timestart));
// harmless potential data race here... // harmless potential data race here...
timeLast = timeend; timeLast = timeend;
timering = true; timering = true;

@ -188,7 +188,7 @@ command_result memview (color_ostream &out, vector <string> & parameters)
isValid=true; isValid=true;
if(!isValid) if(!isValid)
{ {
out.printerr("Invalid address:%x\n",memdata.addr); out.printerr("Invalid address: %p\n",memdata.addr);
mymutex->unlock(); mymutex->unlock();
return CR_OK; return CR_OK;
} }

@ -51,7 +51,7 @@ command_result df_notes (color_ostream &con, vector <string> & parameters)
{ {
t_note* note = (*note_list)[i]; t_note* note = (*note_list)[i];
con.print("Note %x at: %d/%d/%d\n",note, note->x, note->y, note->z); con.print("Note %p at: %d/%d/%d\n",note, note->x, note->y, note->z);
con.print("Note id: %d\n", note->id); con.print("Note id: %d\n", note->id);
con.print("Note symbol: '%c'\n", note->symbol); con.print("Note symbol: '%c'\n", note->symbol);

@ -135,8 +135,8 @@ static void printVec(color_ostream &con, const char* msg, t_vecTriplet *vec,
uintptr_t length = (intptr_t)vec->end - (intptr_t)vec->start; uintptr_t length = (intptr_t)vec->end - (intptr_t)vec->start;
uintptr_t offset = pos - start; uintptr_t offset = pos - start;
con.print("%8s offset %06p, addr %010p, start %010p, length %u", con.print("%8s offset 0x%06zx, addr 0x%01zx, start 0x%01zx, length %zi",
msg, offset, pos, vec->start, length); msg, offset, pos, intptr_t(vec->start), length);
if (length >= 4 && length % 4 == 0) if (length >= 4 && length % 4 == 0)
{ {
void *ptr = vec->start; void *ptr = vec->start;
@ -200,10 +200,10 @@ command_result df_vectors (color_ostream &con, vector <string> & parameters)
// Found the range containing the start // Found the range containing the start
if (!range.isInRange((void *)end)) if (!range.isInRange((void *)end))
{ {
con.print("Scanning %u bytes would read past end of memory " con.print("Scanning %zi bytes would read past end of memory "
"range.\n", bytes); "range.\n", bytes);
size_t diff = end - (intptr_t)range.end; size_t diff = end - (intptr_t)range.end;
con.print("Cutting bytes down by %u.\n", diff); con.print("Cutting bytes down by %zi.\n", diff);
end = (uintptr_t) range.end; end = (uintptr_t) range.end;
} }