Browse Source

Fix wasm tinystl compile error (#3406)

* utilize bx::strLen instead of C function

* utilize bx::strCopy instead of C function
nathanstouffer 11 months ago
parent
commit
b92787168f
1 changed files with 3 additions and 2 deletions
  1. 3 2
      src/glcontext_html5.cpp

+ 3 - 2
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) );