Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3301


Ignore:
Timestamp:
Jul 18, 2009, 4:03:59 PM (15 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.

Location:
code/trunk/src
Files:
47 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/core/ConfigFileManager.cc

    r3280 r3301  
    572572        else
    573573        {
    574             COUT(1) << "ConfigFileManager: Can't find a config file for type with ID " << (int)type << std::endl;
     574            COUT(1) << "ConfigFileManager: Can't find a config file for type with ID " << static_cast<int>(type) << std::endl;
    575575            COUT(1) << "Using " << DEFAULT_CONFIG_FILE << " file." << std::endl;
    576576            this->setFilename(type, DEFAULT_CONFIG_FILE);
  • code/trunk/src/core/ConfigValueContainer.h

    r3196 r3301  
    6969            inline virtual ~ConfigValueCallback() {}
    7070            inline virtual void call(void* object)
    71                 { if (!Identifier::isCreatingHierarchy()) { (((T*)object)->*this->function_)(); } }
     71            {
     72                if (!Identifier::isCreatingHierarchy())
     73                    (static_cast<T*>(object)->*this->function_)();
     74            }
    7275
    7376        private:
  • code/trunk/src/core/Executor.cc

    r3280 r3301  
    9999
    100100            // assign all given arguments to the multitypes
    101             for (unsigned int i = 0; i < std::min(tokens.size(), (unsigned int)MAX_FUNCTOR_ARGUMENTS); i++)
     101            for (unsigned int i = 0; i < std::min(tokens.size(), MAX_FUNCTOR_ARGUMENTS); i++)
    102102                param[i] = tokens[i];
    103103
    104104            // fill the remaining multitypes with default values
    105             for (unsigned int i = tokens.size(); i < std::min(paramCount, (unsigned int)MAX_FUNCTOR_ARGUMENTS); i++)
     105            for (unsigned int i = tokens.size(); i < std::min(paramCount, MAX_FUNCTOR_ARGUMENTS); i++)
    106106                param[i] = this->defaultValue_[i];
    107107
    108108            // evaluate the param types through the functor
    109             for (unsigned int i = 0; i < std::min(paramCount, (unsigned int)MAX_FUNCTOR_ARGUMENTS); i++)
     109            for (unsigned int i = 0; i < std::min(paramCount, MAX_FUNCTOR_ARGUMENTS); i++)
    110110                this->functor_->evaluateParam(i, param[i]);
    111111
  • code/trunk/src/core/Executor.h

    r3280 r3301  
    104104            COUT(5) << tokens[i]; \
    105105        } \
    106         COUT(5) << ") and " << std::max((int)paramCount - (int)tokens.size(), 0) << " default values ("; \
     106        COUT(5) << ") and " << std::max(static_cast<int>(paramCount) - static_cast<int>(tokens.size()), 0) << " default values ("; \
    107107        for (unsigned int i = tokens.size(); i < paramCount; i++) \
    108108        { \
  • code/trunk/src/core/IRC.cc

    r3280 r3301  
    5252    void IRC::initialize()
    5353    {
    54         unsigned int threadID = (unsigned int)IRC_TCL_THREADID;
     54        unsigned int threadID = IRC_TCL_THREADID;
    5555        TclThreadManager::createID(threadID);
    5656        this->bundle_ = TclThreadManager::getInstance().getInterpreterBundle(threadID);
  • code/trunk/src/core/LuaBind.cc

    r3280 r3301  
    124124  const char * LuaBind::lua_Chunkreader(lua_State *L, void *data, size_t *size)
    125125  {
    126     LoadS* ls = ((LoadS*)data);
     126    LoadS* ls = static_cast<LoadS*>(data);
    127127    if (ls->size == 0) return NULL;
    128128    *size = ls->size;
  • code/trunk/src/core/Shell.cc

    r3300 r3301  
    228228    std::string Shell::getFromHistory() const
    229229    {
    230         unsigned int index = mod(((int)this->historyOffset_) - ((int)this->historyPosition_), this->maxHistoryLength_);
     230        unsigned int index = mod(static_cast<int>(this->historyOffset_) - static_cast<int>(this->historyPosition_), this->maxHistoryLength_);
    231231        if (index < this->commandHistory_.size() && this->historyPosition_ != 0)
    232232            return this->commandHistory_[index];
     
    249249            {
    250250                if (this->bAddOutputLevel_)
    251                     output.insert(0, 1, (char)OutputHandler::getOutStream().getOutputLevel());
     251                    output.insert(0, 1, static_cast<char>(OutputHandler::getOutStream().getOutputLevel()));
    252252
    253253                this->lines_.insert(this->lines_.begin(), output);
  • code/trunk/src/core/Super.h

    r3196 r3301  
    9191            static void check() \
    9292            { \
    93                 SuperFunctionCondition<functionnumber, T, 0, templatehack2>::apply((T*)0); \
     93                SuperFunctionCondition<functionnumber, T, 0, templatehack2>::apply(static_cast<T*>(0)); \
    9494                SuperFunctionCondition<functionnumber + 1, T, 0, templatehack2>::check(); \
    9595            } \
     
    149149                // This call to the apply-function is the whole check. By calling the function with
    150150                // a T* pointer, the right function get's called.
    151                 SuperFunctionCondition<functionnumber, T, 0, templatehack2>::apply((T*)0);
     151                SuperFunctionCondition<functionnumber, T, 0, templatehack2>::apply(static_cast<T*>(0));
    152152
    153153                // Go go the check for of next super-function (functionnumber + 1)
  • code/trunk/src/core/TclThreadManager.cc

    r3300 r3301  
    278278    std::string TclThreadManager::tcl_query(int querierID, Tcl::object const &args)
    279279    {
    280         return TclThreadManager::getInstance().evalQuery((unsigned int)querierID, stripEnclosingBraces(args.get()));
     280        return TclThreadManager::getInstance().evalQuery(static_cast<unsigned int>(querierID), stripEnclosingBraces(args.get()));
    281281    }
    282282
    283283    std::string TclThreadManager::tcl_crossquery(int querierID, int threadID, Tcl::object const &args)
    284284    {
    285         return TclThreadManager::getInstance().evalQuery((unsigned int)querierID, (unsigned int)threadID, stripEnclosingBraces(args.get()));
     285        return TclThreadManager::getInstance().evalQuery(static_cast<unsigned int>(querierID), static_cast<unsigned int>(threadID), stripEnclosingBraces(args.get()));
    286286    }
    287287
    288288    bool TclThreadManager::tcl_running(int threadID)
    289289    {
    290         TclInterpreterBundle* bundle = TclThreadManager::getInstance().getInterpreterBundle((unsigned int)threadID);
     290        TclInterpreterBundle* bundle = TclThreadManager::getInstance().getInterpreterBundle(static_cast<unsigned int>(threadID));
    291291        if (bundle)
    292292        {
     
    556556                    try
    557557                    {
    558                         if (querierID == 0 || std::find(querier->queriers_.begin(), querier->queriers_.end(), (unsigned int)0) != querier->queriers_.end())
     558                        if (querierID == 0 || std::find(querier->queriers_.begin(), querier->queriers_.end(), 0U) != querier->queriers_.end())
    559559                            successfullyLocked = interpreter_lock.try_lock();
    560560                        else
     
    631631            boost::try_mutex::scoped_lock interpreter_lock(this->orxonoxInterpreterBundle_.interpreterMutex_);
    632632#endif
    633             unsigned long maxtime = (unsigned long)(time.getDeltaTime() * 1000000 * TCLTHREADMANAGER_MAX_CPU_USAGE);
     633            unsigned long maxtime = static_cast<unsigned long>(time.getDeltaTime() * 1000000 * TCLTHREADMANAGER_MAX_CPU_USAGE);
    634634            Ogre::Timer timer;
    635635            while (!this->queueIsEmpty())
  • 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>
  • code/trunk/src/core/input/InputBuffer.cc

    r3196 r3301  
    218218        }
    219219
    220         this->insert((char)evt.text);
     220        this->insert(static_cast<char>(evt.text));
    221221    }
    222222
  • code/trunk/src/core/input/InputManager.cc

    r3280 r3301  
    175175
    176176            // Fill parameter list
    177             windowHndStr << (unsigned int)windowHnd_;
     177            windowHndStr << static_cast<unsigned int>(windowHnd);
    178178            paramList.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
    179179#if defined(ORXONOX_PLATFORM_WINDOWS)
  • code/trunk/src/core/input/KeyBinder.cc

    r3280 r3301  
    444444                    if (mousePosition_[i] < 0)
    445445                    {
    446                         mouseAxes_[2*i + 0].absVal_ =  -mousePosition_[i]/(float)mouseClippingSize_ * mouseSensitivity_;
    447                         mouseAxes_[2*i + 1].absVal_ =  0.0f;
     446                        mouseAxes_[2*i + 0].absVal_ = -mouseSensitivity_ * mousePosition_[i] / mouseClippingSize_;
     447                        mouseAxes_[2*i + 1].absVal_ = 0.0f;
    448448                    }
    449449                    else
    450450                    {
    451                         mouseAxes_[2*i + 0].absVal_ =  0.0f;
    452                         mouseAxes_[2*i + 1].absVal_ =   mousePosition_[i]/(float)mouseClippingSize_ * mouseSensitivity_;
     451                        mouseAxes_[2*i + 0].absVal_ = 0.0f;
     452                        mouseAxes_[2*i + 1].absVal_ =  mouseSensitivity_ * mousePosition_[i] / mouseClippingSize_;
    453453                    }
    454454                }
     
    460460        {
    461461            if (rel[i] < 0)
    462                 mouseAxes_[0 + 2*i].relVal_ = -((float)rel[i])/(float)mouseClippingSize_ * mouseSensitivity_;
     462                mouseAxes_[0 + 2*i].relVal_ = -mouseSensitivity_ * rel[i] / mouseClippingSize_;
    463463            else
    464                 mouseAxes_[1 + 2*i].relVal_ =  ((float)rel[i])/(float)mouseClippingSize_ * mouseSensitivity_;
     464                mouseAxes_[1 + 2*i].relVal_ =  mouseSensitivity_ * rel[i] / mouseClippingSize_;
    465465        }
    466466    }
     
    474474        if (rel < 0)
    475475            for (int i = 0; i < -rel/mouseWheelStepSize_; i++)
    476                 mouseButtons_[8].execute(KeybindMode::OnPress, ((float)abs)/mouseWheelStepSize_);
     476                mouseButtons_[8].execute(KeybindMode::OnPress, static_cast<float>(abs)/mouseWheelStepSize_);
    477477        else
    478478            for (int i = 0; i < rel/mouseWheelStepSize_; i++)
    479                 mouseButtons_[9].execute(KeybindMode::OnPress, ((float)abs)/mouseWheelStepSize_);
     479                mouseButtons_[9].execute(KeybindMode::OnPress, static_cast<float>(abs)/mouseWheelStepSize_);
    480480    }
    481481
  • code/trunk/src/network/ClientInformation.cc

    r3214 r3301  
    166166
    167167  double ClientInformation::getPacketLoss(){
    168     return ((double)this->peer_->packetLoss)/ENET_PEER_PACKET_LOSS_SCALE;
     168    return static_cast<double>(this->peer_->packetLoss)/ENET_PEER_PACKET_LOSS_SCALE;
    169169  }
    170170
     
    173173      return gamestateID_;
    174174    else
    175       return (unsigned int)-1;
     175      return static_cast<unsigned int>(-1);
    176176  }
    177177
     
    180180      return partialGamestateID_;
    181181    else
    182       return (unsigned int)-1;
     182      return static_cast<unsigned int>(-1);
    183183  }
    184184
     
    197197
    198198  bool ClientInformation::removeClient(unsigned int clientID) {
    199     if((unsigned int)clientID==CLIENTID_UNKNOWN)
     199    if(clientID==CLIENTID_UNKNOWN)
    200200      return false;
    201201    ClientInformation *temp = head_;
  • code/trunk/src/network/GamestateClient.h

    r3214 r3301  
    4747#include "GamestateHandler.h"
    4848
    49 const unsigned int GAMESTATEID_INITIAL = (unsigned int)-1;
     49const unsigned int GAMESTATEID_INITIAL = static_cast<unsigned int>(-1);
    5050
    5151namespace orxonox
  • code/trunk/src/network/GamestateManager.cc

    r3214 r3301  
    174174    }
    175175
    176     assert(curid==(unsigned int)GAMESTATEID_INITIAL || curid<gamestateID);
     176    assert(curid==GAMESTATEID_INITIAL || curid<gamestateID);
    177177    COUT(4) << "acking gamestate " << gamestateID << " for clientid: " << clientID << " curid: " << curid << std::endl;
    178178    std::map<unsigned int, packet::Gamestate*>::iterator it;
  • code/trunk/src/network/NetworkPrereqs.h

    r3280 r3301  
    6161namespace orxonox
    6262{
    63   static const unsigned int GAMESTATEID_INITIAL = (unsigned int)-1;
    64   static const unsigned int CLIENTID_UNKNOWN    = (unsigned int)-2;
    65   static const uint32_t     OBJECTID_UNKNOWN    = (uint32_t)(-1);
     63  static const unsigned int GAMESTATEID_INITIAL = static_cast<unsigned int>(-1);
     64  static const unsigned int CLIENTID_UNKNOWN    = static_cast<unsigned int>(-2);
     65  static const uint32_t     OBJECTID_UNKNOWN    = static_cast<uint32_t>(-1);
    6666}
    6767
  • code/trunk/src/network/TrafficControl.cc

    r3214 r3301  
    3838namespace orxonox {
    3939
    40   static const unsigned int SCHED_PRIORITY_OFFSET = (unsigned int)-1;
     40  static const unsigned int SCHED_PRIORITY_OFFSET = static_cast<unsigned int>(-1);
    4141
    4242  objInfo::objInfo(uint32_t ID, uint32_t creatorID, int32_t curGsID, int32_t diffGsID, uint32_t size, unsigned int prioperm, unsigned int priosched)
  • code/trunk/src/network/packet/Chat.cc

    r3280 r3301  
    5151  *(unsigned int *)(data_ + _PLAYERID ) = playerID;
    5252  *(unsigned int *)(data_ + _MESSAGELENGTH ) = messageLength_;
    53   memcpy( data_+_MESSAGE, (void *)message.c_str(), messageLength_ );
     53  memcpy( data_+_MESSAGE, static_cast<void*>(const_cast<char*>(message.c_str())), messageLength_ );
    5454}
    5555
  • code/trunk/src/network/packet/Packet.cc

    r3280 r3301  
    143143      // Assures we don't create a packet and destroy it right after in another thread
    144144      // without having a reference in the packetMap_
    145       packetMap_[(size_t)(void*)enetPacket_] = this;
     145      packetMap_[reinterpret_cast<size_t>(enetPacket_)] = this;
    146146    }
    147147  }
     
    172172Packet *Packet::createPacket(ENetPacket *packet, ENetPeer *peer){
    173173  uint8_t *data = packet->data;
    174   assert(ClientInformation::findClient(&peer->address)->getID() != (unsigned int)-2 || !Host::isServer());
     174  assert(ClientInformation::findClient(&peer->address)->getID() != static_cast<unsigned int>(-2) || !Host::isServer());
    175175  unsigned int clientID = ClientInformation::findClient(&peer->address)->getID();
    176176  Packet *p = 0;
     
    230230void Packet::deletePacket(ENetPacket *enetPacket){
    231231  // Get our Packet from a gloabal map with all Packets created in the send() method of Packet.
    232   std::map<size_t, Packet*>::iterator it = packetMap_.find((size_t)enetPacket);
     232  std::map<size_t, Packet*>::iterator it = packetMap_.find(reinterpret_cast<size_t>(enetPacket));
    233233  assert(it != packetMap_.end());
    234234  // Make sure we don't delete it again in the destructor
  • code/trunk/src/network/synchronisable/Synchronisable.h

    r3280 r3301  
    4444
    4545/*#define REGISTERDATA(varname, ...) \
    46     registerVariable((void*)&varname, sizeof(varname), DATA, __VA_ARGS__)
     46    registerVariable(static_cast<void*>(&varname), sizeof(varname), DATA, __VA_ARGS__)
    4747#define REGISTERSTRING(stringname, ...) \
    4848    registerVariable(&stringname, stringname.length()+1, STRING, __VA_ARGS__)*/
  • code/trunk/src/network/synchronisable/SynchronisableVariable.h

    r3280 r3301  
    3636#include <cstring>
    3737#include "util/Serialise.h"
     38#include "util/TemplateUtils.h"
    3839#include "core/GameMode.h"
    3940#include "network/synchronisable/NetworkCallbackManager.h"
     
    7879      virtual inline void putData(uint8_t*& mem, uint8_t mode, bool forceCallback = false);
    7980      virtual inline uint32_t getSize(uint8_t mode);
    80       virtual inline void* getReference(){ return (void *)&this->variable_; }
     81      virtual inline void* getReference(){ return static_cast<void*>(const_cast<typename TypeStripper<T>::RawType*>(&this->variable_)); }
    8182    protected:
    8283     
     
    178179        {
    179180          this->varReference_++;
    180           memcpy((void*)&this->varBuffer_, &this->variable_, sizeof(this->variable_));
     181          memcpy(static_cast<void*>(const_cast<typename TypeStripper<T>::RawType*>(&this->varBuffer_)), &this->variable_, sizeof(this->variable_));
    181182        }
    182183      }
     
    211212          {
    212213            mem += sizeof(varReference_);
    213             memcpy((void*)&this->varBuffer_, &this->variable_, sizeof(T));
     214            memcpy(static_cast<void*>(const_cast<typename TypeStripper<T>::RawType*>(&this->varBuffer_)), &this->variable_, sizeof(T));
    214215            if ( this->callback_ != 0 )
    215216              callback = true;
  • code/trunk/src/orxonox/gamestates/GSDedicated.cc

    r3300 r3301  
    193193//                             boost::recursive_mutex::scoped_lock(this->inputLineMutex_);
    194194                            std::cout << endl << CommandExecutor::hint( std::string((const char*)this->commandLine_,inputIterator_) ) << endl;
    195                             strncpy((char*)this->commandLine_, CommandExecutor::complete( std::string((const char*)this->commandLine_,inputIterator_) ).c_str(), MAX_COMMAND_LENGTH);
     195                            strncpy(reinterpret_cast<char*>(this->commandLine_), CommandExecutor::complete( std::string(reinterpret_cast<char*>(this->commandLine_),inputIterator_) ).c_str(), MAX_COMMAND_LENGTH);
    196196                            inputIterator_ = strlen((const char*)this->commandLine_);
    197197                            break;
     
    275275    void GSDedicated::insertCharacter( unsigned int position, char c )
    276276    {
    277 //         std::cout << endl << (unsigned int)c << endl;
     277//         std::cout << endl << static_cast<unsigned int>(c) << endl;
    278278        // check that we do not exceed MAX_COMMAND_LENGTH
    279279        if( inputIterator_+1 < MAX_COMMAND_LENGTH )
  • code/trunk/src/orxonox/objects/Scene.cc

    r3280 r3301  
    325325    {
    326326        // get the WorldEntity pointers
    327         WorldEntity* object0 = (WorldEntity*)colObj0->getUserPointer();
     327        WorldEntity* object0 = static_cast<WorldEntity*>(colObj0->getUserPointer());
    328328        assert(dynamic_cast<WorldEntity*>(object0));
    329         WorldEntity* object1 = (WorldEntity*)colObj1->getUserPointer();
     329        WorldEntity* object1 = static_cast<WorldEntity*>(colObj1->getUserPointer());
    330330        assert(dynamic_cast<WorldEntity*>(object1));
    331331
  • code/trunk/src/orxonox/objects/collisionshapes/CollisionShape.h

    r2662 r3301  
    6363            virtual void setScale3D(const Vector3& scale);
    6464            virtual void setScale(float scale);
    65             inline const Vector3& getScale3D(void) const
     65            inline const Vector3& getScale3D() const
    6666                { return this->scale_; }
    6767
  • code/trunk/src/orxonox/objects/controllers/WaypointPatrolController.cc

    r3196 r3301  
    8585
    8686        Vector3 myposition = this->getControllableEntity()->getPosition();
    87         float shortestsqdistance = (unsigned int)-1;
     87        float shortestsqdistance = static_cast<unsigned int>(-1);
    8888
    8989        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
  • code/trunk/src/orxonox/objects/gametypes/TeamDeathmatch.cc

    r3300 r3301  
    7474                playersperteam[it->second]++;
    7575
    76         unsigned int minplayers = (unsigned int)-1;
     76        unsigned int minplayers = static_cast<unsigned int>(-1);
    7777        size_t minplayersteam = 0;
    7878        for (size_t i = 0; i < this->teams_; ++i)
  • code/trunk/src/orxonox/objects/gametypes/UnderAttack.cc

    r3300 r3301  
    5151
    5252        this->setConfigValues();
    53         this->timesequence_ = static_cast<this->gameTime_);
     53        this->timesequence_ = static_cast<int>(this->gameTime_);
    5454    }
    5555
  • code/trunk/src/orxonox/objects/weaponsystem/Munition.cc

    r3196 r3301  
    354354            return false;
    355355
    356         if (amount <= (unsigned int)needed_magazines)
     356        if (amount <= static_cast<unsigned int>(needed_magazines))
    357357        {
    358358            // We need more magazines than we get, so just add them
  • code/trunk/src/orxonox/objects/weaponsystem/WeaponSystem.h

    r3196 r3301  
    8484
    8585            static const unsigned int MAX_FIRE_MODES = 8;
    86             static const unsigned int FIRE_MODE_UNASSIGNED = (unsigned int)-1;
     86            static const unsigned int FIRE_MODE_UNASSIGNED = static_cast<unsigned int>(-1);
    8787
    8888            static const unsigned int MAX_WEAPON_MODES = 8;
    89             static const unsigned int WEAPON_MODE_UNASSIGNED = (unsigned int)-1;
     89            static const unsigned int WEAPON_MODE_UNASSIGNED = static_cast<unsigned int>(-1);
    9090
    9191        private:
  • code/trunk/src/orxonox/objects/worldentities/ParticleEmitter.h

    r3300 r3301  
    6666                { this->LOD_ = static_cast<LODParticle::Value>(level); this->LODchanged(); }
    6767            inline unsigned int getLODxml() const
    68                 { return (unsigned int)this->LOD_; }
     68                { return static_cast<unsigned int>(this->LOD_); }
    6969
    7070            void sourceChanged();
  • code/trunk/src/orxonox/objects/worldentities/WorldEntity.h

    r3196 r3301  
    148148            inline void setScale3D(float x, float y, float z)
    149149                { this->setScale3D(Vector3(x, y, z)); }
    150             const Vector3& getScale3D(void) const;
     150            const Vector3& getScale3D() const;
    151151            const Vector3& getWorldScale3D() const;
    152152
     
    457457    inline const Quaternion& WorldEntity::getOrientation() const
    458458        { return this->node_->getOrientation(); }
    459     inline const Vector3& WorldEntity::getScale3D(void) const
     459    inline const Vector3& WorldEntity::getScale3D() const
    460460        { return this->node_->getScale(); }
    461461#endif
  • code/trunk/src/orxonox/overlays/GUIOverlay.cc

    r3300 r3301  
    6767            std::string str;
    6868            std::stringstream out;
    69             out << static_cast<long>(this);
     69            out << reinterpret_cast<long>(this);
    7070            str = out.str();
    7171            GUIManager::getInstance().executeCode("showCursor()");
  • code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc

    r3300 r3301  
    8282        // Get aspect ratio from the render window. Later on, we get informed automatically
    8383        Ogre::RenderWindow* defaultWindow = GraphicsManager::getInstance().getRenderWindow();
    84         this->windowAspectRatio_ = (float)defaultWindow->getWidth() / defaultWindow->getHeight();
     84        this->windowAspectRatio_ = static_cast<float>(defaultWindow->getWidth()) / defaultWindow->getHeight();
    8585        this->sizeCorrectionChanged();
    8686
     
    183183    void OrxonoxOverlay::windowResized(unsigned int newWidth, unsigned int newHeight)
    184184    {
    185         this->windowAspectRatio_ = newWidth/(float)newHeight;
     185        this->windowAspectRatio_ = static_cast<float>(newWidth) / newHeight;
    186186        this->sizeCorrectionChanged();
    187187    }
     
    215215            if (angle < 0.0)
    216216                angle = -angle;
    217             angle -= 180.0f * static_caste<int>(angle / 180.0);
     217            angle -= 180.0f * static_cast<int>(angle / 180.0);
    218218
    219219            // take the reverse if angle is about 90 degrees
  • code/trunk/src/orxonox/overlays/console/InGameConsole.cc

    r3300 r3301  
    9393        @brief Destructor: Destroys the TextAreas.
    9494    */
    95     InGameConsole::~InGameConsole(void)
     95    InGameConsole::~InGameConsole()
    9696    {
    9797        this->deactivate();
  • code/trunk/src/orxonox/overlays/hud/HUDNavigation.cc

    r3280 r3301  
    141141
    142142        // set text
    143         int dist = (int) getDist2Focus();
     143        int dist = static_cast<int>(getDist2Focus());
    144144        navText_->setCaption(multi_cast<std::string>(dist));
    145145        float textLength = multi_cast<std::string>(dist).size() * navText_->getCharHeight() * 0.3;
  • code/trunk/src/orxonox/overlays/notifications/NotificationOverlay.cc

    r3196 r3301  
    129129    std::string NotificationOverlay::clipMessage(const std::string & message)
    130130    {
    131         if(message.length() <= (unsigned int)this->queue_->getNotificationLength()) //!< If the message is not too long.
     131        if(message.length() <= static_cast<unsigned int>(this->queue_->getNotificationLength())) //!< If the message is not too long.
    132132            return message;
    133133        return message.substr(0, this->queue_->getNotificationLength());
  • code/trunk/src/orxonox/overlays/notifications/NotificationQueue.cc

    r3196 r3301  
    398398        timeString.erase(timeString.length()-1);
    399399        std::ostringstream stream;
    400         stream << (unsigned long)notification;
     400        stream << reinterpret_cast<unsigned long>(notification);
    401401        std::string addressString = stream.str() ;
    402402        container->name = "NotificationOverlay(" + timeString + ")&" + addressString;
  • code/trunk/src/orxonox/tools/ParticleInterface.cc

    r3280 r3301  
    7979        }
    8080
    81         this->setDetailLevel((unsigned int)detaillevel);
     81        this->setDetailLevel(static_cast<unsigned int>(detaillevel));
    8282    }
    8383
     
    185185    void ParticleInterface::detailLevelChanged(unsigned int newlevel)
    186186    {
    187         if (newlevel >= (unsigned int)this->detaillevel_)
     187        if (newlevel >= static_cast<unsigned int>(this->detaillevel_))
    188188            this->bAllowedByLOD_ = true;
    189189        else
  • code/trunk/src/orxonox/tools/Shader.cc

    r3196 r3301  
    165165            if (pointer->first)
    166166            {
    167                 if ((*((float*)pointer->second)) != value)
    168                 {
    169                     (*((float*)pointer->second)) = value;
     167                if ((*static_cast<float*>(pointer->second)) != value)
     168                {
     169                    (*static_cast<float*>(pointer->second)) = value;
    170170                    return true;
    171171                }
     
    173173            else
    174174            {
    175                 if ((*((int*)pointer->second)) != (int)value)
    176                 {
    177                     (*((int*)pointer->second)) = (int)value;
     175                if ((*static_cast<int*>(pointer->second)) != static_cast<int>(value))
     176                {
     177                    (*static_cast<int*>(pointer->second)) = static_cast<int>(value);
    178178                    return true;
    179179                }
     
    190190            if (pointer->first)
    191191            {
    192                 if ((*((float*)pointer->second)) != (float)value)
    193                 {
    194                     (*((float*)pointer->second)) = (float)value;
     192                if ((*static_cast<float*>(pointer->second)) != static_cast<float>(value))
     193                {
     194                    (*static_cast<float*>(pointer->second)) = static_cast<float>(value);
    195195                    return true;
    196196                }
     
    198198            else
    199199            {
    200                 if ((*((int*)pointer->second)) != value)
    201                 {
    202                     (*((int*)pointer->second)) = value;
     200                if ((*static_cast<int*>(pointer->second)) != value)
     201                {
     202                    (*static_cast<int*>(pointer->second)) = value;
    203203                    return true;
    204204                }
     
    214214        {
    215215            if (pointer->first)
    216                 return (*((float*)pointer->second));
     216                return (*static_cast<float*>(pointer->second));
    217217            else
    218                 return static_cast<float>(*((int*)pointer->second));
     218                return static_cast<float>(*static_cast<int*>(pointer->second));
    219219        }
    220220        else
     
    309309                        {
    310310                            void* temp = (definition_iterator->second.isFloat())
    311                                             ? (void*)parameter_pointer->getFloatPointer(definition_iterator->second.physicalIndex)
    312                                             : (void*)parameter_pointer->getIntPointer(definition_iterator->second.physicalIndex);
     311                                            ? static_cast<void*>(parameter_pointer->getFloatPointer(definition_iterator->second.physicalIndex))
     312                                            : static_cast<void*>(parameter_pointer->getIntPointer(definition_iterator->second.physicalIndex));
    313313                            ParameterPointer parameter_pointer = ParameterPointer(definition_iterator->second.isFloat(), temp);
    314314
  • code/trunk/src/orxonox/tools/Timer.cc

    r3196 r3301  
    136136        {
    137137            // If active: Decrease the timer by the duration of the last frame
    138             this->time_ -= (long long)(time.getDeltaTimeMicroseconds() * this->getTimeFactor());
     138            this->time_ -= static_cast<long long>(time.getDeltaTimeMicroseconds() * this->getTimeFactor());
    139139
    140140            if (this->time_ <= 0)
  • code/trunk/src/orxonox/tools/Timer.h

    r3300 r3301  
    103103            /** @brief Gives the Timer some extra time. @param time The amount of extra time in seconds */
    104104            inline void addTime(float time)
    105                 { if (time > 0.0f) this->time_ += (long long)(time * 1000000.0f); }
     105                { if (time > 0.0f) this->time_ += static_cast<long long>(time * 1000000.0f); }
    106106            /** @brief Decreases the remaining time of the Timer. @param time The amount of time to remove */
    107107            inline void removeTime(float time)
    108                 { if (time > 0.0f) this->time_ -= (long long)(time * 1000000.0f); }
     108                { if (time > 0.0f) this->time_ -= static_cast<long long>(time * 1000000.0f); }
    109109            /** @brief Sets the interval of the Timer. @param interval The interval */
    110110            inline void setInterval(float interval)
    111                 { this->interval_ = (long long)(interval * 1000000.0f); }
     111                { this->interval_ = static_cast<long long>(interval * 1000000.0f); }
    112112            /** @brief Sets bLoop to a given value. @param bLoop True = loop */
    113113            inline void setLoop(bool bLoop)
  • code/trunk/src/util/Clipboard.cc

    r3214 r3301  
    6666                EmptyClipboard();
    6767                HGLOBAL clipbuffer = GlobalAlloc(GMEM_DDESHARE, text.size() + 1);
    68                 char* buffer = (char*)GlobalLock(clipbuffer);
     68                char* buffer = static_cast<char*>(GlobalLock(clipbuffer));
    6969                strcpy(buffer, text.c_str());
    7070                GlobalUnlock(clipbuffer);
     
    9494            {
    9595                HANDLE hData = GetClipboardData(CF_TEXT);
    96                 std::string output = (char*)GlobalLock(hData);
     96                std::string output = static_cast<char*>(GlobalLock(hData));
    9797                GlobalUnlock(hData);
    9898                CloseClipboard();
  • code/trunk/src/util/MultiType.h

    r3280 r3301  
    303303            inline bool                                   setValue(const char* value);
    304304            /** @brief Assigns a pointer. */
    305             template <typename V> inline bool             setValue(V* value)               { if (this->value_) { return this->value_->setValue((void*)value); } else { return this->assignValue((void*)value); } }
     305            template <typename V> inline bool             setValue(V* value)               { if (this->value_) { return this->value_->setValue(static_cast<void*>(const_cast<typename TypeStripper<V>::RawType*>(value))); } else { return this->assignValue(static_cast<void*>(const_cast<typename TypeStripper<V>::RawType*>(value))); } }
    306306            /** @brief Assigns the value of the other MultiType and converts it to the current type. */
    307307            bool                                          setValue(const MultiType& other) { if (this->value_) { return this->value_->assimilate(other); } else { if (other.value_) { this->value_ = other.value_->clone(); } return true; } }
     
    335335           
    336336            /** @brief Saves the value of the MT to a bytestream (pointed at by mem) and increases mem pointer by size of MT */
    337             inline void                       exportData(uint8_t*& mem) const { assert(sizeof(MT_Type::Value)<=8); *(uint8_t*)(mem) = this->getType(); mem+=sizeof(uint8_t); this->value_->exportData(mem); }
     337            inline void                       exportData(uint8_t*& mem) const { assert(sizeof(MT_Type::Value)<=8); *static_cast<uint8_t*>(mem) = this->getType(); mem+=sizeof(uint8_t); this->value_->exportData(mem); }
    338338            /** @brief Loads the value of the MT from a bytestream (pointed at by mem) and increases mem pointer by size of MT */
    339             inline void                       importData(uint8_t*& mem) { assert(sizeof(MT_Type::Value)<=8); this->setType(static_cast<MT_Type::Value>(*(uint8_t*)mem)); mem+=sizeof(uint8_t); this->value_->importData(mem); }
     339            inline void                       importData(uint8_t*& mem) { assert(sizeof(MT_Type::Value)<=8); this->setType(static_cast<MT_Type::Value>(*static_cast<uint8_t*>(mem))); mem+=sizeof(uint8_t); this->value_->importData(mem); }
    340340            /** @brief Saves the value of the MT to a bytestream and increases pointer to bytestream by size of MT */
    341341            inline uint8_t*&                  operator << (uint8_t*& mem) { importData(mem); return mem; }
     
    371371            operator orxonox::Degree()       const;
    372372            /** @brief Returns the current value, converted to a T* pointer. */
    373             template <class T> operator T*() const { return ((T*)this->operator void*()); }
     373            template <class T> operator T*() const { return (static_cast<T*>(this->operator void*())); }
    374374
    375375            inline bool getValue(char*                 value) const { if (this->value_) { return this->value_->getValue(value); } return false; } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */
     
    420420            inline orxonox::Radian          getRadian()           const { return this->operator orxonox::Radian();      } /** @brief Returns the current value, converted to the requested type. */
    421421            inline orxonox::Degree          getDegree()           const { return this->operator orxonox::Degree();      } /** @brief Returns the current value, converted to the requested type. */
    422             template <typename T> inline T* getPointer()          const { return ((T*)this->getVoid());                 } /** @brief Returns the current value, converted to a T* pointer. */
     422            template <typename T> inline T* getPointer()          const { return static_cast<T*>(this->getVoid());      } /** @brief Returns the current value, converted to a T* pointer. */
    423423
    424424        private:
  • code/trunk/src/util/OutputHandler.cc

    r2710 r3301  
    9797    void OutputHandler::setSoftDebugLevel(OutputHandler::OutputDevice device, int level)
    9898    {
    99         OutputHandler::getOutStream().softDebugLevel_[(unsigned int)device] = level;
     99        OutputHandler::getOutStream().softDebugLevel_[static_cast<unsigned int>(device)] = level;
    100100    }
    101101
     
    107107    int OutputHandler::getSoftDebugLevel(OutputHandler::OutputDevice device)
    108108    {
    109         return OutputHandler::getOutStream().softDebugLevel_[(unsigned int)device];
     109        return OutputHandler::getOutStream().softDebugLevel_[static_cast<unsigned int>(device)];
    110110    }
    111111
  • code/trunk/src/util/SignalHandler.cc

    r3198 r3301  
    203203        dup2( gdbErr[1], STDERR_FILENO );
    204204
    205         execlp( "sh", "sh", "-c", "gdb", (void*)NULL);
     205        execlp( "sh", "sh", "-c", "gdb", static_cast<void*>(NULL));
    206206      }
    207207
  • code/trunk/src/util/StringUtils.cc

    r3300 r3301  
    125125
    126126        size_t quotecount = 0;
    127         size_t quote = (size_t)-1;
     127        size_t quote = static_cast<size_t>(-1);
    128128        while ((quote = getNextQuote(str, quote + 1)) < pos)
    129129        {
Note: See TracChangeset for help on using the changeset viewer.