From 23866079be7ab8987d8f61ee20f58a6828679b77 Mon Sep 17 00:00:00 2001 From: kervala <kervala@localhost> Date: Wed, 25 May 2016 23:18:11 +0200 Subject: [PATCH] Changed: Replace size() comparisons by empty() --- code/nel/include/nel/3d/zone.h | 2 +- code/nel/include/nel/misc/cdb.h | 2 +- code/nel/src/3d/driver.cpp | 12 ++++----- code/nel/src/3d/dru.cpp | 4 +-- code/nel/src/3d/landscape.cpp | 2 +- code/nel/src/3d/landscapevb_allocator.cpp | 2 +- code/nel/src/3d/mesh.cpp | 18 ++++++------- code/nel/src/3d/mesh_morpher.cpp | 7 ++--- code/nel/src/3d/mesh_mrm.cpp | 26 +++++++++---------- code/nel/src/3d/mesh_mrm_skin.cpp | 2 +- code/nel/src/3d/mesh_mrm_skin_template.cpp | 6 ++--- code/nel/src/3d/mesh_mrm_skinned.cpp | 14 +++++----- code/nel/src/3d/mrm_builder.cpp | 2 +- code/nel/src/3d/patch.cpp | 5 ++-- code/nel/src/3d/patch_render.cpp | 2 +- code/nel/src/3d/patchdlm_context.cpp | 4 +-- code/nel/src/3d/ps_face.cpp | 6 ++--- code/nel/src/3d/ps_mesh.cpp | 4 +-- code/nel/src/3d/quad_effect.cpp | 2 +- code/nel/src/3d/shadow_map_manager.cpp | 2 +- code/nel/src/3d/texture_dlm.cpp | 4 +-- code/nel/src/3d/tile_bank.cpp | 4 +-- .../src/3d/vegetable_blend_layer_model.cpp | 2 +- code/nel/src/3d/vegetable_manager.cpp | 10 +++---- code/nel/src/3d/vegetablevb_allocator.cpp | 2 +- code/nel/src/3d/water_model.cpp | 2 +- code/nel/src/3d/zone.cpp | 10 ++++--- code/nel/src/3d/zone_lighter.cpp | 2 +- code/nel/src/gui/group_header.cpp | 2 +- code/nel/src/gui/group_tab.cpp | 4 +-- code/nel/src/gui/interface_parser.cpp | 2 +- code/nel/src/ligo/primitive.cpp | 2 +- code/nel/src/misc/cdb_branch.cpp | 2 +- code/nel/src/misc/polygon.cpp | 2 +- code/nel/src/misc/system_utils.cpp | 2 +- code/nel/src/net/admin.cpp | 4 +-- code/nel/src/net/buf_sock.cpp | 4 +-- code/nel/src/net/login_client.cpp | 4 +-- code/nel/src/net/naming_client.cpp | 6 ++--- code/nel/src/net/service.cpp | 2 +- .../sound/driver/openal/sound_driver_al.cpp | 4 +-- .../nel/src/sound/driver/openal/source_al.cpp | 4 +-- .../driver/xaudio2/sound_driver_xaudio2.cpp | 6 ++--- code/ryzom/client/src/commands.cpp | 6 ++--- .../src/interface_v3/action_handler_help.cpp | 2 +- .../src/interface_v3/action_phrase_faber.cpp | 3 ++- .../client/src/interface_v3/dbctrl_sheet.cpp | 4 +-- .../client/src/interface_v3/group_map.cpp | 2 +- .../src/interface_v3/interface_manager.cpp | 6 ++--- .../src/interface_v3/sphrase_manager.cpp | 10 +++---- code/ryzom/client/src/login.cpp | 2 +- code/ryzom/client/src/login_patch.h | 2 +- code/ryzom/client/src/movie_shooter.cpp | 2 +- code/ryzom/client/src/net_manager.cpp | 2 +- code/ryzom/client/src/r2/editor.cpp | 2 +- code/ryzom/client/src/r2/tool_pick.cpp | 6 ++--- .../src/game_share/scenario_entry_points.cpp | 2 +- 57 files changed, 133 insertions(+), 128 deletions(-) diff --git a/code/nel/include/nel/3d/zone.h b/code/nel/include/nel/3d/zone.h index 9c60013a8..4aaaea53b 100644 --- a/code/nel/include/nel/3d/zone.h +++ b/code/nel/include/nel/3d/zone.h @@ -163,7 +163,7 @@ public: /** There is (OrderS/2+1) * (OrderT/2+1) tiles light influence. * It indicates which static pointLight influence each corner of a TessBlock (block of 2*2 tiles). * - * If size()==0, suppose no light influence. but CZone::retrieve() always return a + * If empty(), suppose no light influence. but CZone::retrieve() always return a * size() == (OrderS/2+1) * (OrderT/2+1). * * They are stored in line first order, from S=0 to 1, and T=0 to 1. diff --git a/code/nel/include/nel/misc/cdb.h b/code/nel/include/nel/misc/cdb.h index bc02dc85b..4a6e65097 100644 --- a/code/nel/include/nel/misc/cdb.h +++ b/code/nel/include/nel/misc/cdb.h @@ -120,7 +120,7 @@ public: */ std::string toString() const { - if (_Ids.size()==0) return std::string(""); + if (_Ids.empty()) return std::string(""); std::string str=_Ids[0]; for (unsigned i=1; i<_Ids.size(); i++) str +=std::string(":")+ _Ids[i]; diff --git a/code/nel/src/3d/driver.cpp b/code/nel/src/3d/driver.cpp index 9bd23f815..3ba0178f2 100644 --- a/code/nel/src/3d/driver.cpp +++ b/code/nel/src/3d/driver.cpp @@ -50,14 +50,14 @@ IDriver::~IDriver() { CSynchronized<TTexDrvInfoPtrMap>::CAccessor access(&_SyncTexDrvInfos); TTexDrvInfoPtrMap &rTexDrvInfos = access.value(); - nlassert( rTexDrvInfos.size() == 0 ); + nlassert(rTexDrvInfos.empty()); } - nlassert(_TexDrvShares.size()==0); - nlassert(_MatDrvInfos.size()==0); - nlassert(_VBDrvInfos.size()==0); - nlassert(_IBDrvInfos.size()==0); - nlassert(_GPUPrgDrvInfos.size()==0); + nlassert(_TexDrvShares.empty()); + nlassert(_MatDrvInfos.empty()); + nlassert(_VBDrvInfos.empty()); + nlassert(_IBDrvInfos.empty()); + nlassert(_GPUPrgDrvInfos.empty()); } diff --git a/code/nel/src/3d/dru.cpp b/code/nel/src/3d/dru.cpp index bb86d8b84..fd3e77404 100644 --- a/code/nel/src/3d/dru.cpp +++ b/code/nel/src/3d/dru.cpp @@ -528,7 +528,7 @@ void CDRU::drawTrianglesUnlit(const NLMISC::CTriangleUV *trilist, sint ntris, // *************************************************************************** void CDRU::drawTrianglesUnlit(const std::vector<NLMISC::CTriangleUV> &trilist, CMaterial &mat, IDriver& driver) { - if(trilist.size()==0) + if(trilist.empty()) return; CDRU::drawTrianglesUnlit( &(*trilist.begin()), (uint)trilist.size(), mat, driver); @@ -570,7 +570,7 @@ void CDRU::drawLinesUnlit(const NLMISC::CLine *linelist, sint nlines, CMateria // *************************************************************************** void CDRU::drawLinesUnlit(const std::vector<NLMISC::CLine> &linelist, CMaterial &mat, IDriver& driver) { - if(linelist.size()==0) + if(linelist.empty()) return; CDRU::drawLinesUnlit( &(*linelist.begin()), (sint)linelist.size(), mat, driver); } diff --git a/code/nel/src/3d/landscape.cpp b/code/nel/src/3d/landscape.cpp index ccdeabc34..d588fa424 100644 --- a/code/nel/src/3d/landscape.cpp +++ b/code/nel/src/3d/landscape.cpp @@ -2859,7 +2859,7 @@ void CLandscape::setupAutomaticLightDir(const CVector &lightDir) // *************************************************************************** CVector CLandscape::getHeightFieldDeltaZ(float x, float y) const { - if(_HeightField.ZPatchs.size()==0) + if(_HeightField.ZPatchs.empty()) return CVector::Null; // map to _HeightField coordinates. diff --git a/code/nel/src/3d/landscapevb_allocator.cpp b/code/nel/src/3d/landscapevb_allocator.cpp index 43c38ab64..c6815ea05 100644 --- a/code/nel/src/3d/landscapevb_allocator.cpp +++ b/code/nel/src/3d/landscapevb_allocator.cpp @@ -134,7 +134,7 @@ void CLandscapeVBAllocator::resetReallocation() uint CLandscapeVBAllocator::allocateVertex() { // if no more free, allocate. - if( _VertexFreeMemory.size()==0 ) + if( _VertexFreeMemory.empty() ) { // enlarge capacity. uint newResize; diff --git a/code/nel/src/3d/mesh.cpp b/code/nel/src/3d/mesh.cpp index a533632c5..0d3095182 100644 --- a/code/nel/src/3d/mesh.cpp +++ b/code/nel/src/3d/mesh.cpp @@ -52,7 +52,7 @@ namespace NL3D static NLMISC::CAABBoxExt makeBBox(const std::vector<CVector> &Vertices) { NLMISC::CAABBox ret; - nlassert(Vertices.size()); + nlassert(!Vertices.empty()); ret.setCenter(Vertices[0]); for(sint i=0;i<(sint)Vertices.size();i++) { @@ -167,7 +167,7 @@ void CMeshGeom::build (CMesh::CMeshBuild &m, uint numMaxMaterial) sint i; // Empty geometry? - if(m.Vertices.size()==0 || m.Faces.size()==0) + if(m.Vertices.empty() || m.Faces.empty()) { _VBuffer.setNumVertices(0); _VBuffer.setName("CMeshGeom"); @@ -436,7 +436,7 @@ void CMeshGeom::build (CMesh::CMeshBuild &m, uint numMaxMaterial) } // Set the vertex buffer preferred memory - bool avoidVBHard= _Skinned || ( _MeshMorpher && _MeshMorpher->BlendShapes.size()>0 ); + bool avoidVBHard= _Skinned || ( _MeshMorpher && !_MeshMorpher->BlendShapes.empty() ); _VBuffer.setPreferredMemory (avoidVBHard?CVertexBuffer::RAMPreferred:CVertexBuffer::StaticPreferred, false); // End!! @@ -638,7 +638,7 @@ void CMeshGeom::render(IDriver *drv, CTransformShape *trans, float polygonCount, for(uint mb=0;mb<_MatrixBlocks.size();mb++) { CMatrixBlock &mBlock= _MatrixBlocks[mb]; - if(mBlock.RdrPass.size()==0) + if(mBlock.RdrPass.empty()) continue; // Global alpha ? @@ -790,7 +790,7 @@ void CMeshGeom::renderSkin(CTransformShape *trans, float alphaMRM) for(uint mb=0;mb<_MatrixBlocks.size();mb++) { CMatrixBlock &mBlock= _MatrixBlocks[mb]; - if(mBlock.RdrPass.size()==0) + if(mBlock.RdrPass.empty()) continue; // Render all pass. @@ -840,7 +840,7 @@ void CMeshGeom::renderSimpleWithMaterial(IDriver *drv, const CMatrix &worldMatri for(uint mb=0;mb<_MatrixBlocks.size();mb++) { CMatrixBlock &mBlock= _MatrixBlocks[mb]; - if(mBlock.RdrPass.size()==0) + if(mBlock.RdrPass.empty()) continue; // Render all pass. @@ -998,10 +998,10 @@ void CMeshGeom::compileRunTime() _PreciseClipping= _BBox.getRadius() >= NL3D_MESH_PRECISE_CLIP_THRESHOLD; // Support MeshBlockRendering only if not skinned/meshMorphed. - bool supportMeshBlockRendering= !_Skinned && _MeshMorpher->BlendShapes.size()==0; + bool supportMeshBlockRendering= !_Skinned && _MeshMorpher->BlendShapes.empty(); // true only if one matrix block, and at least one rdrPass. - supportMeshBlockRendering= supportMeshBlockRendering && _MatrixBlocks.size()==1 && _MatrixBlocks[0].RdrPass.size()>0; + supportMeshBlockRendering= supportMeshBlockRendering && _MatrixBlocks.size()==1 && !_MatrixBlocks[0].RdrPass.empty(); if (supportMeshBlockRendering && _MeshVertexProgram) { supportMeshBlockRendering = supportMeshBlockRendering && _MeshVertexProgram->supportMeshBlockRendering(); @@ -1021,7 +1021,7 @@ void CMeshGeom::compileRunTime() if(supportMBRPerMaterial) _SupportMBRFlags|= MBRSortPerMaterial; - bool avoidVBHard= _Skinned || ( _MeshMorpher && _MeshMorpher->BlendShapes.size()>0 ); + bool avoidVBHard= _Skinned || ( _MeshMorpher && !_MeshMorpher->BlendShapes.empty() ); _VBuffer.setPreferredMemory (avoidVBHard?CVertexBuffer::RAMPreferred:CVertexBuffer::StaticPreferred, false); } diff --git a/code/nel/src/3d/mesh_morpher.cpp b/code/nel/src/3d/mesh_morpher.cpp index 4d7ed8255..39f44a130 100644 --- a/code/nel/src/3d/mesh_morpher.cpp +++ b/code/nel/src/3d/mesh_morpher.cpp @@ -407,9 +407,10 @@ void CMeshMorpher::updateRawSkin (CVertexBuffer *vbOri, rFactor*= 0.01f; uint32 numVertices= (uint32)rBS.VertRefs.size(); // don't know why, but cases happen where deltaNorm not empty while deltaPos is - bool hasPos= rBS.deltaPos.size()>0; - bool hasNorm= rBS.deltaNorm.size()>0; - bool hasUV= rBS.deltaUV.size()>0; + bool hasPos = !rBS.deltaPos.empty(); + bool hasNorm = !rBS.deltaNorm.empty(); + bool hasUV = !rBS.deltaUV.empty(); + for (j = 0; j < numVertices; ++j) { // Get the vertex Index in the VBufferFinal diff --git a/code/nel/src/3d/mesh_mrm.cpp b/code/nel/src/3d/mesh_mrm.cpp index 999b3b62d..e5b61c966 100644 --- a/code/nel/src/3d/mesh_mrm.cpp +++ b/code/nel/src/3d/mesh_mrm.cpp @@ -180,7 +180,7 @@ void CMeshMRMGeom::CLod::optimizeTriangleOrder() static NLMISC::CAABBoxExt makeBBox(const std::vector<CVector> &Vertices) { NLMISC::CAABBox ret; - nlassert(Vertices.size()); + nlassert(!Vertices.empty()); ret.setCenter(Vertices[0]); for(sint i=0;i<(sint)Vertices.size();i++) { @@ -236,7 +236,7 @@ void CMeshMRMGeom::build(CMesh::CMeshBuild &m, std::vector<CMesh::CMeshBuild*> uint numMaxMaterial, const CMRMParameters ¶ms) { // Empty geometry? - if(m.Vertices.size()==0 || m.Faces.size()==0) + if(m.Vertices.empty() || m.Faces.empty()) { _VBufferFinal.setNumVertices(0); _VBufferFinal.reserve(0); @@ -308,7 +308,7 @@ void CMeshMRMGeom::build(CMesh::CMeshBuild &m, std::vector<CMesh::CMeshBuild*> _LevelDetail.MaxFaceUsed= 0; _LevelDetail.MinFaceUsed= 0; // Count of primitive block - if(_Lods.size()>0) + if (!_Lods.empty()) { uint pb; // Compute MinFaces. @@ -469,7 +469,7 @@ void CMeshMRMGeom::applyGeomorph(std::vector<CMRMWedgeGeom> &geoms, float alpha void CMeshMRMGeom::applyGeomorphWithVBHardPtr(std::vector<CMRMWedgeGeom> &geoms, float alphaLod, uint8 *vertexDestPtr) { // no geomorphs? quit. - if(geoms.size()==0) + if(geoms.empty()) return; clamp(alphaLod, 0.f, 1.f); @@ -900,7 +900,7 @@ inline sint CMeshMRMGeom::chooseLod(float alphaMRM, float &alphaLod) void CMeshMRMGeom::render(IDriver *drv, CTransformShape *trans, float polygonCount, uint32 rdrFlags, float globalAlpha) { nlassert(drv); - if(_Lods.size()==0) + if(_Lods.empty()) return; @@ -922,7 +922,7 @@ void CMeshMRMGeom::render(IDriver *drv, CTransformShape *trans, float polygonCou // Render the choosen Lod. CLod &lod= _Lods[numLod]; - if(lod.RdrPass.size()==0) + if(lod.RdrPass.empty()) return; @@ -1104,7 +1104,7 @@ void CMeshMRMGeom::renderSkin(CTransformShape *trans, float alphaMRM) { H_AUTO( NL3D_MeshMRMGeom_renderSkin ); - if(_Lods.size()==0) + if(_Lods.empty()) return; @@ -1126,7 +1126,7 @@ void CMeshMRMGeom::renderSkin(CTransformShape *trans, float alphaMRM) // Render the choosen Lod. CLod &lod= _Lods[numLod]; - if(lod.RdrPass.size()==0) + if(lod.RdrPass.empty()) return; @@ -1295,7 +1295,7 @@ sint CMeshMRMGeom::renderSkinGroupGeom(CMeshMRMInstance *mi, float alphaMRM, uin // Render the choosen Lod. CLod &lod= _Lods[numLod]; - if(lod.RdrPass.size()==0) + if(lod.RdrPass.empty()) // return no vertices added return 0; @@ -1942,7 +1942,7 @@ void CMeshMRMGeom::loadFirstLod(NLMISC::IStream &f) // If empty MRM, quit. - if(_LodInfos.size()==0) + if(_LodInfos.empty()) return; /* If the version is <4, then SkinWeights are serialised per Lod. @@ -2431,7 +2431,7 @@ void CMeshMRMGeom::compileRunTime() _PreciseClipping= _BBox.getRadius() >= NL3D_MESH_PRECISE_CLIP_THRESHOLD; // Compute if can support SkinGrouping rendering - if(_Lods.size()==0 || !_Skinned) + if(_Lods.empty() || !_Skinned) { _SupportSkinGrouping= false; _SupportShadowSkinGrouping= false; @@ -2451,7 +2451,7 @@ void CMeshMRMGeom::compileRunTime() } // Support MeshBlockRendering only if not skinned/meshMorphed. - _SupportMeshBlockRendering= !_Skinned && _MeshMorpher.BlendShapes.size()==0; + _SupportMeshBlockRendering= !_Skinned && _MeshMorpher.BlendShapes.empty(); // \todo yoyo: support later MeshVertexProgram _SupportMeshBlockRendering= _SupportMeshBlockRendering && _MeshVertexProgram==NULL; @@ -3367,7 +3367,7 @@ void CMeshMRMGeom::updateRawSkinNormal(bool enabled, CMeshMRMInstance *mi, sint // Case of MeshMorpher //======== - if(_MeshMorpher.BlendShapes.size()>0) + if(!_MeshMorpher.BlendShapes.empty()) { skinLod.VertexRemap.resize((uint32)vertexFinalRemap.size()); diff --git a/code/nel/src/3d/mesh_mrm_skin.cpp b/code/nel/src/3d/mesh_mrm_skin.cpp index 23ff04fee..7bba5d370 100644 --- a/code/nel/src/3d/mesh_mrm_skin.cpp +++ b/code/nel/src/3d/mesh_mrm_skin.cpp @@ -55,7 +55,7 @@ namespace NL3D void CMeshMRMGeom::applySkin(CLod &lod, const CSkeletonModel *skeleton) { nlassert(_Skinned); - if(_SkinWeights.size()==0) + if(_SkinWeights.empty()) return; // get vertexPtr. diff --git a/code/nel/src/3d/mesh_mrm_skin_template.cpp b/code/nel/src/3d/mesh_mrm_skin_template.cpp index 4a9e11106..63a0b67e8 100644 --- a/code/nel/src/3d/mesh_mrm_skin_template.cpp +++ b/code/nel/src/3d/mesh_mrm_skin_template.cpp @@ -380,7 +380,7 @@ static void applyArraySkinTangentSpaceT(uint numMatrixes, uint32 *infPtr, CMesh: void CMeshMRMGeom::applySkinWithNormal(CLod &lod, const CSkeletonModel *skeleton) { nlassert(_Skinned); - if(_SkinWeights.size()==0) + if(_SkinWeights.empty()) return; // get vertexPtr / normalOff. @@ -446,7 +446,7 @@ void CMeshMRMGeom::applySkinWithTangentSpace(CLod &lod, const CSkeletonModel *sk uint tangentSpaceTexCoord) { nlassert(_Skinned); - if(_SkinWeights.size()==0) + if(_SkinWeights.empty()) return; // get vertexPtr / normalOff / tangent space offset. @@ -1468,7 +1468,7 @@ void CMeshMRMGeom::applyArrayRawSkinNormal4(CRawVertexNormalSkin4 *src, uint8 * void CMeshMRMGeom::applyRawSkinWithNormal(CLod &lod, CRawSkinNormalCache &rawSkinLod, const CSkeletonModel *skeleton, uint8 *vbHard, float alphaLod) { nlassert(_Skinned); - if(_SkinWeights.size()==0) + if(_SkinWeights.empty()) return; // Some assert diff --git a/code/nel/src/3d/mesh_mrm_skinned.cpp b/code/nel/src/3d/mesh_mrm_skinned.cpp index 6af29bf73..11a1b41fc 100644 --- a/code/nel/src/3d/mesh_mrm_skinned.cpp +++ b/code/nel/src/3d/mesh_mrm_skinned.cpp @@ -160,7 +160,7 @@ void CMeshMRMSkinnedGeom::CLod::buildPrimitiveBlock(uint renderPass, const CInde static NLMISC::CAABBoxExt makeBBox(const std::vector<CVector> &Vertices) { NLMISC::CAABBox ret; - nlassert(Vertices.size()); + nlassert(!Vertices.empty()); ret.setCenter(Vertices[0]); for(sint i=0;i<(sint)Vertices.size();i++) { @@ -211,7 +211,7 @@ void CMeshMRMSkinnedGeom::build(CMesh::CMeshBuild &m, uint numMaxMaterial, const CMRMParameters ¶ms) { // Empty geometry? - if(m.Vertices.size()==0 || m.Faces.size()==0) + if(m.Vertices.empty() || m.Faces.empty()) { _VBufferFinal.clear(); _Lods.clear(); @@ -261,7 +261,7 @@ void CMeshMRMSkinnedGeom::build(CMesh::CMeshBuild &m, _LevelDetail.MaxFaceUsed= 0; _LevelDetail.MinFaceUsed= 0; // Count of primitive block - if(_Lods.size()>0) + if(!_Lods.empty()) { uint pb; // Compute MinFaces. @@ -421,7 +421,7 @@ void CMeshMRMSkinnedGeom::applyGeomorph(std::vector<CMRMWedgeGeom> &geoms, floa void CMeshMRMSkinnedGeom::applyGeomorphWithVBHardPtr(std::vector<CMRMWedgeGeom> &geoms, float alphaLod) { // no geomorphs? quit. - if(geoms.size()==0) + if(geoms.empty()) return; clamp(alphaLod, 0.f, 1.f); @@ -579,7 +579,7 @@ inline sint CMeshMRMSkinnedGeom::chooseLod(float alphaMRM, float &alphaLod) void CMeshMRMSkinnedGeom::render(IDriver *drv, CTransformShape *trans, float polygonCount, uint32 rdrFlags, float globalAlpha) { nlassert(drv); - if(_Lods.size()==0) + if(_Lods.empty()) return; @@ -597,7 +597,7 @@ void CMeshMRMSkinnedGeom::render(IDriver *drv, CTransformShape *trans, float pol // Render the choosen Lod. CLod &lod= _Lods[numLod]; - if(lod.RdrPass.size()==0) + if(lod.RdrPass.empty()) return; @@ -757,7 +757,7 @@ sint CMeshMRMSkinnedGeom::renderSkinGroupGeom(CMeshMRMSkinnedInstance *mi, float // Render the choosen Lod. CLod &lod= _Lods[numLod]; - if(lod.RdrPass.size()==0) + if(lod.RdrPass.empty()) // return no vertices added return 0; diff --git a/code/nel/src/3d/mrm_builder.cpp b/code/nel/src/3d/mrm_builder.cpp index 1002436d7..3035aa78b 100644 --- a/code/nel/src/3d/mrm_builder.cpp +++ b/code/nel/src/3d/mrm_builder.cpp @@ -3119,7 +3119,7 @@ bool CMRMBuilder::buildMRMSewingMeshes(const CMesh::CMeshBuild &mbuild, uint nWa { nlassert(nWantedLods>=1); nlassert(divisor>=1); - if(mbuild.Interfaces.size()==0) + if(mbuild.Interfaces.empty()) return false; // must have same size if(mbuild.InterfaceLinks.size()!=mbuild.Vertices.size()) diff --git a/code/nel/src/3d/patch.cpp b/code/nel/src/3d/patch.cpp index 799e5b8a3..4b0253ead 100644 --- a/code/nel/src/3d/patch.cpp +++ b/code/nel/src/3d/patch.cpp @@ -604,7 +604,8 @@ void CPatch::addRefTessBlocks() uint i; TessBlockRefCount++; - if(TessBlocks.size()==0) + + if (TessBlocks.empty()) { // Allocate the tessblocks. //========== @@ -1629,7 +1630,7 @@ void CPatch::serial(NLMISC::IStream &f) // then just copy to TileColors. TileColors.resize(tmpArray.size()); - if(TileColors.size()>0) + if(!TileColors.empty()) { memcpy(&TileColors[0], &tmpArray[0], TileColors.size()*sizeof(CTileColor)); } diff --git a/code/nel/src/3d/patch_render.cpp b/code/nel/src/3d/patch_render.cpp index bc74648d3..ee916a3fe 100644 --- a/code/nel/src/3d/patch_render.cpp +++ b/code/nel/src/3d/patch_render.cpp @@ -1452,7 +1452,7 @@ void CPatch::computeSoftwareGeomorphAndAlpha() // Need only to fill CTessVertex, so do it only for FarVertices // Hence Geomorph is done twice on edges of patches!!. // If not too near for precise, fast compute of geomorph. - if( TessBlocks.size()==0 ) + if( TessBlocks.empty() ) { // Just update all vertices of master block. computeGeomorphVertexList(MasterBlock.FarVertexList); diff --git a/code/nel/src/3d/patchdlm_context.cpp b/code/nel/src/3d/patchdlm_context.cpp index 53d580e66..f7d2236e8 100644 --- a/code/nel/src/3d/patchdlm_context.cpp +++ b/code/nel/src/3d/patchdlm_context.cpp @@ -540,7 +540,7 @@ bool CPatchDLMContext::generate(CPatch *patch, CTextureDLM *textureDLM, CPatch #ifndef NL_DLM_TILE_RES // retrieve patch tileColor pointer. - nlassert(_Patch->TileColors.size()>0); + nlassert(!_Patch->TileColors.empty()); CTileColor *tileColor= &_Patch->TileColors[0]; // skip 1 tiles colors per column and per row @@ -898,7 +898,7 @@ void CPatchDLMContext::compileLighting(TCompileType compType, CRGBA modulateCt if(! (_IsSrcTextureFullBlack && _IsDstTextureFullBlack) ) { // if lightMap allocated - if(_LightMap.size()>0 && _DLMTexture) + if(!_LightMap.empty() && _DLMTexture) { // If the srcTexture is full black (ie no pointLight influence touch it), if(_IsSrcTextureFullBlack) diff --git a/code/nel/src/3d/ps_face.cpp b/code/nel/src/3d/ps_face.cpp index 63909287d..e87459acf 100644 --- a/code/nel/src/3d/ps_face.cpp +++ b/code/nel/src/3d/ps_face.cpp @@ -226,7 +226,7 @@ void CPSFace::step(TPSProcessPass pass) else if (pass == PSMotion) { - if (_PrecompBasis.size()) // do we use precomputed basis ? + if (!_PrecompBasis.empty()) // do we use precomputed basis ? { // rotate all precomputed basis for (CPSVector< CPlaneBasisPair >::V::iterator it = _PrecompBasis.begin(); it != _PrecompBasis.end(); ++it) @@ -394,7 +394,7 @@ void CPSFace::deleteElement(uint32 index) NL_PS_FUNC(CPSFace_deleteElement) CPSQuad::deleteElement(index); deletePlaneBasisElement(index); - if (_PrecompBasis.size()) // do we use precomputed basis ? + if (!_PrecompBasis.empty()) // do we use precomputed basis ? { // replace ourself by the last element... _IndexInPrecompBasis[index] = _IndexInPrecompBasis[_Owner->getSize() - 1]; @@ -407,7 +407,7 @@ void CPSFace::resize(uint32 size) NL_PS_FUNC(CPSFace_resize) nlassert(size < (1 << 16)); resizePlaneBasis(size); - if (_PrecompBasis.size()) // do we use precomputed basis ? + if (!_PrecompBasis.empty()) // do we use precomputed basis ? { _IndexInPrecompBasis.resize(size); } diff --git a/code/nel/src/3d/ps_mesh.cpp b/code/nel/src/3d/ps_mesh.cpp index f473a79ee..5002f0054 100644 --- a/code/nel/src/3d/ps_mesh.cpp +++ b/code/nel/src/3d/ps_mesh.cpp @@ -1994,7 +1994,7 @@ void CPSConstraintMesh::deleteElement(uint32 index) deleteSizeElement(index); deletePlaneBasisElement(index); // TODO : avoid code cuplication with CPSFace ... - if (_PrecompBasis.size()) // do we use precomputed basis ? + if (!_PrecompBasis.empty()) // do we use precomputed basis ? { // replace ourself by the last element... _IndexInPrecompBasis[index] = _IndexInPrecompBasis[_Owner->getSize() - 1]; @@ -2011,7 +2011,7 @@ void CPSConstraintMesh::resize(uint32 size) resizeSize(size); resizePlaneBasis(size); // TODO : avoid code cuplication with CPSFace ... - if (_PrecompBasis.size()) // do we use precomputed basis ? + if (!_PrecompBasis.empty()) // do we use precomputed basis ? { _IndexInPrecompBasis.resize(size); } diff --git a/code/nel/src/3d/quad_effect.cpp b/code/nel/src/3d/quad_effect.cpp index 8b40a786c..a6c75c99d 100644 --- a/code/nel/src/3d/quad_effect.cpp +++ b/code/nel/src/3d/quad_effect.cpp @@ -229,7 +229,7 @@ void CQuadEffect::processPoly(const TPoint2DVect &poly static TRasters rDest; float currY; makeRasters(poly, quadWidth, quadHeight, rDest, currY); - if (dest.size()) + if (!dest.empty()) { TRasters::const_iterator it, endIt = rDest.end(); for (it = rDest.begin(); it != endIt; ++it) diff --git a/code/nel/src/3d/shadow_map_manager.cpp b/code/nel/src/3d/shadow_map_manager.cpp index 0c9f7ba8b..e3f8fde99 100644 --- a/code/nel/src/3d/shadow_map_manager.cpp +++ b/code/nel/src/3d/shadow_map_manager.cpp @@ -705,7 +705,7 @@ void CShadowMapManager::renderProject(CScene *scene) } driver->activeVertexBuffer (CopyQuads); - if (_ShadowCasters.size()>0) + if (!_ShadowCasters.empty()) { // get the transform to compute shadow map. CTransform *sc= _ShadowCasters[0]; diff --git a/code/nel/src/3d/texture_dlm.cpp b/code/nel/src/3d/texture_dlm.cpp index 2c8603859..3e7695936 100644 --- a/code/nel/src/3d/texture_dlm.cpp +++ b/code/nel/src/3d/texture_dlm.cpp @@ -119,7 +119,7 @@ bool CTextureDLM::canCreateLightMap(uint w, uint h) return true; // If empty, test if there is an empty block. - return _EmptyBlocks.size()>0; + return !_EmptyBlocks.empty(); } @@ -166,7 +166,7 @@ bool CTextureDLM::createLightMap(uint w, uint h, uint &x, uint &y) if(_FreeBlocks[lMapType]==NULL) { // list is empty => allocate a block from _EmptyBlocks. - nlassert(_EmptyBlocks.size()>0); + nlassert(!_EmptyBlocks.empty()); // pop a block from empty list CBlock *block= &_Blocks[_EmptyBlocks.back()]; diff --git a/code/nel/src/3d/tile_bank.cpp b/code/nel/src/3d/tile_bank.cpp index 4c1ba1c23..d4e26ab06 100644 --- a/code/nel/src/3d/tile_bank.cpp +++ b/code/nel/src/3d/tile_bank.cpp @@ -108,7 +108,7 @@ void CTileBank::serial(NLMISC::IStream &f) throw(NLMISC::EStream) if (f.isReading()) { // Checks - nlassert (_DisplacementMap.size()>0); + nlassert (!_DisplacementMap.empty()); // Set first empty _DisplacementMap[0].setEmpty (); @@ -543,7 +543,7 @@ CTileNoiseMap *CTileBank::getTileNoiseMap (uint tileNumber, uint tileSubNoise) } } - if (_DisplacementMap.size()==0 || _DisplacementMap[0]._TileNoiseMap) + if (_DisplacementMap.empty() || _DisplacementMap[0]._TileNoiseMap) return NULL; // Checks diff --git a/code/nel/src/3d/vegetable_blend_layer_model.cpp b/code/nel/src/3d/vegetable_blend_layer_model.cpp index a1df0d89d..44754add2 100644 --- a/code/nel/src/3d/vegetable_blend_layer_model.cpp +++ b/code/nel/src/3d/vegetable_blend_layer_model.cpp @@ -71,7 +71,7 @@ void CVegetableBlendLayerModel::render(IDriver *driver) nlassert(VegetableManager); - if(SortBlocks.size()==0) + if(SortBlocks.empty()) return; // Setup VegetableManager renderState (like pre-setuped material) diff --git a/code/nel/src/3d/vegetable_manager.cpp b/code/nel/src/3d/vegetable_manager.cpp index 640d5e77f..e479a5e62 100644 --- a/code/nel/src/3d/vegetable_manager.cpp +++ b/code/nel/src/3d/vegetable_manager.cpp @@ -1019,12 +1019,12 @@ void CVegetableManager::reserveIgCompile(CVegetableInstanceGroup *ig, const CV { CVegetableInstanceGroup::CVegetableRdrPass &vegetRdrPass= ig->_RdrPass[rdrPass]; nlassert(vegetRdrPass.TriangleIndices.getNumIndexes()==0); - nlassert(vegetRdrPass.TriangleLocalIndices.size()==0); - nlassert(vegetRdrPass.Vertices.size()==0); - nlassert(vegetRdrPass.LightedInstances.size()==0); + nlassert(vegetRdrPass.TriangleLocalIndices.empty()); + nlassert(vegetRdrPass.Vertices.empty()); + nlassert(vegetRdrPass.LightedInstances.empty()); } // Do the same for all quadrants of the zsort rdrPass. - nlassert(ig->_TriangleQuadrantOrderArray.size()==0); + nlassert(ig->_TriangleQuadrantOrderArray.empty()); nlassert(ig->_TriangleQuadrantOrderNumTriangles==0); @@ -2553,7 +2553,7 @@ bool CVegetableManager::updateLightingIGPart() } CVegetableInstanceGroup::CVegetableRdrPass &vegetRdrPass= _ULRootIg->_RdrPass[_ULCurrentIgRdrPass]; - // if all instances are processed for this pass (especially if size()==0 !!) + // if all instances are processed for this pass (especially if empty() !!) if(_ULCurrentIgInstance>= vegetRdrPass.LightedInstances.size()) { // skip to the next rdrPass. diff --git a/code/nel/src/3d/vegetablevb_allocator.cpp b/code/nel/src/3d/vegetablevb_allocator.cpp index 29a03b51d..f5c833d8a 100644 --- a/code/nel/src/3d/vegetablevb_allocator.cpp +++ b/code/nel/src/3d/vegetablevb_allocator.cpp @@ -186,7 +186,7 @@ bool CVegetableVBAllocator::exceedMaxVertexInBufferHard(uint numAddVerts) cons uint CVegetableVBAllocator::allocateVertex() { // if no more free, allocate. - if( _VertexFreeMemory.size()==0 ) + if( _VertexFreeMemory.empty() ) { // enlarge capacity. uint newResize; diff --git a/code/nel/src/3d/water_model.cpp b/code/nel/src/3d/water_model.cpp index fb53100cb..e6ae132e1 100644 --- a/code/nel/src/3d/water_model.cpp +++ b/code/nel/src/3d/water_model.cpp @@ -500,7 +500,7 @@ void CWaterModel::traverseRender() sint startY; projPoly.computeBorders(rasters, startY); - if (rasters.size()) + if (!rasters.empty()) { //===========================// // perform Water animation // diff --git a/code/nel/src/3d/zone.cpp b/code/nel/src/3d/zone.cpp index c601f0fa4..263c61539 100644 --- a/code/nel/src/3d/zone.cpp +++ b/code/nel/src/3d/zone.cpp @@ -1126,7 +1126,7 @@ void CZone::refineAll() { nlassert(Compiled); - if(Patchs.size()==0) + if(Patchs.empty()) return; // DO NOT do a forceNoRenderClip(), to avoid big allocation of Near/Far VB vertices in driver. @@ -1150,7 +1150,7 @@ void CZone::averageTesselationVertices() { nlassert(Compiled); - if(Patchs.size()==0) + if(Patchs.empty()) return; // averageTesselationVertices of ALL patchs. @@ -1250,8 +1250,10 @@ void CZone::resetRenderFarAndDeleteVBFV() void CZone::forceMergeAtTileLevel() { CPatch *pPatch=0; - if(Patchs.size()>0) + + if (!Patchs.empty()) pPatch= &(*Patchs.begin()); + for(sint n=(sint)Patchs.size();n>0;n--, pPatch++) { pPatch->forceMergeAtTileLevel(); @@ -1446,7 +1448,7 @@ void CZone::applyHeightField(const CLandscape &landScape) vector<CBezierPatch> patchs; // no patch, do nothing. - if(Patchs.size()==0) + if(Patchs.empty()) return; // 0. Unpack patchs to Bezier Patchs. diff --git a/code/nel/src/3d/zone_lighter.cpp b/code/nel/src/3d/zone_lighter.cpp index f5549e66a..c70ad0ba2 100644 --- a/code/nel/src/3d/zone_lighter.cpp +++ b/code/nel/src/3d/zone_lighter.cpp @@ -3113,7 +3113,7 @@ void CZoneLighter::addWaterShape(CWaterShape *shape, const NLMISC::CMatrix &MT) // *********************************************************** void CZoneLighter::makeQuadGridFromWaterShapes(NLMISC::CAABBox zoneBBox) { - if (!_WaterShapes.size()) return; + if (_WaterShapes.empty()) return; NLMISC::CAABBox tmpBox; diff --git a/code/nel/src/gui/group_header.cpp b/code/nel/src/gui/group_header.cpp index d166b539b..908aa183e 100644 --- a/code/nel/src/gui/group_header.cpp +++ b/code/nel/src/gui/group_header.cpp @@ -159,7 +159,7 @@ namespace NLGUI } // resize H - if(entries.size()>0) + if (!entries.empty()) { CInterfaceGroup *colEnclosing = entries[0]->getTargetColumn(); if (colEnclosing && !colEnclosing->getGroups().empty()) diff --git a/code/nel/src/gui/group_tab.cpp b/code/nel/src/gui/group_tab.cpp index ca876c25e..69ccce046 100644 --- a/code/nel/src/gui/group_tab.cpp +++ b/code/nel/src/gui/group_tab.cpp @@ -262,7 +262,7 @@ namespace NLGUI { tabB->setId(string("tab") + NLMISC::toString(_Buttons.size())); - if(_Buttons.size()==0) + if(_Buttons.empty()) { tabB->setParentPos(NULL); tabB->setParentPosRef(Hotspot_TL); @@ -453,7 +453,7 @@ namespace NLGUI // *************************************************************************** void CGroupTab::updateFirstTabButton() { - if(!_HideOutTabs || (_Selection<0) || (_Buttons.size()==0) || (_Parent->getWReal()<0) + if(!_HideOutTabs || (_Selection<0) || _Buttons.empty() || (_Parent->getWReal()<0) || _FirstTabIndex>=(sint)_Buttons.size()) return; diff --git a/code/nel/src/gui/interface_parser.cpp b/code/nel/src/gui/interface_parser.cpp index 739e807c8..068d827bf 100644 --- a/code/nel/src/gui/interface_parser.cpp +++ b/code/nel/src/gui/interface_parser.cpp @@ -193,7 +193,7 @@ namespace NLGUI xmlKeepBlanksDefault(0); //parse all interface files and build a single xml document xmlNodePtr globalEnclosing; - nlassert (strings.size()); + nlassert (!strings.empty()); CIXml read; string nextFileName; static const char *SCRIPT_AS_STRING = "<script as string>"; diff --git a/code/nel/src/ligo/primitive.cpp b/code/nel/src/ligo/primitive.cpp index ba9b69435..3fc97fdf5 100644 --- a/code/nel/src/ligo/primitive.cpp +++ b/code/nel/src/ligo/primitive.cpp @@ -1218,7 +1218,7 @@ const IPrimitive *IPrimitive::getPrimitive (const std::string &absoluteOrRelativ path.erase(0,2); } - while (path.size()>0) + while (!path.empty()) { if (path.find("/")==0) { diff --git a/code/nel/src/misc/cdb_branch.cpp b/code/nel/src/misc/cdb_branch.cpp index 627c1f38b..55b36a645 100644 --- a/code/nel/src/misc/cdb_branch.cpp +++ b/code/nel/src/misc/cdb_branch.cpp @@ -278,7 +278,7 @@ ICDBNode * CCDBNodeBranch::getNode (const CTextId& id, bool bCreate) { // Yoyo: must not be SERVER or LOCAL, cause definied through xml. // This may cause some important crash error - //nlassert(id.size()>0); + //nlassert(!id.empty()); //nlassert(id.getElement(0)!="SERVER"); //nlassert(id.getElement(0)!="LOCAL"); ICDBNode *newNode; diff --git a/code/nel/src/misc/polygon.cpp b/code/nel/src/misc/polygon.cpp index b541d2eba..9388dbd45 100644 --- a/code/nel/src/misc/polygon.cpp +++ b/code/nel/src/misc/polygon.cpp @@ -105,7 +105,7 @@ void CPolygon::clip(const CPlane *planes, uint nPlanes) // *************************************************************************** void CPolygon::clip(const std::vector<CPlane> &planes) { - if(planes.size()==0) + if(planes.empty()) return; clip(&(*planes.begin()), (uint)planes.size()); } diff --git a/code/nel/src/misc/system_utils.cpp b/code/nel/src/misc/system_utils.cpp index de23db001..32fed9344 100644 --- a/code/nel/src/misc/system_utils.cpp +++ b/code/nel/src/misc/system_utils.cpp @@ -139,7 +139,7 @@ bool CSystemUtils::updateProgressBar(uint value, uint total) bool CSystemUtils::copyTextToClipboard(const ucstring &text) { - if (!text.size()) return false; + if (text.empty()) return false; bool res = false; diff --git a/code/nel/src/net/admin.cpp b/code/nel/src/net/admin.cpp index 72794dd0f..89981a697 100644 --- a/code/nel/src/net/admin.cpp +++ b/code/nel/src/net/admin.cpp @@ -430,7 +430,7 @@ void serviceGetView (uint32 rid, const string &rawvarpath, TAdminViewResult &ans else { - if (strs.size()>0) + if (!strs.empty()) { str = strs[0].substr(0,strs[0].size()-1); // replace all spaces into udnerscore because space is a reserved char @@ -717,7 +717,7 @@ void updateAdmin() ICommand::execute(Alarms[i].Name, logDisplayVars, true, false); const std::deque<std::string> &strs = mdDisplayVars.lockStrings(); - if (strs.size()>0) + if (!strs.empty()) { str = strs[0].substr(0,strs[0].size()-1); } diff --git a/code/nel/src/net/buf_sock.cpp b/code/nel/src/net/buf_sock.cpp index 8535435b0..c419e1aa2 100644 --- a/code/nel/src/net/buf_sock.cpp +++ b/code/nel/src/net/buf_sock.cpp @@ -155,7 +155,7 @@ bool CBufSock::flush( uint *nbBytesRemaining ) { SendFifo.front( tmpbuffer, size ); } - while ( ! SendFifo.empty() && ( (_ReadyToSendBuffer.size()==0) || (_ReadyToSendBuffer.size() +size < MaxTCPPacketSize) ) ) + while ( ! SendFifo.empty() && ( _ReadyToSendBuffer.empty() || (_ReadyToSendBuffer.size() +size < MaxTCPPacketSize) ) ) { // Compute the size and add it into the beginning of the buffer netlen = htonl( (TBlockSize)size ); @@ -252,7 +252,7 @@ bool CBufSock::flush( uint *nbBytesRemaining ) } } - while ( !SendFifo.empty() && _ReadyToSendBuffer.size()==0 ); + while ( !SendFifo.empty() && _ReadyToSendBuffer.empty() ); return true; } diff --git a/code/nel/src/net/login_client.cpp b/code/nel/src/net/login_client.cpp index 2e729f8ec..71ffc6825 100644 --- a/code/nel/src/net/login_client.cpp +++ b/code/nel/src/net/login_client.cpp @@ -288,7 +288,7 @@ string CLoginClient::confirmConnection(sint32 shardId) // S05: create and send the "CS" message with the shardid choice to the LS // - if (!ShardList.size()) + if (ShardList.empty()) { _LSCallbackClient->disconnect(); return "No shard available"; @@ -358,7 +358,7 @@ string CLoginClient::selectShardBegin(sint32 shardId) ShardChooseShardReason = ""; ShardChooseShard = false; - if (!ShardList.size()) + if (ShardList.empty()) { _LSCallbackClient->disconnect(); delete _LSCallbackClient; diff --git a/code/nel/src/net/naming_client.cpp b/code/nel/src/net/naming_client.cpp index 2cc89300a..a54fddaa0 100644 --- a/code/nel/src/net/naming_client.cpp +++ b/code/nel/src/net/naming_client.cpp @@ -420,7 +420,7 @@ bool CNamingClient::lookup (const std::string &name, CInetAddress &addr) vector<CInetAddress> addrs; find (name, addrs); - if (addrs.size()==0) + if (addrs.empty()) return false; nlassert (addrs.size()==1); @@ -436,7 +436,7 @@ bool CNamingClient::lookup (TServiceId sid, CInetAddress &addr) vector<CInetAddress> addrs; find (sid, addrs); - if (addrs.size()==0) + if (addrs.empty()) return false; nlassert (addrs.size()==1); @@ -465,7 +465,7 @@ bool CNamingClient::lookupAlternate (const std::string &name, CInetAddress &addr vector<CInetAddress> addrs; find (name, addrs); - if (addrs.size()==0) + if (addrs.empty()) return false; nlassert (addrs.size()==1); diff --git a/code/nel/src/net/service.cpp b/code/nel/src/net/service.cpp index e2db26bd5..989f94d81 100644 --- a/code/nel/src/net/service.cpp +++ b/code/nel/src/net/service.cpp @@ -1460,7 +1460,7 @@ sint IService::main (const char *serviceShortName, const char *serviceLongName, mdDisplayVars.clear (); ICommand::execute(varName, logDisplayVars, true); const std::deque<std::string> &strs = mdDisplayVars.lockStrings(); - if (strs.size()>0) + if (!strs.empty()) { str += strs[0].substr(0,strs[0].size()-1); } diff --git a/code/nel/src/sound/driver/openal/sound_driver_al.cpp b/code/nel/src/sound/driver/openal/sound_driver_al.cpp index 4aa358062..ab9574483 100644 --- a/code/nel/src/sound/driver/openal/sound_driver_al.cpp +++ b/code/nel/src/sound/driver/openal/sound_driver_al.cpp @@ -197,7 +197,7 @@ CSoundDriverAL::~CSoundDriverAL() // Remove the allocated (but not exported) source and buffer names- // Release internal resources of all remaining ISource instances - if (_Sources.size()) + if (!_Sources.empty()) { nlwarning("AL: _Sources.size(): '%u'", (uint32)_Sources.size()); set<CSourceAL *>::iterator it(_Sources.begin()), end(_Sources.end()); @@ -206,7 +206,7 @@ CSoundDriverAL::~CSoundDriverAL() } if (!_Buffers.empty()) alDeleteBuffers(compactAliveNames(_Buffers, alIsBuffer), &*_Buffers.begin()); // Release internal resources of all remaining IEffect instances - if (_Effects.size()) + if (!_Effects.empty()) { nlwarning("AL: _Effects.size(): '%u'", (uint32)_Effects.size()); set<CEffectAL *>::iterator it(_Effects.begin()), end(_Effects.end()); diff --git a/code/nel/src/sound/driver/openal/source_al.cpp b/code/nel/src/sound/driver/openal/source_al.cpp index 1f8d2219f..c13db52af 100644 --- a/code/nel/src/sound/driver/openal/source_al.cpp +++ b/code/nel/src/sound/driver/openal/source_al.cpp @@ -254,7 +254,7 @@ bool CSourceAL::play() if (!_IsPlaying) // set start time if not playing yet _StartTime = CTime::getLocalTime(); _IsPlaying = true; // this play always virtually succeed but may not actually be playing - if (_QueuedBuffers.size()) // ensure buffers have actually queued + if (!_QueuedBuffers.empty()) // ensure buffers have actually queued { alSourcePlay(_Source); if (alGetError() != AL_NO_ERROR) @@ -306,7 +306,7 @@ void CSourceAL::stop() alSourceStop(_Source); alTestError(); // unqueue buffers - while (_QueuedBuffers.size()) + while (!_QueuedBuffers.empty()) { ALuint bufferName = _QueuedBuffers.front()->bufferName(); alSourceUnqueueBuffers(_Source, 1, &bufferName); diff --git a/code/nel/src/sound/driver/xaudio2/sound_driver_xaudio2.cpp b/code/nel/src/sound/driver/xaudio2/sound_driver_xaudio2.cpp index d15f2f6aa..529954006 100644 --- a/code/nel/src/sound/driver/xaudio2/sound_driver_xaudio2.cpp +++ b/code/nel/src/sound/driver/xaudio2/sound_driver_xaudio2.cpp @@ -215,7 +215,7 @@ void CSoundDriverXAudio2::release() // the created instances must still be released by the user! // Release internal resources of all remaining ISource instances - if (_Sources.size()) + if (!_Sources.empty()) { nlwarning(NLSOUND_XAUDIO2_PREFIX "_Sources.size(): '%u'", (uint32)_Sources.size()); set<CSourceXAudio2 *>::iterator it(_Sources.begin()), end(_Sources.end()); @@ -223,7 +223,7 @@ void CSoundDriverXAudio2::release() _Sources.clear(); } // Release internal resources of all remaining IBuffer instances - if (_Buffers.size()) + if (!_Buffers.empty()) { nlwarning(NLSOUND_XAUDIO2_PREFIX "_Buffers.size(): '%u'", (uint32)_Buffers.size()); set<CBufferXAudio2 *>::iterator it(_Buffers.begin()), end(_Buffers.end()); @@ -231,7 +231,7 @@ void CSoundDriverXAudio2::release() _Buffers.clear(); } // Release internal resources of all remaining IEffect instances - if (_Effects.size()) + if (!_Effects.empty()) { nlwarning(NLSOUND_XAUDIO2_PREFIX "_Effects.size(): '%u'", (uint32)_Effects.size()); set<CEffectXAudio2 *>::iterator it(_Effects.begin()), end(_Effects.end()); diff --git a/code/ryzom/client/src/commands.cpp b/code/ryzom/client/src/commands.cpp index 59c2c9fa6..87e052cec 100644 --- a/code/ryzom/client/src/commands.cpp +++ b/code/ryzom/client/src/commands.cpp @@ -672,7 +672,7 @@ NLMISC_COMMAND(bugReport, "Call the bug report tool with dump", "<AddScreenshot> sys = "Language "+CI18N::getCurrentLanguageName().toString() +" "; - if (args.size()>0) + if (!args.empty()) { uint8 quality; fromString(args[0], quality); @@ -1205,9 +1205,9 @@ static bool talkInChan(uint32 nb,std::vector<std::string>args) { return false; } - if(args.size()>0) + if(!args.empty()) { - std::string tmp=""; + std::string tmp; std::vector<std::string>::const_iterator first(args.begin()),last(args.end()); for(;first!=last;++first) diff --git a/code/ryzom/client/src/interface_v3/action_handler_help.cpp b/code/ryzom/client/src/interface_v3/action_handler_help.cpp index 072d53591..dbd6d6ac1 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_help.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_help.cpp @@ -1604,7 +1604,7 @@ void getMagicBonus(CDBCtrlSheet *item, ucstring &itemText) } // append a \n before - if(mbInfo.size()) + if(!mbInfo.empty()) { // add spell level header ucstring spellRuleFmt= CI18N::get("uihelpItemMagicBonusHeader"); diff --git a/code/ryzom/client/src/interface_v3/action_phrase_faber.cpp b/code/ryzom/client/src/interface_v3/action_phrase_faber.cpp index a1506bd8b..d872f4553 100644 --- a/code/ryzom/client/src/interface_v3/action_phrase_faber.cpp +++ b/code/ryzom/client/src/interface_v3/action_phrase_faber.cpp @@ -105,7 +105,8 @@ void CActionPhraseFaber::launchFaberCastWindow(sint32 memoryLine, uint memoryIn // get the family of item plan (for selection) from the rootBrick. It is stored in the Property0. _FaberPlanBrickFamilies.clear(); - if(rootBrick->Properties.size()>0) + + if (!rootBrick->Properties.empty()) { string prop= NLMISC::toUpper(rootBrick->Properties[0].Text); vector<string> strList; diff --git a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index 423571000..abd85de83 100644 --- a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -639,8 +639,8 @@ void CDBCtrlSheet::initSheet(const std::string &dbBranchId, const CCtrlSheetInfo { H_AUTO ( RZ_CDBCtrlSheet_initSheet ) - nlassert((ctrlInfo._Type == SheetType_Macro) || (dbBranchId.size()>0)); - nlassert((ctrlInfo._Type == SheetType_Macro) || (_Id.size()>0)); + nlassert((ctrlInfo._Type == SheetType_Macro) || !dbBranchId.empty()); + nlassert((ctrlInfo._Type == SheetType_Macro) || !_Id.empty()); // init *static_cast<CCtrlSheetInfo*>(this)= ctrlInfo; diff --git a/code/ryzom/client/src/interface_v3/group_map.cpp b/code/ryzom/client/src/interface_v3/group_map.cpp index 667e900c4..6e1022e76 100644 --- a/code/ryzom/client/src/interface_v3/group_map.cpp +++ b/code/ryzom/client/src/interface_v3/group_map.cpp @@ -3021,7 +3021,7 @@ void CGroupMap::addRespawnPoints(const CRespawnPointsMsg &rpm) for (uint32 i = 0; i < rpm.RespawnPoints.size(); ++i) _RespawnPos.push_back(rpm.RespawnPoints[i]); // Ensure there is at least one respawn point -// nlassert(_RespawnPos.size()>0); +// nlassert(!_RespawnPos.empty()); // Choose the good map ! (select the first respawn point and check for first matching bounding box map if (_MapMode != MapMode_Death) return; diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index fab67d55e..2ff42b7e9 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -643,7 +643,7 @@ void CInterfaceManager::initLogin() ActionsContext.addActionsManager(&EditActions, RZ_CATEGORY_EDIT); - if (ClientCfg.XMLLoginInterfaceFiles.size()==0) + if (ClientCfg.XMLLoginInterfaceFiles.empty()) { nlinfo("no xml login config files in client.cfg"); return; @@ -729,7 +729,7 @@ void CInterfaceManager::initOutGame() //NLMEMORY::CheckHeap (true); - if (ClientCfg.XMLOutGameInterfaceFiles.size()==0) + if (ClientCfg.XMLOutGameInterfaceFiles.empty()) { nlinfo("no xml outgame config files in client.cfg"); return; @@ -889,7 +889,7 @@ void CInterfaceManager::initInGame() // NLMEMORY::CheckHeap (true); - if (ClientCfg.XMLInterfaceFiles.size()==0) + if (ClientCfg.XMLInterfaceFiles.empty()) { nlinfo("no xml config files in client.cfg"); return; diff --git a/code/ryzom/client/src/interface_v3/sphrase_manager.cpp b/code/ryzom/client/src/interface_v3/sphrase_manager.cpp index 0b96f77a3..09cc9b3fe 100644 --- a/code/ryzom/client/src/interface_v3/sphrase_manager.cpp +++ b/code/ryzom/client/src/interface_v3/sphrase_manager.cpp @@ -1346,7 +1346,7 @@ sint CSPhraseManager::getPhraseSuccessRate(const CSPhraseCom &phrase) CSBrickManager *pBM= CSBrickManager::getInstance(); CSkillManager *pSM= CSkillManager::getInstance(); - if(phrase.Bricks.size()==0) + if(phrase.Bricks.empty()) return 0; CSBrickSheet *rootBrick= pBM->getBrick(phrase.Bricks[0]); if(!rootBrick) @@ -1432,7 +1432,7 @@ sint CSPhraseManager::getCraftPhraseSuccessRate(const CSPhraseCom &phrase, SK { CSkillManager *pSM= CSkillManager::getInstance(); - if(phrase.Bricks.size()==0) + if(phrase.Bricks.empty()) return 0; // take skill value of the skill @@ -1450,7 +1450,7 @@ sint CSPhraseManager::getForageExtractionPhraseSuccessRate(const CSPhraseCom { CSkillManager *pSM= CSkillManager::getInstance(); - if(phrase.Bricks.size()==0) + if(phrase.Bricks.empty()) return 0; // take skill value of the skill @@ -1505,7 +1505,7 @@ void CSPhraseManager::getPhraseCastTime(const CSPhraseCom &phrase, uint32 tot castTime= 0; castTimeMalus= 0; - if(phrase.Bricks.size()==0) + if(phrase.Bricks.empty()) return; CSBrickSheet *rootBrick= pBM->getBrick(phrase.Bricks[0]); if(!rootBrick) @@ -1576,7 +1576,7 @@ void CSPhraseManager::getPhraseMagicRange(const CSPhraseCom &phrase, uint32 t range= 0; rangeMalus= 0; - if(phrase.Bricks.size()==0) + if(phrase.Bricks.empty()) return; CSBrickSheet *rootBrick= pBM->getBrick(phrase.Bricks[0]); if(!rootBrick) diff --git a/code/ryzom/client/src/login.cpp b/code/ryzom/client/src/login.cpp index 944a212e0..d29306202 100644 --- a/code/ryzom/client/src/login.cpp +++ b/code/ryzom/client/src/login.cpp @@ -978,7 +978,7 @@ bool login() void removeSpace(string &s) { uint i = 0; - while (s.size()>0) + while (!s.empty()) { if (s[i] == ' ') s.erase(i, 1); diff --git a/code/ryzom/client/src/login_patch.h b/code/ryzom/client/src/login_patch.h index 9407290e9..1de6f03f0 100644 --- a/code/ryzom/client/src/login_patch.h +++ b/code/ryzom/client/src/login_patch.h @@ -370,7 +370,7 @@ private: ServerPath = serverPath; Available = true; - if (ServerPath.size()>0 && ServerPath[ServerPath.size()-1] != '/') + if (!ServerPath.empty() && ServerPath[ServerPath.size()-1] != '/') ServerPath += '/'; std::string::size_type pos = ServerPath.find ("@"); diff --git a/code/ryzom/client/src/movie_shooter.cpp b/code/ryzom/client/src/movie_shooter.cpp index 27d26874e..0bf6015bf 100644 --- a/code/ryzom/client/src/movie_shooter.cpp +++ b/code/ryzom/client/src/movie_shooter.cpp @@ -111,7 +111,7 @@ bool CMovieShooter::addFrame(double time, UDriver *pDriver) nlassert(bitmap.getPixelFormat()==CBitmap::RGBA); // add the frame. - if(bitmap.getPixels().size()==0) + if(bitmap.getPixels().empty()) return false; return addFrame(time, (CRGBA*)(&bitmap.getPixels()[0]), bitmap.getWidth(), bitmap.getHeight()); } diff --git a/code/ryzom/client/src/net_manager.cpp b/code/ryzom/client/src/net_manager.cpp index ead456a81..0e9f09747 100644 --- a/code/ryzom/client/src/net_manager.cpp +++ b/code/ryzom/client/src/net_manager.cpp @@ -2499,7 +2499,7 @@ void impulseRemoteAdmin (NLMISC::CBitMemStream &impulse) } else { - if (strs.size()>0) + if (!strs.empty()) { str = strs[0].substr(0,strs[0].size()-1); // replace all spaces into underscore because space is a reserved char diff --git a/code/ryzom/client/src/r2/editor.cpp b/code/ryzom/client/src/r2/editor.cpp index 337e77828..93acc1d98 100644 --- a/code/ryzom/client/src/r2/editor.cpp +++ b/code/ryzom/client/src/r2/editor.cpp @@ -5808,7 +5808,7 @@ void CEditor::scenarioUpdated(CObject* highLevel, bool willTP, uint32 initialAct playerPos.y <= ci.YMin || playerPos.y >= ci.YMax) { - if(ci.EntryPoints.size()>0) + if(!ci.EntryPoints.empty()) { const CScenarioEntryPoints::CShortEntryPoint & shortEntryPoint = ci.EntryPoints[0]; CVector dest((float) shortEntryPoint.X, (float) shortEntryPoint.Y, 0.f); diff --git a/code/ryzom/client/src/r2/tool_pick.cpp b/code/ryzom/client/src/r2/tool_pick.cpp index 62b99eb26..cca373162 100644 --- a/code/ryzom/client/src/r2/tool_pick.cpp +++ b/code/ryzom/client/src/r2/tool_pick.cpp @@ -63,14 +63,14 @@ void CToolPick::setIgnoreInstances(const std::string & ignoreInstances) allKind = allKind.substr(e+1,allKind.size()); } - while(tmp.size()>0 && tmp[0]==' ') + while(!tmp.empty() && tmp[0]==' ') { if(tmp.size()==1) tmp=""; else tmp = tmp.substr(1,tmp.size()); } - while(tmp.size()>0 && tmp[tmp.size()]==' ') + while(!tmp.empty() && tmp[tmp.size()]==' ') { if(tmp.size()==1) tmp=""; @@ -98,7 +98,7 @@ void CToolPick::updateAfterRender() _CandidateInstance = NULL; CInstance *instanceUnder = checkInstanceUnderMouse(); bool ignoreInstanceUnder = false; - if(instanceUnder && _IgnoreInstances.size()>0) + if(instanceUnder && !_IgnoreInstances.empty()) { for(uint i=0; i<_IgnoreInstances.size(); i++) { diff --git a/code/ryzom/common/src/game_share/scenario_entry_points.cpp b/code/ryzom/common/src/game_share/scenario_entry_points.cpp index e97adb84c..51e3c56c3 100644 --- a/code/ryzom/common/src/game_share/scenario_entry_points.cpp +++ b/code/ryzom/common/src/game_share/scenario_entry_points.cpp @@ -425,7 +425,7 @@ void CScenarioEntryPoints::loadFromXMLFile() } - if(entryPoints.size()>0) + if(!entryPoints.empty()) { completeIsland.EntryPoints = entryPoints; _CompleteIslands.push_back(completeIsland);