remove format warning

This commit is contained in:
2023-01-02 12:27:08 +01:00
parent 7d30017742
commit 8f95b1a750
2 changed files with 2 additions and 2 deletions

View File

@@ -14,7 +14,7 @@ std::string format(const std::string& format, Args... args){
throw std::runtime_error("Error during formatting."); throw std::runtime_error("Error during formatting.");
} }
std::unique_ptr<char[]> buf(new char[size]); std::unique_ptr<char[]> buf(new char[size]);
snprintf(buf.get(), size, format.c_str(), args...); snprintf(buf.get(), static_cast<std::size_t>(size), format.c_str(), args...);
return std::string(buf.get(), buf.get() + size - 1); // We don't want the '\0' inside return std::string(buf.get(), buf.get() + size - 1); // We don't want the '\0' inside
} }

View File

@@ -37,7 +37,7 @@ target("TowerDefense")
if is_os("windows") then if is_os("windows") then
add_links("dbghelp", "psapi", "kernel32", "msvcr90") add_links("dbghelp", "psapi", "kernel32", "msvcr90")
end end
add_cxflags("-pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -Wno-unused") add_cxflags("-pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=1 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -Wno-unused")
end end