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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user