From ef5f2c7503caa761834cdc3e474322b8299260ab Mon Sep 17 00:00:00 2001
From: relesgoe <RElesgoe@users.noreply.github.com>
Date: Sat, 26 Sep 2020 13:28:53 -0700
Subject: [PATCH] Change vernum_to_verstr() to take in a std::uint32_t instead
 of a long and return a std::string instead of a const char* to a static
 variable

---
 src/common/proginfo.cpp | 13 +++++++------
 src/common/proginfo.h   |  4 +++-
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/common/proginfo.cpp b/src/common/proginfo.cpp
index de241cd..b05219b 100644
--- a/src/common/proginfo.cpp
+++ b/src/common/proginfo.cpp
@@ -22,6 +22,10 @@
 #include <cstdio>
 #include <cstdlib>
 #include <cstring>
+#include <string>
+
+#include <fmt/format.h>
+
 #include "common/setup_after.h"
 
 
@@ -82,16 +86,13 @@ namespace pvpgn
 	}
 
 
-	extern char const * vernum_to_verstr(unsigned long vernum)
+	extern std::string vernum_to_verstr(std::uint32_t vernum)
 	{
-		static char verstr[16];
-
-		std::sprintf(verstr, "%lu.%lu.%lu.%lu",
+		return fmt::format("{}.{}.{}.{}",
 			(vernum >> 24),
 			(vernum >> 16) & 0xff,
 			(vernum >> 8) & 0xff,
-			(vernum)& 0xff);
-		return verstr;
+			(vernum) & 0xff);
 	}
 
 }
diff --git a/src/common/proginfo.h b/src/common/proginfo.h
index 8298bb6..2fb6d5d 100644
--- a/src/common/proginfo.h
+++ b/src/common/proginfo.h
@@ -19,12 +19,14 @@
 #ifndef INCLUDED_PROGINFO_PROTOS
 #define INCLUDED_PROGINFO_PROTOS
 
+#include <string>
+
 namespace pvpgn
 {
 
 	extern int verparts_to_vernum(unsigned short v1, unsigned short v2, unsigned short v3, unsigned short v4, unsigned long * vernum);
 	extern int verstr_to_vernum(char const * verstr, unsigned long * vernum);
-	extern char const * vernum_to_verstr(unsigned long vernum);
+	extern std::string vernum_to_verstr(std::uint32_t vernum);
 
 }