diff --git a/libsrc/core/archive.hpp b/libsrc/core/archive.hpp index 7efc2d9d..a72d4dde 100644 --- a/libsrc/core/archive.hpp +++ b/libsrc/core/archive.hpp @@ -387,7 +387,7 @@ namespace ngcore auto info = GetArchiveRegister(name); // the creator creates a new object of type name, and returns a void* pointing // to T (which may have an offset) - p = dynamic_cast(info.creator(typeid(T))); + p = static_cast(info.creator(typeid(T))); // we store the downcasted pointer (to be able to find it again from // another class in a multiple inheritance tree) nr2ptr.push_back(info.downcaster(typeid(T),p)); @@ -402,10 +402,10 @@ namespace ngcore { // if the class has been downcasted we can assume it is in the register auto info = GetArchiveRegister(name); - p = dynamic_cast(info.upcaster(typeid(T), nr2ptr[nr])); + p = static_cast(info.upcaster(typeid(T), nr2ptr[nr])); } else - p = dynamic_cast(nr2ptr[nr]); + p = static_cast(nr2ptr[nr]); } } return *this; @@ -459,7 +459,7 @@ namespace ngcore static void* tryDowncast(const std::type_info& ti, void* p) { if(typeid(B1) == ti) - return dynamic_cast(dynamic_cast(p)); + return dynamic_cast(static_cast(p)); try { return GetArchiveRegister(demangle(typeid(B1).name())).downcaster(ti, static_cast(dynamic_cast(p))); } catch(std::exception) @@ -481,7 +481,7 @@ namespace ngcore { return typeid(T) == ti ? constructIfPossible() : Archive::Caster::tryUpcast(ti, constructIfPossible()); }; info.upcaster = [this](const std::type_info& ti, void* p) -> void* - { return typeid(T) == ti ? p : Archive::Caster::tryUpcast(ti, dynamic_cast(p)); }; + { return typeid(T) == ti ? p : Archive::Caster::tryUpcast(ti, static_cast(p)); }; info.downcaster = [this](const std::type_info& ti, void* p) -> void* { return typeid(T) == ti ? p : Archive::Caster::tryDowncast(ti, p); }; Archive::SetArchiveRegister(std::string(demangle(typeid(T).name())),info); @@ -558,11 +558,11 @@ namespace ngcore if (unlikely(ptr > BUFFERSIZE-sizeof(T))) { fout->write(&buffer[0], ptr); - *dynamic_cast(&buffer[0]) = x; + *static_cast(&buffer[0]) = x; ptr = sizeof(T); return *this; } - *dynamic_cast(&buffer[ptr]) = x; + *static_cast(&buffer[ptr]) = x; ptr += sizeof(T); return *this; }