1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Also use c_wchar in StringView.ToScopedNativeWChar

This commit is contained in:
disarray2077 2022-07-04 23:37:46 -03:00
parent cbc4888853
commit 14b0af7f22

View file

@ -4107,18 +4107,21 @@ namespace System
public mixin ToScopedNativeWChar()
{
int encodedLen = UTF16.GetEncodedLen(this);
char16* buf;
c_wchar* buf;
if (encodedLen < 128)
{
buf = scope:mixin char16[encodedLen+1]* ( ? );
buf = scope:mixin c_wchar[encodedLen+1]* ( ? );
}
else
{
buf = new char16[encodedLen+1]* ( ? );
buf = new c_wchar[encodedLen+1]* ( ? );
defer:mixin delete buf;
}
UTF16.Encode(this, buf, encodedLen);
if (sizeof(c_wchar) == 2)
UTF16.Encode(this, (.)buf, encodedLen);
else
UTF32.Encode(this, (.)buf, encodedLen);
buf[encodedLen] = 0;
buf
}