Fix Linux build warnings

This was SVN commit r7034.
This commit is contained in:
Ykkrosh 2009-07-25 20:35:48 +00:00
parent 6937137341
commit cd0554c6bc
6 changed files with 14 additions and 12 deletions

View File

@ -85,6 +85,8 @@ void* debug_GetCaller(void* UNUSED(context), const char* UNUSED(lastFuncToSkip))
// instead just returning the caller of the function calling us
void *bt[3];
int bt_size = backtrace(bt, 3);
if (bt_size < 3)
return NULL;
return bt[2];
}
@ -300,7 +302,7 @@ static LibError debug_resolve_symbol_dladdr(void *ptr, char* sym_name, char* fil
demangle_buf(sym_name, syminfo.dli_sname, DBG_SYMBOL_LEN);
else
{
snprintf(sym_name, DBG_SYMBOL_LEN, "0x%08x", (size_t)ptr);
snprintf(sym_name, DBG_SYMBOL_LEN, "%p", ptr);
sym_name[DBG_SYMBOL_LEN-1]=0;
}
}

View File

@ -93,7 +93,7 @@ void WriteSystemInfo()
// CPU
const CpuTopology* topology = cpu_topology_Detect();
fprintf(f, "CPU : %s, %s (%dx%dx%d)", un.machine, cpu_IdentifierString(), cpu_topology_NumPackages(topology), cpu_topology_CoresPerPackage(topology), cpu_topology_LogicalPerCore(topology));
fprintf(f, "CPU : %s, %s (%dx%dx%d)", un.machine, cpu_IdentifierString(), (int)cpu_topology_NumPackages(topology), (int)cpu_topology_CoresPerPackage(topology), (int)cpu_topology_LogicalPerCore(topology));
const double cpu_freq = os_cpu_ClockFrequency();
if(cpu_freq != 0.0f)
{
@ -106,7 +106,7 @@ void WriteSystemInfo()
fprintf(f, "\n");
// memory
fprintf(f, "Memory : %u MiB; %u MiB free\n", os_cpu_MemorySize(), os_cpu_MemoryAvailable());
fprintf(f, "Memory : %u MiB; %u MiB free\n", (unsigned)os_cpu_MemorySize(), (unsigned)os_cpu_MemoryAvailable());
// graphics
fprintf(f, "Graphics Card : %s\n", gfx_card);

View File

@ -149,31 +149,31 @@ CStr CRendererStatsTable::GetCellText(size_t row, size_t col)
case Row_Counter:
if (col == 0)
return "counter";
snprintf(buf, sizeof(buf), "%d", Stats.m_Counter);
snprintf(buf, sizeof(buf), "%lu", (unsigned long)Stats.m_Counter);
return buf;
case Row_DrawCalls:
if (col == 0)
return "# draw calls";
snprintf(buf, sizeof(buf), "%d", Stats.m_DrawCalls);
snprintf(buf, sizeof(buf), "%lu", (unsigned long)Stats.m_DrawCalls);
return buf;
case Row_TerrainTris:
if (col == 0)
return "# terrain tris";
snprintf(buf, sizeof(buf), "%d", Stats.m_TerrainTris);
snprintf(buf, sizeof(buf), "%lu", (unsigned long)Stats.m_TerrainTris);
return buf;
case Row_ModelTris:
if (col == 0)
return "# model tris";
snprintf(buf, sizeof(buf), "%d", Stats.m_ModelTris);
snprintf(buf, sizeof(buf), "%lu", (unsigned long)Stats.m_ModelTris);
return buf;
case Row_BlendSplats:
if (col == 0)
return "# blend splats";
snprintf(buf, sizeof(buf), "%d", Stats.m_BlendSplats);
snprintf(buf, sizeof(buf), "%lu", (unsigned long)Stats.m_BlendSplats);
return buf;
default:

View File

@ -111,7 +111,7 @@ int WaterManager::LoadWaterTextures()
while (cur_loading_water_tex < num_textures)
{
snprintf(filename, ARRAY_SIZE(filename), "art/textures/animated/water/%s/diffuse%02d.dds",
water_type, cur_loading_water_tex+1);
water_type, (int)cur_loading_water_tex+1);
Handle ht = ogl_tex_load(filename);
if (ht <= 0)
{
@ -128,7 +128,7 @@ int WaterManager::LoadWaterTextures()
while (cur_loading_normal_map < num_normal_maps)
{
snprintf(filename, ARRAY_SIZE(filename), "art/textures/animated/water/%s/normal%02d.dds",
water_type, cur_loading_normal_map+1);
water_type, (int)cur_loading_normal_map+1);
Handle ht = ogl_tex_load(filename);
if (ht <= 0)
{

View File

@ -645,7 +645,7 @@ static void InitJsTimers()
for(size_t i = 0; i < MAX_JS_TIMERS; i++)
{
const char* description = pos;
pos += sprintf(pos, "js_timer %d", i)+1;
pos += sprintf(pos, "js_timer %d", (int)i)+1;
timer_AddClient(&js_timer_clients[i], description);
}

View File

@ -34,7 +34,7 @@ MessagePasserImpl::MessagePasserImpl()
{
static char name[1024];
sprintf(name, "/wfg-atlas-msgpass-%d-%d",
rand(1, 1000), (int)(time(0)%1000));
(int)rand(1, 1000), (int)(time(0)%1000));
sem_t* sem = sem_open(name, O_CREAT | O_EXCL, 0700, 0);
// This cast should not be necessary, but apparently SEM_FAILED is not