Remove unnecessary string copy.

Casting `const char*` → `char*` is bad form, and we'd rather copy the string than do that. However, `GetGlyphIndex()` now takes a const, so neither workaround is needed.
This commit is contained in:
player-03
2024-01-31 13:46:09 -05:00
committed by GitHub
parent bed2f7cdca
commit 590be2bbe6

View File

@@ -1198,10 +1198,7 @@ namespace lime {
#ifdef LIME_FREETYPE
Font *font = (Font*)val_data (fontHandle);
const std::string str (hxs_utf8 (character, nullptr));
const std::unique_ptr<char[]> buff (new char[str.size() + 1]);
std::memcpy (buff.get (), str.c_str (), str.size () + 1);
return font->GetGlyphIndex (buff.get ());
return font->GetGlyphIndex (character.c_str ());
#else
return -1;
#endif