[Orxonox-commit 774] r3301 - in trunk/src: core core/input network network/packet network/synchronisable orxonox/gamestates orxonox/objects orxonox/objects/collisionshapes orxonox/objects/controllers orxonox/objects/gametypes orxonox/objects/weaponsystem orxonox/objects/worldentities orxonox/overlays orxonox/overlays/console orxonox/overlays/hud orxonox/overlays/notifications orxonox/tools util
rgrieder at orxonox.net
rgrieder at orxonox.net
Sat Jul 18 16:04:00 CEST 2009
Author: rgrieder
Date: 2009-07-18 16:03:59 +0200 (Sat, 18 Jul 2009)
New Revision: 3301
Modified:
trunk/src/core/ConfigFileManager.cc
trunk/src/core/ConfigValueContainer.h
trunk/src/core/Executor.cc
trunk/src/core/Executor.h
trunk/src/core/IRC.cc
trunk/src/core/LuaBind.cc
trunk/src/core/Shell.cc
trunk/src/core/Super.h
trunk/src/core/TclThreadManager.cc
trunk/src/core/XMLPort.h
trunk/src/core/input/InputBuffer.cc
trunk/src/core/input/InputManager.cc
trunk/src/core/input/KeyBinder.cc
trunk/src/network/ClientInformation.cc
trunk/src/network/GamestateClient.h
trunk/src/network/GamestateManager.cc
trunk/src/network/NetworkPrereqs.h
trunk/src/network/TrafficControl.cc
trunk/src/network/packet/Chat.cc
trunk/src/network/packet/Packet.cc
trunk/src/network/synchronisable/Synchronisable.h
trunk/src/network/synchronisable/SynchronisableVariable.h
trunk/src/orxonox/gamestates/GSDedicated.cc
trunk/src/orxonox/objects/Scene.cc
trunk/src/orxonox/objects/collisionshapes/CollisionShape.h
trunk/src/orxonox/objects/controllers/WaypointPatrolController.cc
trunk/src/orxonox/objects/gametypes/TeamDeathmatch.cc
trunk/src/orxonox/objects/gametypes/UnderAttack.cc
trunk/src/orxonox/objects/weaponsystem/Munition.cc
trunk/src/orxonox/objects/weaponsystem/WeaponSystem.h
trunk/src/orxonox/objects/worldentities/ParticleEmitter.h
trunk/src/orxonox/objects/worldentities/WorldEntity.h
trunk/src/orxonox/overlays/GUIOverlay.cc
trunk/src/orxonox/overlays/OrxonoxOverlay.cc
trunk/src/orxonox/overlays/console/InGameConsole.cc
trunk/src/orxonox/overlays/hud/HUDNavigation.cc
trunk/src/orxonox/overlays/notifications/NotificationOverlay.cc
trunk/src/orxonox/overlays/notifications/NotificationQueue.cc
trunk/src/orxonox/tools/ParticleInterface.cc
trunk/src/orxonox/tools/Shader.cc
trunk/src/orxonox/tools/Timer.cc
trunk/src/orxonox/tools/Timer.h
trunk/src/util/Clipboard.cc
trunk/src/util/MultiType.h
trunk/src/util/OutputHandler.cc
trunk/src/util/SignalHandler.cc
trunk/src/util/StringUtils.cc
Log:
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.
Modified: trunk/src/core/ConfigFileManager.cc
===================================================================
--- trunk/src/core/ConfigFileManager.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/core/ConfigFileManager.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -571,7 +571,7 @@
return it->second;
else
{
- COUT(1) << "ConfigFileManager: Can't find a config file for type with ID " << (int)type << std::endl;
+ COUT(1) << "ConfigFileManager: Can't find a config file for type with ID " << static_cast<int>(type) << std::endl;
COUT(1) << "Using " << DEFAULT_CONFIG_FILE << " file." << std::endl;
this->setFilename(type, DEFAULT_CONFIG_FILE);
return getFile(type);
Modified: trunk/src/core/ConfigValueContainer.h
===================================================================
--- trunk/src/core/ConfigValueContainer.h 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/core/ConfigValueContainer.h 2009-07-18 14:03:59 UTC (rev 3301)
@@ -68,7 +68,10 @@
inline ConfigValueCallback(void (T::*function) (void)) : function_(function) {}
inline virtual ~ConfigValueCallback() {}
inline virtual void call(void* object)
- { if (!Identifier::isCreatingHierarchy()) { (((T*)object)->*this->function_)(); } }
+ {
+ if (!Identifier::isCreatingHierarchy())
+ (static_cast<T*>(object)->*this->function_)();
+ }
private:
void (T::*function_) (void);
Modified: trunk/src/core/Executor.cc
===================================================================
--- trunk/src/core/Executor.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/core/Executor.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -98,15 +98,15 @@
return false;
// assign all given arguments to the multitypes
- for (unsigned int i = 0; i < std::min(tokens.size(), (unsigned int)MAX_FUNCTOR_ARGUMENTS); i++)
+ for (unsigned int i = 0; i < std::min(tokens.size(), MAX_FUNCTOR_ARGUMENTS); i++)
param[i] = tokens[i];
// fill the remaining multitypes with default values
- for (unsigned int i = tokens.size(); i < std::min(paramCount, (unsigned int)MAX_FUNCTOR_ARGUMENTS); i++)
+ for (unsigned int i = tokens.size(); i < std::min(paramCount, MAX_FUNCTOR_ARGUMENTS); i++)
param[i] = this->defaultValue_[i];
// evaluate the param types through the functor
- for (unsigned int i = 0; i < std::min(paramCount, (unsigned int)MAX_FUNCTOR_ARGUMENTS); i++)
+ for (unsigned int i = 0; i < std::min(paramCount, MAX_FUNCTOR_ARGUMENTS); i++)
this->functor_->evaluateParam(i, param[i]);
return true;
Modified: trunk/src/core/Executor.h
===================================================================
--- trunk/src/core/Executor.h 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/core/Executor.h 2009-07-18 14:03:59 UTC (rev 3301)
@@ -103,7 +103,7 @@
} \
COUT(5) << tokens[i]; \
} \
- COUT(5) << ") and " << std::max((int)paramCount - (int)tokens.size(), 0) << " default values ("; \
+ COUT(5) << ") and " << std::max(static_cast<int>(paramCount) - static_cast<int>(tokens.size()), 0) << " default values ("; \
for (unsigned int i = tokens.size(); i < paramCount; i++) \
{ \
param[i] = this->defaultValue_[i]; \
Modified: trunk/src/core/IRC.cc
===================================================================
--- trunk/src/core/IRC.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/core/IRC.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -51,7 +51,7 @@
void IRC::initialize()
{
- unsigned int threadID = (unsigned int)IRC_TCL_THREADID;
+ unsigned int threadID = IRC_TCL_THREADID;
TclThreadManager::createID(threadID);
this->bundle_ = TclThreadManager::getInstance().getInterpreterBundle(threadID);
Modified: trunk/src/core/LuaBind.cc
===================================================================
--- trunk/src/core/LuaBind.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/core/LuaBind.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -123,7 +123,7 @@
#if LUA_VERSION_NUM != 501
const char * LuaBind::lua_Chunkreader(lua_State *L, void *data, size_t *size)
{
- LoadS* ls = ((LoadS*)data);
+ LoadS* ls = static_cast<LoadS*>(data);
if (ls->size == 0) return NULL;
*size = ls->size;
ls->size = 0;
Modified: trunk/src/core/Shell.cc
===================================================================
--- trunk/src/core/Shell.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/core/Shell.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -227,7 +227,7 @@
std::string Shell::getFromHistory() const
{
- unsigned int index = mod(((int)this->historyOffset_) - ((int)this->historyPosition_), this->maxHistoryLength_);
+ unsigned int index = mod(static_cast<int>(this->historyOffset_) - static_cast<int>(this->historyPosition_), this->maxHistoryLength_);
if (index < this->commandHistory_.size() && this->historyPosition_ != 0)
return this->commandHistory_[index];
else
@@ -248,7 +248,7 @@
if (this->finishedLastLine_)
{
if (this->bAddOutputLevel_)
- output.insert(0, 1, (char)OutputHandler::getOutStream().getOutputLevel());
+ output.insert(0, 1, static_cast<char>(OutputHandler::getOutStream().getOutputLevel()));
this->lines_.insert(this->lines_.begin(), output);
Modified: trunk/src/core/Super.h
===================================================================
--- trunk/src/core/Super.h 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/core/Super.h 2009-07-18 14:03:59 UTC (rev 3301)
@@ -90,7 +90,7 @@
{ \
static void check() \
{ \
- SuperFunctionCondition<functionnumber, T, 0, templatehack2>::apply((T*)0); \
+ SuperFunctionCondition<functionnumber, T, 0, templatehack2>::apply(static_cast<T*>(0)); \
SuperFunctionCondition<functionnumber + 1, T, 0, templatehack2>::check(); \
} \
\
@@ -148,7 +148,7 @@
{
// This call to the apply-function is the whole check. By calling the function with
// a T* pointer, the right function get's called.
- SuperFunctionCondition<functionnumber, T, 0, templatehack2>::apply((T*)0);
+ SuperFunctionCondition<functionnumber, T, 0, templatehack2>::apply(static_cast<T*>(0));
// Go go the check for of next super-function (functionnumber + 1)
SuperFunctionCondition<functionnumber + 1, T, 0, templatehack2>::check();
Modified: trunk/src/core/TclThreadManager.cc
===================================================================
--- trunk/src/core/TclThreadManager.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/core/TclThreadManager.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -277,17 +277,17 @@
std::string TclThreadManager::tcl_query(int querierID, Tcl::object const &args)
{
- return TclThreadManager::getInstance().evalQuery((unsigned int)querierID, stripEnclosingBraces(args.get()));
+ return TclThreadManager::getInstance().evalQuery(static_cast<unsigned int>(querierID), stripEnclosingBraces(args.get()));
}
std::string TclThreadManager::tcl_crossquery(int querierID, int threadID, Tcl::object const &args)
{
- return TclThreadManager::getInstance().evalQuery((unsigned int)querierID, (unsigned int)threadID, stripEnclosingBraces(args.get()));
+ return TclThreadManager::getInstance().evalQuery(static_cast<unsigned int>(querierID), static_cast<unsigned int>(threadID), stripEnclosingBraces(args.get()));
}
bool TclThreadManager::tcl_running(int threadID)
{
- TclInterpreterBundle* bundle = TclThreadManager::getInstance().getInterpreterBundle((unsigned int)threadID);
+ TclInterpreterBundle* bundle = TclThreadManager::getInstance().getInterpreterBundle(static_cast<unsigned int>(threadID));
if (bundle)
{
boost::mutex::scoped_lock running_lock(bundle->runningMutex_);
@@ -555,7 +555,7 @@
bool successfullyLocked = false;
try
{
- if (querierID == 0 || std::find(querier->queriers_.begin(), querier->queriers_.end(), (unsigned int)0) != querier->queriers_.end())
+ if (querierID == 0 || std::find(querier->queriers_.begin(), querier->queriers_.end(), 0U) != querier->queriers_.end())
successfullyLocked = interpreter_lock.try_lock();
else
{
@@ -630,7 +630,7 @@
#else
boost::try_mutex::scoped_lock interpreter_lock(this->orxonoxInterpreterBundle_.interpreterMutex_);
#endif
- unsigned long maxtime = (unsigned long)(time.getDeltaTime() * 1000000 * TCLTHREADMANAGER_MAX_CPU_USAGE);
+ unsigned long maxtime = static_cast<unsigned long>(time.getDeltaTime() * 1000000 * TCLTHREADMANAGER_MAX_CPU_USAGE);
Ogre::Timer timer;
while (!this->queueIsEmpty())
{
Modified: trunk/src/core/XMLPort.h
===================================================================
--- trunk/src/core/XMLPort.h 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/core/XMLPort.h 2009-07-18 14:03:59 UTC (rev 3301)
@@ -92,7 +92,7 @@
The macro will then store "value" in the variable or read it when saving.
*/
#define XMLPortParamVariable(classname, paramname, variable, xmlelement, mode) \
- XMLPortVariableHelperClass xmlcontainer##variable##dummy((void*)&variable); \
+ XMLPortVariableHelperClass xmlcontainer##variable##dummy(static_cast<void*>(&variable)); \
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")); \
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" )); \
XMLPortParamGeneric(xmlcontainer##variable, classname, orxonox::XMLPortVariableHelperClass, &xmlcontainer##variable##dummy, paramname, xmlcontainer##variable##loadexecutor, xmlcontainer##variable##saveexecutor, xmlelement, mode)
@@ -560,7 +560,7 @@
{
COUT(4) << object->getLoaderIndentation() << "fabricating " << child->Value() << "..." << std::endl;
- BaseObject* newObject = identifier->fabricate((BaseObject*)object);
+ BaseObject* newObject = identifier->fabricate(static_cast<BaseObject*>(object));
assert(newObject);
newObject->setLoaderIndentation(object->getLoaderIndentation() + " ");
@@ -570,11 +570,11 @@
if (this->bLoadBefore_)
{
newObject->XMLPort(*child, XMLPort::LoadObject);
- COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (objectname " << newObject->getName() << ") to " << this->identifier_->getName() << " (objectname " << ((BaseObject*)object)->getName() << ")" << std::endl;
+ COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (objectname " << newObject->getName() << ") to " << this->identifier_->getName() << " (objectname " << static_cast<BaseObject*>(object)->getName() << ")" << std::endl;
}
else
{
- COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (object not yet loaded) to " << this->identifier_->getName() << " (objectname " << ((BaseObject*)object)->getName() << ")" << std::endl;
+ COUT(4) << object->getLoaderIndentation() << "assigning " << child->Value() << " (object not yet loaded) to " << this->identifier_->getName() << " (objectname " << static_cast<BaseObject*>(object)->getName() << ")" << std::endl;
}
COUT(5) << object->getLoaderIndentation();
@@ -670,11 +670,11 @@
template <class T>
void load(const T& value)
- { *((T*)this->variable_) = value; }
+ { *static_cast<T*>(this->variable_) = value; }
template <class T>
const T& save()
- { return *((T*)this->variable_); }
+ { return *static_cast<T*>(this->variable_); }
template <class T>
static void (XMLPortVariableHelperClass::*getLoader(const T& var))(const T& value)
Modified: trunk/src/core/input/InputBuffer.cc
===================================================================
--- trunk/src/core/input/InputBuffer.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/core/input/InputBuffer.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -217,7 +217,7 @@
}
}
- this->insert((char)evt.text);
+ this->insert(static_cast<char>(evt.text));
}
/**
Modified: trunk/src/core/input/InputManager.cc
===================================================================
--- trunk/src/core/input/InputManager.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/core/input/InputManager.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -174,7 +174,7 @@
std::ostringstream windowHndStr;
// Fill parameter list
- windowHndStr << (unsigned int)windowHnd_;
+ windowHndStr << static_cast<unsigned int>(windowHnd);
paramList.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
#if defined(ORXONOX_PLATFORM_WINDOWS)
//paramList.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_NONEXCLUSIVE")));
Modified: trunk/src/core/input/KeyBinder.cc
===================================================================
--- trunk/src/core/input/KeyBinder.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/core/input/KeyBinder.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -443,13 +443,13 @@
if (mousePosition_[i] < 0)
{
- mouseAxes_[2*i + 0].absVal_ = -mousePosition_[i]/(float)mouseClippingSize_ * mouseSensitivity_;
- mouseAxes_[2*i + 1].absVal_ = 0.0f;
+ mouseAxes_[2*i + 0].absVal_ = -mouseSensitivity_ * mousePosition_[i] / mouseClippingSize_;
+ mouseAxes_[2*i + 1].absVal_ = 0.0f;
}
else
{
- mouseAxes_[2*i + 0].absVal_ = 0.0f;
- mouseAxes_[2*i + 1].absVal_ = mousePosition_[i]/(float)mouseClippingSize_ * mouseSensitivity_;
+ mouseAxes_[2*i + 0].absVal_ = 0.0f;
+ mouseAxes_[2*i + 1].absVal_ = mouseSensitivity_ * mousePosition_[i] / mouseClippingSize_;
}
}
}
@@ -459,9 +459,9 @@
for (int i = 0; i < 2; i++)
{
if (rel[i] < 0)
- mouseAxes_[0 + 2*i].relVal_ = -((float)rel[i])/(float)mouseClippingSize_ * mouseSensitivity_;
+ mouseAxes_[0 + 2*i].relVal_ = -mouseSensitivity_ * rel[i] / mouseClippingSize_;
else
- mouseAxes_[1 + 2*i].relVal_ = ((float)rel[i])/(float)mouseClippingSize_ * mouseSensitivity_;
+ mouseAxes_[1 + 2*i].relVal_ = mouseSensitivity_ * rel[i] / mouseClippingSize_;
}
}
@@ -473,10 +473,10 @@
{
if (rel < 0)
for (int i = 0; i < -rel/mouseWheelStepSize_; i++)
- mouseButtons_[8].execute(KeybindMode::OnPress, ((float)abs)/mouseWheelStepSize_);
+ mouseButtons_[8].execute(KeybindMode::OnPress, static_cast<float>(abs)/mouseWheelStepSize_);
else
for (int i = 0; i < rel/mouseWheelStepSize_; i++)
- mouseButtons_[9].execute(KeybindMode::OnPress, ((float)abs)/mouseWheelStepSize_);
+ mouseButtons_[9].execute(KeybindMode::OnPress, static_cast<float>(abs)/mouseWheelStepSize_);
}
void KeyBinder::joyStickAxisMoved(unsigned int joyStickID, unsigned int axis, float value)
Modified: trunk/src/network/ClientInformation.cc
===================================================================
--- trunk/src/network/ClientInformation.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/network/ClientInformation.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -165,21 +165,21 @@
}
double ClientInformation::getPacketLoss(){
- return ((double)this->peer_->packetLoss)/ENET_PEER_PACKET_LOSS_SCALE;
+ return static_cast<double>(this->peer_->packetLoss)/ENET_PEER_PACKET_LOSS_SCALE;
}
unsigned int ClientInformation::getGamestateID() {
if(this)
return gamestateID_;
else
- return (unsigned int)-1;
+ return static_cast<unsigned int>(-1);
}
unsigned int ClientInformation::getPartialGamestateID() {
if(this)
return partialGamestateID_;
else
- return (unsigned int)-1;
+ return static_cast<unsigned int>(-1);
}
ClientInformation *ClientInformation::insertBack(ClientInformation *ins) {
@@ -196,7 +196,7 @@
}
bool ClientInformation::removeClient(unsigned int clientID) {
- if((unsigned int)clientID==CLIENTID_UNKNOWN)
+ if(clientID==CLIENTID_UNKNOWN)
return false;
ClientInformation *temp = head_;
while(temp!=0 && temp->getID()!=clientID)
Modified: trunk/src/network/GamestateClient.h
===================================================================
--- trunk/src/network/GamestateClient.h 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/network/GamestateClient.h 2009-07-18 14:03:59 UTC (rev 3301)
@@ -46,7 +46,7 @@
#include "core/CorePrereqs.h"
#include "GamestateHandler.h"
-const unsigned int GAMESTATEID_INITIAL = (unsigned int)-1;
+const unsigned int GAMESTATEID_INITIAL = static_cast<unsigned int>(-1);
namespace orxonox
{
Modified: trunk/src/network/GamestateManager.cc
===================================================================
--- trunk/src/network/GamestateManager.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/network/GamestateManager.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -173,7 +173,7 @@
return true;
}
- assert(curid==(unsigned int)GAMESTATEID_INITIAL || curid<gamestateID);
+ assert(curid==GAMESTATEID_INITIAL || curid<gamestateID);
COUT(4) << "acking gamestate " << gamestateID << " for clientid: " << clientID << " curid: " << curid << std::endl;
std::map<unsigned int, packet::Gamestate*>::iterator it;
for(it = gamestateMap_[clientID].begin(); it!=gamestateMap_[clientID].end() && it->first<gamestateID; ){
Modified: trunk/src/network/NetworkPrereqs.h
===================================================================
--- trunk/src/network/NetworkPrereqs.h 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/network/NetworkPrereqs.h 2009-07-18 14:03:59 UTC (rev 3301)
@@ -60,9 +60,9 @@
//-----------------------------------------------------------------------
namespace orxonox
{
- static const unsigned int GAMESTATEID_INITIAL = (unsigned int)-1;
- static const unsigned int CLIENTID_UNKNOWN = (unsigned int)-2;
- static const uint32_t OBJECTID_UNKNOWN = (uint32_t)(-1);
+ static const unsigned int GAMESTATEID_INITIAL = static_cast<unsigned int>(-1);
+ static const unsigned int CLIENTID_UNKNOWN = static_cast<unsigned int>(-2);
+ static const uint32_t OBJECTID_UNKNOWN = static_cast<uint32_t>(-1);
}
//-----------------------------------------------------------------------
Modified: trunk/src/network/TrafficControl.cc
===================================================================
--- trunk/src/network/TrafficControl.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/network/TrafficControl.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -37,7 +37,7 @@
namespace orxonox {
- static const unsigned int SCHED_PRIORITY_OFFSET = (unsigned int)-1;
+ static const unsigned int SCHED_PRIORITY_OFFSET = static_cast<unsigned int>(-1);
objInfo::objInfo(uint32_t ID, uint32_t creatorID, int32_t curGsID, int32_t diffGsID, uint32_t size, unsigned int prioperm, unsigned int priosched)
{
Modified: trunk/src/network/packet/Chat.cc
===================================================================
--- trunk/src/network/packet/Chat.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/network/packet/Chat.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -50,7 +50,7 @@
*(Type::Value *)(data_ + _PACKETID ) = Type::Chat;
*(unsigned int *)(data_ + _PLAYERID ) = playerID;
*(unsigned int *)(data_ + _MESSAGELENGTH ) = messageLength_;
- memcpy( data_+_MESSAGE, (void *)message.c_str(), messageLength_ );
+ memcpy( data_+_MESSAGE, static_cast<void*>(const_cast<char*>(message.c_str())), messageLength_ );
}
Chat::Chat( uint8_t* data, unsigned int clientID )
Modified: trunk/src/network/packet/Packet.cc
===================================================================
--- trunk/src/network/packet/Packet.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/network/packet/Packet.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -142,7 +142,7 @@
{
// Assures we don't create a packet and destroy it right after in another thread
// without having a reference in the packetMap_
- packetMap_[(size_t)(void*)enetPacket_] = this;
+ packetMap_[reinterpret_cast<size_t>(enetPacket_)] = this;
}
}
#ifndef NDEBUG
@@ -171,7 +171,7 @@
Packet *Packet::createPacket(ENetPacket *packet, ENetPeer *peer){
uint8_t *data = packet->data;
- assert(ClientInformation::findClient(&peer->address)->getID() != (unsigned int)-2 || !Host::isServer());
+ assert(ClientInformation::findClient(&peer->address)->getID() != static_cast<unsigned int>(-2) || !Host::isServer());
unsigned int clientID = ClientInformation::findClient(&peer->address)->getID();
Packet *p = 0;
COUT(6) << "packet type: " << *(Type::Value *)&data[_PACKETID] << std::endl;
@@ -229,7 +229,7 @@
*/
void Packet::deletePacket(ENetPacket *enetPacket){
// Get our Packet from a gloabal map with all Packets created in the send() method of Packet.
- std::map<size_t, Packet*>::iterator it = packetMap_.find((size_t)enetPacket);
+ std::map<size_t, Packet*>::iterator it = packetMap_.find(reinterpret_cast<size_t>(enetPacket));
assert(it != packetMap_.end());
// Make sure we don't delete it again in the destructor
it->second->enetPacket_ = 0;
Modified: trunk/src/network/synchronisable/Synchronisable.h
===================================================================
--- trunk/src/network/synchronisable/Synchronisable.h 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/network/synchronisable/Synchronisable.h 2009-07-18 14:03:59 UTC (rev 3301)
@@ -43,7 +43,7 @@
#include "NetworkCallback.h"
/*#define REGISTERDATA(varname, ...) \
- registerVariable((void*)&varname, sizeof(varname), DATA, __VA_ARGS__)
+ registerVariable(static_cast<void*>(&varname), sizeof(varname), DATA, __VA_ARGS__)
#define REGISTERSTRING(stringname, ...) \
registerVariable(&stringname, stringname.length()+1, STRING, __VA_ARGS__)*/
Modified: trunk/src/network/synchronisable/SynchronisableVariable.h
===================================================================
--- trunk/src/network/synchronisable/SynchronisableVariable.h 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/network/synchronisable/SynchronisableVariable.h 2009-07-18 14:03:59 UTC (rev 3301)
@@ -35,6 +35,7 @@
#include <cassert>
#include <cstring>
#include "util/Serialise.h"
+#include "util/TemplateUtils.h"
#include "core/GameMode.h"
#include "network/synchronisable/NetworkCallbackManager.h"
@@ -77,7 +78,7 @@
virtual inline uint32_t getData(uint8_t*& mem, uint8_t mode);
virtual inline void putData(uint8_t*& mem, uint8_t mode, bool forceCallback = false);
virtual inline uint32_t getSize(uint8_t mode);
- virtual inline void* getReference(){ return (void *)&this->variable_; }
+ virtual inline void* getReference(){ return static_cast<void*>(const_cast<typename TypeStripper<T>::RawType*>(&this->variable_)); }
protected:
T& variable_;
@@ -177,7 +178,7 @@
if( this->varBuffer_ != this->variable_ )
{
this->varReference_++;
- memcpy((void*)&this->varBuffer_, &this->variable_, sizeof(this->variable_));
+ memcpy(static_cast<void*>(const_cast<typename TypeStripper<T>::RawType*>(&this->varBuffer_)), &this->variable_, sizeof(this->variable_));
}
}
// write the reference number to the stream
@@ -210,7 +211,7 @@
else
{
mem += sizeof(varReference_);
- memcpy((void*)&this->varBuffer_, &this->variable_, sizeof(T));
+ memcpy(static_cast<void*>(const_cast<typename TypeStripper<T>::RawType*>(&this->varBuffer_)), &this->variable_, sizeof(T));
if ( this->callback_ != 0 )
callback = true;
}
Modified: trunk/src/orxonox/gamestates/GSDedicated.cc
===================================================================
--- trunk/src/orxonox/gamestates/GSDedicated.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/orxonox/gamestates/GSDedicated.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -192,7 +192,7 @@
{
// boost::recursive_mutex::scoped_lock(this->inputLineMutex_);
std::cout << endl << CommandExecutor::hint( std::string((const char*)this->commandLine_,inputIterator_) ) << endl;
- strncpy((char*)this->commandLine_, CommandExecutor::complete( std::string((const char*)this->commandLine_,inputIterator_) ).c_str(), MAX_COMMAND_LENGTH);
+ strncpy(reinterpret_cast<char*>(this->commandLine_), CommandExecutor::complete( std::string(reinterpret_cast<char*>(this->commandLine_),inputIterator_) ).c_str(), MAX_COMMAND_LENGTH);
inputIterator_ = strlen((const char*)this->commandLine_);
break;
}
@@ -274,7 +274,7 @@
void GSDedicated::insertCharacter( unsigned int position, char c )
{
-// std::cout << endl << (unsigned int)c << endl;
+// std::cout << endl << static_cast<unsigned int>(c) << endl;
// check that we do not exceed MAX_COMMAND_LENGTH
if( inputIterator_+1 < MAX_COMMAND_LENGTH )
{
Modified: trunk/src/orxonox/objects/Scene.cc
===================================================================
--- trunk/src/orxonox/objects/Scene.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/orxonox/objects/Scene.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -324,9 +324,9 @@
int index0, const btCollisionObject* colObj1, int partId1, int index1)
{
// get the WorldEntity pointers
- WorldEntity* object0 = (WorldEntity*)colObj0->getUserPointer();
+ WorldEntity* object0 = static_cast<WorldEntity*>(colObj0->getUserPointer());
assert(dynamic_cast<WorldEntity*>(object0));
- WorldEntity* object1 = (WorldEntity*)colObj1->getUserPointer();
+ WorldEntity* object1 = static_cast<WorldEntity*>(colObj1->getUserPointer());
assert(dynamic_cast<WorldEntity*>(object1));
// false means that bullet will assume we didn't modify the contact
Modified: trunk/src/orxonox/objects/collisionshapes/CollisionShape.h
===================================================================
--- trunk/src/orxonox/objects/collisionshapes/CollisionShape.h 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/orxonox/objects/collisionshapes/CollisionShape.h 2009-07-18 14:03:59 UTC (rev 3301)
@@ -62,7 +62,7 @@
virtual void setScale3D(const Vector3& scale);
virtual void setScale(float scale);
- inline const Vector3& getScale3D(void) const
+ inline const Vector3& getScale3D() const
{ return this->scale_; }
void updateShape();
Modified: trunk/src/orxonox/objects/controllers/WaypointPatrolController.cc
===================================================================
--- trunk/src/orxonox/objects/controllers/WaypointPatrolController.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/orxonox/objects/controllers/WaypointPatrolController.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -84,7 +84,7 @@
return;
Vector3 myposition = this->getControllableEntity()->getPosition();
- float shortestsqdistance = (unsigned int)-1;
+ float shortestsqdistance = static_cast<unsigned int>(-1);
for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
{
Modified: trunk/src/orxonox/objects/gametypes/TeamDeathmatch.cc
===================================================================
--- trunk/src/orxonox/objects/gametypes/TeamDeathmatch.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/orxonox/objects/gametypes/TeamDeathmatch.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -73,7 +73,7 @@
if (it->second < static_cast<int>(this->teams_) && it->second >= 0)
playersperteam[it->second]++;
- unsigned int minplayers = (unsigned int)-1;
+ unsigned int minplayers = static_cast<unsigned int>(-1);
size_t minplayersteam = 0;
for (size_t i = 0; i < this->teams_; ++i)
{
Modified: trunk/src/orxonox/objects/gametypes/UnderAttack.cc
===================================================================
--- trunk/src/orxonox/objects/gametypes/UnderAttack.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/orxonox/objects/gametypes/UnderAttack.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -50,7 +50,7 @@
this->setHUDTemplate("UnderAttackHUD");
this->setConfigValues();
- this->timesequence_ = static_cast<this->gameTime_);
+ this->timesequence_ = static_cast<int>(this->gameTime_);
}
void UnderAttack::setConfigValues()
Modified: trunk/src/orxonox/objects/weaponsystem/Munition.cc
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/Munition.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/orxonox/objects/weaponsystem/Munition.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -353,7 +353,7 @@
if (needed_magazines <= 0 && !this->bStackMunition_)
return false;
- if (amount <= (unsigned int)needed_magazines)
+ if (amount <= static_cast<unsigned int>(needed_magazines))
{
// We need more magazines than we get, so just add them
this->magazines_ += amount;
Modified: trunk/src/orxonox/objects/weaponsystem/WeaponSystem.h
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/WeaponSystem.h 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/orxonox/objects/weaponsystem/WeaponSystem.h 2009-07-18 14:03:59 UTC (rev 3301)
@@ -83,10 +83,10 @@
{ return (0x1 << firemode); }
static const unsigned int MAX_FIRE_MODES = 8;
- static const unsigned int FIRE_MODE_UNASSIGNED = (unsigned int)-1;
+ static const unsigned int FIRE_MODE_UNASSIGNED = static_cast<unsigned int>(-1);
static const unsigned int MAX_WEAPON_MODES = 8;
- static const unsigned int WEAPON_MODE_UNASSIGNED = (unsigned int)-1;
+ static const unsigned int WEAPON_MODE_UNASSIGNED = static_cast<unsigned int>(-1);
private:
std::map<unsigned int, WeaponSet *> weaponSets_;
Modified: trunk/src/orxonox/objects/worldentities/ParticleEmitter.h
===================================================================
--- trunk/src/orxonox/objects/worldentities/ParticleEmitter.h 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/orxonox/objects/worldentities/ParticleEmitter.h 2009-07-18 14:03:59 UTC (rev 3301)
@@ -65,7 +65,7 @@
inline void setLODxml(unsigned int level)
{ this->LOD_ = static_cast<LODParticle::Value>(level); this->LODchanged(); }
inline unsigned int getLODxml() const
- { return (unsigned int)this->LOD_; }
+ { return static_cast<unsigned int>(this->LOD_); }
void sourceChanged();
void LODchanged();
Modified: trunk/src/orxonox/objects/worldentities/WorldEntity.h
===================================================================
--- trunk/src/orxonox/objects/worldentities/WorldEntity.h 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/orxonox/objects/worldentities/WorldEntity.h 2009-07-18 14:03:59 UTC (rev 3301)
@@ -147,7 +147,7 @@
virtual void setScale3D(const Vector3& scale);
inline void setScale3D(float x, float y, float z)
{ this->setScale3D(Vector3(x, y, z)); }
- const Vector3& getScale3D(void) const;
+ const Vector3& getScale3D() const;
const Vector3& getWorldScale3D() const;
inline void setScale(float scale)
@@ -456,7 +456,7 @@
{ return this->node_->getPosition(); }
inline const Quaternion& WorldEntity::getOrientation() const
{ return this->node_->getOrientation(); }
- inline const Vector3& WorldEntity::getScale3D(void) const
+ inline const Vector3& WorldEntity::getScale3D() const
{ return this->node_->getScale(); }
#endif
Modified: trunk/src/orxonox/overlays/GUIOverlay.cc
===================================================================
--- trunk/src/orxonox/overlays/GUIOverlay.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/orxonox/overlays/GUIOverlay.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -66,7 +66,7 @@
{
std::string str;
std::stringstream out;
- out << static_cast<long>(this);
+ out << reinterpret_cast<long>(this);
str = out.str();
GUIManager::getInstance().executeCode("showCursor()");
InputManager::getInstance().requestEnterState("guiMouseOnly");
Modified: trunk/src/orxonox/overlays/OrxonoxOverlay.cc
===================================================================
--- trunk/src/orxonox/overlays/OrxonoxOverlay.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/orxonox/overlays/OrxonoxOverlay.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -81,7 +81,7 @@
// Get aspect ratio from the render window. Later on, we get informed automatically
Ogre::RenderWindow* defaultWindow = GraphicsManager::getInstance().getRenderWindow();
- this->windowAspectRatio_ = (float)defaultWindow->getWidth() / defaultWindow->getHeight();
+ this->windowAspectRatio_ = static_cast<float>(defaultWindow->getWidth()) / defaultWindow->getHeight();
this->sizeCorrectionChanged();
this->changedVisibility();
@@ -182,7 +182,7 @@
*/
void OrxonoxOverlay::windowResized(unsigned int newWidth, unsigned int newHeight)
{
- this->windowAspectRatio_ = newWidth/(float)newHeight;
+ this->windowAspectRatio_ = static_cast<float>(newWidth) / newHeight;
this->sizeCorrectionChanged();
}
@@ -214,7 +214,7 @@
float angle = this->angle_.valueDegrees();
if (angle < 0.0)
angle = -angle;
- angle -= 180.0f * static_caste<int>(angle / 180.0);
+ angle -= 180.0f * static_cast<int>(angle / 180.0);
// take the reverse if angle is about 90 degrees
float tempAspect;
Modified: trunk/src/orxonox/overlays/console/InGameConsole.cc
===================================================================
--- trunk/src/orxonox/overlays/console/InGameConsole.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/orxonox/overlays/console/InGameConsole.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -92,7 +92,7 @@
/**
@brief Destructor: Destroys the TextAreas.
*/
- InGameConsole::~InGameConsole(void)
+ InGameConsole::~InGameConsole()
{
this->deactivate();
Modified: trunk/src/orxonox/overlays/hud/HUDNavigation.cc
===================================================================
--- trunk/src/orxonox/overlays/hud/HUDNavigation.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/orxonox/overlays/hud/HUDNavigation.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -140,7 +140,7 @@
}
// set text
- int dist = (int) getDist2Focus();
+ int dist = static_cast<int>(getDist2Focus());
navText_->setCaption(multi_cast<std::string>(dist));
float textLength = multi_cast<std::string>(dist).size() * navText_->getCharHeight() * 0.3;
Modified: trunk/src/orxonox/overlays/notifications/NotificationOverlay.cc
===================================================================
--- trunk/src/orxonox/overlays/notifications/NotificationOverlay.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/orxonox/overlays/notifications/NotificationOverlay.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -128,7 +128,7 @@
*/
std::string NotificationOverlay::clipMessage(const std::string & message)
{
- if(message.length() <= (unsigned int)this->queue_->getNotificationLength()) //!< If the message is not too long.
+ if(message.length() <= static_cast<unsigned int>(this->queue_->getNotificationLength())) //!< If the message is not too long.
return message;
return message.substr(0, this->queue_->getNotificationLength());
}
Modified: trunk/src/orxonox/overlays/notifications/NotificationQueue.cc
===================================================================
--- trunk/src/orxonox/overlays/notifications/NotificationQueue.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/orxonox/overlays/notifications/NotificationQueue.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -397,7 +397,7 @@
std::string timeString = std::ctime(&time);
timeString.erase(timeString.length()-1);
std::ostringstream stream;
- stream << (unsigned long)notification;
+ stream << reinterpret_cast<unsigned long>(notification);
std::string addressString = stream.str() ;
container->name = "NotificationOverlay(" + timeString + ")&" + addressString;
Modified: trunk/src/orxonox/tools/ParticleInterface.cc
===================================================================
--- trunk/src/orxonox/tools/ParticleInterface.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/orxonox/tools/ParticleInterface.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -78,7 +78,7 @@
}
}
- this->setDetailLevel((unsigned int)detaillevel);
+ this->setDetailLevel(static_cast<unsigned int>(detaillevel));
}
ParticleInterface::~ParticleInterface()
@@ -184,7 +184,7 @@
void ParticleInterface::detailLevelChanged(unsigned int newlevel)
{
- if (newlevel >= (unsigned int)this->detaillevel_)
+ if (newlevel >= static_cast<unsigned int>(this->detaillevel_))
this->bAllowedByLOD_ = true;
else
this->bAllowedByLOD_ = false;
Modified: trunk/src/orxonox/tools/Shader.cc
===================================================================
--- trunk/src/orxonox/tools/Shader.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/orxonox/tools/Shader.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -164,17 +164,17 @@
{
if (pointer->first)
{
- if ((*((float*)pointer->second)) != value)
+ if ((*static_cast<float*>(pointer->second)) != value)
{
- (*((float*)pointer->second)) = value;
+ (*static_cast<float*>(pointer->second)) = value;
return true;
}
}
else
{
- if ((*((int*)pointer->second)) != (int)value)
+ if ((*static_cast<int*>(pointer->second)) != static_cast<int>(value))
{
- (*((int*)pointer->second)) = (int)value;
+ (*static_cast<int*>(pointer->second)) = static_cast<int>(value);
return true;
}
}
@@ -189,17 +189,17 @@
{
if (pointer->first)
{
- if ((*((float*)pointer->second)) != (float)value)
+ if ((*static_cast<float*>(pointer->second)) != static_cast<float>(value))
{
- (*((float*)pointer->second)) = (float)value;
+ (*static_cast<float*>(pointer->second)) = static_cast<float>(value);
return true;
}
}
else
{
- if ((*((int*)pointer->second)) != value)
+ if ((*static_cast<int*>(pointer->second)) != value)
{
- (*((int*)pointer->second)) = value;
+ (*static_cast<int*>(pointer->second)) = value;
return true;
}
}
@@ -213,9 +213,9 @@
if (pointer)
{
if (pointer->first)
- return (*((float*)pointer->second));
+ return (*static_cast<float*>(pointer->second));
else
- return static_cast<float>(*((int*)pointer->second));
+ return static_cast<float>(*static_cast<int*>(pointer->second));
}
else
return 0;
@@ -308,8 +308,8 @@
for (Ogre::GpuConstantDefinitionMap::const_iterator definition_iterator = constant_definitions.begin(); definition_iterator != constant_definitions.end(); ++definition_iterator)
{
void* temp = (definition_iterator->second.isFloat())
- ? (void*)parameter_pointer->getFloatPointer(definition_iterator->second.physicalIndex)
- : (void*)parameter_pointer->getIntPointer(definition_iterator->second.physicalIndex);
+ ? static_cast<void*>(parameter_pointer->getFloatPointer(definition_iterator->second.physicalIndex))
+ : static_cast<void*>(parameter_pointer->getIntPointer(definition_iterator->second.physicalIndex));
ParameterPointer parameter_pointer = ParameterPointer(definition_iterator->second.isFloat(), temp);
TechniqueVector& technique_vector = Shader::parameters_s[material];
Modified: trunk/src/orxonox/tools/Timer.cc
===================================================================
--- trunk/src/orxonox/tools/Timer.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/orxonox/tools/Timer.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -135,7 +135,7 @@
if (this->bActive_)
{
// If active: Decrease the timer by the duration of the last frame
- this->time_ -= (long long)(time.getDeltaTimeMicroseconds() * this->getTimeFactor());
+ this->time_ -= static_cast<long long>(time.getDeltaTimeMicroseconds() * this->getTimeFactor());
if (this->time_ <= 0)
{
Modified: trunk/src/orxonox/tools/Timer.h
===================================================================
--- trunk/src/orxonox/tools/Timer.h 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/orxonox/tools/Timer.h 2009-07-18 14:03:59 UTC (rev 3301)
@@ -102,13 +102,13 @@
{ return static_cast<float>(this->time_ / 1000000.0f); }
/** @brief Gives the Timer some extra time. @param time The amount of extra time in seconds */
inline void addTime(float time)
- { if (time > 0.0f) this->time_ += (long long)(time * 1000000.0f); }
+ { if (time > 0.0f) this->time_ += static_cast<long long>(time * 1000000.0f); }
/** @brief Decreases the remaining time of the Timer. @param time The amount of time to remove */
inline void removeTime(float time)
- { if (time > 0.0f) this->time_ -= (long long)(time * 1000000.0f); }
+ { if (time > 0.0f) this->time_ -= static_cast<long long>(time * 1000000.0f); }
/** @brief Sets the interval of the Timer. @param interval The interval */
inline void setInterval(float interval)
- { this->interval_ = (long long)(interval * 1000000.0f); }
+ { this->interval_ = static_cast<long long>(interval * 1000000.0f); }
/** @brief Sets bLoop to a given value. @param bLoop True = loop */
inline void setLoop(bool bLoop)
{ this->bLoop_ = bLoop; }
Modified: trunk/src/util/Clipboard.cc
===================================================================
--- trunk/src/util/Clipboard.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/util/Clipboard.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -65,7 +65,7 @@
{
EmptyClipboard();
HGLOBAL clipbuffer = GlobalAlloc(GMEM_DDESHARE, text.size() + 1);
- char* buffer = (char*)GlobalLock(clipbuffer);
+ char* buffer = static_cast<char*>(GlobalLock(clipbuffer));
strcpy(buffer, text.c_str());
GlobalUnlock(clipbuffer);
SetClipboardData(CF_TEXT, clipbuffer);
@@ -93,7 +93,7 @@
if (OpenClipboard(0))
{
HANDLE hData = GetClipboardData(CF_TEXT);
- std::string output = (char*)GlobalLock(hData);
+ std::string output = static_cast<char*>(GlobalLock(hData));
GlobalUnlock(hData);
CloseClipboard();
Modified: trunk/src/util/MultiType.h
===================================================================
--- trunk/src/util/MultiType.h 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/util/MultiType.h 2009-07-18 14:03:59 UTC (rev 3301)
@@ -302,7 +302,7 @@
inline bool setValue(const orxonox::Degree& value);
inline bool setValue(const char* value);
/** @brief Assigns a pointer. */
- template <typename V> inline bool setValue(V* value) { if (this->value_) { return this->value_->setValue((void*)value); } else { return this->assignValue((void*)value); } }
+ 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))); } }
/** @brief Assigns the value of the other MultiType and converts it to the current type. */
bool setValue(const MultiType& other) { if (this->value_) { return this->value_->assimilate(other); } else { if (other.value_) { this->value_ = other.value_->clone(); } return true; } }
/** @brief Changes the type to T and assigns the new value (which might be of another type than T - it gets converted). */
@@ -334,9 +334,9 @@
std::string getTypename() const;
/** @brief Saves the value of the MT to a bytestream (pointed at by mem) and increases mem pointer by size of MT */
- 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); }
+ 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); }
/** @brief Loads the value of the MT from a bytestream (pointed at by mem) and increases mem pointer by size of MT */
- 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); }
+ 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); }
/** @brief Saves the value of the MT to a bytestream and increases pointer to bytestream by size of MT */
inline uint8_t*& operator << (uint8_t*& mem) { importData(mem); return mem; }
/** @brief Loads the value of the MT to a bytestream and increases pointer to bytestream by size of MT */
@@ -370,7 +370,7 @@
operator orxonox::Radian() const;
operator orxonox::Degree() const;
/** @brief Returns the current value, converted to a T* pointer. */
- template <class T> operator T*() const { return ((T*)this->operator void*()); }
+ template <class T> operator T*() const { return (static_cast<T*>(this->operator void*())); }
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. */
inline bool getValue(unsigned 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. */
@@ -419,7 +419,7 @@
inline orxonox::Quaternion getQuaternion() const { return this->operator orxonox::Quaternion(); } /** @brief Returns the current value, converted to the requested type. */
inline orxonox::Radian getRadian() const { return this->operator orxonox::Radian(); } /** @brief Returns the current value, converted to the requested type. */
inline orxonox::Degree getDegree() const { return this->operator orxonox::Degree(); } /** @brief Returns the current value, converted to the requested type. */
- template <typename T> inline T* getPointer() const { return ((T*)this->getVoid()); } /** @brief Returns the current value, converted to a T* pointer. */
+ template <typename T> inline T* getPointer() const { return static_cast<T*>(this->getVoid()); } /** @brief Returns the current value, converted to a T* pointer. */
private:
inline bool assignValue(const char& value) { if (this->value_ && this->value_->type_ == MT_Type::Char) { return this->value_->setValue(value); } else { this->changeValueContainer<char>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
Modified: trunk/src/util/OutputHandler.cc
===================================================================
--- trunk/src/util/OutputHandler.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/util/OutputHandler.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -96,7 +96,7 @@
*/
void OutputHandler::setSoftDebugLevel(OutputHandler::OutputDevice device, int level)
{
- OutputHandler::getOutStream().softDebugLevel_[(unsigned int)device] = level;
+ OutputHandler::getOutStream().softDebugLevel_[static_cast<unsigned int>(device)] = level;
}
/**
@@ -106,7 +106,7 @@
*/
int OutputHandler::getSoftDebugLevel(OutputHandler::OutputDevice device)
{
- return OutputHandler::getOutStream().softDebugLevel_[(unsigned int)device];
+ return OutputHandler::getOutStream().softDebugLevel_[static_cast<unsigned int>(device)];
}
/**
Modified: trunk/src/util/SignalHandler.cc
===================================================================
--- trunk/src/util/SignalHandler.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/util/SignalHandler.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -202,7 +202,7 @@
dup2( gdbOut[1], STDOUT_FILENO );
dup2( gdbErr[1], STDERR_FILENO );
- execlp( "sh", "sh", "-c", "gdb", (void*)NULL);
+ execlp( "sh", "sh", "-c", "gdb", static_cast<void*>(NULL));
}
char cmd[256];
Modified: trunk/src/util/StringUtils.cc
===================================================================
--- trunk/src/util/StringUtils.cc 2009-07-17 21:53:35 UTC (rev 3300)
+++ trunk/src/util/StringUtils.cc 2009-07-18 14:03:59 UTC (rev 3301)
@@ -124,7 +124,7 @@
return false;
size_t quotecount = 0;
- size_t quote = (size_t)-1;
+ size_t quote = static_cast<size_t>(-1);
while ((quote = getNextQuote(str, quote + 1)) < pos)
{
if (quote == pos)
More information about the Orxonox-commit
mailing list