From 90a99991d1eaca47b192e01fc4eb5cef7ae249f1 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 22 Feb 2016 19:06:12 +0100 Subject: [PATCH] Use empty() instead of !size() --- apps/openmw/mwdialogue/keywordsearch.hpp | 2 +- apps/openmw/mwgui/console.cpp | 2 +- apps/openmw/mwgui/containeritemmodel.cpp | 2 +- apps/openmw/mwmechanics/aiwander.cpp | 2 +- apps/openmw/mwmechanics/character.cpp | 2 +- apps/openmw/mwrender/characterpreview.cpp | 2 +- apps/openmw/mwrender/globalmap.cpp | 2 +- apps/openmw/mwrender/localmap.cpp | 2 +- apps/openmw/mwrender/water.cpp | 2 +- apps/openmw/mwsound/soundmanagerimp.cpp | 2 +- components/esm/loadtes3.cpp | 4 ++-- components/nifosg/nifloader.cpp | 8 ++++---- components/nifosg/particle.cpp | 2 +- components/sceneutil/lightmanager.cpp | 2 +- components/sceneutil/workqueue.cpp | 2 +- components/shader/shadervisitor.cpp | 2 +- 16 files changed, 20 insertions(+), 20 deletions(-) diff --git a/apps/openmw/mwdialogue/keywordsearch.hpp b/apps/openmw/mwdialogue/keywordsearch.hpp index 3532dc22b..f296f223f 100644 --- a/apps/openmw/mwdialogue/keywordsearch.hpp +++ b/apps/openmw/mwdialogue/keywordsearch.hpp @@ -158,7 +158,7 @@ public: } // resolve overlapping keywords - while (matches.size()) + while (!matches.empty()) { int longestKeywordSize = 0; typename std::vector::iterator longestKeyword = matches.begin(); diff --git a/apps/openmw/mwgui/console.cpp b/apps/openmw/mwgui/console.cpp index 1777d86ad..aeff7dc39 100644 --- a/apps/openmw/mwgui/console.cpp +++ b/apps/openmw/mwgui/console.cpp @@ -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(""); diff --git a/apps/openmw/mwgui/containeritemmodel.cpp b/apps/openmw/mwgui/containeritemmodel.cpp index b2befc3ba..1e4749695 100644 --- a/apps/openmw/mwgui/containeritemmodel.cpp +++ b/apps/openmw/mwgui/containeritemmodel.cpp @@ -37,7 +37,7 @@ ContainerItemModel::ContainerItemModel(const std::vector& itemSour : mItemSources(itemSources) , mWorldItems(worldItems) { - assert (mItemSources.size()); + assert (!mItemSources.empty()); } ContainerItemModel::ContainerItemModel (const MWWorld::Ptr& source) diff --git a/apps/openmw/mwmechanics/aiwander.cpp b/apps/openmw/mwmechanics/aiwander.cpp index 8231e572e..27c7f6a93 100644 --- a/apps/openmw/mwmechanics/aiwander.cpp +++ b/apps/openmw/mwmechanics/aiwander.cpp @@ -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); } diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 2f024838d..0035ebb1a 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -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 diff --git a/apps/openmw/mwrender/characterpreview.cpp b/apps/openmw/mwrender/characterpreview.cpp index 201124447..c858b57b7 100644 --- a/apps/openmw/mwrender/characterpreview.cpp +++ b/apps/openmw/mwrender/characterpreview.cpp @@ -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(); diff --git a/apps/openmw/mwrender/globalmap.cpp b/apps/openmw/mwrender/globalmap.cpp index 9e8a545f8..b3b6cc3b0 100644 --- a/apps/openmw/mwrender/globalmap.cpp +++ b/apps/openmw/mwrender/globalmap.cpp @@ -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()); diff --git a/apps/openmw/mwrender/localmap.cpp b/apps/openmw/mwrender/localmap.cpp index be477735f..8340ab78a 100644 --- a/apps/openmw/mwrender/localmap.cpp +++ b/apps/openmw/mwrender/localmap.cpp @@ -632,7 +632,7 @@ void LocalMap::MapSegment::initFogOfWar() void LocalMap::MapSegment::loadFogOfWar(const ESM::FogTexture &esm) { const std::vector& data = esm.mImageData; - if (!data.size()) + if (data.empty()) { initFogOfWar(); return; diff --git a/apps/openmw/mwrender/water.cpp b/apps/openmw/mwrender/water.cpp index a410527de..0a379e50a 100644 --- a/apps/openmw/mwrender/water.cpp +++ b/apps/openmw/mwrender/water.cpp @@ -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"); diff --git a/apps/openmw/mwsound/soundmanagerimp.cpp b/apps/openmw/mwsound/soundmanagerimp.cpp index e8ceaa40f..ae8601594 100644 --- a/apps/openmw/mwsound/soundmanagerimp.cpp +++ b/apps/openmw/mwsound/soundmanagerimp.cpp @@ -366,7 +366,7 @@ namespace MWSound else filelist = mMusicFiles[mCurrentPlaylist]; - if(!filelist.size()) + if(filelist.empty()) return; int i = Misc::Rng::rollDice(filelist.size()); diff --git a/components/esm/loadtes3.cpp b/components/esm/loadtes3.cpp index df35a2579..60d411fc6 100644 --- a/components/esm/loadtes3.cpp +++ b/components/esm/loadtes3.cpp @@ -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()); } } diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index 0b49419ff..975d6d6e0 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -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& 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& boundTextures, int animflags) { - if (boundTextures.size()) + if (!boundTextures.empty()) { // overriding a parent NiTexturingProperty, so remove what was previously bound for (unsigned int i=0; igetParentalNodePaths(); - if (partsysNodePaths.size()) + if (!partsysNodePaths.empty()) { osg::Matrix psToWorld = osg::computeLocalToWorld(partsysNodePaths[0]); worldToPs = osg::Matrix::inverse(psToWorld); diff --git a/components/sceneutil/lightmanager.cpp b/components/sceneutil/lightmanager.cpp index 3950d0aea..da29647c2 100644 --- a/components/sceneutil/lightmanager.cpp +++ b/components/sceneutil/lightmanager.cpp @@ -351,7 +351,7 @@ namespace SceneUtil mLightList.push_back(&l); } } - if (mLightList.size()) + if (!mLightList.empty()) { unsigned int maxLights = static_cast (8 - mLightManager->getStartLight()); diff --git a/components/sceneutil/workqueue.cpp b/components/sceneutil/workqueue.cpp index bb1d1f1f7..bbd9f4840 100644 --- a/components/sceneutil/workqueue.cpp +++ b/components/sceneutil/workqueue.cpp @@ -87,7 +87,7 @@ osg::ref_ptr WorkQueue::removeWorkItem() { mCondition.wait(&mMutex); } - if (mQueue.size()) + if (!mQueue.empty()) { osg::ref_ptr item = mQueue.front(); mQueue.pop(); diff --git a/components/shader/shadervisitor.cpp b/components/shader/shadervisitor.cpp index 46d4edf44..c88200759 100644 --- a/components/shader/shadervisitor.cpp +++ b/components/shader/shadervisitor.cpp @@ -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;