aboutsummaryrefslogtreecommitdiff
path: root/src/unittest
diff options
context:
space:
mode:
Diffstat (limited to 'src/unittest')
-rw-r--r--src/unittest/test.cpp5
-rw-r--r--src/unittest/test_connection.cpp5
2 files changed, 6 insertions, 4 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";
}
diff --git a/src/unittest/test_connection.cpp b/src/unittest/test_connection.cpp
index 8217c403e..c5e4085e1 100644
--- a/src/unittest/test_connection.cpp
+++ b/src/unittest/test_connection.cpp
@@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "test.h"
#include "log.h"
+#include "porting.h"
#include "settings.h"
#include "util/serialize.h"
#include "network/connection.h"
@@ -280,7 +281,7 @@ void TestConnection::testConnectSendReceive()
if (i % 2 == 0)
infostream << " ";
char buf[10];
- snprintf(buf, 10, "%.2X",
+ porting::mt_snprintf(buf, sizeof(buf), "%.2X",
((int)((const char *)pkt.getU8Ptr(0))[i]) & 0xff);
infostream<<buf;
}
@@ -323,7 +324,7 @@ void TestConnection::testConnectSendReceive()
if (i % 2 == 0)
infostream << " ";
char buf[10];
- snprintf(buf, 10, "%.2X", ((int)(recvdata[i])) & 0xff);
+ porting::mt_snprintf(buf, sizeof(buf), "%.2X", ((int)(recvdata[i])) & 0xff);
infostream << buf;
}
if (size > 20)