Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 18, 2009, 4:03:59 PM (16 years ago)
Author:
rgrieder
Message:

Found even more casts. They sure aren't all of them, but I hope to have caught every pointer C-style cast because they can be very dangerous.
Note: I didn't do the pointer casts in the network library because that would have taken way too long.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/core/XMLPort.h

    r3196 r3301  
    9393*/
    9494#define XMLPortParamVariable(classname, paramname, variable, xmlelement, mode) \
    95     XMLPortVariableHelperClass xmlcontainer##variable##dummy((void*)&variable); \
     95    XMLPortVariableHelperClass xmlcontainer##variable##dummy(static_cast<void*>(&variable)); \
    9696    static ExecutorMember<orxonox::XMLPortVariableHelperClass>* xmlcontainer##variable##loadexecutor = static_cast<ExecutorMember<orxonox::XMLPortVariableHelperClass>*>(orxonox::createExecutor(orxonox::createFunctor(orxonox::XMLPortVariableHelperClass::getLoader(variable)), std::string( #classname ) + "::" + #variable + "loader")); \
    9797    static ExecutorMember<orxonox::XMLPortVariableHelperClass>* xmlcontainer##variable##saveexecutor = static_cast<ExecutorMember<orxonox::XMLPortVariableHelperClass>*>(orxonox::createExecutor(orxonox::createFunctor(orxonox::XMLPortVariableHelperClass::getSaver (variable)), std::string( #classname ) + "::" + #variable + "saver" )); \
     
    561561                                                    COUT(4) << object->getLoaderIndentation() << "fabricating " << child->Value() << "..." << std::endl;
    562562
    563                                                     BaseObject* newObject = identifier->fabricate((BaseObject*)object);
     563                                                    BaseObject* newObject = identifier->fabricate(static_cast<BaseObject*>(object));
    564564                                                    assert(newObject);
    565565                                                    newObject->setLoaderIndentation(object->getLoaderIndentation() + "  ");
     
    571571                                                    {
    572572                                                        newObject->XMLPort(*child, XMLPort::LoadObject);
    573                                                         COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (objectname " << newObject->getName() << ") to " << this->identifier_->getName() << " (objectname " << ((BaseObject*)object)->getName() << ")" << std::endl;
     573                                                        COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (objectname " << newObject->getName() << ") to " << this->identifier_->getName() << " (objectname " << static_cast<BaseObject*>(object)->getName() << ")" << std::endl;
    574574                                                    }
    575575                                                    else
    576576                                                    {
    577                                                         COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (object not yet loaded) to " << this->identifier_->getName() << " (objectname " << ((BaseObject*)object)->getName() << ")" << std::endl;
     577                                                        COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (object not yet loaded) to " << this->identifier_->getName() << " (objectname " << static_cast<BaseObject*>(object)->getName() << ")" << std::endl;
    578578                                                    }
    579579
     
    671671            template <class T>
    672672            void load(const T& value)
    673                 { *((T*)this->variable_) = value; }
     673                { *static_cast<T*>(this->variable_) = value; }
    674674
    675675            template <class T>
    676676            const T& save()
    677                 { return *((T*)this->variable_); }
     677                { return *static_cast<T*>(this->variable_); }
    678678
    679679            template <class T>
Note: See TracChangeset for help on using the changeset viewer.