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:
parent
cbc4888853
commit
14b0af7f22
1 changed files with 7 additions and 4 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue