Skip to content

Commit

Permalink
Fix incorrect format specifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
AMS21 committed Feb 6, 2024
1 parent ecfc127 commit dbf8897
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/xrCore/Animation/SkeletonMotions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ void motions_container::dump()
sz += it->second->mem_usage();
Msg("#%3d: [%3d/%5d Kb] - %s", k, it->second->m_dwReference, it->second->mem_usage() / 1024, it->first.c_str());
}
Msg("--- items: %d, mem usage: %d Kb ", container.size(), sz / 1024);
Msg("--- items: %zu, mem usage: %zu Kb ", container.size(), sz / 1024);
Log("--- motion container --- end.");
}

Expand Down
2 changes: 1 addition & 1 deletion src/xrCore/LocatorAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ void CLocatorAPI::_initialize(u32 flags, pcstr target_folder, pcstr fs_name)
};

const size_t M2 = Memory.mem_usage();
Msg("FS: %d files cached %d archives, %dKb memory used.", m_files.size(), m_archives.size(), (M2 - M1) / 1024);
Msg("FS: %zu files cached %zu archives, %zuKb memory used.", m_files.size(), m_archives.size(), (M2 - M1) / 1024);

m_Flags.set(flReady, true);

Expand Down
18 changes: 18 additions & 0 deletions src/xrCore/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,24 @@ void Log(const char* msg, const char* dop)
Log(buf);
}

void Log(const char* msg, u32 dop)
{
const u32 buffer_size = (xr_strlen(msg) + 1 + 10 + 1) * sizeof(char);
pstr buf = static_cast<pstr>(xr_alloca(buffer_size));

xr_sprintf(buf, buffer_size, "%s %d", msg, dop);
Log(buf);
}

void Log(const char* msg, u64 dop)
{
const u32 buffer_size = (xr_strlen(msg) + 1 + 64 + 1) * sizeof(char);
pstr buf = static_cast<pstr>(xr_alloca(buffer_size));

xr_sprintf(buf, buffer_size, "%s %ull", msg, dop);
Log(buf);
}

void Log(const char* msg, int dop)
{
const u32 buffer_size = (xr_strlen(msg) + 1 + 11 + 1) * sizeof(char);
Expand Down
2 changes: 1 addition & 1 deletion src/xrCore/xrMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ XRCORE_API void log_vminfo()
{
size_t w_free, w_reserved, w_committed;
vminfo(&w_free, &w_reserved, &w_committed);
Msg("* [ %s ]: free[%d K], reserved[%d K], committed[%d K]", SDL_GetPlatform(), w_free / 1024, w_reserved / 1024, w_committed / 1024);
Msg("* [ %s ]: free[%zu K], reserved[%zu K], committed[%zu K]", SDL_GetPlatform(), w_free / 1024, w_reserved / 1024, w_committed / 1024);
}

size_t xrMemory::mem_usage()
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/configs_dumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void configs_dumper::write_configs()
string16 tmp_strbuff;
for (active_objects_t::size_type i = 0; i < aobjs_count; ++i)
{
xr_sprintf(tmp_strbuff, "%d", i + 1);
xr_sprintf(tmp_strbuff, "%zu", i + 1);
m_active_params.dump(active_objects[i], tmp_strbuff, active_params_dumper);
}
active_params_dumper.save_as(m_dump_result);
Expand Down

0 comments on commit dbf8897

Please sign in to comment.