mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Made GetBoxed work for pointers to value types
This commit is contained in:
parent
2341e08179
commit
befcbf3ddc
1 changed files with 12 additions and 2 deletions
|
@ -313,14 +313,24 @@ namespace System
|
|||
if (IsObject)
|
||||
return .Err;
|
||||
|
||||
var self = this;
|
||||
var type = VariantType;
|
||||
void* dataPtr = self.DataPtr;
|
||||
if (type.IsPointer)
|
||||
{
|
||||
type = type.UnderlyingType;
|
||||
var boxedType = type.BoxedType;
|
||||
if (boxedType == null)
|
||||
return .Err;
|
||||
dataPtr = (void*)mData;
|
||||
}
|
||||
|
||||
var boxedType = type.BoxedType;
|
||||
if (boxedType == null)
|
||||
return .Err;
|
||||
|
||||
var self = this;
|
||||
var object = Try!(boxedType.CreateObject());
|
||||
Internal.MemCpy((uint8*)Internal.UnsafeCastToPtr(object) + boxedType.[Friend]mMemberDataOffset, self.DataPtr, type.Size);
|
||||
Internal.MemCpy((uint8*)Internal.UnsafeCastToPtr(object) + boxedType.[Friend]mMemberDataOffset, dataPtr, type.Size);
|
||||
return object;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue