From 5082c940d0d76871288024ba406864f36bcc8eb8 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Mon, 6 Mar 2023 21:13:40 +0100 Subject: [PATCH] Fix: Replace back_inserter usage. --- .../SimpleTexturedOpenGL/src/model_loading.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/samples/SimpleTexturedOpenGL/SimpleTexturedOpenGL/src/model_loading.cpp b/samples/SimpleTexturedOpenGL/SimpleTexturedOpenGL/src/model_loading.cpp index 89731bd9b..7d730a630 100644 --- a/samples/SimpleTexturedOpenGL/SimpleTexturedOpenGL/src/model_loading.cpp +++ b/samples/SimpleTexturedOpenGL/SimpleTexturedOpenGL/src/model_loading.cpp @@ -622,9 +622,12 @@ BOOL CreateGLWindow(const char* title, int width, int height, int bits, bool ful AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle); // Adjust Window To True Requested Size - const std::string message = title; - std::wstring targetMessage; - utf8::utf8to16(message.c_str(), message.c_str() + message.size(), back_inserter(targetMessage)); + const size_t len = std::strlen(title) + 1; + wchar_t *tmp = new wchar_t[len]; + memset(tmp, L'\0', sizeof(wchar_t) * len); + utf8::utf8to16(title, title+len, tmp); + std::wstring targetMessage = tmp; + delete[] tmp; if (nullptr == (g_hWnd = CreateWindowEx(dwExStyle, // Extended Style For The Window TEXT("OpenGL"), // Class Name