summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authornOOb3167 <nOOb3167@gmail.com>2018-07-22 21:56:06 +0200
committerSmallJoker <SmallJoker@users.noreply.github.com>2018-07-22 21:56:06 +0200
commit9537cfd3f8264700619f58d15741829489e1099e (patch)
tree36412677aba19e1a2037db7fad2f934a2daa5046 /src/map.cpp
parent9855651c06f84f29780cf6b25a392ac841b4630c (diff)
downloadminetest-9537cfd3f8264700619f58d15741829489e1099e.tar.gz
minetest-9537cfd3f8264700619f58d15741829489e1099e.tar.bz2
minetest-9537cfd3f8264700619f58d15741829489e1099e.zip
Add a MSVC / Windows compatible snprintf function (#7353)
Use sizeof where applicable for mt_snprintf
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/map.cpp b/src/map.cpp
index 35bdc3e9c..801027ae2 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -1727,13 +1727,13 @@ std::string ServerMap::getSectorDir(v2s16 pos, int layout)
switch(layout)
{
case 1:
- snprintf(cc, 9, "%.4x%.4x",
+ porting::mt_snprintf(cc, sizeof(cc), "%.4x%.4x",
(unsigned int) pos.X & 0xffff,
(unsigned int) pos.Y & 0xffff);
return m_savedir + DIR_DELIM + "sectors" + DIR_DELIM + cc;
case 2:
- snprintf(cc, 9, (std::string("%.3x") + DIR_DELIM + "%.3x").c_str(),
+ porting::mt_snprintf(cc, sizeof(cc), (std::string("%.3x") + DIR_DELIM + "%.3x").c_str(),
(unsigned int) pos.X & 0xfff,
(unsigned int) pos.Y & 0xfff);
@@ -1791,7 +1791,7 @@ v3s16 ServerMap::getBlockPos(const std::string &sectordir, const std::string &bl
std::string ServerMap::getBlockFilename(v3s16 p)
{
char cc[5];
- snprintf(cc, 5, "%.4x", (unsigned int)p.Y&0xffff);
+ porting::mt_snprintf(cc, sizeof(cc), "%.4x", (unsigned int)p.Y&0xffff);
return cc;
}