diff --git a/src/framework/core/resourcemanager.cpp b/src/framework/core/resourcemanager.cpp index c14ef3c1..87ccc069 100644 --- a/src/framework/core/resourcemanager.cpp +++ b/src/framework/core/resourcemanager.cpp @@ -55,7 +55,7 @@ bool ResourceManager::discoverWorkDir(const std::string& existentFile) continue; if(PHYSFS_exists(existentFile.c_str())) { - g_logger.debug(stdext::format("Found work dir at '%s'", dir.c_str())); + g_logger.debug(stdext::format("Found work dir at '%s'", dir)); m_workDir = dir; found = true; break; diff --git a/src/framework/platform/unixcrashhandler.cpp b/src/framework/platform/unixcrashhandler.cpp index ee78d9c0..aeae5f72 100644 --- a/src/framework/platform/unixcrashhandler.cpp +++ b/src/framework/platform/unixcrashhandler.cpp @@ -111,7 +111,7 @@ void crashHandler(int signum, siginfo_t* info, void* secret) fout << ss.str(); fout << "\n"; fout.close(); - g_logger.info(stdext::format("Crash report saved to file %s", fileName.c_str())); + g_logger.info(stdext::format("Crash report saved to file %s", fileName)); } else g_logger.error("Failed to save crash report!"); diff --git a/src/framework/platform/win32crashhandler.cpp b/src/framework/platform/win32crashhandler.cpp index a7423b3b..59544a21 100644 --- a/src/framework/platform/win32crashhandler.cpp +++ b/src/framework/platform/win32crashhandler.cpp @@ -111,13 +111,13 @@ LONG CALLBACK ExceptionHandler(LPEXCEPTION_POINTERS e) SymInitialize(GetCurrentProcess(), 0, TRUE); std::stringstream ss; ss << "== application crashed\n"; - ss << stdext::format("app name: %s\n", g_app.getName().c_str()); - ss << stdext::format("app version: %s\n", g_app.getVersion().c_str()); + ss << stdext::format("app name: %s\n", g_app.getName()); + ss << stdext::format("app version: %s\n", g_app.getVersion()); ss << stdext::format("build compiler: %s\n", BUILD_COMPILER); ss << stdext::format("build date: %s\n", __DATE__); ss << stdext::format("build type: %s\n", BUILD_TYPE); ss << stdext::format("build revision: %s (%s)\n", BUILD_REVISION, BUILD_COMMIT); - ss << stdext::format("crash date: %s\n", stdext::date_time_string().c_str()); + ss << stdext::format("crash date: %s\n", stdext::date_time_string()); ss << stdext::format("exception: %s (0x%08lx)\n", getExceptionName(e->ExceptionRecord->ExceptionCode), e->ExceptionRecord->ExceptionCode); ss << stdext::format("exception address: 0x%08lx\n", (long unsigned int)e->ExceptionRecord->ExceptionAddress); ss << stdext::format(" backtrace:\n"); diff --git a/src/framework/platform/win32window.cpp b/src/framework/platform/win32window.cpp index 6e3de22e..68a81ec4 100644 --- a/src/framework/platform/win32window.cpp +++ b/src/framework/platform/win32window.cpp @@ -236,7 +236,7 @@ void WIN32Window::terminate() } if(m_instance) { - if(!UnregisterClassA(g_app.getCompactName().c_str(), m_instance)) + if(!UnregisterClassA(g_app.getCompactName(), m_instance)) g_logger.error("UnregisterClassA failed"); m_instance = NULL; } @@ -262,7 +262,7 @@ void WIN32Window::internalCreateWindow() wc.hCursor = m_defaultCursor; wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); wc.lpszMenuName = NULL; - wc.lpszClassName = g_app.getCompactName().c_str(); + wc.lpszClassName = g_app.getCompactName(); if(!RegisterClassA(&wc)) g_logger.fatal("Failed to register the window class."); diff --git a/src/framework/stdext/format.h b/src/framework/stdext/format.h index abc077cb..3002a46e 100644 --- a/src/framework/stdext/format.h +++ b/src/framework/stdext/format.h @@ -48,6 +48,7 @@ typename std::enable_if::value || std::is_pointer::value || std::is_floating_point::value || std::is_enum::value, T>::type sprintf_cast(const T& t) { return t; } +inline const char *sprintf_cast(const char *s) { return s; } inline const char *sprintf_cast(const std::string& s) { return s.c_str(); } template struct expand_snprintf { diff --git a/src/framework/ui/uiwidget.cpp b/src/framework/ui/uiwidget.cpp index b4af4121..31e97e3f 100644 --- a/src/framework/ui/uiwidget.cpp +++ b/src/framework/ui/uiwidget.cpp @@ -536,7 +536,7 @@ void UIWidget::applyStyle(const OTMLNodePtr& styleNode) for(const OTMLNodePtr& node : styleNode->children()) { if(node->tag()[0] == '!') { std::string tag = node->tag().substr(1); - std::string code = stdext::format("tostring(%s)", node->value().c_str()); + std::string code = stdext::format("tostring(%s)", node->value()); std::string origin = "@" + node->source() + ": [" + node->tag() + "]"; g_lua.evaluateExpression(code, origin); std::string value = g_lua.popString();