From b92787168f845aa3c90002c8145521b5bf4a4fd0 Mon Sep 17 00:00:00 2001 From: nathanstouffer Date: Tue, 4 Feb 2025 10:49:45 -0700 Subject: [PATCH] Fix wasm tinystl compile error (#3406) * utilize bx::strLen instead of C function * utilize bx::strCopy instead of C function --- src/glcontext_html5.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/glcontext_html5.cpp b/src/glcontext_html5.cpp index ce2dc7012..03dae927f 100644 --- a/src/glcontext_html5.cpp +++ b/src/glcontext_html5.cpp @@ -31,8 +31,9 @@ namespace bgfx { namespace gl SwapChainGL(int _context, const char* _canvas) : m_context(_context) { - m_canvas = (char*)bx::alloc(g_allocator, strlen(_canvas) + 1); - strcpy(m_canvas, _canvas); + size_t length = bx::strLen(_canvas) + 1; + m_canvas = (char*)bx::alloc(g_allocator, length); + bx::strCopy(m_canvas, length, _canvas); makeCurrent(); GL_CHECK(glClearColor(0.0f, 0.0f, 0.0f, 0.0f) );