Fix potentially ambiguous printf()

Not a real issue, since it's just supposed to be some unique number.
but still.

Reported by PVS-Studio - https://www.viva64.com/en/b/0540/
This commit is contained in:
Robin Gareus 2017-11-23 10:12:34 +01:00
parent 4f82d1ba99
commit 3ac66ce022
1 changed files with 3 additions and 2 deletions

View File

@ -483,11 +483,12 @@ LuaWindow::save_script ()
// 5) construct filename -- TODO ask user for name, ask to replace file.
do {
char tme[80];
char buf[80];
time_t t = time(0);
struct tm * timeinfo = localtime (&t);
strftime (buf, sizeof(buf), "%s%d", timeinfo);
sprintf (buf, "%s%ld", buf, random ()); // is this valid?
strftime (tme, sizeof(tme), "%s", timeinfo);
snprintf (buf, sizeof(buf), "%s%ld", tme, random ());
MD5 md5;
std::string fn = md5.digestString (buf);