Use GetChars return value

This commit is contained in:
Ethan Lee 2018-06-27 15:43:10 -04:00
parent f26b55e8be
commit dd6f7face8

View file

@ -91,8 +91,8 @@ namespace SDL2
/* Old C# requires an extra memcpy, bleh! */
int len = (int) (ptr - (byte*) s);
char* chars = stackalloc char[len];
System.Text.Encoding.UTF8.GetChars((byte*) s, len, chars, len);
string result = new string(chars);
int strLen = System.Text.Encoding.UTF8.GetChars((byte*) s, len, chars, len);
string result = new string(chars, 0, strLen);
#endif
/* Some SDL functions will malloc, we have to free! */