Use empty() instead of !size()

pull/904/head
scrawl 9 years ago
parent 8bd16e4d5a
commit 90a99991d1

@ -158,7 +158,7 @@ public:
}
// resolve overlapping keywords
while (matches.size())
while (!matches.empty())
{
int longestKeywordSize = 0;
typename std::vector<Match>::iterator longestKeyword = matches.begin();

@ -240,7 +240,7 @@ namespace MWGui
mCommandLine->setCaption(newCaption);
// List candidates if repeatedly pressing tab
if (oldCaption == newCaption && matches.size())
if (oldCaption == newCaption && !matches.empty())
{
int i = 0;
printOK("");

@ -37,7 +37,7 @@ ContainerItemModel::ContainerItemModel(const std::vector<MWWorld::Ptr>& itemSour
: mItemSources(itemSources)
, mWorldItems(worldItems)
{
assert (mItemSources.size());
assert (!mItemSources.empty());
}
ContainerItemModel::ContainerItemModel (const MWWorld::Ptr& source)

@ -255,7 +255,7 @@ namespace MWMechanics
// Construct a new path if there isn't one
if(!storage.mPathFinder.isPathConstructed())
{
if (mAllowedNodes.size())
if (!mAllowedNodes.empty())
{
setPathToAnAllowedNode(actor, storage, pos);
}

@ -2155,7 +2155,7 @@ void CharacterController::updateHeadTracking(float duration)
if (node != NULL)
{
osg::NodePathList nodepaths = node->getParentalNodePaths();
if (nodepaths.size())
if (!nodepaths.empty())
direction = osg::computeLocalToWorld(nodepaths[0]).getTrans() - headPos;
}
else

@ -366,7 +366,7 @@ namespace MWRender
// Now update camera utilizing the updated head position
osg::NodePathList nodepaths = mNodeToFollow->getParentalNodePaths();
if (!nodepaths.size())
if (nodepaths.empty())
return;
osg::Matrix worldMat = osg::computeLocalToWorld(nodepaths[0]);
osg::Vec3 headOffset = worldMat.getTrans();

@ -402,7 +402,7 @@ namespace MWRender
|| bounds.mMinY > bounds.mMaxY)
throw std::runtime_error("invalid map bounds");
if (!map.mImageData.size())
if (map.mImageData.empty())
return;
Files::IMemStream istream(&map.mImageData[0], map.mImageData.size());

@ -632,7 +632,7 @@ void LocalMap::MapSegment::initFogOfWar()
void LocalMap::MapSegment::loadFogOfWar(const ESM::FogTexture &esm)
{
const std::vector<char>& data = esm.mImageData;
if (!data.size())
if (data.empty())
{
initFogOfWar();
return;

@ -566,7 +566,7 @@ void Water::createSimpleWaterStateSet(osg::Node* node, float alpha)
textures.push_back(tex);
}
if (!textures.size())
if (textures.empty())
return;
float fps = mFallback->getFallbackFloat("Water_SurfaceFPS");

@ -366,7 +366,7 @@ namespace MWSound
else
filelist = mMusicFiles[mCurrentPlaylist];
if(!filelist.size())
if(filelist.empty())
return;
int i = Misc::Rng::rollDice(filelist.size());

@ -53,14 +53,14 @@ void ESM::Header::load (ESMReader &esm)
{
esm.getSubHeader();
mSCRD.resize(esm.getSubSize());
if (mSCRD.size())
if (!mSCRD.empty())
esm.getExact(&mSCRD[0], mSCRD.size());
}
if (esm.isNextSub("SCRS"))
{
esm.getSubHeader();
mSCRS.resize(esm.getSubSize());
if (mSCRS.size())
if (!mSCRS.empty())
esm.getExact(&mSCRS[0], mSCRS.size());
}
}

@ -962,7 +962,7 @@ namespace NifOsg
if (uvSet >= (int)data->uvlist.size())
{
std::cerr << "Warning: out of bounds UV set " << uvSet << " on TriShape \"" << triShape->name << "\" in " << mFilename << std::endl;
if (data->uvlist.size())
if (!data->uvlist.empty())
geometry->setTexCoordArray(textureStage, data->uvlist[0]);
continue;
}
@ -1040,7 +1040,7 @@ namespace NifOsg
triShapeToGeometry(triShape, morphGeom, parentNode, composite, boundTextures, animflags);
const std::vector<Nif::NiMorphData::MorphData>& morphs = morpher->data.getPtr()->mMorphs;
if (!morphs.size())
if (morphs.empty())
return morphGeom;
// Note we are not interested in morph 0, which just contains the original vertices
for (unsigned int i = 1; i < morphs.size(); ++i)
@ -1228,7 +1228,7 @@ namespace NifOsg
return NULL;
}
if (!pixelData->mipmaps.size())
if (pixelData->mipmaps.empty())
return NULL;
unsigned char* data = new unsigned char[pixelData->data.size()];
@ -1274,7 +1274,7 @@ namespace NifOsg
void handleTextureProperty(const Nif::NiTexturingProperty* texprop, osg::StateSet* stateset, SceneUtil::CompositeStateSetUpdater* composite, Resource::ImageManager* imageManager, std::vector<int>& boundTextures, int animflags)
{
if (boundTextures.size())
if (!boundTextures.empty())
{
// overriding a parent NiTexturingProperty, so remove what was previously bound
for (unsigned int i=0; i<boundTextures.size(); ++i)

@ -262,7 +262,7 @@ void Emitter::emitParticles(double dt)
// maybe this could be optimized by halting at the lowest common ancestor of the particle and emitter nodes
osg::NodePathList partsysNodePaths = getParticleSystem()->getParentalNodePaths();
if (partsysNodePaths.size())
if (!partsysNodePaths.empty())
{
osg::Matrix psToWorld = osg::computeLocalToWorld(partsysNodePaths[0]);
worldToPs = osg::Matrix::inverse(psToWorld);

@ -351,7 +351,7 @@ namespace SceneUtil
mLightList.push_back(&l);
}
}
if (mLightList.size())
if (!mLightList.empty())
{
unsigned int maxLights = static_cast<unsigned int> (8 - mLightManager->getStartLight());

@ -87,7 +87,7 @@ osg::ref_ptr<WorkItem> WorkQueue::removeWorkItem()
{
mCondition.wait(&mMutex);
}
if (mQueue.size())
if (!mQueue.empty())
{
osg::ref_ptr<WorkItem> item = mQueue.front();
mQueue.pop();

@ -103,7 +103,7 @@ namespace Shader
if (mAllowedToModifyStateSets)
writableStateSet = node.getStateSet();
const osg::StateSet::TextureAttributeList& texAttributes = stateset->getTextureAttributeList();
if (texAttributes.size())
if (!texAttributes.empty())
{
const osg::Texture* diffuseMap = NULL;
const osg::Texture* normalMap = NULL;

Loading…
Cancel
Save