From 38a7269400a832ff12cbd4fbec00c91ae2afe468 Mon Sep 17 00:00:00 2001 From: joey-lunarg Date: Mon, 14 Nov 2016 15:20:43 -0700 Subject: [PATCH] demos: Fix compiler warning in smoketest Replaced snprintf with stringstream. --- demos/smoke/Game.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/demos/smoke/Game.cpp b/demos/smoke/Game.cpp index 656d910..5affc08 100644 --- a/demos/smoke/Game.cpp +++ b/demos/smoke/Game.cpp @@ -14,24 +14,20 @@ * limitations under the License. */ +#include + #include "Game.h" #include "Shell.h" -#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) || \ - defined MINGW_HAS_SECURE_API -#include -#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(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() { -- 2.7.4