Change dynamic_cast to static_cast to make coverity happy

openmw-35
scrawl 10 years ago
parent cda2eea906
commit de23ad5c8d

@ -246,7 +246,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
Style* createHotStyle (Style* baseStyle, Colour normalColour, Colour hoverColour, Colour activeColour, InteractiveId id, bool unique)
{
StyleImpl* BaseStyle = dynamic_cast <StyleImpl*> (baseStyle);
StyleImpl* BaseStyle = static_cast <StyleImpl*> (baseStyle);
if (!unique)
for (Styles::iterator i = mBook->mStyles.begin (); i != mBook->mStyles.end (); ++i)
@ -268,7 +268,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
{
Range range = mBook->addContent (text);
writeImpl (dynamic_cast <StyleImpl*> (style), range.first, range.second);
writeImpl (static_cast <StyleImpl*> (style), range.first, range.second);
}
intptr_t addContent (Utf8Span text, bool select)
@ -295,7 +295,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
Utf8Point begin_ = &mCurrentContent->front () + begin;
Utf8Point end_ = &mCurrentContent->front () + end ;
writeImpl (dynamic_cast <StyleImpl*> (style), begin_, end_);
writeImpl (static_cast <StyleImpl*> (style), begin_, end_);
}
void lineBreak (float margin)

@ -131,7 +131,7 @@ void adjustCommandedActor (const MWWorld::Ptr& actor)
for (it = stats.getAiSequence().begin(); it != stats.getAiSequence().end(); ++it)
{
if ((*it)->getTypeId() == MWMechanics::AiPackage::TypeIdFollow &&
dynamic_cast<MWMechanics::AiFollow*>(*it)->isCommanded())
static_cast<MWMechanics::AiFollow*>(*it)->isCommanded())
{
hasCommandPackage = true;
break;
@ -355,7 +355,7 @@ namespace MWMechanics
{
if ((*it)->getTypeId() == MWMechanics::AiPackage::TypeIdFollow)
{
MWWorld::Ptr followTarget = dynamic_cast<MWMechanics::AiFollow*>(*it)->getTarget();
MWWorld::Ptr followTarget = static_cast<MWMechanics::AiFollow*>(*it)->getTarget();
if (followTarget.isEmpty())
continue;
@ -1389,7 +1389,7 @@ namespace MWMechanics
{
if ((*it)->getTypeId() == MWMechanics::AiPackage::TypeIdFollow)
{
MWWorld::Ptr followTarget = dynamic_cast<MWMechanics::AiFollow*>(*it)->getTarget();
MWWorld::Ptr followTarget = static_cast<MWMechanics::AiFollow*>(*it)->getTarget();
if (followTarget.isEmpty())
continue;
if (followTarget == actor)
@ -1419,11 +1419,11 @@ namespace MWMechanics
{
if ((*it)->getTypeId() == MWMechanics::AiPackage::TypeIdFollow)
{
MWWorld::Ptr followTarget = dynamic_cast<MWMechanics::AiFollow*>(*it)->getTarget();
MWWorld::Ptr followTarget = static_cast<MWMechanics::AiFollow*>(*it)->getTarget();
if (followTarget.isEmpty())
continue;
if (followTarget == actor)
list.push_back(dynamic_cast<MWMechanics::AiFollow*>(*it)->getFollowIndex());
list.push_back(static_cast<MWMechanics::AiFollow*>(*it)->getFollowIndex());
else
break;
}

@ -342,49 +342,49 @@ void AiSequence::readState(const ESM::AiSequence::AiSequence &sequence)
case ESM::AiSequence::Ai_Wander:
{
MWMechanics::AiWander* wander = new AiWander(
dynamic_cast<ESM::AiSequence::AiWander*>(it->mPackage));
static_cast<ESM::AiSequence::AiWander*>(it->mPackage));
mPackages.push_back(wander);
break;
}
case ESM::AiSequence::Ai_Travel:
{
MWMechanics::AiTravel* travel = new AiTravel(
dynamic_cast<ESM::AiSequence::AiTravel*>(it->mPackage));
static_cast<ESM::AiSequence::AiTravel*>(it->mPackage));
mPackages.push_back(travel);
break;
}
case ESM::AiSequence::Ai_Escort:
{
MWMechanics::AiEscort* escort = new AiEscort(
dynamic_cast<ESM::AiSequence::AiEscort*>(it->mPackage));
static_cast<ESM::AiSequence::AiEscort*>(it->mPackage));
mPackages.push_back(escort);
break;
}
case ESM::AiSequence::Ai_Follow:
{
MWMechanics::AiFollow* follow = new AiFollow(
dynamic_cast<ESM::AiSequence::AiFollow*>(it->mPackage));
static_cast<ESM::AiSequence::AiFollow*>(it->mPackage));
mPackages.push_back(follow);
break;
}
case ESM::AiSequence::Ai_Activate:
{
MWMechanics::AiActivate* activate = new AiActivate(
dynamic_cast<ESM::AiSequence::AiActivate*>(it->mPackage));
static_cast<ESM::AiSequence::AiActivate*>(it->mPackage));
mPackages.push_back(activate);
break;
}
case ESM::AiSequence::Ai_Combat:
{
MWMechanics::AiCombat* combat = new AiCombat(
dynamic_cast<ESM::AiSequence::AiCombat*>(it->mPackage));
static_cast<ESM::AiSequence::AiCombat*>(it->mPackage));
mPackages.push_back(combat);
break;
}
case ESM::AiSequence::Ai_Pursue:
{
MWMechanics::AiPursue* pursue = new AiPursue(
dynamic_cast<ESM::AiSequence::AiPursue*>(it->mPackage));
static_cast<ESM::AiSequence::AiPursue*>(it->mPackage));
mPackages.push_back(pursue);
break;
}

