- Be clear about the safe 'memset/memcpy' operations on virtual classes.

Since I remember that 'memset/memcpy' is safe in this code, it should be okay to cast to the generic pointer all the 'virtual class' arguments before calling the above functions. Shuts up Clang warnings.
This commit is contained in:
Edoardo Prezioso 2013-07-31 12:15:33 +02:00
parent 4eb6f74e36
commit 8cab8f180b
3 changed files with 3 additions and 3 deletions

View file

@ -2945,7 +2945,7 @@ void FinishDehPatch ()
PClass *subclass = RUNTIME_CLASS(ADehackedPickup)->CreateDerivedClass
(typeNameBuilder, sizeof(ADehackedPickup));
AActor *defaults2 = GetDefaultByType (subclass);
memcpy (defaults2, defaults1, sizeof(AActor));
memcpy ((void *)defaults2, (void *)defaults1, sizeof(AActor));
// Make a copy of the replaced class's state labels
FStateDefinitions statedef;

View file

@ -452,7 +452,7 @@ void FDecalLib::ParseDecal (FScanner &sc)
decalNum = GetDecalID (sc);
sc.MustGetStringName ("{");
memset (&newdecal, 0, sizeof(newdecal));
memset ((void *)&newdecal, 0, sizeof(newdecal));
newdecal.PicNum.SetInvalid();
newdecal.ScaleX = newdecal.ScaleY = FRACUNIT;
newdecal.RenderFlags = RF_WALLSPRITE;

View file

@ -433,7 +433,7 @@ DEFINE_PROPERTY(skip_super, 0, Actor)
return;
}
memcpy (defaults, GetDefault<AActor>(), sizeof(AActor));
memcpy ((void *)defaults, (void *)GetDefault<AActor>(), sizeof(AActor));
if (bag.DropItemList != NULL)
{
FreeDropItemChain (bag.DropItemList);