Fix Clang compilation

This commit is contained in:
Wojtek Figat
2022-10-21 19:06:05 +02:00
parent 8b446edc06
commit 52b1b19b02
2 changed files with 6 additions and 4 deletions

View File

@@ -166,7 +166,7 @@ void NetworkReplicator::AddSerializer(const ScriptingTypeHandle& typeHandle, con
return; return;
// This assumes that C# glue code passed static method pointer (via Marshal.GetFunctionPointerForDelegate) // This assumes that C# glue code passed static method pointer (via Marshal.GetFunctionPointerForDelegate)
const Serializer serializer{ INetworkSerializable_Managed, INetworkSerializable_Managed, *(SerializeFunc*)&serialize, *(SerializeFunc*)&deserialize }; const Serializer serializer{ INetworkSerializable_Managed, INetworkSerializable_Managed, *(SerializeFunc*)(void*)&serialize, *(SerializeFunc*)(void*)&deserialize };
SerializersTable.Add(typeHandle, serializer); SerializersTable.Add(typeHandle, serializer);
} }

View File

@@ -171,8 +171,10 @@ public:
template<typename T> template<typename T>
typename TEnableIf<TIsBaseOf<ScriptingObject, T>::Value>::Type Write(const T* data) typename TEnableIf<TIsBaseOf<ScriptingObject, T>::Value>::Type Write(const T* data)
{ {
const Guid id = data ? data->GetID() : Guid::Empty; uint32 id[4] = { 0 };
WriteBytes(&id, sizeof(Guid)); if (data)
Platform::MemoryCopy(id, &data->GetID(), sizeof(id));
WriteBytes(id, sizeof(id));
} }
template<typename T, typename AllocationType = HeapAllocation> template<typename T, typename AllocationType = HeapAllocation>
@@ -183,7 +185,7 @@ public:
if (size > 0) if (size > 0)
{ {
if (TIsPODType<T>::Value && !TIsPointer<T>::Value) if (TIsPODType<T>::Value && !TIsPointer<T>::Value)
WriteBytes(data.Get(), size * sizeof(T)); WriteBytes(data.Get(), size * sizeof(T));
else else
{ {
for (int32 i = 0; i < size; i++) for (int32 i = 0; i < size; i++)