From 8cab8f180b2f80918c315a460f2e43e7aa2933a8 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Wed, 31 Jul 2013 12:15:33 +0200 Subject: [PATCH] - 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. --- src/d_dehacked.cpp | 2 +- src/decallib.cpp | 2 +- src/thingdef/thingdef_properties.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index eb4e2fcd6..d01e9513f 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -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; diff --git a/src/decallib.cpp b/src/decallib.cpp index c8fe6c593..91827409b 100644 --- a/src/decallib.cpp +++ b/src/decallib.cpp @@ -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; diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index 61a18b370..7b922df02 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -433,7 +433,7 @@ DEFINE_PROPERTY(skip_super, 0, Actor) return; } - memcpy (defaults, GetDefault(), sizeof(AActor)); + memcpy ((void *)defaults, (void *)GetDefault(), sizeof(AActor)); if (bag.DropItemList != NULL) { FreeDropItemChain (bag.DropItemList);