@ -245,7 +245,7 @@ namespace MWRender
void GlobalMap::loadResource(Ogre::Resource *resource)
{
Ogre::Texture* tex = dynamic_cast<Ogre::Texture*>(resource);
Ogre::Texture* tex = static_cast<Ogre::Texture*>(resource);
Ogre::ConstImagePtrList list;
list.push_back(&mOverlayImage);
tex->_loadImages(list);

@ -494,7 +494,7 @@ void LocalMap::loadResource(Ogre::Resource* resource)
std::vector<uint32>& buffer = mBuffers[resourceName];
Ogre::Texture* tex = dynamic_cast<Ogre::Texture*>(resource);
Ogre::Texture* tex = static_cast<Ogre::Texture*>(resource);
tex->createInternalResources();
memcpy(tex->getBuffer()->lock(HardwareBuffer::HBL_DISCARD), &buffer[0], sFogOfWarResolution*sFogOfWarResolution*4);
tex->getBuffer()->unlock();

@ -382,7 +382,7 @@ NIFMeshLoader::NIFMeshLoader(const std::string &name, const std::string &group,
void NIFMeshLoader::loadResource(Ogre::Resource *resource)
{
Ogre::Mesh *mesh = dynamic_cast<Ogre::Mesh*>(resource);
Ogre::Mesh *mesh = static_cast<Ogre::Mesh*>(resource);
OgreAssert(mesh, "Attempting to load a mesh into a non-mesh resource!");
Nif::NIFFilePtr nif = Nif::Cache::getInstance().load(mName);
@ -395,7 +395,7 @@ void NIFMeshLoader::loadResource(Ogre::Resource *resource)
}
const Nif::Record *record = nif->getRecord(mShapeIndex);
createSubMesh(mesh, dynamic_cast<const Nif::NiTriShape*>(record));
createSubMesh(mesh, static_cast<const Nif::NiTriShape*>(record));
}

@ -799,7 +799,7 @@ class NIFObjectLoader
{
if (ctrls->recType == Nif::RC_NiAlphaController)
{
const Nif::NiAlphaController *alphaCtrl = dynamic_cast<const Nif::NiAlphaController*>(ctrls.getPtr());
const Nif::NiAlphaController *alphaCtrl = static_cast<const Nif::NiAlphaController*>(ctrls.getPtr());
Ogre::ControllerValueRealPtr dstval(OGRE_NEW AlphaController::Value(movable, alphaCtrl->data.getPtr(), &scene->mMaterialControllerMgr));
AlphaController::Function* function = OGRE_NEW AlphaController::Function(alphaCtrl, (animflags&Nif::NiNode::AnimFlag_AutoPlay));
scene->mMaxControllerLength = std::max(function->mStopTime, scene->mMaxControllerLength);
@ -808,7 +808,7 @@ class NIFObjectLoader
}
else if (ctrls->recType == Nif::RC_NiMaterialColorController)
{
const Nif::NiMaterialColorController *matCtrl = dynamic_cast<const Nif::NiMaterialColorController*>(ctrls.getPtr());
const Nif::NiMaterialColorController *matCtrl = static_cast<const Nif::NiMaterialColorController*>(ctrls.getPtr());
Ogre::ControllerValueRealPtr dstval(OGRE_NEW MaterialColorController::Value(movable, matCtrl->data.getPtr(), &scene->mMaterialControllerMgr));
MaterialColorController::Function* function = OGRE_NEW MaterialColorController::Function(matCtrl, (animflags&Nif::NiNode::AnimFlag_AutoPlay));
scene->mMaxControllerLength = std::max(function->mStopTime, scene->mMaxControllerLength);
@ -826,7 +826,7 @@ class NIFObjectLoader
{
if (ctrls->recType == Nif::RC_NiFlipController)
{
const Nif::NiFlipController *flipCtrl = dynamic_cast<const Nif::NiFlipController*>(ctrls.getPtr());
const Nif::NiFlipController *flipCtrl = static_cast<const Nif::NiFlipController*>(ctrls.getPtr());
Ogre::ControllerValueRealPtr dstval(OGRE_NEW FlipController::Value(

@ -35,7 +35,7 @@ btCollisionShape *duplicateCollisionShape(btCollisionShape *shape)
if(btBvhTriangleMeshShape *trishape = dynamic_cast<btBvhTriangleMeshShape*>(shape))
{
btTriangleMesh* oldMesh = dynamic_cast<btTriangleMesh*>(trishape->getMeshInterface());
btTriangleMesh* oldMesh = static_cast<btTriangleMesh*>(trishape->getMeshInterface());
btTriangleMesh* newMesh = new btTriangleMesh(*oldMesh);
NifBullet::TriangleMeshShape *newShape = new NifBullet::TriangleMeshShape(newMesh, true);

Loading…
Cancel
Save