demos: Fix compiler warning in smoketest
authorjoey-lunarg <joey@lunarg.com>
Mon, 14 Nov 2016 22:20:43 +0000 (15:20 -0700)
committerjoey-lunarg <joey@lunarg.com>
Tue, 15 Nov 2016 17:58:47 +0000 (10:58 -0700)
Replaced snprintf with stringstream.

demos/smoke/Game.cpp

index 656d910..5affc08 100644 (file)
 * limitations under the License.
 */
 
+#include <sstream>
+
 #include "Game.h"
 #include "Shell.h"
 
-#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) ||                       \
-    defined MINGW_HAS_SECURE_API
-#include <basetsd.h>
-#define snprintf sprintf_s
-#endif
-
 void Game::print_stats() {
     // Output frame count and measured elapsed time
     auto now = std::chrono::system_clock::now();
     auto elapsed = now - start_time;
     auto elapsed_millis =
         std::chrono::duration_cast<std::chrono::milliseconds>(elapsed).count();
-    char msg[256];
-    snprintf(msg, 255, "frames:%d, elapsedms:%ld", frame_count, elapsed_millis);
-    shell_->log(Shell::LogPriority::LOG_INFO, msg);
+    std::stringstream ss;
+    ss << "frames:" << frame_count << ", elapsedms:" << elapsed_millis;
+    shell_->log(Shell::LogPriority::LOG_INFO, ss.str().c_str());
 }
 
 void Game::quit() {