Fix wasm tinystl compile error (#3406)

* utilize bx::strLen instead of C function

* utilize bx::strCopy instead of C function
This commit is contained in:
nathanstouffer
2025-02-04 10:49:45 -07:00
committed by GitHub
parent 736bffa3dd
commit b92787168f

View File

@@ -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) );