diff options
author | nOOb3167 <nOOb3167@gmail.com> | 2018-07-22 21:56:06 +0200 |
---|---|---|
committer | SmallJoker <SmallJoker@users.noreply.github.com> | 2018-07-22 21:56:06 +0200 |
commit | 9537cfd3f8264700619f58d15741829489e1099e (patch) | |
tree | 36412677aba19e1a2037db7fad2f934a2daa5046 /src/unittest/test.cpp | |
parent | 9855651c06f84f29780cf6b25a392ac841b4630c (diff) | |
download | minetest-9537cfd3f8264700619f58d15741829489e1099e.tar.xz |
Add a MSVC / Windows compatible snprintf function (#7353)
Use sizeof where applicable for mt_snprintf
Diffstat (limited to 'src/unittest/test.cpp')
-rw-r--r-- | src/unittest/test.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/unittest/test.cpp b/src/unittest/test.cpp index 547c3fd07..3ac8ffb19 100644 --- a/src/unittest/test.cpp +++ b/src/unittest/test.cpp @@ -26,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "modchannels.h" #include "content/mods.h" #include "util/numeric.h" +#include "porting.h" content_t t_CONTENT_STONE; content_t t_CONTENT_GRASS; @@ -323,7 +324,7 @@ std::string TestBase::getTestTempDirectory() return m_test_dir; char buf[32]; - snprintf(buf, sizeof(buf), "%08X", myrand()); + porting::mt_snprintf(buf, sizeof(buf), "%08X", myrand()); m_test_dir = fs::TempPath() + DIR_DELIM "mttest_" + buf; if (!fs::CreateDir(m_test_dir)) @@ -335,7 +336,7 @@ std::string TestBase::getTestTempDirectory() std::string TestBase::getTestTempFile() { char buf[32]; - snprintf(buf, sizeof(buf), "%08X", myrand()); + porting::mt_snprintf(buf, sizeof(buf), "%08X", myrand()); return getTestTempDirectory() + DIR_DELIM + buf + ".tmp"; } |