From 63eb3e331ed0c54dcdc3036b7b0e534ae708fd93 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 12 Apr 2017 14:40:29 +0200 Subject: [PATCH] - un-const-ify some functions. --- src/dobjtype.cpp | 20 ++++++++++---------- src/dobjtype.h | 23 +++++++++++------------ src/info.cpp | 2 +- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/dobjtype.cpp b/src/dobjtype.cpp index 1cf8af53b..1f327b9c1 100644 --- a/src/dobjtype.cpp +++ b/src/dobjtype.cpp @@ -209,7 +209,7 @@ bool PType::ReadValue(FSerializer &ar, const char *key, void *addr) const // //========================================================================== -void PType::SetDefaultValue(void *base, unsigned offset, TArray *stroffs) const +void PType::SetDefaultValue(void *base, unsigned offset, TArray *stroffs) { } @@ -219,7 +219,7 @@ void PType::SetDefaultValue(void *base, unsigned offset, TArray // //========================================================================== -void PType::SetPointer(void *base, unsigned offset, TArray *stroffs) const +void PType::SetPointer(void *base, unsigned offset, TArray *stroffs) { } @@ -1068,7 +1068,7 @@ bool PString::ReadValue(FSerializer &ar, const char *key, void *addr) const // //========================================================================== -void PString::SetDefaultValue(void *base, unsigned offset, TArray *special) const +void PString::SetDefaultValue(void *base, unsigned offset, TArray *special) { if (base != nullptr) new((uint8_t *)base + offset) FString; if (special != nullptr) @@ -1444,7 +1444,7 @@ PObjectPointer::PObjectPointer(PClass *cls, bool isconst) // //========================================================================== -void PObjectPointer::SetPointer(void *base, unsigned offset, TArray *special) const +void PObjectPointer::SetPointer(void *base, unsigned offset, TArray *special) { // Add to the list of pointers for this class. special->Push(offset); @@ -1612,7 +1612,7 @@ bool PClassPointer::isCompatible(PType *type) // //========================================================================== -void PClassPointer::SetPointer(void *base, unsigned offset, TArray *special) const +void PClassPointer::SetPointer(void *base, unsigned offset, TArray *special) { // Class pointers do not get added to FlatPointers because they are released from the GC. } @@ -1829,7 +1829,7 @@ bool PArray::ReadValue(FSerializer &ar, const char *key, void *addr) const // //========================================================================== -void PArray::SetDefaultValue(void *base, unsigned offset, TArray *special) const +void PArray::SetDefaultValue(void *base, unsigned offset, TArray *special) { for (unsigned i = 0; i < ElementCount; ++i) { @@ -1843,7 +1843,7 @@ void PArray::SetDefaultValue(void *base, unsigned offset, TArray // //========================================================================== -void PArray::SetPointer(void *base, unsigned offset, TArray *special) const +void PArray::SetPointer(void *base, unsigned offset, TArray *special) { for (unsigned i = 0; i < ElementCount; ++i) { @@ -2067,7 +2067,7 @@ void PDynArray::DestroyValue(void *addr) const // //========================================================================== -void PDynArray::SetDefaultValue(void *base, unsigned offset, TArray *special) const +void PDynArray::SetDefaultValue(void *base, unsigned offset, TArray *special) { if (base != nullptr) memset((char*)base + offset, 0, sizeof(FArray)); // same as constructing an empty array. if (special != nullptr) @@ -2312,7 +2312,7 @@ PStruct::PStruct(FName name, PTypeBase *outer) // //========================================================================== -void PStruct::SetDefaultValue(void *base, unsigned offset, TArray *special) const +void PStruct::SetDefaultValue(void *base, unsigned offset, TArray *special) { for (const PField *field : Fields) { @@ -2329,7 +2329,7 @@ void PStruct::SetDefaultValue(void *base, unsigned offset, TArray *special) const +void PStruct::SetPointer(void *base, unsigned offset, TArray *special) { for (const PField *field : Fields) { diff --git a/src/dobjtype.h b/src/dobjtype.h index 27248e955..c1b93e595 100644 --- a/src/dobjtype.h +++ b/src/dobjtype.h @@ -123,8 +123,8 @@ public: // and destruction (e.g. strings) can add their offsets to it for special // initialization when the object is created and destruction when the // object is destroyed. - virtual void SetDefaultValue(void *base, unsigned offset, TArray *special=NULL) const; - virtual void SetPointer(void *base, unsigned offset, TArray *ptrofs = NULL) const; + virtual void SetDefaultValue(void *base, unsigned offset, TArray *special=NULL); + virtual void SetPointer(void *base, unsigned offset, TArray *ptrofs = NULL); virtual void SetPointerArray(void *base, unsigned offset, TArray *ptrofs = NULL) const; // Initialize the value, if needed (e.g. strings) @@ -312,7 +312,7 @@ public: void WriteValue(FSerializer &ar, const char *key,const void *addr) const override; bool ReadValue(FSerializer &ar, const char *key,void *addr) const override; - void SetDefaultValue(void *base, unsigned offset, TArray *special=NULL) const override; + void SetDefaultValue(void *base, unsigned offset, TArray *special=NULL) override; void InitializeValue(void *addr, const void *def) const override; void DestroyValue(void *addr) const override; }; @@ -427,7 +427,7 @@ public: void WriteValue(FSerializer &ar, const char *key, const void *addr) const override; bool ReadValue(FSerializer &ar, const char *key, void *addr) const override; - void SetPointer(void *base, unsigned offset, TArray *special = NULL) const override; + void SetPointer(void *base, unsigned offset, TArray *special = NULL) override; PClass *PointedClass() const; }; @@ -444,7 +444,7 @@ public: void WriteValue(FSerializer &ar, const char *key, const void *addr) const override; bool ReadValue(FSerializer &ar, const char *key, void *addr) const override; - void SetPointer(void *base, unsigned offset, TArray *special = NULL) const override; + void SetPointer(void *base, unsigned offset, TArray *special = NULL) override; virtual bool IsMatch(intptr_t id1, intptr_t id2) const; virtual void GetTypeIDs(intptr_t &id1, intptr_t &id2) const; }; @@ -479,8 +479,8 @@ public: void WriteValue(FSerializer &ar, const char *key,const void *addr) const override; bool ReadValue(FSerializer &ar, const char *key,void *addr) const override; - void SetDefaultValue(void *base, unsigned offset, TArray *special) const override; - void SetPointer(void *base, unsigned offset, TArray *special) const override; + void SetDefaultValue(void *base, unsigned offset, TArray *special) override; + void SetPointer(void *base, unsigned offset, TArray *special) override; protected: PArray(); @@ -513,7 +513,7 @@ public: void WriteValue(FSerializer &ar, const char *key, const void *addr) const override; bool ReadValue(FSerializer &ar, const char *key, void *addr) const override; - void SetDefaultValue(void *base, unsigned offset, TArray *specials) const override; + void SetDefaultValue(void *base, unsigned offset, TArray *specials) override; void InitializeValue(void *addr, const void *def) const override; void DestroyValue(void *addr) const override; void SetPointerArray(void *base, unsigned offset, TArray *ptrofs = NULL) const override; @@ -546,7 +546,7 @@ public: TArray Fields; bool HasNativeFields; - // Some internal structs require explicit construction and destruction of fields the VM cannot handle directly so use thes two functions for it. + // Some internal structs require explicit construction and destruction of fields the VM cannot handle directly so use these two functions for it. VMFunction *mConstructor = nullptr; VMFunction *mDestructor = nullptr; @@ -555,8 +555,8 @@ public: void WriteValue(FSerializer &ar, const char *key,const void *addr) const override; bool ReadValue(FSerializer &ar, const char *key,void *addr) const override; - void SetDefaultValue(void *base, unsigned offset, TArray *specials) const override; - void SetPointer(void *base, unsigned offset, TArray *specials) const override; + void SetDefaultValue(void *base, unsigned offset, TArray *specials) override; + void SetPointer(void *base, unsigned offset, TArray *specials) override; static void WriteFields(FSerializer &ar, const void *addr, const TArray &fields); bool ReadFields(FSerializer &ar, void *addr) const; @@ -565,7 +565,6 @@ protected: }; // a native struct will always be abstract and cannot be instantiated. All variables are references. -// In addition, native structs can have methods (but no virtual ones.) class PNativeStruct : public PStruct { DECLARE_CLASS(PNativeStruct, PStruct); diff --git a/src/info.cpp b/src/info.cpp index 71216cc06..4c3777af4 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -82,7 +82,7 @@ public: { } - void SetDefaultValue(void *base, unsigned offset, TArray *special) const override + void SetDefaultValue(void *base, unsigned offset, TArray *special) override { if (base != nullptr) new((uint8_t *)base + offset) FActorInfo; if (special != nullptr)