From 9537cfd3f8264700619f58d15741829489e1099e Mon Sep 17 00:00:00 2001 From: nOOb3167 Date: Sun, 22 Jul 2018 21:56:06 +0200 Subject: Add a MSVC / Windows compatible snprintf function (#7353) Use sizeof where applicable for mt_snprintf --- src/map.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/map.cpp') 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 §ordir, 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; } -- cgit v1.2.3