diff --git a/.github/workflows/stale.yaml b/.github/workflows/stale.yaml
new file mode 100644
index 0000000000..82a9a968b9
--- /dev/null
+++ b/.github/workflows/stale.yaml
@@ -0,0 +1,24 @@
+name: Stale PRs
+on:
+ workflow_dispatch:
+ schedule:
+ - cron: 0 0 * * *
+
+permissions:
+ issues: write
+ pull-requests: write
+
+jobs:
+ stale:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/stale@v6
+ id: stale
+ with:
+ stale-pr-message: This pull request is stale because it has been open 60 days with no activity. Remove stale label or comment or it will be closed in 7 days
+ days-before-stale: 60
+ days-before-close: 7
+ exempt-pr-labels: blocked,must,should,keep
+ stale-pr-label: stale
+ - name: Print outputs
+ run: echo ${{ join(steps.stale.outputs.*, ',') }}
diff --git a/doc/contributions.txt b/doc/contributions.txt
index 2f073cdcc9..96b5857117 100755
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -496,6 +496,8 @@ Evangelista Emerald
Faelon Swordthain
Farallon Greyskin
VWR-2036
+Fawrsk
+ SL-18893
Feep Larsson
VWR-447
VWR-1314
@@ -588,6 +590,7 @@ Henri Beauchamp
VWR-1320
VWR-1406
VWR-4157
+ SL-15175
herina Bode
Hikkoshi Sakai
VWR-429
@@ -1178,6 +1181,10 @@ Ollie Kubrick
Orenj Marat
Orion Delphis
Oryx Tempel
+PanteraPolnocy
+ SL-18891
+ SL-18904
+ SL-18937
Parvati Silverweb
Patric Mills
VWR-2645
diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake
index 0dbb34e019..e9c0f75c09 100644
--- a/indra/cmake/Variables.cmake
+++ b/indra/cmake/Variables.cmake
@@ -194,9 +194,15 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# development must be done after the build as we do in viewer_manifest.py for
# released builds
# https://stackoverflow.com/a/54296008
+ # With Xcode 14.1, apparently you must take drastic steps to prevent
+ # implicit signing.
+ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED NO)
+ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED NO)
# "-" represents "Sign to Run Locally" and empty string represents "Do Not Sign"
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
-
+ set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "")
+ set(CMAKE_XCODE_ATTRIBUTE_DISABLE_MANUAL_TARGET_ORDER_BUILD_WARNING YES)
+ set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_64_TO_32_BIT_CONVERSION NO)
set(CMAKE_OSX_ARCHITECTURES "${ARCH}")
string(REPLACE "i686" "i386" CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
string(REPLACE "AMD64" "x86_64" CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp
index 44760810dc..7998942c2f 100644
--- a/indra/llappearance/llavatarappearance.cpp
+++ b/indra/llappearance/llavatarappearance.cpp
@@ -214,12 +214,10 @@ void LLAvatarAppearance::initInstance()
mRoot = createAvatarJoint();
mRoot->setName( "mRoot" );
- for (LLAvatarAppearanceDictionary::MeshEntries::const_iterator iter = sAvatarDictionary->getMeshEntries().begin();
- iter != sAvatarDictionary->getMeshEntries().end();
- ++iter)
+ for (const LLAvatarAppearanceDictionary::MeshEntries::value_type& mesh_pair : sAvatarDictionary->getMeshEntries())
{
- const EMeshIndex mesh_index = iter->first;
- const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = iter->second;
+ const EMeshIndex mesh_index = mesh_pair.first;
+ const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = mesh_pair.second;
LLAvatarJoint* joint = createAvatarJoint();
joint->setName(mesh_dict->mName);
joint->setMeshID(mesh_index);
@@ -260,30 +258,17 @@ void LLAvatarAppearance::initInstance()
//-------------------------------------------------------------------------
// associate baked textures with meshes
//-------------------------------------------------------------------------
- for (LLAvatarAppearanceDictionary::MeshEntries::const_iterator iter = sAvatarDictionary->getMeshEntries().begin();
- iter != sAvatarDictionary->getMeshEntries().end();
- ++iter)
+ for (const LLAvatarAppearanceDictionary::MeshEntries::value_type& mesh_pair : sAvatarDictionary->getMeshEntries())
{
- const EMeshIndex mesh_index = iter->first;
- const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = iter->second;
+ const EMeshIndex mesh_index = mesh_pair.first;
+ const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = mesh_pair.second;
const EBakedTextureIndex baked_texture_index = mesh_dict->mBakedID;
// Skip it if there's no associated baked texture.
if (baked_texture_index == BAKED_NUM_INDICES) continue;
- // FIRE-11915: Variable redefinition
- //for (avatar_joint_mesh_list_t::iterator iter = mMeshLOD[mesh_index]->mMeshParts.begin();
- // iter != mMeshLOD[mesh_index]->mMeshParts.end();
- // ++iter)
- //{
- // LLAvatarJointMesh* mesh = (*iter);
- // mBakedTextureDatas[(int)baked_texture_index].mJointMeshes.push_back(mesh);
- for (avatar_joint_mesh_list_t::iterator ajm_iter = mMeshLOD[mesh_index]->mMeshParts.begin();
- ajm_iter != mMeshLOD[mesh_index]->mMeshParts.end();
- ++ajm_iter)
+ for (LLAvatarJointMesh* mesh : mMeshLOD[mesh_index]->mMeshParts)
{
- LLAvatarJointMesh* mesh = (*ajm_iter);
mBakedTextureDatas[(S32)baked_texture_index].mJointMeshes.push_back(mesh);
- // FIRE-11915: Variable redefinition
}
}
@@ -305,10 +290,8 @@ LLAvatarAppearance::~LLAvatarAppearance()
delete_and_clear(mBakedTextureDatas[i].mTexLayerSet);
mBakedTextureDatas[i].mJointMeshes.clear();
- for (morph_list_t::iterator iter2 = mBakedTextureDatas[i].mMaskedMorphs.begin();
- iter2 != mBakedTextureDatas[i].mMaskedMorphs.end(); iter2++)
+ for (LLMaskedMorph* masked_morph : mBakedTextureDatas[i].mMaskedMorphs)
{
- LLMaskedMorph* masked_morph = (*iter2);
delete masked_morph;
}
}
@@ -322,11 +305,8 @@ LLAvatarAppearance::~LLAvatarAppearance()
std::for_each(mPolyMeshes.begin(), mPolyMeshes.end(), DeletePairedPointer());
mPolyMeshes.clear();
- for (avatar_joint_list_t::iterator jointIter = mMeshLOD.begin();
- jointIter != mMeshLOD.end();
- ++jointIter)
+ for (LLAvatarJoint* joint : mMeshLOD)
{
- LLAvatarJoint* joint = *jointIter;
std::for_each(joint->mMeshParts.begin(), joint->mMeshParts.end(), DeletePointer());
joint->mMeshParts.clear();
}
@@ -482,10 +462,9 @@ void LLAvatarAppearance::compareJointStateMaps(joint_state_map_t& last_state,
if (!last_state.empty() && (last_state != curr_state))
{
S32 diff_count = 0;
- joint_state_map_t::iterator it;
- for (it=last_state.begin(); it != last_state.end(); ++it)
+ for (joint_state_map_t::value_type& pair : last_state)
{
- const std::string& key = it->first;
+ const std::string& key = pair.first;
if (last_state[key] != curr_state[key])
{
LL_DEBUGS("AvatarBodySize") << "BodySize change " << key << " " << last_state[key] << "->" << curr_state[key] << LL_ENDL;
@@ -706,10 +685,8 @@ BOOL LLAvatarAppearance::setupBone(const LLAvatarBoneInfo* info, LLJoint* parent
// setup children
- LLAvatarBoneInfo::bones_t::const_iterator iter;
- for (iter = info->mChildren.begin(); iter != info->mChildren.end(); ++iter)
+ for (LLAvatarBoneInfo* child_info : info->mChildren)
{
- LLAvatarBoneInfo *child_info = *iter;
if (!setupBone(child_info, joint, volume_num, joint_num))
{
return FALSE;
@@ -762,10 +739,8 @@ BOOL LLAvatarAppearance::buildSkeleton(const LLAvatarSkeletonInfo *info)
S32 current_joint_num = 0;
S32 current_volume_num = 0;
- LLAvatarSkeletonInfo::bone_info_list_t::const_iterator iter;
- for (iter = info->mBoneInfoList.begin(); iter != info->mBoneInfoList.end(); ++iter)
+ for (LLAvatarBoneInfo* bone_info : info->mBoneInfoList)
{
- LLAvatarBoneInfo *bone_info = *iter;
if (!setupBone(bone_info, NULL, current_volume_num, current_joint_num))
{
LL_ERRS() << "Error parsing bone in skeleton file" << LL_ENDL;
@@ -843,14 +818,10 @@ void LLAvatarAppearance::buildCharacter()
//-------------------------------------------------------------------------
// clear mesh data
//-------------------------------------------------------------------------
- for (avatar_joint_list_t::iterator jointIter = mMeshLOD.begin();
- jointIter != mMeshLOD.end(); ++jointIter)
+ for (LLAvatarJoint* joint : mMeshLOD)
{
- LLAvatarJoint* joint = *jointIter;
- for (avatar_joint_mesh_list_t::iterator meshIter = joint->mMeshParts.begin();
- meshIter != joint->mMeshParts.end(); ++meshIter)
+ for (LLAvatarJointMesh* mesh : joint->mMeshParts)
{
- LLAvatarJointMesh * mesh = *meshIter;
mesh->setMesh(NULL);
}
}
@@ -1024,12 +995,8 @@ BOOL LLAvatarAppearance::loadAvatar()
}
// avatar_lad.xml :
- for (LLAvatarXmlInfo::morph_info_list_t::iterator iter = sAvatarXmlInfo->mMorphMaskInfoList.begin();
- iter != sAvatarXmlInfo->mMorphMaskInfoList.end();
- ++iter)
+ for (LLAvatarXmlInfo::LLAvatarMorphInfo* info : sAvatarXmlInfo->mMorphMaskInfoList)
{
- LLAvatarXmlInfo::LLAvatarMorphInfo *info = *iter;
-
EBakedTextureIndex baked = sAvatarDictionary->findBakedByRegionName(info->mRegion);
if (baked != BAKED_NUM_INDICES)
{
@@ -1048,11 +1015,8 @@ BOOL LLAvatarAppearance::loadAvatar()
loadLayersets();
// avatar_lad.xml :
- for (LLAvatarXmlInfo::driver_info_list_t::iterator iter = sAvatarXmlInfo->mDriverInfoList.begin();
- iter != sAvatarXmlInfo->mDriverInfoList.end();
- ++iter)
+ for (LLDriverParamInfo* info : sAvatarXmlInfo->mDriverInfoList)
{
- LLDriverParamInfo *info = *iter;
LLDriverParam* driver_param = new LLDriverParam( this );
if (driver_param->setInfo(info))
{
@@ -1084,11 +1048,8 @@ BOOL LLAvatarAppearance::loadSkeletonNode ()
mRoot->addChild( mSkeleton[0] );
// make meshes children before calling parent version of the function
- for (avatar_joint_list_t::iterator iter = mMeshLOD.begin();
- iter != mMeshLOD.end();
- ++iter)
+ for (LLAvatarJoint* joint : mMeshLOD)
{
- LLAvatarJoint *joint = *iter;
joint->mUpdateXform = FALSE;
joint->setMeshesToChildren();
}
@@ -1121,11 +1082,9 @@ BOOL LLAvatarAppearance::loadSkeletonNode ()
// SKELETAL DISTORTIONS
{
LLAvatarXmlInfo::skeletal_distortion_info_list_t::iterator iter;
- for (iter = sAvatarXmlInfo->mSkeletalDistortionInfoList.begin();
- iter != sAvatarXmlInfo->mSkeletalDistortionInfoList.end();
- ++iter)
+ for (LLViewerVisualParamInfo* visual_param_info : sAvatarXmlInfo->mSkeletalDistortionInfoList)
{
- LLPolySkeletalDistortionInfo *info = (LLPolySkeletalDistortionInfo*)*iter;
+ LLPolySkeletalDistortionInfo *info = (LLPolySkeletalDistortionInfo*)visual_param_info;
LLPolySkeletalDistortion *param = new LLPolySkeletalDistortion(this);
if (!param->setInfo(info))
{
@@ -1149,11 +1108,8 @@ BOOL LLAvatarAppearance::loadSkeletonNode ()
//-----------------------------------------------------------------------------
BOOL LLAvatarAppearance::loadMeshNodes()
{
- for (LLAvatarXmlInfo::mesh_info_list_t::const_iterator meshinfo_iter = sAvatarXmlInfo->mMeshInfoList.begin();
- meshinfo_iter != sAvatarXmlInfo->mMeshInfoList.end();
- ++meshinfo_iter)
+ for (const LLAvatarXmlInfo::LLAvatarMeshInfo* info : sAvatarXmlInfo->mMeshInfoList)
{
- const LLAvatarXmlInfo::LLAvatarMeshInfo *info = *meshinfo_iter;
const std::string &type = info->mType;
S32 lod = info->mLOD;
@@ -1165,12 +1121,10 @@ BOOL LLAvatarAppearance::loadMeshNodes()
switch(lod)
case 0:
mesh = &mHairMesh0; */
- for (LLAvatarAppearanceDictionary::MeshEntries::const_iterator mesh_iter = sAvatarDictionary->getMeshEntries().begin();
- mesh_iter != sAvatarDictionary->getMeshEntries().end();
- ++mesh_iter)
+ for (const LLAvatarAppearanceDictionary::MeshEntries::value_type& mesh_pair : sAvatarDictionary->getMeshEntries())
{
- const EMeshIndex mesh_index = mesh_iter->first;
- const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = mesh_iter->second;
+ const EMeshIndex mesh_index = mesh_pair.first;
+ const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = mesh_pair.second;
if (type.compare(mesh_dict->mName) == 0)
{
mesh_id = mesh_index;
@@ -1238,20 +1192,17 @@ BOOL LLAvatarAppearance::loadMeshNodes()
mesh->setMesh( poly_mesh );
mesh->setLOD( info->mMinPixelArea );
- for (LLAvatarXmlInfo::LLAvatarMeshInfo::morph_info_list_t::const_iterator xmlinfo_iter = info->mPolyMorphTargetInfoList.begin();
- xmlinfo_iter != info->mPolyMorphTargetInfoList.end();
- ++xmlinfo_iter)
+ for (const LLAvatarXmlInfo::LLAvatarMeshInfo::morph_info_pair_t& info_pair : info->mPolyMorphTargetInfoList)
{
- const LLAvatarXmlInfo::LLAvatarMeshInfo::morph_info_pair_t *info_pair = &(*xmlinfo_iter);
LLPolyMorphTarget *param = new LLPolyMorphTarget(mesh->getMesh());
- if (!param->setInfo((LLPolyMorphTargetInfo*)info_pair->first))
+ if (!param->setInfo((LLPolyMorphTargetInfo*)info_pair.first))
{
delete param;
return FALSE;
}
else
{
- if (info_pair->second)
+ if (info_pair.second)
{
addSharedVisualParam(param);
param->setParamLocation(isSelf() ? LOC_AV_SELF : LOC_AV_OTHER);
@@ -1274,11 +1225,8 @@ BOOL LLAvatarAppearance::loadMeshNodes()
BOOL LLAvatarAppearance::loadLayersets()
{
BOOL success = TRUE;
- for (LLAvatarXmlInfo::layer_info_list_t::const_iterator layerset_iter = sAvatarXmlInfo->mLayerInfoList.begin();
- layerset_iter != sAvatarXmlInfo->mLayerInfoList.end();
- ++layerset_iter)
+ for (LLTexLayerSetInfo* layerset_info : sAvatarXmlInfo->mLayerInfoList)
{
- LLTexLayerSetInfo *layerset_info = *layerset_iter;
if (isSelf())
{
// Construct a layerset for each one specified in avatar_lad.xml and initialize it as such.
@@ -1294,14 +1242,12 @@ BOOL LLAvatarAppearance::loadLayersets()
// scan baked textures and associate the layerset with the appropriate one
EBakedTextureIndex baked_index = BAKED_NUM_INDICES;
- for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = sAvatarDictionary->getBakedTextures().begin();
- baked_iter != sAvatarDictionary->getBakedTextures().end();
- ++baked_iter)
+ for (const LLAvatarAppearanceDictionary::BakedTextures::value_type& baked_pair : sAvatarDictionary->getBakedTextures())
{
- const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second;
+ const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_pair.second;
if (layer_set->isBodyRegion(baked_dict->mName))
{
- baked_index = baked_iter->first;
+ baked_index = baked_pair.first;
// ensure both structures are aware of each other
mBakedTextureDatas[baked_index].mTexLayerSet = layer_set;
layer_set->setBakedTexIndex(baked_index);
@@ -1317,11 +1263,8 @@ BOOL LLAvatarAppearance::loadLayersets()
}
// scan morph masks and let any affected layers know they have an associated morph
- for (LLAvatarAppearance::morph_list_t::const_iterator morph_iter = mBakedTextureDatas[baked_index].mMaskedMorphs.begin();
- morph_iter != mBakedTextureDatas[baked_index].mMaskedMorphs.end();
- ++morph_iter)
+ for (LLMaskedMorph* morph : mBakedTextureDatas[baked_index].mMaskedMorphs)
{
- LLMaskedMorph *morph = *morph_iter;
LLTexLayerInterface* layer = layer_set->findLayerByName(morph->mLayer);
if (layer)
{
@@ -1337,7 +1280,6 @@ BOOL LLAvatarAppearance::loadLayersets()
else // !isSelf()
{
// Construct a layerset for each one specified in avatar_lad.xml and initialize it as such.
- LLTexLayerSetInfo *layerset_info = *layerset_iter;
layerset_info->createVisualParams(this);
}
}
@@ -1772,13 +1714,13 @@ void LLAvatarAppearance::makeJointAliases(LLAvatarBoneInfo *bone_info)
boost::char_separator sep(" ");
boost::tokenizer > tok(aliases, sep);
- for(boost::tokenizer >::iterator i = tok.begin(); i != tok.end(); ++i)
+ for(const std::string& i : tok)
{
- if ( mJointAliasMap.find(*i) != mJointAliasMap.end() )
+ if ( mJointAliasMap.find(i) != mJointAliasMap.end() )
{
- LL_WARNS() << "avatar skeleton: Joint alias \"" << *i << "\" remapped from " << mJointAliasMap[*i] << " to " << bone_name << LL_ENDL;
+ LL_WARNS() << "avatar skeleton: Joint alias \"" << i << "\" remapped from " << mJointAliasMap[i] << " to " << bone_name << LL_ENDL;
}
- mJointAliasMap[*i] = bone_name;
+ mJointAliasMap[i] = bone_name;
}
for (LLAvatarBoneInfo* bone : bone_info->mChildren)
@@ -1793,21 +1735,14 @@ const LLAvatarAppearance::joint_alias_map_t& LLAvatarAppearance::getJointAliases
if (mJointAliasMap.empty())
{
- LLAvatarSkeletonInfo::bone_info_list_t::const_iterator iter;
- for (iter = sAvatarSkeletonInfo->mBoneInfoList.begin();
- iter != sAvatarSkeletonInfo->mBoneInfoList.end();
- ++iter)
+ for (LLAvatarBoneInfo* bone_info : sAvatarSkeletonInfo->mBoneInfoList)
{
//LLAvatarBoneInfo *bone_info = *iter;
- makeJointAliases( *iter );
+ makeJointAliases(bone_info);
}
- LLAvatarXmlInfo::attachment_info_list_t::iterator attach_iter;
- for (attach_iter = sAvatarXmlInfo->mAttachmentInfoList.begin();
- attach_iter != sAvatarXmlInfo->mAttachmentInfoList.end();
- ++attach_iter)
+ for (LLAvatarXmlInfo::LLAvatarAttachmentInfo* info : sAvatarXmlInfo->mAttachmentInfoList)
{
- LLAvatarXmlInfo::LLAvatarAttachmentInfo *info = *attach_iter;
std::string bone_name = info->mName;
// Also accept the name with spaces substituted with
diff --git a/indra/llappearance/llavatarappearance.h b/indra/llappearance/llavatarappearance.h
index f395b78605..3e3bb24ded 100644
--- a/indra/llappearance/llavatarappearance.h
+++ b/indra/llappearance/llavatarappearance.h
@@ -410,10 +410,9 @@ protected:
LLAvatarMeshInfo() : mLOD(0), mMinPixelArea(.1f) {}
~LLAvatarMeshInfo()
{
- morph_info_list_t::iterator iter;
- for (iter = mPolyMorphTargetInfoList.begin(); iter != mPolyMorphTargetInfoList.end(); iter++)
+ for (morph_info_list_t::value_type& pair : mPolyMorphTargetInfoList)
{
- delete iter->first;
+ delete pair.first;
}
mPolyMorphTargetInfoList.clear();
}
diff --git a/indra/llappearance/llavatarappearancedefines.cpp b/indra/llappearance/llavatarappearancedefines.cpp
index cde308430b..8df6e30e19 100644
--- a/indra/llappearance/llavatarappearancedefines.cpp
+++ b/indra/llappearance/llavatarappearancedefines.cpp
@@ -183,18 +183,15 @@ LLAvatarAppearanceDictionary::~LLAvatarAppearanceDictionary()
// map it to the baked texture.
void LLAvatarAppearanceDictionary::createAssociations()
{
- for (BakedTextures::const_iterator iter = mBakedTextures.begin(); iter != mBakedTextures.end(); iter++)
+ for (BakedTextures::value_type& baked_pair : mBakedTextures)
{
- const EBakedTextureIndex baked_index = (iter->first);
- const BakedEntry *dict = (iter->second);
+ const EBakedTextureIndex baked_index = baked_pair.first;
+ const BakedEntry *dict = baked_pair.second;
// For each texture that this baked texture index affects, associate those textures
// with this baked texture index.
- for (texture_vec_t::const_iterator local_texture_iter = dict->mLocalTextures.begin();
- local_texture_iter != dict->mLocalTextures.end();
- local_texture_iter++)
+ for (const ETextureIndex local_texture_index : dict->mLocalTextures)
{
- const ETextureIndex local_texture_index = (ETextureIndex) *local_texture_iter;
mTextures[local_texture_index]->mIsUsedByBakedTexture = true;
mTextures[local_texture_index]->mBakedTextureIndex = baked_index;
}
diff --git a/indra/llappearance/llavatarjoint.cpp b/indra/llappearance/llavatarjoint.cpp
index a1d4fe6423..9300b08b7b 100644
--- a/indra/llappearance/llavatarjoint.cpp
+++ b/indra/llappearance/llavatarjoint.cpp
@@ -100,10 +100,9 @@ void LLAvatarJoint::setValid( BOOL valid, BOOL recursive )
//----------------------------------------------------------------
if (recursive)
{
- for (joints_t::iterator iter = mChildren.begin();
- iter != mChildren.end(); ++iter)
+ for (LLJoint* child : mChildren)
{
- LLAvatarJoint* joint = static_cast(*iter);
+ LLAvatarJoint* joint = static_cast(child);
joint->setValid(valid, TRUE);
}
}
@@ -118,10 +117,9 @@ void LLAvatarJoint::setSkeletonComponents( U32 comp, BOOL recursive )
mComponents = comp;
if (recursive)
{
- for (joints_t::iterator iter = mChildren.begin();
- iter != mChildren.end(); ++iter)
+ for (auto child : mChildren)
{
- LLAvatarJoint* joint = static_cast(*iter);
+ LLAvatarJoint* joint = static_cast(child);
joint->setSkeletonComponents(comp, recursive);
}
}
@@ -133,10 +131,9 @@ void LLAvatarJoint::setVisible(BOOL visible, BOOL recursive)
if (recursive)
{
- for (joints_t::iterator iter = mChildren.begin();
- iter != mChildren.end(); ++iter)
+ for (LLJoint* child : mChildren)
{
- LLAvatarJoint* joint = static_cast(*iter);
+ LLAvatarJoint* joint = static_cast(child);
joint->setVisible(visible, recursive);
}
}
@@ -144,30 +141,27 @@ void LLAvatarJoint::setVisible(BOOL visible, BOOL recursive)
void LLAvatarJoint::updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area)
{
- for (joints_t::iterator iter = mChildren.begin();
- iter != mChildren.end(); ++iter)
+ for (LLJoint* child : mChildren)
{
- LLAvatarJoint* joint = static_cast(*iter);
+ LLAvatarJoint* joint = static_cast(child);
joint->updateFaceSizes(num_vertices, num_indices, pixel_area);
}
}
void LLAvatarJoint::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind, bool terse_update)
{
- for (joints_t::iterator iter = mChildren.begin();
- iter != mChildren.end(); ++iter)
+ for (LLJoint* child : mChildren)
{
- LLAvatarJoint* joint = static_cast(*iter);
+ LLAvatarJoint* joint = static_cast(child);
joint->updateFaceData(face, pixel_area, damp_wind, terse_update);
}
}
void LLAvatarJoint::updateJointGeometry()
{
- for (joints_t::iterator iter = mChildren.begin();
- iter != mChildren.end(); ++iter)
+ for (LLJoint* child : mChildren)
{
- LLAvatarJoint* joint = static_cast(*iter);
+ LLAvatarJoint* joint = static_cast(child);
joint->updateJointGeometry();
}
}
@@ -178,10 +172,9 @@ BOOL LLAvatarJoint::updateLOD(F32 pixel_area, BOOL activate)
BOOL lod_changed = FALSE;
BOOL found_lod = FALSE;
- for (joints_t::iterator iter = mChildren.begin();
- iter != mChildren.end(); ++iter)
+ for (LLJoint* child : mChildren)
{
- LLAvatarJoint* joint = static_cast(*iter);
+ LLAvatarJoint* joint = static_cast(child);
F32 jointLOD = joint->getLOD();
if (found_lod || jointLOD == DEFAULT_AVATAR_JOINT_LOD)
@@ -207,10 +200,9 @@ BOOL LLAvatarJoint::updateLOD(F32 pixel_area, BOOL activate)
void LLAvatarJoint::dump()
{
- for (joints_t::iterator iter = mChildren.begin();
- iter != mChildren.end(); ++iter)
+ for (LLJoint* child : mChildren)
{
- LLAvatarJoint* joint = static_cast(*iter);
+ LLAvatarJoint* joint = static_cast(child);
joint->dump();
}
}
@@ -219,10 +211,9 @@ void LLAvatarJoint::dump()
void LLAvatarJoint::setMeshesToChildren()
{
removeAllChildren();
- for (avatar_joint_mesh_list_t::iterator iter = mMeshParts.begin();
- iter != mMeshParts.end(); iter++)
+ for (LLAvatarJointMesh* mesh : mMeshParts)
{
- addChild((*iter));
+ addChild(mesh);
}
}
//-----------------------------------------------------------------------------
diff --git a/indra/llappearance/llavatarjointmesh.cpp b/indra/llappearance/llavatarjointmesh.cpp
index 0a23b1fda3..ed39f78d28 100644
--- a/indra/llappearance/llavatarjointmesh.cpp
+++ b/indra/llappearance/llavatarjointmesh.cpp
@@ -379,10 +379,9 @@ void LLAvatarJointMesh::setupJoint(LLAvatarJoint* current_joint)
}
// depth-first traversal
- for (LLJoint::joints_t::iterator iter = current_joint->mChildren.begin();
- iter != current_joint->mChildren.end(); ++iter)
+ for (LLJoint* joint : current_joint->mChildren)
{
- LLAvatarJoint* child_joint = (LLAvatarJoint*)(*iter);
+ LLAvatarJoint* child_joint = (LLAvatarJoint*)joint;
setupJoint(child_joint);
}
}
diff --git a/indra/llappearance/lldriverparam.cpp b/indra/llappearance/lldriverparam.cpp
index bebdb73ba1..0248f2c3ec 100644
--- a/indra/llappearance/lldriverparam.cpp
+++ b/indra/llappearance/lldriverparam.cpp
@@ -102,9 +102,8 @@ void LLDriverParamInfo::toStream(std::ostream &out)
LLViewerVisualParamInfo::toStream(out);
out << "driver" << "\t";
out << mDrivenInfoList.size() << "\t";
- for (entry_info_list_t::iterator iter = mDrivenInfoList.begin(); iter != mDrivenInfoList.end(); iter++)
+ for (LLDrivenEntryInfo& driven : mDrivenInfoList)
{
- LLDrivenEntryInfo driven = *iter;
out << driven.mDrivenID << "\t";
}
@@ -121,9 +120,8 @@ void LLDriverParamInfo::toStream(std::ostream &out)
if(mDriverParam && mDriverParam->getAvatarAppearance()->isSelf() &&
mDriverParam->getAvatarAppearance()->isValid())
{
- for (entry_info_list_t::iterator iter = mDrivenInfoList.begin(); iter != mDrivenInfoList.end(); iter++)
+ for (LLDrivenEntryInfo& driven : mDrivenInfoList)
{
- LLDrivenEntryInfo driven = *iter;
LLViewerVisualParam *param =
(LLViewerVisualParam*)mDriverParam->getAvatarAppearance()->getVisualParam(driven.mDrivenID);
if (param)
@@ -237,19 +235,19 @@ void LLDriverParam::setWeight(F32 weight, BOOL upload_bake)
//-------|----|-------|----|-------> driver
// | min1 max1 max2 min2
- for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
+ for(LLDrivenEntry& driven : mDriven)
{
- LLDrivenEntry* driven = &(*iter);
- LLDrivenEntryInfo* info = driven->mInfo;
+ LLDrivenEntry* drivenp = &driven;
+ LLDrivenEntryInfo* info = drivenp->mInfo;
F32 driven_weight = 0.f;
- F32 driven_min = driven->mParam->getMinWeight();
- F32 driven_max = driven->mParam->getMaxWeight();
+ F32 driven_min = drivenp->mParam->getMinWeight();
+ F32 driven_max = drivenp->mParam->getMaxWeight();
if (mIsAnimating)
{
// driven param doesn't interpolate (textures, for example)
- if (!driven->mParam->getAnimating())
+ if (!drivenp->mParam->getAnimating())
{
continue;
}
@@ -274,8 +272,8 @@ void LLDriverParam::setWeight(F32 weight, BOOL upload_bake)
}
// [Legacy Bake]
- //setDrivenWeight(driven,driven_weight);
- setDrivenWeight(driven,driven_weight,upload_bake);
+ //setDrivenWeight(drivenp,driven_weight);
+ setDrivenWeight(drivenp,driven_weight,upload_bake);
// [Legacy Bake]
continue;
}
@@ -301,27 +299,26 @@ void LLDriverParam::setWeight(F32 weight, BOOL upload_bake)
}
// [Legacy Bake]
- //setDrivenWeight(driven,driven_weight);
- setDrivenWeight(driven,driven_weight,upload_bake);
+ //setDrivenWeight(drivenp,driven_weight);
+ setDrivenWeight(drivenp,driven_weight,upload_bake);
// [Legacy Bake]
continue;
}
}
- driven_weight = getDrivenWeight(driven, mCurWeight);
+ driven_weight = getDrivenWeight(drivenp, mCurWeight);
// [Legacy Bake]
- //setDrivenWeight(driven,driven_weight);
- setDrivenWeight(driven,driven_weight, upload_bake);
+ //setDrivenWeight(drivenp,driven_weight);
+ setDrivenWeight(drivenp,driven_weight, upload_bake);
}
}
F32 LLDriverParam::getTotalDistortion()
{
F32 sum = 0.f;
- for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
+ for(LLDrivenEntry& driven : mDriven)
{
- LLDrivenEntry* driven = &(*iter);
- sum += driven->mParam->getTotalDistortion();
+ sum += driven.mParam->getTotalDistortion();
}
return sum;
@@ -333,10 +330,9 @@ const LLVector4a &LLDriverParam::getAvgDistortion()
LLVector4a sum;
sum.clear();
S32 count = 0;
- for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
+ for(LLDrivenEntry& driven : mDriven)
{
- LLDrivenEntry* driven = &(*iter);
- sum.add(driven->mParam->getAvgDistortion());
+ sum.add(driven.mParam->getAvgDistortion());
count++;
}
sum.mul( 1.f/(F32)count);
@@ -348,10 +344,9 @@ const LLVector4a &LLDriverParam::getAvgDistortion()
F32 LLDriverParam::getMaxDistortion()
{
F32 max = 0.f;
- for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
+ for(LLDrivenEntry& driven : mDriven)
{
- LLDrivenEntry* driven = &(*iter);
- F32 param_max = driven->mParam->getMaxDistortion();
+ F32 param_max = driven.mParam->getMaxDistortion();
if( param_max > max )
{
max = param_max;
@@ -366,10 +361,9 @@ LLVector4a LLDriverParam::getVertexDistortion(S32 index, LLPolyMesh *poly_mesh)
{
LLVector4a sum;
sum.clear();
- for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
+ for(LLDrivenEntry& driven : mDriven)
{
- LLDrivenEntry* driven = &(*iter);
- sum.add(driven->mParam->getVertexDistortion( index, poly_mesh ));
+ sum.add(driven.mParam->getVertexDistortion(index, poly_mesh));
}
return sum;
}
@@ -378,13 +372,12 @@ const LLVector4a* LLDriverParam::getFirstDistortion(U32 *index, LLPolyMesh **pol
{
mCurrentDistortionParam = NULL;
const LLVector4a* v = NULL;
- for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
+ for(LLDrivenEntry& driven : mDriven)
{
- LLDrivenEntry* driven = &(*iter);
- v = driven->mParam->getFirstDistortion( index, poly_mesh );
+ v = driven.mParam->getFirstDistortion(index, poly_mesh);
if( v )
{
- mCurrentDistortionParam = driven->mParam;
+ mCurrentDistortionParam = driven.mParam;
break;
}
}
@@ -428,7 +421,7 @@ const LLVector4a* LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **poly
for( iter++; iter != mDriven.end(); iter++ )
{
driven = &(*iter);
- v = driven->mParam->getFirstDistortion( index, poly_mesh );
+ v = driven->mParam->getFirstDistortion(index, poly_mesh);
if( v )
{
mCurrentDistortionParam = driven->mParam;
@@ -466,16 +459,16 @@ void LLDriverParam::setAnimationTarget( F32 target_value, BOOL upload_bake )
LLVisualParam::setAnimationTarget(target_value, upload_bake);
// [Legacy Bake]
- for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
+ for(LLDrivenEntry& driven : mDriven)
{
- LLDrivenEntry* driven = &(*iter);
- F32 driven_weight = getDrivenWeight(driven, mTargetWeight);
+ LLDrivenEntry* drivenp = &driven;
+ F32 driven_weight = getDrivenWeight(drivenp, mTargetWeight);
// this isn't normally necessary, as driver params handle interpolation of their driven params
// but texture params need to know to assume their final value at beginning of interpolation
// [Legacy Bake]
- //driven->mParam->setAnimationTarget(driven_weight);
- driven->mParam->setAnimationTarget(driven_weight, upload_bake);
+ //drivenp->mParam->setAnimationTarget(driven_weight);
+ drivenp->mParam->setAnimationTarget(driven_weight, upload_bake);
// [Legacy Bake]
}
}
@@ -492,10 +485,9 @@ void LLDriverParam::stopAnimating(BOOL upload_bake)
LLVisualParam::stopAnimating(upload_bake);
// [Legacy Bake]
- for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
+ for(LLDrivenEntry& driven : mDriven)
{
- LLDrivenEntry* driven = &(*iter);
- driven->mParam->setAnimating(FALSE);
+ driven.mParam->setAnimating(FALSE);
}
}
@@ -503,17 +495,15 @@ void LLDriverParam::stopAnimating(BOOL upload_bake)
BOOL LLDriverParam::linkDrivenParams(visual_param_mapper mapper, BOOL only_cross_params)
{
BOOL success = TRUE;
- LLDriverParamInfo::entry_info_list_t::iterator iter;
- for (iter = getInfo()->mDrivenInfoList.begin(); iter != getInfo()->mDrivenInfoList.end(); ++iter)
+ for (LLDrivenEntryInfo& driven_info : getInfo()->mDrivenInfoList)
{
- LLDrivenEntryInfo *driven_info = &(*iter);
- S32 driven_id = driven_info->mDrivenID;
+ S32 driven_id = driven_info.mDrivenID;
// check for already existing links. Do not overwrite.
BOOL found = FALSE;
- for (entry_list_t::iterator driven_iter = mDriven.begin(); driven_iter != mDriven.end() && !found; ++driven_iter)
+ for (auto& driven : mDriven)
{
- if (driven_iter->mInfo->mDrivenID == driven_id)
+ if (driven.mInfo->mDrivenID == driven_id)
{
found = TRUE;
}
@@ -526,7 +516,7 @@ BOOL LLDriverParam::linkDrivenParams(visual_param_mapper mapper, BOOL only_cross
bool push = param && (!only_cross_params || param->getCrossWearable());
if (push)
{
- mDriven.push_back(LLDrivenEntry( param, driven_info ));
+ mDriven.push_back(LLDrivenEntry( param, &driven_info ));
}
else
{
@@ -549,10 +539,9 @@ void LLDriverParam::updateCrossDrivenParams(LLWearableType::EType driven_type)
bool needs_update = (getWearableType()==driven_type);
// if the driver has a driven entry for the passed-in wearable type, we need to refresh the value
- for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
+ for(LLDrivenEntry& driven : mDriven)
{
- LLDrivenEntry* driven = &(*iter);
- if (driven && driven->mParam && driven->mParam->getCrossWearable() && driven->mParam->getWearableType() == driven_type)
+ if (driven.mParam && driven.mParam->getCrossWearable() && driven.mParam->getWearableType() == driven_type)
{
needs_update = true;
}
diff --git a/indra/llappearance/lllocaltextureobject.cpp b/indra/llappearance/lllocaltextureobject.cpp
index 3fc406d51d..defb5018be 100644
--- a/indra/llappearance/lllocaltextureobject.cpp
+++ b/indra/llappearance/lllocaltextureobject.cpp
@@ -96,9 +96,8 @@ LLTexLayer* LLLocalTextureObject::getTexLayer(U32 index) const
LLTexLayer* LLLocalTextureObject::getTexLayer(const std::string &name)
{
- for( tex_layer_vec_t::iterator iter = mTexLayers.begin(); iter != mTexLayers.end(); iter++)
+ for(LLTexLayer* layer : mTexLayers)
{
- LLTexLayer *layer = *iter;
if (layer->getName().compare(name) == 0)
{
return layer;
diff --git a/indra/llappearance/llpolymesh.cpp b/indra/llappearance/llpolymesh.cpp
index c3ad605331..b128f9eebf 100644
--- a/indra/llappearance/llpolymesh.cpp
+++ b/indra/llappearance/llpolymesh.cpp
@@ -890,11 +890,10 @@ void LLPolyMesh::dumpDiagInfo()
LL_INFOS() << "-----------------------------------------------------" << LL_ENDL;
// print each loaded mesh, and it's memory usage
- for(LLPolyMeshSharedDataTable::iterator iter = sGlobalSharedMeshList.begin();
- iter != sGlobalSharedMeshList.end(); ++iter)
+ for(const LLPolyMeshSharedDataTable::value_type& mesh_pair : sGlobalSharedMeshList)
{
- const std::string& mesh_name = iter->first;
- LLPolyMeshSharedData* mesh = iter->second;
+ const std::string& mesh_name = mesh_pair.first;
+ LLPolyMeshSharedData* mesh = mesh_pair.second;
S32 num_verts = mesh->mNumVertices;
S32 num_faces = mesh->mNumFaces;
@@ -997,14 +996,12 @@ LLPolyMorphData* LLPolyMesh::getMorphData(const std::string& morph_name)
{
if (!mSharedData)
return NULL;
- for (LLPolyMeshSharedData::morphdata_list_t::iterator iter = mSharedData->mMorphData.begin();
- iter != mSharedData->mMorphData.end(); ++iter)
+ for (LLPolyMorphData* morph_data : mSharedData->mMorphData)
{
- LLPolyMorphData *morph_data = *iter;
- if (morph_data->getName() == morph_name)
- {
- return morph_data;
- }
+ if (morph_data->getName() == morph_name)
+ {
+ return morph_data;
+ }
}
return NULL;
}
diff --git a/indra/llappearance/llpolymorph.cpp b/indra/llappearance/llpolymorph.cpp
index d23f5081b3..98b01ee708 100644
--- a/indra/llappearance/llpolymorph.cpp
+++ b/indra/llappearance/llpolymorph.cpp
@@ -366,17 +366,16 @@ BOOL LLPolyMorphTarget::setInfo(LLPolyMorphTargetInfo* info)
LLAvatarAppearance* avatarp = mMesh->getAvatar();
LLPolyMorphTargetInfo::volume_info_list_t::iterator iter;
- for (iter = getInfo()->mVolumeInfoList.begin(); iter != getInfo()->mVolumeInfoList.end(); iter++)
+ for (LLPolyVolumeMorphInfo& volume_info : getInfo()->mVolumeInfoList)
{
- LLPolyVolumeMorphInfo *volume_info = &(*iter);
for (S32 i = 0; i < avatarp->mNumCollisionVolumes; i++)
{
- if (avatarp->mCollisionVolumes[i].getName() == volume_info->mName)
+ if (avatarp->mCollisionVolumes[i].getName() == volume_info.mName)
{
mVolumeMorphs.push_back(
LLPolyVolumeMorph(&avatarp->mCollisionVolumes[i],
- volume_info->mScale,
- volume_info->mPos));
+ volume_info.mScale,
+ volume_info.mPos));
break;
}
}
@@ -643,15 +642,14 @@ void LLPolyMorphTarget::apply( ESex avatar_sex )
}
// now apply volume changes
- for( volume_list_t::iterator iter = mVolumeMorphs.begin(); iter != mVolumeMorphs.end(); iter++ )
+ for(LLPolyVolumeMorph& volume_morph : mVolumeMorphs)
{
- LLPolyVolumeMorph* volume_morph = &(*iter);
- LLVector3 scale_delta = volume_morph->mScale * delta_weight;
- LLVector3 pos_delta = volume_morph->mPos * delta_weight;
+ LLVector3 scale_delta = volume_morph.mScale * delta_weight;
+ LLVector3 pos_delta = volume_morph.mPos * delta_weight;
- volume_morph->mVolume->setScale(volume_morph->mVolume->getScale() + scale_delta);
+ volume_morph.mVolume->setScale(volume_morph.mVolume->getScale() + scale_delta);
// SL-315
- volume_morph->mVolume->setPosition(volume_morph->mVolume->getPosition() + pos_delta);
+ volume_morph.mVolume->setPosition(volume_morph.mVolume->getPosition() + pos_delta);
}
}
@@ -737,15 +735,14 @@ void LLPolyMorphTarget::applyMask(U8 *maskTextureData, S32 width, S32 height, S3
void LLPolyMorphTarget::applyVolumeChanges(F32 delta_weight)
{
// now apply volume changes
- for( volume_list_t::iterator iter = mVolumeMorphs.begin(); iter != mVolumeMorphs.end(); iter++ )
+ for(LLPolyVolumeMorph& volume_morph : mVolumeMorphs)
{
- LLPolyVolumeMorph* volume_morph = &(*iter);
- LLVector3 scale_delta = volume_morph->mScale * delta_weight;
- LLVector3 pos_delta = volume_morph->mPos * delta_weight;
+ LLVector3 scale_delta = volume_morph.mScale * delta_weight;
+ LLVector3 pos_delta = volume_morph.mPos * delta_weight;
- volume_morph->mVolume->setScale(volume_morph->mVolume->getScale() + scale_delta);
+ volume_morph.mVolume->setScale(volume_morph.mVolume->getScale() + scale_delta);
// SL-315
- volume_morph->mVolume->setPosition(volume_morph->mVolume->getPosition() + pos_delta);
+ volume_morph.mVolume->setPosition(volume_morph.mVolume->getPosition() + pos_delta);
}
}
diff --git a/indra/llappearance/llpolyskeletaldistortion.cpp b/indra/llappearance/llpolyskeletaldistortion.cpp
index cdd44bdeb3..4d45f78509 100644
--- a/indra/llappearance/llpolyskeletaldistortion.cpp
+++ b/indra/llappearance/llpolyskeletaldistortion.cpp
@@ -146,37 +146,35 @@ BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info)
setWeight(getDefaultWeight(), FALSE);
LLPolySkeletalDistortionInfo::bone_info_list_t::iterator iter;
- for (iter = getInfo()->mBoneInfoList.begin(); iter != getInfo()->mBoneInfoList.end(); iter++)
+ for (LLPolySkeletalBoneInfo& bone_info : getInfo()->mBoneInfoList)
{
- LLPolySkeletalBoneInfo *bone_info = &(*iter);
- LLJoint* joint = mAvatar->getJoint(bone_info->mBoneName);
+ LLJoint* joint = mAvatar->getJoint(bone_info.mBoneName);
if (!joint)
{
// There's no point continuing after this error - means
// that either the skeleton or lad file is broken.
- LL_WARNS() << "Joint " << bone_info->mBoneName << " not found." << LL_ENDL;
+ LL_WARNS() << "Joint " << bone_info.mBoneName << " not found." << LL_ENDL;
return FALSE;
}
// store it
- mJointScales[joint] = bone_info->mScaleDeformation;
+ mJointScales[joint] = bone_info.mScaleDeformation;
// apply to children that need to inherit it
- for (LLJoint::joints_t::iterator iter = joint->mChildren.begin();
- iter != joint->mChildren.end(); ++iter)
+ for (LLJoint* joint : joint->mChildren)
{
- LLAvatarJoint* child_joint = (LLAvatarJoint*)(*iter);
+ LLAvatarJoint* child_joint = (LLAvatarJoint*)joint;
if (child_joint->inheritScale())
{
LLVector3 childDeformation = LLVector3(child_joint->getScale());
- childDeformation.scaleVec(bone_info->mScaleDeformation);
+ childDeformation.scaleVec(bone_info.mScaleDeformation);
mJointScales[child_joint] = childDeformation;
}
}
- if (bone_info->mHasPositionDeformation)
+ if (bone_info.mHasPositionDeformation)
{
- mJointOffsets[joint] = bone_info->mPositionDeformation;
+ mJointOffsets[joint] = bone_info.mPositionDeformation;
}
}
return TRUE;
@@ -197,15 +195,12 @@ void LLPolySkeletalDistortion::apply( ESex avatar_sex )
F32 effective_weight = ( getSex() & avatar_sex ) ? mCurWeight : getDefaultWeight();
LLJoint* joint;
- joint_vec_map_t::iterator iter;
- for (iter = mJointScales.begin();
- iter != mJointScales.end();
- iter++)
+ for (joint_vec_map_t::value_type& scale_pair : mJointScales)
{
- joint = iter->first;
+ joint = scale_pair.first;
LLVector3 newScale = joint->getScale();
- LLVector3 scaleDelta = iter->second;
+ LLVector3 scaleDelta = scale_pair.second;
LLVector3 offset = (effective_weight - mLastWeight) * scaleDelta;
newScale = newScale + offset;
//An aspect of attached mesh objects (which contain joint offsets) that need to be cleaned up when detached
@@ -220,13 +215,11 @@ void LLPolySkeletalDistortion::apply( ESex avatar_sex )
joint->setScale(newScale, true);
}
- for (iter = mJointOffsets.begin();
- iter != mJointOffsets.end();
- iter++)
+ for (joint_vec_map_t::value_type& offset_pair : mJointOffsets)
{
- joint = iter->first;
+ joint = offset_pair.first;
LLVector3 newPosition = joint->getPosition();
- LLVector3 positionDelta = iter->second;
+ LLVector3 positionDelta = offset_pair.second;
newPosition = newPosition + (effective_weight * positionDelta) - (mLastWeight * positionDelta);
// SL-315
bool allow_attachment_pos_overrides = true;
diff --git a/indra/llappearance/lltexglobalcolor.cpp b/indra/llappearance/lltexglobalcolor.cpp
index 13b48b711f..347bf6f8ca 100644
--- a/indra/llappearance/lltexglobalcolor.cpp
+++ b/indra/llappearance/lltexglobalcolor.cpp
@@ -55,12 +55,10 @@ BOOL LLTexGlobalColor::setInfo(LLTexGlobalColorInfo *info)
//mID = info->mID; // No ID
mParamGlobalColorList.reserve(mInfo->mParamColorInfoList.size());
- for (param_color_info_list_t::iterator iter = mInfo->mParamColorInfoList.begin();
- iter != mInfo->mParamColorInfoList.end();
- iter++)
+ for (LLTexLayerParamColorInfo* color_info : mInfo->mParamColorInfoList)
{
LLTexParamGlobalColor* param_color = new LLTexParamGlobalColor(this);
- if (!param_color->setInfo(*iter, TRUE))
+ if (!param_color->setInfo(color_info, TRUE))
{
mInfo = NULL;
return FALSE;
diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp
index f39b112f37..e7c67d870c 100644
--- a/indra/llappearance/lltexlayer.cpp
+++ b/indra/llappearance/lltexlayer.cpp
@@ -248,11 +248,8 @@ BOOL LLTexLayerSetInfo::parseXml(LLXmlTreeNode* node)
void LLTexLayerSetInfo::createVisualParams(LLAvatarAppearance *appearance)
{
//layer_info_list_t mLayerInfoList;
- for (layer_info_list_t::iterator layer_iter = mLayerInfoList.begin();
- layer_iter != mLayerInfoList.end();
- layer_iter++)
+ for (LLTexLayerInfo* layer_info : mLayerInfoList)
{
- LLTexLayerInfo *layer_info = *layer_iter;
layer_info->createVisualParams(appearance);
}
}
@@ -294,12 +291,10 @@ BOOL LLTexLayerSet::setInfo(const LLTexLayerSetInfo *info)
//mID = info->mID; // No ID
mLayerList.reserve(info->mLayerInfoList.size());
- for (LLTexLayerSetInfo::layer_info_list_t::const_iterator iter = info->mLayerInfoList.begin();
- iter != info->mLayerInfoList.end();
- iter++)
+ for (LLTexLayerInfo* layer_info : info->mLayerInfoList)
{
LLTexLayerInterface *layer = NULL;
- if ( (*iter)->isUserSettable() )
+ if (layer_info->isUserSettable())
{
layer = new LLTexLayerTemplate( this, getAvatarAppearance() );
}
@@ -308,7 +303,7 @@ BOOL LLTexLayerSet::setInfo(const LLTexLayerSetInfo *info)
layer = new LLTexLayer(this);
}
// this is the first time this layer (of either type) is being created - make sure you add the parameters to the avatar appearance
- if (!layer->setInfo(*iter, NULL))
+ if (!layer->setInfo(layer_info, NULL))
{
mInfo = NULL;
return FALSE;
@@ -355,14 +350,12 @@ BOOL LLTexLayerSet::parseData(LLXmlTreeNode* node)
void LLTexLayerSet::deleteCaches()
{
- for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
+ for(LLTexLayerInterface* layer : mLayerList)
{
- LLTexLayerInterface* layer = *iter;
layer->deleteCaches();
}
- for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++)
+ for (LLTexLayerInterface* layer : mMaskLayerList)
{
- LLTexLayerInterface* layer = *iter;
layer->deleteCaches();
}
}
@@ -375,9 +368,8 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height, LLRenderTarget*
if (mMaskLayerList.size() > 0)
{
- for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++)
+ for (LLTexLayerInterface* layer : mMaskLayerList)
{
- LLTexLayerInterface* layer = *iter;
if (layer->isInvisibleAlphaMask())
{
mIsVisible = FALSE;
@@ -406,9 +398,8 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height, LLRenderTarget*
if (mIsVisible)
{
// composite color layers
- for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
+ for(LLTexLayerInterface* layer : mLayerList)
{
- LLTexLayerInterface* layer = *iter;
if (layer->getRenderPass() == LLTexLayer::RP_COLOR)
{
gGL.flush();
@@ -480,9 +471,8 @@ void LLTexLayerSet::gatherMorphMaskAlpha(U8 *data, S32 origin_x, S32 origin_y, S
LL_PROFILE_ZONE_SCOPED;
memset(data, 255, width * height);
- for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
+ for(LLTexLayerInterface* layer : mLayerList)
{
- LLTexLayerInterface* layer = *iter;
layer->gatherAlphaMasks(data, origin_x, origin_y, width, height, bound_target);
}
@@ -533,9 +523,8 @@ void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height,
if (mMaskLayerList.size() > 0)
{
gGL.setSceneBlendType(LLRender::BT_MULT_ALPHA);
- for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++)
+ for (LLTexLayerInterface* layer : mMaskLayerList)
{
- LLTexLayerInterface* layer = *iter;
gGL.flush();
layer->blendAlphaTexture(x,y,width, height);
gGL.flush();
@@ -556,9 +545,8 @@ void LLTexLayerSet::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_
BOOL LLTexLayerSet::isMorphValid() const
{
- for(layer_list_t::const_iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
+ for(const LLTexLayerInterface* layer : mLayerList)
{
- const LLTexLayerInterface* layer = *iter;
if (layer && !layer->isMorphValid())
{
return FALSE;
@@ -569,9 +557,8 @@ BOOL LLTexLayerSet::isMorphValid() const
void LLTexLayerSet::invalidateMorphMasks()
{
- for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
+ for(LLTexLayerInterface* layer : mLayerList)
{
- LLTexLayerInterface* layer = *iter;
if (layer)
{
layer->invalidateMorphMasks();
@@ -668,14 +655,12 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node)
/* if ("upper_shirt" == local_texture_name)
mLocalTexture = TEX_UPPER_SHIRT; */
mLocalTexture = TEX_NUM_INDICES;
- for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearance::getDictionary()->getTextures().begin();
- iter != LLAvatarAppearance::getDictionary()->getTextures().end();
- iter++)
+ for (const LLAvatarAppearanceDictionary::Textures::value_type& dict_pair : LLAvatarAppearance::getDictionary()->getTextures())
{
- const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
+ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = dict_pair.second;
if (local_texture_name == texture_dict->mName)
{
- mLocalTexture = iter->first;
+ mLocalTexture = dict_pair.first;
break;
}
}
@@ -742,11 +727,8 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node)
BOOL LLTexLayerInfo::createVisualParams(LLAvatarAppearance *appearance)
{
BOOL success = TRUE;
- for (param_color_info_list_t::iterator color_info_iter = mParamColorInfoList.begin();
- color_info_iter != mParamColorInfoList.end();
- color_info_iter++)
+ for (LLTexLayerParamColorInfo* color_info : mParamColorInfoList)
{
- LLTexLayerParamColorInfo * color_info = *color_info_iter;
LLTexLayerParamColor* param_color = new LLTexLayerParamColor(appearance);
if (!param_color->setInfo(color_info, TRUE))
{
@@ -756,11 +738,8 @@ BOOL LLTexLayerInfo::createVisualParams(LLAvatarAppearance *appearance)
}
}
- for (param_alpha_info_list_t::iterator alpha_info_iter = mParamAlphaInfoList.begin();
- alpha_info_iter != mParamAlphaInfoList.end();
- alpha_info_iter++)
+ for (LLTexLayerParamAlphaInfo* alpha_info : mParamAlphaInfoList)
{
- LLTexLayerParamAlphaInfo * alpha_info = *alpha_info_iter;
LLTexLayerParamAlpha* param_alpha = new LLTexLayerParamAlpha(appearance);
if (!param_alpha->setInfo(alpha_info, TRUE))
{
@@ -803,15 +782,13 @@ BOOL LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearab
//mID = info->mID; // No ID
mParamColorList.reserve(mInfo->mParamColorInfoList.size());
- for (param_color_info_list_t::const_iterator iter = mInfo->mParamColorInfoList.begin();
- iter != mInfo->mParamColorInfoList.end();
- iter++)
+ for (LLTexLayerParamColorInfo* color_info : mInfo->mParamColorInfoList)
{
LLTexLayerParamColor* param_color;
if (!wearable)
{
param_color = new LLTexLayerParamColor(this);
- if (!param_color->setInfo(*iter, TRUE))
+ if (!param_color->setInfo(color_info, TRUE))
{
mInfo = NULL;
return FALSE;
@@ -819,7 +796,7 @@ BOOL LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearab
}
else
{
- param_color = (LLTexLayerParamColor*)wearable->getVisualParam((*iter)->getID());
+ param_color = (LLTexLayerParamColor*)wearable->getVisualParam(color_info->getID());
if (!param_color)
{
mInfo = NULL;
@@ -830,15 +807,13 @@ BOOL LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearab
}
mParamAlphaList.reserve(mInfo->mParamAlphaInfoList.size());
- for (param_alpha_info_list_t::const_iterator iter = mInfo->mParamAlphaInfoList.begin();
- iter != mInfo->mParamAlphaInfoList.end();
- iter++)
+ for (LLTexLayerParamAlphaInfo* alpha_info : mInfo->mParamAlphaInfoList)
{
LLTexLayerParamAlpha* param_alpha;
if (!wearable)
{
param_alpha = new LLTexLayerParamAlpha( this );
- if (!param_alpha->setInfo(*iter, TRUE))
+ if (!param_alpha->setInfo(alpha_info, TRUE))
{
mInfo = NULL;
return FALSE;
@@ -846,7 +821,7 @@ BOOL LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearab
}
else
{
- param_alpha = (LLTexLayerParamAlpha*) wearable->getVisualParam((*iter)->getID());
+ param_alpha = (LLTexLayerParamAlpha*) wearable->getVisualParam(alpha_info->getID());
if (!param_alpha)
{
mInfo = NULL;
@@ -880,12 +855,9 @@ LLWearableType::EType LLTexLayerInterface::getWearableType() const
if (TEX_INVALID == te)
{
LLWearableType::EType type = LLWearableType::WT_INVALID;
- param_color_list_t::const_iterator color_iter = mParamColorList.begin();
- param_alpha_list_t::const_iterator alpha_iter = mParamAlphaList.begin();
- for (; color_iter != mParamColorList.end(); color_iter++)
+ for (LLTexLayerParamColor* param : mParamColorList)
{
- LLTexLayerParamColor* param = *color_iter;
if (param)
{
LLWearableType::EType new_type = (LLWearableType::EType)param->getWearableType();
@@ -900,9 +872,8 @@ LLWearableType::EType LLTexLayerInterface::getWearableType() const
}
}
- for (; alpha_iter != mParamAlphaList.end(); alpha_iter++)
+ for (LLTexLayerParamAlpha* param : mParamAlphaList)
{
- LLTexLayerParamAlpha* param = *alpha_iter;
if (param)
{
LLWearableType::EType new_type = (LLWearableType::EType)param->getWearableType();
@@ -945,18 +916,18 @@ void LLTexLayerInterface::invalidateMorphMasks()
LLViewerVisualParam* LLTexLayerInterface::getVisualParamPtr(S32 index) const
{
LLViewerVisualParam *result = NULL;
- for (param_color_list_t::const_iterator color_iter = mParamColorList.begin(); color_iter != mParamColorList.end() && !result; ++color_iter)
+ for (LLTexLayerParamColor* param : mParamColorList)
{
- if ((*color_iter)->getID() == index)
+ if (param->getID() == index)
{
- result = *color_iter;
+ result = param;
}
}
- for (param_alpha_list_t::const_iterator alpha_iter = mParamAlphaList.begin(); alpha_iter != mParamAlphaList.end() && !result; ++alpha_iter)
+ for (LLTexLayerParamAlpha* param : mParamAlphaList)
{
- if ((*alpha_iter)->getID() == index)
+ if (param->getID() == index)
{
- result = *alpha_iter;
+ result = param;
}
}
@@ -1001,10 +972,9 @@ LLTexLayer::~LLTexLayer()
//std::for_each(mParamAlphaList.begin(), mParamAlphaList.end(), DeletePointer());
//std::for_each(mParamColorList.begin(), mParamColorList.end(), DeletePointer());
- for( alpha_cache_t::iterator iter = mAlphaCache.begin();
- iter != mAlphaCache.end(); iter++ )
+ for (alpha_cache_t::value_type& alpha_pair : mAlphaCache)
{
- U8* alpha_data = iter->second;
+ U8* alpha_data = alpha_pair.second;
ll_aligned_free_32(alpha_data);
}
@@ -1028,10 +998,8 @@ BOOL LLTexLayer::setInfo(const LLTexLayerInfo* info, LLWearable* wearable )
//static
void LLTexLayer::calculateTexLayerColor(const param_color_list_t ¶m_list, LLColor4 &net_color)
{
- for (param_color_list_t::const_iterator iter = param_list.begin();
- iter != param_list.end(); iter++)
+ for (const LLTexLayerParamColor* param : param_list)
{
- const LLTexLayerParamColor* param = *iter;
LLColor4 param_net = param->getNetColor();
const LLTexLayerParamColorInfo *info = (LLTexLayerParamColorInfo *)param->getInfo();
switch(info->getOperation())
@@ -1056,10 +1024,8 @@ void LLTexLayer::calculateTexLayerColor(const param_color_list_t ¶m_list, LL
/*virtual*/ void LLTexLayer::deleteCaches()
{
// Only need to delete caches for alpha params. Color params don't hold extra memory
- for (param_alpha_list_t::iterator iter = mParamAlphaList.begin();
- iter != mParamAlphaList.end(); iter++ )
+ for (LLTexLayerParamAlpha* param : mParamAlphaList)
{
- LLTexLayerParamAlpha* param = *iter;
param->deleteCaches();
}
}
@@ -1233,9 +1199,8 @@ const U8* LLTexLayer::getAlphaData() const
const LLUUID& uuid = getUUID();
alpha_mask_crc.update((U8*)(&uuid.mData), UUID_BYTES);
- for (param_alpha_list_t::const_iterator iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); iter++)
+ for (const LLTexLayerParamAlpha* param : mParamAlphaList)
{
- const LLTexLayerParamAlpha* param = *iter;
// MULTI-WEARABLE: verify visual parameters used here
F32 param_weight = param->getWeight();
alpha_mask_crc.update((U8*)¶m_weight, sizeof(F32));
@@ -1372,9 +1337,8 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
// Accumulate alphas
LLGLSNoAlphaTest gls_no_alpha_test;
gGL.color4f( 1.f, 1.f, 1.f, 1.f );
- for (param_alpha_list_t::iterator iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); iter++)
+ for (LLTexLayerParamAlpha* param : mParamAlphaList)
{
- LLTexLayerParamAlpha* param = *iter;
success &= param->render( x, y, width, height );
if (!success && !force_render)
{
@@ -1448,9 +1412,8 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
const LLUUID& uuid = getUUID();
alpha_mask_crc.update((U8*)(&uuid.mData), UUID_BYTES);
- for (param_alpha_list_t::const_iterator iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); iter++)
+ for (const LLTexLayerParamAlpha* param : mParamAlphaList)
{
- const LLTexLayerParamAlpha* param = *iter;
F32 param_weight = param->getWeight();
alpha_mask_crc.update((U8*)¶m_weight, sizeof(F32));
}
@@ -1750,12 +1713,10 @@ LLTexLayer* LLTexLayerTemplate::getLayer(U32 i) const
BOOL success = TRUE;
updateWearableCache();
- for (wearable_cache_t::const_iterator iter = mWearableCache.begin(); iter!= mWearableCache.end(); iter++)
+ for (LLWearable* wearable : mWearableCache)
{
- LLWearable* wearable = NULL;
LLLocalTextureObject *lto = NULL;
LLTexLayer *layer = NULL;
- wearable = *iter;
if (wearable)
{
lto = wearable->getLocalTextureObject(mInfo->mLocalTexture);
@@ -1852,17 +1813,15 @@ LLTexLayer* LLTexLayerTemplate::getLayer(U32 i) const
//-----------------------------------------------------------------------------
LLTexLayerInterface* LLTexLayerSet::findLayerByName(const std::string& name)
{
- for (layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
+ for (LLTexLayerInterface* layer : mLayerList)
{
- LLTexLayerInterface* layer = *iter;
if (layer->getName() == name)
{
return layer;
}
}
- for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++ )
+ for (LLTexLayerInterface* layer : mMaskLayerList)
{
- LLTexLayerInterface* layer = *iter;
if (layer->getName() == name)
{
return layer;
@@ -1874,20 +1833,20 @@ LLTexLayerInterface* LLTexLayerSet::findLayerByName(const std::string& name)
void LLTexLayerSet::cloneTemplates(LLLocalTextureObject *lto, LLAvatarAppearanceDefines::ETextureIndex tex_index, LLWearable *wearable)
{
// initialize all texlayers with this texture type for this LTO
- for( LLTexLayerSet::layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ )
+ for(LLTexLayerInterface* layer : mLayerList)
{
- LLTexLayerTemplate* layer = (LLTexLayerTemplate*)*iter;
- if (layer->getInfo()->getLocalTexture() == (S32) tex_index)
+ LLTexLayerTemplate* layer_template = (LLTexLayerTemplate*)layer;
+ if (layer_template->getInfo()->getLocalTexture() == (S32)tex_index)
{
- lto->addTexLayer(layer, wearable);
+ lto->addTexLayer(layer_template, wearable);
}
}
- for( LLTexLayerSet::layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++ )
+ for(LLTexLayerInterface* layer : mMaskLayerList)
{
- LLTexLayerTemplate* layer = (LLTexLayerTemplate*)*iter;
- if (layer->getInfo()->getLocalTexture() == (S32) tex_index)
+ LLTexLayerTemplate* layer_template = (LLTexLayerTemplate*)layer;
+ if (layer_template->getInfo()->getLocalTexture() == (S32)tex_index)
{
- lto->addTexLayer(layer, wearable);
+ lto->addTexLayer(layer_template, wearable);
}
}
}
diff --git a/indra/llappearance/lltexlayerparams.cpp b/indra/llappearance/lltexlayerparams.cpp
index 68d650eacb..9ec434ff32 100644
--- a/indra/llappearance/lltexlayerparams.cpp
+++ b/indra/llappearance/lltexlayerparams.cpp
@@ -103,10 +103,8 @@ void LLTexLayerParamAlpha::getCacheByteCount(S32* gl_bytes)
{
*gl_bytes = 0;
- for (param_alpha_ptr_list_t::iterator iter = sInstances.begin();
- iter != sInstances.end(); iter++)
+ for (LLTexLayerParamAlpha* instance : sInstances)
{
- LLTexLayerParamAlpha* instance = *iter;
LLGLTexture* tex = instance->mCachedProcessedTexture;
if (tex)
{
diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp
index 4670af4181..7a7dc01ef9 100644
--- a/indra/llappearance/llwearable.cpp
+++ b/indra/llappearance/llwearable.cpp
@@ -63,12 +63,12 @@ LLWearable::~LLWearable()
for (std::set< LLWearableObserver* >::iterator itr = mObservers.begin(); itr != mObservers.end(); ++itr )
(*itr)->onDestroyed( this );
- for (visual_param_index_map_t::iterator vpIter = mVisualParamIndexMap.begin(); vpIter != mVisualParamIndexMap.end(); ++vpIter)
+ for (visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
{
- LLVisualParam* vp = vpIter->second;
+ LLVisualParam* vp = vp_pair.second;
vp->clearNextParam();
delete vp;
- vpIter->second = NULL;
+ vp_pair.second = NULL;
}
destroyTextures();
@@ -125,12 +125,10 @@ BOOL LLWearable::exportStream( std::ostream& output_stream ) const
// parameters
output_stream << "parameters " << mVisualParamIndexMap.size() << "\n";
- for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin();
- iter != mVisualParamIndexMap.end();
- ++iter)
+ for (const visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
{
- S32 param_id = iter->first;
- const LLVisualParam* param = iter->second;
+ S32 param_id = vp_pair.first;
+ const LLVisualParam* param = vp_pair.second;
F32 param_weight = param->getWeight();
output_stream << param_id << " " << terse_F32_to_string( param_weight ) << "\n";
}
@@ -138,11 +136,11 @@ BOOL LLWearable::exportStream( std::ostream& output_stream ) const
// texture entries
output_stream << "textures " << mTEMap.size() << "\n";
- for (te_map_t::const_iterator iter = mTEMap.begin(); iter != mTEMap.end(); ++iter)
+ for (const te_map_t::value_type& te_pair : mTEMap)
{
- S32 te = iter->first;
- const LLUUID& image_id = iter->second->getID();
- output_stream << te << " " << image_id << "\n";
+ S32 te = te_pair.first;
+ const LLUUID& image_id = te_pair.second->getID();
+ output_stream << te << " " << image_id << "\n";
}
return TRUE;
}
@@ -163,11 +161,9 @@ void LLWearable::createVisualParams(LLAvatarAppearance *avatarp)
}
// resync driver parameters to point to the newly cloned driven parameters
- for (visual_param_index_map_t::iterator param_iter = mVisualParamIndexMap.begin();
- param_iter != mVisualParamIndexMap.end();
- ++param_iter)
+ for (visual_param_index_map_t::value_type& param_pair : mVisualParamIndexMap)
{
- LLVisualParam* param = param_iter->second;
+ LLVisualParam* param = param_pair.second;
LLVisualParam*(LLWearable::*wearable_function)(S32)const = &LLWearable::getVisualParam;
// need this line to disambiguate between versions of LLCharacter::getVisualParam()
LLVisualParam*(LLAvatarAppearance::*param_function)(S32)const = &LLAvatarAppearance::getVisualParam;
@@ -526,10 +522,9 @@ std::vector LLWearable::getLocalTextureListSeq()
{
std::vector result;
- for(te_map_t::const_iterator iter = mTEMap.begin();
- iter != mTEMap.end(); iter++)
+ for(te_map_t::value_type& te_pair : mTEMap)
{
- LLLocalTextureObject* lto = iter->second;
+ LLLocalTextureObject* lto = te_pair.second;
result.push_back(lto);
}
@@ -550,41 +545,17 @@ void LLWearable::revertValues()
// FIXME DRANO - this triggers changes to driven params on avatar, potentially clobbering baked appearance.
//update saved settings so wearable is no longer dirty
- // non-driver params first
- for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++)
+ // One loop should be necessary here
+ for (param_map_t::value_type& vp_pair : mSavedVisualParamMap)
{
- S32 id = iter->first;
- F32 value = iter->second;
+ S32 id = vp_pair.first;
LLVisualParam *param = getVisualParam(id);
- if(param && !dynamic_cast(param) )
+ if(param)
{
+ F32 value = vp_pair.second;
// [Legacy Bake]
//setVisualParamWeight(id, value);
setVisualParamWeight(id, value, TRUE);
- }
- }
-
- //then driver params
- for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++)
- {
- S32 id = iter->first;
- F32 value = iter->second;
- LLVisualParam *param = getVisualParam(id);
- if(param && dynamic_cast(param) )
- {
- // [Legacy Bake]
- //setVisualParamWeight(id, value);
- setVisualParamWeight(id, value, TRUE);
- }
- }
-
- // make sure that saved values are sane
- for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++)
- {
- S32 id = iter->first;
- LLVisualParam *param = getVisualParam(id);
- if( param )
- {
mSavedVisualParamMap[id] = param->getWeight();
}
}
@@ -596,10 +567,10 @@ void LLWearable::saveValues()
{
//update saved settings so wearable is no longer dirty
mSavedVisualParamMap.clear();
- for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); ++iter)
+ for (const visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
{
- S32 id = iter->first;
- LLVisualParam *wearable_param = iter->second;
+ S32 id = vp_pair.first;
+ LLVisualParam *wearable_param = vp_pair.second;
F32 value = wearable_param->getWeight();
mSavedVisualParamMap[id] = value;
}
@@ -717,13 +688,10 @@ LLVisualParam* LLWearable::getVisualParam(S32 index) const
void LLWearable::getVisualParams(visual_param_vec_t &list)
{
- visual_param_index_map_t::iterator iter = mVisualParamIndexMap.begin();
- visual_param_index_map_t::iterator end = mVisualParamIndexMap.end();
-
// add all visual params to the passed-in vector
- for( ; iter != end; ++iter )
+ for(visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
{
- list.push_back(iter->second);
+ list.push_back(vp_pair.second);
}
}
@@ -731,11 +699,9 @@ void LLWearable::getVisualParams(visual_param_vec_t &list)
//void LLWearable::animateParams(F32 delta)
void LLWearable::animateParams(F32 delta, BOOL upload_bake)
{
- for(visual_param_index_map_t::iterator iter = mVisualParamIndexMap.begin();
- iter != mVisualParamIndexMap.end();
- ++iter)
+ for(visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
{
- LLVisualParam *param = (LLVisualParam*) iter->second;
+ LLVisualParam *param = (LLVisualParam*)vp_pair.second;
// [Legacy Bake]
//param->animate(delta);
param->animate(delta, upload_bake);
diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp
index 66c12164ab..8f61654de6 100644
--- a/indra/llaudio/llaudioengine.cpp
+++ b/indra/llaudio/llaudioengine.cpp
@@ -136,18 +136,16 @@ void LLAudioEngine::shutdown()
cleanupWind();
// Clean up audio sources
- source_map::iterator iter_src;
- for (iter_src = mAllSources.begin(); iter_src != mAllSources.end(); iter_src++)
+ for (source_map::value_type& src_pair : mAllSources)
{
- delete iter_src->second;
+ delete src_pair.second;
}
// Clean up audio data
- data_map::iterator iter_data;
- for (iter_data = mAllData.begin(); iter_data != mAllData.end(); iter_data++)
+ for (data_map::value_type& data_pair : mAllData)
{
- delete iter_data->second;
+ delete data_pair.second;
}
@@ -323,12 +321,12 @@ void LLAudioEngine::idle()
updateChannels();
// Update queued sounds (switch to next queued data if the current has finished playing)
- for (iter = mAllSources.begin(); iter != mAllSources.end(); ++iter)
+ for (source_map::value_type& src_pair : mAllSources)
{
// This is lame, instead of this I could actually iterate through all the sources
// attached to each channel, since only those with active channels
// can have anything interesting happen with their queue? (Maybe not true)
- LLAudioSource *sourcep = iter->second;
+ LLAudioSource *sourcep = src_pair.second;
if (!sourcep->mQueuedDatap || sourcep->isMuted())
{
// Muted, or nothing queued, so we don't care.
@@ -408,9 +406,9 @@ void LLAudioEngine::idle()
LLAudioSource *sync_masterp = NULL;
LLAudioChannel *master_channelp = NULL;
F32 max_sm_priority = -1.f;
- for (iter = mAllSources.begin(); iter != mAllSources.end(); ++iter)
+ for (source_map::value_type& src_pair : mAllSources)
{
- LLAudioSource *sourcep = iter->second;
+ LLAudioSource *sourcep = src_pair.second;
if (sourcep->isMuted())
{
continue;
@@ -430,9 +428,9 @@ void LLAudioEngine::idle()
{
// Synchronize loop slaves with their masters
// Update queued sounds (switch to next queued data if the current has finished playing)
- for (iter = mAllSources.begin(); iter != mAllSources.end(); ++iter)
+ for (source_map::value_type& src_pair : mAllSources)
{
- LLAudioSource *sourcep = iter->second;
+ LLAudioSource *sourcep = src_pair.second;
if (!sourcep->isSyncSlave())
{
@@ -1150,9 +1148,9 @@ void LLAudioEngine::startNextTransfer()
}
- for (data_iter = asp->mPreloadMap.begin(); data_iter != asp->mPreloadMap.end(); data_iter++)
+ for (data_map::value_type& preload_pair : asp->mPreloadMap)
{
- LLAudioData *adp = data_iter->second;
+ LLAudioData *adp = preload_pair.second;
if (!adp)
{
continue;
@@ -1172,9 +1170,9 @@ void LLAudioEngine::startNextTransfer()
{
max_pri = -1.f;
source_map::iterator source_iter;
- for (source_iter = mAllSources.begin(); source_iter != mAllSources.end(); source_iter++)
+ for (source_map::value_type& source_pair : mAllSources)
{
- asp = source_iter->second;
+ asp = source_pair.second;
if (!asp)
{
continue;
@@ -1201,9 +1199,9 @@ void LLAudioEngine::startNextTransfer()
continue;
}
- for (data_iter = asp->mPreloadMap.begin(); data_iter != asp->mPreloadMap.end(); data_iter++)
+ for (data_map::value_type& preload_pair : asp->mPreloadMap)
{
- LLAudioData *adp = data_iter->second;
+ LLAudioData *adp = preload_pair.second;
if (!adp)
{
continue;
@@ -1745,10 +1743,9 @@ void LLAudioSource::addAudioData(LLAudioData *adp, const bool set_current)
bool LLAudioSource::hasPendingPreloads() const
{
// Check to see if we've got any preloads on deck for this source
- data_map::const_iterator iter;
- for (iter = mPreloadMap.begin(); iter != mPreloadMap.end(); iter++)
+ for (const data_map::value_type& preload_pair : mPreloadMap)
{
- LLAudioData *adp = iter->second;
+ LLAudioData *adp = preload_pair.second;
// note: a bad UUID will forever be !hasDecodedData()
// but also hasDecodeFailed(), hence the check for hasDecodeFailed()
if (!adp)
diff --git a/indra/llcharacter/llanimationstates.cpp b/indra/llcharacter/llanimationstates.cpp
index fb03cfdacd..c476a30fb5 100644
--- a/indra/llcharacter/llanimationstates.cpp
+++ b/indra/llcharacter/llanimationstates.cpp
@@ -381,12 +381,11 @@ LLUUID LLAnimationLibrary::stringToAnimState( const std::string& name, BOOL allo
if (true_name)
{
- for (anim_map_t::iterator iter = mAnimMap.begin();
- iter != mAnimMap.end(); iter++)
+ for (anim_map_t::value_type& anim_pair : mAnimMap)
{
- if (iter->second == true_name)
+ if (anim_pair.second == true_name)
{
- id = iter->first;
+ id = anim_pair.first;
break;
}
}
diff --git a/indra/llcharacter/llbvhloader.cpp b/indra/llcharacter/llbvhloader.cpp
index 8eb454d093..0e6b85732c 100644
--- a/indra/llcharacter/llbvhloader.cpp
+++ b/indra/llcharacter/llbvhloader.cpp
@@ -156,10 +156,9 @@ LLBVHLoader::LLBVHLoader(const char* buffer, ELoadStatus &loadStatus, S32 &error
}
// Recognize all names we've been told are legal.
- std::map::iterator iter;
- for (iter = joint_alias_map.begin(); iter != joint_alias_map.end(); iter++)
+ for (std::map::value_type& alias_pair : joint_alias_map)
{
- makeTranslation( iter->first , iter->second );
+ makeTranslation( alias_pair.first , alias_pair.second );
}
char error_text[128]; /* Flawfinder: ignore */
@@ -956,9 +955,8 @@ ELoadStatus LLBVHLoader::loadBVHFile(const char *buffer, char* error_text, S32 &
void LLBVHLoader::applyTranslations()
{
JointVector::iterator ji;
- for (ji = mJoints.begin(); ji != mJoints.end(); ++ji )
+ for (Joint* joint : mJoints)
{
- Joint *joint = *ji;
//----------------------------------------------------------------
// Look for a translation for this joint.
// If none, skip to next joint
@@ -1072,9 +1070,8 @@ void LLBVHLoader::optimize()
}
JointVector::iterator ji;
- for (ji = mJoints.begin(); ji != mJoints.end(); ++ji)
+ for (Joint* joint : mJoints)
{
- Joint *joint = *ji;
BOOL pos_changed = FALSE;
BOOL rot_changed = FALSE;
@@ -1303,15 +1300,12 @@ U32 LLBVHLoader::getOutputSize()
// writes contents to datapacker
BOOL LLBVHLoader::serialize(LLDataPacker& dp)
{
- JointVector::iterator ji;
- KeyVector::iterator ki;
F32 time;
// count number of non-ignored joints
S32 numJoints = 0;
- for (ji=mJoints.begin(); ji!=mJoints.end(); ++ji)
+ for (Joint* joint : mJoints)
{
- Joint *joint = *ji;
if ( ! joint->mIgnore )
numJoints++;
}
@@ -1330,11 +1324,8 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp)
dp.packU32(mHand, "hand_pose");
dp.packU32(numJoints, "num_joints");
- for ( ji = mJoints.begin();
- ji != mJoints.end();
- ++ji )
+ for (Joint* joint : mJoints)
{
- Joint *joint = *ji;
// if ignored, skip it
if ( joint->mIgnore )
continue;
@@ -1357,17 +1348,15 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp)
Joint *mergeParent = NULL;
Joint *mergeChild = NULL;
- JointVector::iterator mji;
- for (mji=mJoints.begin(); mji!=mJoints.end(); ++mji)
+ for (Joint* mjoint : mJoints)
{
- Joint *mjoint = *mji;
if ( !joint->mMergeParentName.empty() && (mjoint->mName == joint->mMergeParentName) )
{
- mergeParent = *mji;
+ mergeParent = mjoint;
}
if ( !joint->mMergeChildName.empty() && (mjoint->mName == joint->mMergeChildName) )
{
- mergeChild = *mji;
+ mergeChild = mjoint;
}
}
@@ -1376,19 +1365,17 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp)
LLQuaternion::Order order = bvhStringToOrder( joint->mOrder );
S32 outcount = 0;
S32 frame = 0;
- for ( ki = joint->mKeys.begin();
- ki != joint->mKeys.end();
- ++ki )
+ for (Key& key : joint->mKeys)
{
if ((frame == 0) && joint->mRelativeRotationKey)
{
- first_frame_rot = mayaQ( ki->mRot[0], ki->mRot[1], ki->mRot[2], order);
+ first_frame_rot = mayaQ( key.mRot[0], key.mRot[1], key.mRot[2], order);
fixup_rot.shortestArc(LLVector3::z_axis * first_frame_rot * frameRot, LLVector3::z_axis);
}
- if (ki->mIgnoreRot)
+ if (key.mIgnoreRot)
{
frame++;
continue;
@@ -1427,7 +1414,7 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp)
mergeChildRot.loadIdentity();
}
- LLQuaternion inRot = mayaQ( ki->mRot[0], ki->mRot[1], ki->mRot[2], order);
+ LLQuaternion inRot = mayaQ( key.mRot[0], key.mRot[1], key.mRot[2], order);
LLQuaternion outRot = frameRotInv* mergeChildRot * inRot * mergeParentRot * ~first_frame_rot * frameRot * offsetRot;
@@ -1455,16 +1442,14 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp)
LLVector3 relKey;
frame = 0;
- for ( ki = joint->mKeys.begin();
- ki != joint->mKeys.end();
- ++ki )
+ for (Key& key : joint->mKeys)
{
if ((frame == 0) && joint->mRelativePositionKey)
{
- relKey.setVec(ki->mPos);
+ relKey.setVec(key.mPos);
}
- if (ki->mIgnorePos)
+ if (key.mIgnorePos)
{
frame++;
continue;
@@ -1472,7 +1457,7 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp)
time = llmax((F32)(frame - NUMBER_OF_IGNORED_FRAMES_AT_START), 0.0f) * mFrameTime; // Time elapsed before this frame starts.
- LLVector3 inPos = (LLVector3(ki->mPos) - relKey) * ~first_frame_rot;// * fixup_rot;
+ LLVector3 inPos = (LLVector3(key.mPos) - relKey) * ~first_frame_rot;// * fixup_rot;
LLVector3 outPos = inPos * frameRot * offsetRot;
outPos *= INCHES_TO_METERS;
@@ -1505,24 +1490,22 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp)
S32 num_constraints = (S32)mConstraints.size();
dp.packS32(num_constraints, "num_constraints");
- for (ConstraintVector::iterator constraint_it = mConstraints.begin();
- constraint_it != mConstraints.end();
- constraint_it++)
+ for (Constraint& constraint : mConstraints)
{
- U8 byte = constraint_it->mChainLength;
+ U8 byte = constraint.mChainLength;
dp.packU8(byte, "chain_length");
- byte = constraint_it->mConstraintType;
+ byte = constraint.mConstraintType;
dp.packU8(byte, "constraint_type");
- dp.packBinaryDataFixed((U8*)constraint_it->mSourceJointName, 16, "source_volume");
- dp.packVector3(constraint_it->mSourceOffset, "source_offset");
- dp.packBinaryDataFixed((U8*)constraint_it->mTargetJointName, 16, "target_volume");
- dp.packVector3(constraint_it->mTargetOffset, "target_offset");
- dp.packVector3(constraint_it->mTargetDir, "target_dir");
- dp.packF32(constraint_it->mEaseInStart, "ease_in_start");
- dp.packF32(constraint_it->mEaseInStop, "ease_in_stop");
- dp.packF32(constraint_it->mEaseOutStart, "ease_out_start");
- dp.packF32(constraint_it->mEaseOutStop, "ease_out_stop");
+ dp.packBinaryDataFixed((U8*)constraint.mSourceJointName, 16, "source_volume");
+ dp.packVector3(constraint.mSourceOffset, "source_offset");
+ dp.packBinaryDataFixed((U8*)constraint.mTargetJointName, 16, "target_volume");
+ dp.packVector3(constraint.mTargetOffset, "target_offset");
+ dp.packVector3(constraint.mTargetDir, "target_dir");
+ dp.packF32(constraint.mEaseInStart, "ease_in_start");
+ dp.packF32(constraint.mEaseInStop, "ease_in_stop");
+ dp.packF32(constraint.mEaseOutStart, "ease_out_start");
+ dp.packF32(constraint.mEaseOutStop, "ease_out_stop");
}
diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp
index af109b8373..af5f679015 100644
--- a/indra/llcharacter/llcharacter.cpp
+++ b/indra/llcharacter/llcharacter.cpp
@@ -254,10 +254,8 @@ void LLCharacter::dumpCharacter( LLJoint* joint )
LL_INFOS() << "DEBUG: " << joint->getName() << " (" << (joint->getParent()?joint->getParent()->getName():std::string("ROOT")) << ")" << LL_ENDL;
// recurse
- for (LLJoint::joints_t::iterator iter = joint->mChildren.begin();
- iter != joint->mChildren.end(); ++iter)
+ for (LLJoint* child_joint : joint->mChildren)
{
- LLJoint* child_joint = *iter;
dumpCharacter(child_joint);
}
}
diff --git a/indra/llcharacter/llcharacter.h b/indra/llcharacter/llcharacter.h
index 4f973c392e..e08695ea9f 100644
--- a/indra/llcharacter/llcharacter.h
+++ b/indra/llcharacter/llcharacter.h
@@ -229,11 +229,9 @@ public:
S32 getVisualParamCountInGroup(const EVisualParamGroup group) const
{
S32 rtn = 0;
- for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin();
- iter != mVisualParamIndexMap.end();
- /**/ )
+ for (const visual_param_index_map_t::value_type& index_pair : mVisualParamIndexMap)
{
- if ((iter++)->second->getGroup() == group)
+ if (index_pair.second->getGroup() == group)
{
++rtn;
}
@@ -248,11 +246,10 @@ public:
}
S32 getVisualParamID(LLVisualParam *id)
{
- visual_param_index_map_t::iterator iter;
- for (iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); iter++)
+ for (visual_param_index_map_t::value_type& index_pair : mVisualParamIndexMap)
{
- if (iter->second == id)
- return iter->first;
+ if (index_pair.second == id)
+ return index_pair.first;
}
return 0;
}
diff --git a/indra/llcharacter/llgesture.cpp b/indra/llcharacter/llgesture.cpp
index 37904936d8..80717d8d26 100644
--- a/indra/llcharacter/llgesture.cpp
+++ b/indra/llcharacter/llgesture.cpp
@@ -199,15 +199,14 @@ BOOL LLGestureList::triggerAndReviseString(const std::string &string, std::strin
typedef boost::tokenizer > tokenizer;
boost::char_separator sep(" ");
tokenizer tokens(string, sep);
- tokenizer::iterator token_iter;
- for( token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter)
+ for(const std::string& cur_token : tokens)
{
LLGesture* gesture = NULL;
if( !found_gestures ) // Only pay attention to the first gesture in the string.
{
- std::string cur_token_lower = *token_iter;
+ std::string cur_token_lower = cur_token;
LLStringUtil::toLower(cur_token_lower);
for (U32 i = 0; i < mList.size(); i++)
@@ -228,7 +227,7 @@ BOOL LLGestureList::triggerAndReviseString(const std::string &string, std::strin
LLStringUtil::toLower(output_lower);
if( cur_token_lower == output_lower )
{
- revised_string->append(*token_iter);
+ revised_string->append(cur_token);
}
else
{
@@ -249,7 +248,7 @@ BOOL LLGestureList::triggerAndReviseString(const std::string &string, std::strin
{
revised_string->append( " " );
}
- revised_string->append( *token_iter );
+ revised_string->append( cur_token );
}
first_token = FALSE;
diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp
index 3602b22294..d8be3f8d9d 100644
--- a/indra/llcharacter/lljoint.cpp
+++ b/indra/llcharacter/lljoint.cpp
@@ -89,11 +89,10 @@ void LLVector3OverrideMap::showJointVector3Overrides( std::ostringstream& os ) c
map_type::const_iterator max_it = std::max_element(m_map.begin(),
m_map.end(),
attachment_map_iter_compare_key);
- for (map_type::const_iterator it = m_map.begin();
- it != m_map.end(); ++it)
+ for (const map_type::value_type& pos_pair : m_map)
{
- const LLVector3& pos = it->second;
- os << " " << "[" << it->first <<": " << pos << "]" << ((it==max_it) ? "*" : "");
+ const LLVector3& pos = pos_pair.second;
+ os << " " << "[" << pos_pair.first <<": " << pos << "]" << ((pos_pair==(*max_it)) ? "*" : "");
}
}
@@ -231,10 +230,8 @@ void LLJoint::touch(U32 flags)
child_flags |= POSITION_DIRTY;
}
- for (joints_t::iterator iter = mChildren.begin();
- iter != mChildren.end(); ++iter)
+ for (LLJoint* joint : mChildren)
{
- LLJoint* joint = *iter;
joint->touch(child_flags);
}
}
@@ -273,10 +270,8 @@ LLJoint *LLJoint::findJoint( const std::string &name )
if (name == getName())
return this;
- for (joints_t::iterator iter = mChildren.begin();
- iter != mChildren.end(); ++iter)
+ for (LLJoint* joint : mChildren)
{
- LLJoint* joint = *iter;
LLJoint *found = joint->findJoint(name);
if (found)
{
@@ -536,10 +531,9 @@ void LLJoint::getAllAttachmentPosOverrides(S32& num_pos_overrides,
std::set& distinct_pos_overrides) const
{
num_pos_overrides = m_attachmentPosOverrides.count();
- LLVector3OverrideMap::map_type::const_iterator it = m_attachmentPosOverrides.getMap().begin();
- for (; it != m_attachmentPosOverrides.getMap().end(); ++it)
+ for (const LLVector3OverrideMap::map_type::value_type& pos_override_pair : m_attachmentPosOverrides.getMap())
{
- distinct_pos_overrides.insert(it->second);
+ distinct_pos_overrides.insert(pos_override_pair.second);
}
}
@@ -550,10 +544,9 @@ void LLJoint::getAllAttachmentScaleOverrides(S32& num_scale_overrides,
std::set& distinct_scale_overrides) const
{
num_scale_overrides = m_attachmentScaleOverrides.count();
- LLVector3OverrideMap::map_type::const_iterator it = m_attachmentScaleOverrides.getMap().begin();
- for (; it != m_attachmentScaleOverrides.getMap().end(); ++it)
+ for (const LLVector3OverrideMap::map_type::value_type& scale_override_pair : m_attachmentScaleOverrides.getMap())
{
- distinct_scale_overrides.insert(it->second);
+ distinct_scale_overrides.insert(scale_override_pair.second);
}
}
@@ -578,10 +571,9 @@ void LLJoint::showAttachmentPosOverrides(const std::string& av_info) const
{
LL_DEBUGS("Avatar") << "av " << av_info << " joint " << getName() << " has " << count << " attachment pos overrides" << LL_ENDL;
std::set distinct_offsets;
- LLVector3OverrideMap::map_type::const_iterator it = m_attachmentPosOverrides.getMap().begin();
- for (; it != m_attachmentPosOverrides.getMap().end(); ++it)
+ for (const LLVector3OverrideMap::map_type::value_type& pos_override_pair : m_attachmentPosOverrides.getMap())
{
- distinct_offsets.insert(it->second);
+ distinct_offsets.insert(pos_override_pair.second);
}
if (distinct_offsets.size()>1)
{
@@ -591,11 +583,10 @@ void LLJoint::showAttachmentPosOverrides(const std::string& av_info) const
{
LL_DEBUGS("Avatar") << "no conflicts" << LL_ENDL;
}
- std::set::iterator dit = distinct_offsets.begin();
- for ( ; dit != distinct_offsets.end(); ++dit)
+ for (const LLVector3& offset : distinct_offsets)
{
- std::string highlight = (has_active_override && *dit == active_override) ? "*" : "";
- LL_DEBUGS("Avatar") << " POS " << highlight << "" << (*dit) << " default " << mDefaultPosition << LL_ENDL;
+ std::string highlight = (has_active_override && offset == active_override) ? "*" : "";
+ LL_DEBUGS("Avatar") << " POS " << highlight << "" << offset << " default " << mDefaultPosition << LL_ENDL;
}
}
}
@@ -739,10 +730,9 @@ void LLJoint::showAttachmentScaleOverrides(const std::string& av_info) const
{
LL_DEBUGS("Avatar") << "av " << av_info << " joint " << getName() << " has " << count << " attachment scale overrides" << LL_ENDL;
std::set distinct_offsets;
- LLVector3OverrideMap::map_type::const_iterator it = m_attachmentScaleOverrides.getMap().begin();
- for (; it != m_attachmentScaleOverrides.getMap().end(); ++it)
+ for (const LLVector3OverrideMap::map_type::value_type& scale_override_pair : m_attachmentScaleOverrides.getMap())
{
- distinct_offsets.insert(it->second);
+ distinct_offsets.insert(scale_override_pair.second);
}
if (distinct_offsets.size()>1)
{
@@ -753,10 +743,10 @@ void LLJoint::showAttachmentScaleOverrides(const std::string& av_info) const
LL_DEBUGS("Avatar") << "no conflicts" << LL_ENDL;
}
std::set::iterator dit = distinct_offsets.begin();
- for ( ; dit != distinct_offsets.end(); ++dit)
+ for (const LLVector3& offset : distinct_offsets)
{
- std::string highlight = (has_active_override && *dit == active_override) ? "*" : "";
- LL_DEBUGS("Avatar") << " POS " << highlight << "" << (*dit) << " default " << mDefaultScale << LL_ENDL;
+ std::string highlight = (has_active_override && offset == active_override) ? "*" : "";
+ LL_DEBUGS("Avatar") << " POS " << highlight << "" << offset << " default " << mDefaultScale << LL_ENDL;
}
}
}
@@ -1015,10 +1005,8 @@ void LLJoint::updateWorldMatrixChildren()
{
updateWorldMatrix();
}
- for (joints_t::iterator iter = mChildren.begin();
- iter != mChildren.end(); ++iter)
+ for (LLJoint* joint : mChildren)
{
- LLJoint* joint = *iter;
joint->updateWorldMatrixChildren();
}
}
@@ -1062,10 +1050,8 @@ void LLJoint::clampRotation(LLQuaternion old_rot, LLQuaternion new_rot)
{
LLVector3 main_axis(1.f, 0.f, 0.f);
- for (joints_t::iterator iter = mChildren.begin();
- iter != mChildren.end(); ++iter)
+ for (LLJoint* joint : mChildren)
{
- LLJoint* joint = *iter;
if (joint->isAnimatable())
{
main_axis = joint->getPosition();
diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp
index cc6e37ebe6..2975ce1c5c 100644
--- a/indra/llcharacter/llkeyframemotion.cpp
+++ b/indra/llcharacter/llkeyframemotion.cpp
@@ -629,10 +629,8 @@ BOOL LLKeyframeMotion::setupPose()
}
// initialize joint constraints
- for (JointMotionList::constraint_list_t::iterator iter = mJointMotionList->mConstraints.begin();
- iter != mJointMotionList->mConstraints.end(); ++iter)
+ for (JointConstraintSharedData* shared_constraintp : mJointMotionList->mConstraints)
{
- JointConstraintSharedData* shared_constraintp = *iter;
JointConstraint* constraintp = new JointConstraint(shared_constraintp);
initializeConstraint(constraintp);
mConstraints.push_front(constraintp);
@@ -767,19 +765,15 @@ void LLKeyframeMotion::applyConstraints(F32 time, U8* joint_mask)
if (mCharacter->getSkeletonSerialNum() != mLastSkeletonSerialNum)
{
mLastSkeletonSerialNum = mCharacter->getSkeletonSerialNum();
- for (constraint_list_t::iterator iter = mConstraints.begin();
- iter != mConstraints.end(); ++iter)
+ for (JointConstraint* constraintp : mConstraints)
{
- JointConstraint* constraintp = *iter;
initializeConstraint(constraintp);
}
}
// apply constraints
- for (constraint_list_t::iterator iter = mConstraints.begin();
- iter != mConstraints.end(); ++iter)
+ for (JointConstraint* constraintp : mConstraints)
{
- JointConstraint* constraintp = *iter;
applyConstraint(constraintp, time, joint_mask);
}
}
@@ -789,10 +783,8 @@ void LLKeyframeMotion::applyConstraints(F32 time, U8* joint_mask)
//-----------------------------------------------------------------------------
void LLKeyframeMotion::onDeactivate()
{
- for (constraint_list_t::iterator iter = mConstraints.begin();
- iter != mConstraints.end(); ++iter)
+ for (JointConstraint* constraintp : mConstraints)
{
- JointConstraint* constraintp = *iter;
deactivateConstraint(constraintp);
}
}
@@ -2067,10 +2059,9 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const
success &= dp.packS32(joint_motionp->mRotationCurve.mNumKeys, "num_rot_keys");
LL_DEBUGS("BVH") << "Joint " << joint_motionp->mJointName << LL_ENDL;
- for (RotationCurve::key_map_t::iterator iter = joint_motionp->mRotationCurve.mKeys.begin();
- iter != joint_motionp->mRotationCurve.mKeys.end(); ++iter)
+ for (RotationCurve::key_map_t::value_type& rot_pair : joint_motionp->mRotationCurve.mKeys)
{
- RotationKey& rot_key = iter->second;
+ RotationKey& rot_key = rot_pair.second;
U16 time_short = F32_to_U16(rot_key.mTime, 0.f, mJointMotionList->mDuration);
success &= dp.packU16(time_short, "time");
@@ -2089,10 +2080,9 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const
}
success &= dp.packS32(joint_motionp->mPositionCurve.mNumKeys, "num_pos_keys");
- for (PositionCurve::key_map_t::iterator iter = joint_motionp->mPositionCurve.mKeys.begin();
- iter != joint_motionp->mPositionCurve.mKeys.end(); ++iter)
+ for (PositionCurve::key_map_t::value_type& pos_pair : joint_motionp->mPositionCurve.mKeys)
{
- PositionKey& pos_key = iter->second;
+ PositionKey& pos_key = pos_pair.second;
U16 time_short = F32_to_U16(pos_key.mTime, 0.f, mJointMotionList->mDuration);
success &= dp.packU16(time_short, "time");
@@ -2111,10 +2101,8 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const
success &= dp.packS32(mJointMotionList->mConstraints.size(), "num_constraints");
LL_DEBUGS("BVH") << "num_constraints " << mJointMotionList->mConstraints.size() << LL_ENDL;
- for (JointMotionList::constraint_list_t::const_iterator iter = mJointMotionList->mConstraints.begin();
- iter != mJointMotionList->mConstraints.end(); ++iter)
+ for (JointConstraintSharedData* shared_constraintp : mJointMotionList->mConstraints)
{
- JointConstraintSharedData* shared_constraintp = *iter;
success &= dp.packU8(shared_constraintp->mChainLength, "chain_length");
success &= dp.packU8(shared_constraintp->mConstraintType, "constraint_type");
char source_volume[16]; /* Flawfinder: ignore */
@@ -2482,14 +2470,13 @@ void LLKeyframeDataCache::dumpDiagInfo()
LL_INFOS() << "-----------------------------------------------------" << LL_ENDL;
// print each loaded mesh, and it's memory usage
- for (keyframe_data_map_t::iterator map_it = sKeyframeDataMap.begin();
- map_it != sKeyframeDataMap.end(); ++map_it)
+ for (keyframe_data_map_t::value_type& data_pair : sKeyframeDataMap)
{
U32 joint_motion_kb;
- LLKeyframeMotion::JointMotionList *motion_list_p = map_it->second;
+ LLKeyframeMotion::JointMotionList *motion_list_p = data_pair.second;
- LL_INFOS() << "Motion: " << map_it->first << LL_ENDL;
+ LL_INFOS() << "Motion: " << data_pair.first << LL_ENDL;
joint_motion_kb = motion_list_p->dumpDiagInfo();
diff --git a/indra/llcharacter/llkeyframemotionparam.cpp b/indra/llcharacter/llkeyframemotionparam.cpp
index 4a43d5f346..1dc4a70c6b 100644
--- a/indra/llcharacter/llkeyframemotionparam.cpp
+++ b/indra/llcharacter/llkeyframemotionparam.cpp
@@ -64,13 +64,11 @@ LLKeyframeMotionParam::LLKeyframeMotionParam( const LLUUID &id) : LLMotion(id)
//-----------------------------------------------------------------------------
LLKeyframeMotionParam::~LLKeyframeMotionParam()
{
- for (motion_map_t::iterator iter = mParameterizedMotions.begin();
- iter != mParameterizedMotions.end(); ++iter)
+ for (motion_map_t::value_type& motion_pair : mParameterizedMotions)
{
- motion_list_t& motionList = iter->second;
- for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2)
+ motion_list_t& motionList = motion_pair.second;
+ for (const ParameterizedMotion& paramMotion : motionList)
{
- const ParameterizedMotion& paramMotion = *iter2;
delete paramMotion.mMotion;
}
motionList.clear();
@@ -90,13 +88,11 @@ LLMotion::LLMotionInitStatus LLKeyframeMotionParam::onInitialize(LLCharacter *ch
return STATUS_FAILURE;
}
- for (motion_map_t::iterator iter = mParameterizedMotions.begin();
- iter != mParameterizedMotions.end(); ++iter)
+ for (motion_map_t::value_type& motion_pair : mParameterizedMotions)
{
- motion_list_t& motionList = iter->second;
- for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2)
+ motion_list_t& motionList = motion_pair.second;
+ for (const ParameterizedMotion& paramMotion : motionList)
{
- const ParameterizedMotion& paramMotion = *iter2;
LLMotion* motion = paramMotion.mMotion;
motion->onInitialize(character);
@@ -142,13 +138,11 @@ LLMotion::LLMotionInitStatus LLKeyframeMotionParam::onInitialize(LLCharacter *ch
//-----------------------------------------------------------------------------
BOOL LLKeyframeMotionParam::onActivate()
{
- for (motion_map_t::iterator iter = mParameterizedMotions.begin();
- iter != mParameterizedMotions.end(); ++iter)
+ for (motion_map_t::value_type& motion_pair : mParameterizedMotions)
{
- motion_list_t& motionList = iter->second;
- for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2)
+ motion_list_t& motionList = motion_pair.second;
+ for (const ParameterizedMotion& paramMotion : motionList)
{
- const ParameterizedMotion& paramMotion = *iter2;
paramMotion.mMotion->activate(mActivationTimestamp);
}
}
@@ -165,23 +159,20 @@ BOOL LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask)
F32 weightFactor = 1.f / (F32)mParameterizedMotions.size();
// zero out all pose weights
- for (motion_map_t::iterator iter = mParameterizedMotions.begin();
- iter != mParameterizedMotions.end(); ++iter)
+ for (motion_map_t::value_type& motion_pair : mParameterizedMotions)
{
- motion_list_t& motionList = iter->second;
- for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2)
+ motion_list_t& motionList = motion_pair.second;
+ for (const ParameterizedMotion& paramMotion : motionList)
{
- const ParameterizedMotion& paramMotion = *iter2;
// LL_INFOS() << "Weight for pose " << paramMotion.mMotion->getName() << " is " << paramMotion.mMotion->getPose()->getWeight() << LL_ENDL;
paramMotion.mMotion->getPose()->setWeight(0.f);
}
}
- for (motion_map_t::iterator iter = mParameterizedMotions.begin();
- iter != mParameterizedMotions.end(); ++iter)
+ for (motion_map_t::value_type& motion_pair : mParameterizedMotions)
{
- const std::string& paramName = iter->first;
+ const std::string& paramName = motion_pair.first;
F32* paramValue = (F32 *)mCharacter->getAnimationData(paramName);
if (NULL == paramValue) // unexpected, but...
{
@@ -193,10 +184,9 @@ BOOL LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask)
const ParameterizedMotion* firstMotion = NULL;
const ParameterizedMotion* secondMotion = NULL;
- motion_list_t& motionList = iter->second;
- for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2)
+ motion_list_t& motionList = motion_pair.second;
+ for (const ParameterizedMotion& paramMotion : motionList)
{
- const ParameterizedMotion& paramMotion = *iter2;
paramMotion.mMotion->onUpdate(time, joint_mask);
F32 distToParam = paramMotion.mParam - *paramValue;
@@ -283,13 +273,11 @@ BOOL LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask)
//-----------------------------------------------------------------------------
void LLKeyframeMotionParam::onDeactivate()
{
- for (motion_map_t::iterator iter = mParameterizedMotions.begin();
- iter != mParameterizedMotions.end(); ++iter)
+ for (motion_map_t::value_type& motion_pair : mParameterizedMotions)
{
- motion_list_t& motionList = iter->second;
- for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2)
+ motion_list_t& motionList = motion_pair.second;
+ for (const ParameterizedMotion& paramMotion : motionList)
{
- const ParameterizedMotion& paramMotion = *iter2;
paramMotion.mMotion->onDeactivate();
}
}
@@ -321,13 +309,11 @@ BOOL LLKeyframeMotionParam::addKeyframeMotion(char *name, const LLUUID &id, char
//-----------------------------------------------------------------------------
void LLKeyframeMotionParam::setDefaultKeyframeMotion(char *name)
{
- for (motion_map_t::iterator iter = mParameterizedMotions.begin();
- iter != mParameterizedMotions.end(); ++iter)
+ for (motion_map_t::value_type& motion_pair : mParameterizedMotions)
{
- motion_list_t& motionList = iter->second;
- for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2)
+ motion_list_t& motionList = motion_pair.second;
+ for (const ParameterizedMotion& paramMotion : motionList)
{
- const ParameterizedMotion& paramMotion = *iter2;
if (paramMotion.mMotion->getName() == name)
{
mDefaultKeyframeMotion = paramMotion.mMotion;
diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp
index 0028279d40..6ff3230f14 100644
--- a/indra/llcharacter/llmotioncontroller.cpp
+++ b/indra/llcharacter/llmotioncontroller.cpp
@@ -212,11 +212,8 @@ void LLMotionController::purgeExcessMotions()
{
// too many motions active this frame, kill all blenders
mPoseBlender.clearBlenders();
- for (motion_set_t::iterator loaded_motion_it = mLoadedMotions.begin();
- loaded_motion_it != mLoadedMotions.end();
- ++loaded_motion_it)
+ for (LLMotion* cur_motionp : mLoadedMotions)
{
- LLMotion* cur_motionp = *loaded_motion_it;
// motion isn't playing, delete it
if (!isMotionActive(cur_motionp))
{
@@ -226,13 +223,10 @@ void LLMotionController::purgeExcessMotions()
}
// clean up all inactive, loaded motions
- for (std::set::iterator motion_it = motions_to_kill.begin();
- motion_it != motions_to_kill.end();
- ++motion_it)
+ for (LLUUID motion_id : motions_to_kill)
{
// look up the motion again by ID to get canonical instance
// and kill it only if that one is inactive
- LLUUID motion_id = *motion_it;
LLMotion* motionp = findMotion(motion_id);
if (motionp && !isMotionActive(motionp))
{
@@ -1072,12 +1066,11 @@ LLMotion* LLMotionController::findMotion(const LLUUID& id) const
void LLMotionController::dumpMotions()
{
LL_INFOS() << "=====================================" << LL_ENDL;
- for (motion_map_t::iterator iter = mAllMotions.begin();
- iter != mAllMotions.end(); iter++)
+ for (motion_map_t::value_type& motion_pair : mAllMotions)
{
- LLUUID id = iter->first;
+ LLUUID id = motion_pair.first;
std::string state_string;
- LLMotion *motion = iter->second;
+ LLMotion *motion = motion_pair.second;
if (mLoadingMotions.find(motion) != mLoadingMotions.end())
state_string += std::string("l");
if (mLoadedMotions.find(motion) != mLoadedMotions.end())
@@ -1096,10 +1089,9 @@ void LLMotionController::dumpMotions()
//-----------------------------------------------------------------------------
void LLMotionController::deactivateAllMotions()
{
- for (motion_map_t::iterator iter = mAllMotions.begin();
- iter != mAllMotions.end(); iter++)
+ for (motion_map_t::value_type& motion_pair : mAllMotions)
{
- LLMotion* motionp = iter->second;
+ LLMotion* motionp = motion_pair.second;
deactivateMotionInstance(motionp);
}
}
@@ -1131,10 +1123,9 @@ void LLMotionController::flushAllMotions()
mCharacter->removeAnimationData("Hand Pose");
// restart motions
- for (std::vector >::iterator iter = active_motions.begin();
- iter != active_motions.end(); ++iter)
+ for (std::vector >::value_type& motion_pair : active_motions)
{
- startMotion(iter->first, iter->second);
+ startMotion(motion_pair.first, motion_pair.second);
}
}
diff --git a/indra/llcharacter/llmultigesture.cpp b/indra/llcharacter/llmultigesture.cpp
index 2045739c7f..7ed242f90a 100644
--- a/indra/llcharacter/llmultigesture.cpp
+++ b/indra/llcharacter/llmultigesture.cpp
@@ -88,10 +88,8 @@ S32 LLMultiGesture::getMaxSerialSize() const
max_size += 64; // step count S32
- std::vector::const_iterator it;
- for (it = mSteps.begin(); it != mSteps.end(); ++it)
+ for (LLGestureStep* step : mSteps)
{
- LLGestureStep* step = *it;
max_size += 64; // type S32
max_size += step->getMaxSerialSize();
}
diff --git a/indra/llcharacter/llpose.cpp b/indra/llcharacter/llpose.cpp
index fc95fafd61..6f41a0e747 100644
--- a/indra/llcharacter/llpose.cpp
+++ b/indra/llcharacter/llpose.cpp
@@ -148,11 +148,9 @@ LLJointState* LLPose::findJointState(const std::string &name)
void LLPose::setWeight(F32 weight)
{
joint_map_iterator iter;
- for(iter = mJointMap.begin();
- iter != mJointMap.end();
- ++iter)
+ for (joint_map_value_type& joint_pair : mJointMap)
{
- iter->second->setWeight(weight);
+ joint_pair.second->setWeight(weight);
}
mWeight = weight;
}
diff --git a/indra/llcharacter/llstatemachine.cpp b/indra/llcharacter/llstatemachine.cpp
index b40a18b6c9..2716bd36bc 100644
--- a/indra/llcharacter/llstatemachine.cpp
+++ b/indra/llcharacter/llstatemachine.cpp
@@ -169,10 +169,9 @@ void LLStateDiagram::setDefaultState(LLFSMState& default_state)
S32 LLStateDiagram::numDeadendStates()
{
S32 numDeadends = 0;
- StateMap::iterator state_it;
- for(state_it = mStates.begin(); state_it != mStates.end(); ++state_it)
+ for (StateMap::value_type& state_pair : mStates)
{
- if (state_it->second.size() == 0)
+ if (state_pair.second.size() == 0)
{
numDeadends++;
}
@@ -191,12 +190,11 @@ BOOL LLStateDiagram::stateIsValid(LLFSMState& state)
LLFSMState* LLStateDiagram::getState(U32 state_id)
{
- StateMap::iterator state_it;
- for(state_it = mStates.begin(); state_it != mStates.end(); ++state_it)
+ for (StateMap::value_type& state_pair : mStates)
{
- if (state_it->first->getID() == state_id)
+ if (state_pair.first->getID() == state_id)
{
- return state_it->first;
+ return state_pair.first;
}
}
return NULL;
@@ -219,18 +217,16 @@ BOOL LLStateDiagram::saveDotFile(const std::string& filename)
}
apr_file_printf(dot_file, "digraph StateMachine {\n\tsize=\"100,100\";\n\tfontsize=40;\n\tlabel=\"Finite State Machine\";\n\torientation=landscape\n\tratio=.77\n");
- StateMap::iterator state_it;
- for(state_it = mStates.begin(); state_it != mStates.end(); ++state_it)
+ for (StateMap::value_type& state_pair : mStates)
{
- apr_file_printf(dot_file, "\t\"%s\" [fontsize=28,shape=box]\n", state_it->first->getName().c_str());
+ apr_file_printf(dot_file, "\t\"%s\" [fontsize=28,shape=box]\n", state_pair.first->getName().c_str());
}
apr_file_printf(dot_file, "\t\"All States\" [fontsize=30,style=bold,shape=box]\n");
- Transitions::iterator transitions_it;
- for(transitions_it = mDefaultTransitions.begin(); transitions_it != mDefaultTransitions.end(); ++transitions_it)
+ for (Transitions::value_type& transition_pair : mDefaultTransitions)
{
- apr_file_printf(dot_file, "\t\"All States\" -> \"%s\" [label = \"%s\",fontsize=24];\n", transitions_it->second->getName().c_str(),
- transitions_it->second->getName().c_str());
+ apr_file_printf(dot_file, "\t\"All States\" -> \"%s\" [label = \"%s\",fontsize=24];\n", transition_pair.second->getName().c_str(),
+ transition_pair.second->getName().c_str());
}
if (mDefaultState)
@@ -239,18 +235,15 @@ BOOL LLStateDiagram::saveDotFile(const std::string& filename)
}
- for(state_it = mStates.begin(); state_it != mStates.end(); ++state_it)
+ for (StateMap::value_type& state_pair : mStates)
{
- LLFSMState *state = state_it->first;
+ LLFSMState *state = state_pair.first;
- Transitions::iterator transitions_it;
- for(transitions_it = state_it->second.begin();
- transitions_it != state_it->second.end();
- ++transitions_it)
+ for (Transitions::value_type& transition_pair : state_pair.second)
{
std::string state_name = state->getName();
- std::string target_name = transitions_it->second->getName();
- std::string transition_name = transitions_it->first->getName();
+ std::string target_name = transition_pair.second->getName();
+ std::string transition_name = transition_pair.first->getName();
apr_file_printf(dot_file, "\t\"%s\" -> \"%s\" [label = \"%s\",fontsize=24];\n", state->getName().c_str(),
target_name.c_str(),
transition_name.c_str());
@@ -269,25 +262,18 @@ std::ostream& operator<<(std::ostream &s, LLStateDiagram &FSM)
s << "Default State: " << FSM.mDefaultState->getName() << "\n";
}
- LLStateDiagram::Transitions::iterator transitions_it;
- for(transitions_it = FSM.mDefaultTransitions.begin();
- transitions_it != FSM.mDefaultTransitions.end();
- ++transitions_it)
+ for (LLStateDiagram::Transitions::value_type& transition_pair : FSM.mDefaultTransitions)
{
- s << "Any State -- " << transitions_it->first->getName()
- << " --> " << transitions_it->second->getName() << "\n";
+ s << "Any State -- " << transition_pair.first->getName()
+ << " --> " << transition_pair.second->getName() << "\n";
}
- LLStateDiagram::StateMap::iterator state_it;
- for(state_it = FSM.mStates.begin(); state_it != FSM.mStates.end(); ++state_it)
+ for (LLStateDiagram::StateMap::value_type& state_pair : FSM.mStates)
{
- LLStateDiagram::Transitions::iterator transitions_it;
- for(transitions_it = state_it->second.begin();
- transitions_it != state_it->second.end();
- ++transitions_it)
+ for (LLStateDiagram::Transitions::value_type& transition_pair : state_pair.second)
{
- s << state_it->first->getName() << " -- " << transitions_it->first->getName()
- << " --> " << transitions_it->second->getName() << "\n";
+ s << state_pair.first->getName() << " -- " << transition_pair.first->getName()
+ << " --> " << transition_pair.second->getName() << "\n";
}
s << "\n";
}
diff --git a/indra/llcommon/llallocator_heap_profile.cpp b/indra/llcommon/llallocator_heap_profile.cpp
index b63d91caa6..f4008c40aa 100644
--- a/indra/llcommon/llallocator_heap_profile.cpp
+++ b/indra/llcommon/llallocator_heap_profile.cpp
@@ -142,14 +142,13 @@ void LLAllocatorHeapProfile::parse(std::string const & prof_text)
void LLAllocatorHeapProfile::dump(std::ostream & out) const
{
lines_t::const_iterator i;
- for(i = mLines.begin(); i != mLines.end(); ++i)
+ for (const LLAllocatorHeapProfile::line& line : mLines)
{
- out << i->mLiveCount << ": " << i->mLiveSize << '[' << i->mTotalCount << ": " << i->mTotalSize << "] @";
+ out << line.mLiveCount << ": " << line.mLiveSize << '[' << line.mTotalCount << ": " << line.mTotalSize << "] @";
- stack_trace::const_iterator j;
- for(j = i->mTrace.begin(); j != i->mTrace.end(); ++j)
+ for (const stack_marker marker : line.mTrace)
{
- out << ' ' << *j;
+ out << ' ' << marker;
}
out << '\n';
}
diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp
index 5a7174ac9a..fc78662f09 100644
--- a/indra/llcommon/llapp.cpp
+++ b/indra/llcommon/llapp.cpp
@@ -865,14 +865,14 @@ bool unix_post_minidump_callback(const char *dump_dir,
// heap allocations in a crash handler.
// path format: /.dmp
- int dirPathLength = strlen(dump_dir);
- int idLength = strlen(minidump_id);
+ auto dirPathLength = strlen(dump_dir);
+ auto idLength = strlen(minidump_id);
// The path must not be truncated.
llassert((dirPathLength + idLength + 5) <= LLApp::MAX_MINDUMP_PATH_LENGTH);
char * path = LLApp::instance()->getMiniDumpFilename();
- S32 remaining = LLApp::MAX_MINDUMP_PATH_LENGTH;
+ auto remaining = LLApp::MAX_MINDUMP_PATH_LENGTH;
strncpy(path, dump_dir, remaining);
remaining -= dirPathLength;
path += dirPathLength;
diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp
index e6cc06e8d0..4c84223dad 100644
--- a/indra/llcommon/llassettype.cpp
+++ b/indra/llcommon/llassettype.cpp
@@ -150,14 +150,12 @@ LLAssetType::EType LLAssetType::lookup(const char* name)
LLAssetType::EType LLAssetType::lookup(const std::string& type_name)
{
const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
- for (LLAssetDictionary::const_iterator iter = dict->begin();
- iter != dict->end();
- iter++)
+ for (const LLAssetDictionary::value_type& pair : *dict)
{
- const AssetEntry *entry = iter->second;
+ const AssetEntry *entry = pair.second;
if (type_name == entry->mTypeName)
{
- return iter->first;
+ return pair.first;
}
}
return AT_UNKNOWN;
@@ -188,14 +186,12 @@ LLAssetType::EType LLAssetType::lookupHumanReadable(const char* name)
LLAssetType::EType LLAssetType::lookupHumanReadable(const std::string& readable_name)
{
const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
- for (LLAssetDictionary::const_iterator iter = dict->begin();
- iter != dict->end();
- iter++)
+ for (const LLAssetDictionary::value_type& pair : *dict)
{
- const AssetEntry *entry = iter->second;
+ const AssetEntry *entry = pair.second;
if (entry->mHumanName && (readable_name == entry->mHumanName))
{
- return iter->first;
+ return pair.first;
}
}
return AT_NONE;
diff --git a/indra/llcommon/llbase64.cpp b/indra/llcommon/llbase64.cpp
index 4e82cf7f20..bb85fe32a3 100644
--- a/indra/llcommon/llbase64.cpp
+++ b/indra/llcommon/llbase64.cpp
@@ -42,7 +42,7 @@ std::string LLBase64::encode(const U8* input, size_t input_size)
&& input_size > 0)
{
// Yes, it returns int.
- int b64_buffer_length = apr_base64_encode_len(input_size);
+ int b64_buffer_length = apr_base64_encode_len(narrow(input_size));
char* b64_buffer = new char[b64_buffer_length];
// This is faster than apr_base64_encode() if you know
@@ -52,7 +52,7 @@ std::string LLBase64::encode(const U8* input, size_t input_size)
b64_buffer_length = apr_base64_encode_binary(
b64_buffer,
input,
- input_size);
+ narrow(input_size));
output.assign(b64_buffer);
delete[] b64_buffer;
}
diff --git a/indra/llcommon/llcallbacklist.cpp b/indra/llcommon/llcallbacklist.cpp
index 541ff75ee4..93d0a035da 100644
--- a/indra/llcommon/llcallbacklist.cpp
+++ b/indra/llcommon/llcallbacklist.cpp
@@ -109,7 +109,7 @@ void LLCallbackList::deleteAllFunctions()
void LLCallbackList::callFunctions()
{
- for (callback_list_t::iterator iter = mCallbackList.begin(); iter != mCallbackList.end(); )
+ for (callback_list_t::iterator iter = mCallbackList.begin(); iter != mCallbackList.end(); )
{
callback_list_t::iterator curiter = iter++;
curiter->first(curiter->second);
diff --git a/indra/llcommon/llcallstack.cpp b/indra/llcommon/llcallstack.cpp
index 8db291eed1..83d5ae2a63 100644
--- a/indra/llcommon/llcallstack.cpp
+++ b/indra/llcommon/llcallstack.cpp
@@ -91,10 +91,9 @@ LLCallStack::LLCallStack(S32 skip_count, bool verbose):
bool LLCallStack::contains(const std::string& str)
{
- for (std::vector::const_iterator it = m_strings.begin();
- it != m_strings.end(); ++it)
+ for (const std::string& src_str : m_strings)
{
- if (it->find(str) != std::string::npos)
+ if (src_str.find(str) != std::string::npos)
{
return true;
}
@@ -105,10 +104,9 @@ bool LLCallStack::contains(const std::string& str)
std::ostream& operator<<(std::ostream& s, const LLCallStack& call_stack)
{
#ifndef LL_RELEASE_FOR_DOWNLOAD
- std::vector::const_iterator it;
- for (it=call_stack.m_strings.begin(); it!=call_stack.m_strings.end(); ++it)
+ for (const std::string& str : call_stack.m_strings)
{
- s << *it;
+ s << str;
}
#else
s << "UNAVAILABLE IN RELEASE";
@@ -156,9 +154,9 @@ bool LLContextStrings::contains(const std::string& str)
{
const std::map& strings =
LLThreadLocalSingletonPointer::getInstance()->m_contextStrings;
- for (std::map::const_iterator it = strings.begin(); it!=strings.end(); ++it)
+ for (const std::map::value_type& str_pair : strings)
{
- if (it->first.find(str) != std::string::npos)
+ if (str_pair.first.find(str) != std::string::npos)
{
return true;
}
@@ -171,9 +169,9 @@ void LLContextStrings::output(std::ostream& os)
{
const std::map& strings =
LLThreadLocalSingletonPointer::getInstance()->m_contextStrings;
- for (std::map::const_iterator it = strings.begin(); it!=strings.end(); ++it)
+ for (const std::map::value_type& str_pair : strings)
{
- os << it->first << "[" << it->second << "]" << "\n";
+ os << str_pair.first << "[" << str_pair.second << "]" << "\n";
}
}
diff --git a/indra/llcommon/lldefs.h b/indra/llcommon/lldefs.h
index 5a4b8325f4..5c46f6a796 100644
--- a/indra/llcommon/lldefs.h
+++ b/indra/llcommon/lldefs.h
@@ -28,6 +28,7 @@
#define LL_LLDEFS_H
#include "stdtypes.h"
+#include
// Often used array indices
const U32 VX = 0;
@@ -168,80 +169,79 @@ const U32 MAXADDRSTR = 17; // 123.567.901.345 = 15 chars + \0 + 1 for good luc
// llclampb(a) // clamps a to [0 .. 255]
//
-template
-inline LLDATATYPE llmax(const LLDATATYPE& d1, const LLDATATYPE& d2)
+template
+inline auto llmax(T1 d1, T2 d2)
{
return (d1 > d2) ? d1 : d2;
}
-template
-inline LLDATATYPE llmax(const LLDATATYPE& d1, const LLDATATYPE& d2, const LLDATATYPE& d3)
+template
+inline auto llmax(T1 d1, T2 d2, T3 d3)
{
- LLDATATYPE r = llmax(d1,d2);
+ auto r = llmax(d1,d2);
return llmax(r, d3);
}
-template
-inline LLDATATYPE llmax(const LLDATATYPE& d1, const LLDATATYPE& d2, const LLDATATYPE& d3, const LLDATATYPE& d4)
+template
+inline auto llmax(T1 d1, T2 d2, T3 d3, T4 d4)
{
- LLDATATYPE r1 = llmax(d1,d2);
- LLDATATYPE r2 = llmax(d3,d4);
+ auto r1 = llmax(d1,d2);
+ auto r2 = llmax(d3,d4);
return llmax(r1, r2);
}
-template
-inline LLDATATYPE llmin(const LLDATATYPE& d1, const LLDATATYPE& d2)
+template
+inline auto llmin(T1 d1, T2 d2)
{
return (d1 < d2) ? d1 : d2;
}
-template
-inline LLDATATYPE llmin(const LLDATATYPE& d1, const LLDATATYPE& d2, const LLDATATYPE& d3)
+template
+inline auto llmin(T1 d1, T2 d2, T3 d3)
{
- LLDATATYPE r = llmin(d1,d2);
+ auto r = llmin(d1,d2);
return (r < d3 ? r : d3);
}
-template
-inline LLDATATYPE llmin(const LLDATATYPE& d1, const LLDATATYPE& d2, const LLDATATYPE& d3, const LLDATATYPE& d4)
+template
+inline auto llmin(T1 d1, T2 d2, T3 d3, T4 d4)
{
- LLDATATYPE r1 = llmin(d1,d2);
- LLDATATYPE r2 = llmin(d3,d4);
+ auto r1 = llmin(d1,d2);
+ auto r2 = llmin(d3,d4);
return llmin(r1, r2);
}
-template
-inline LLDATATYPE llclamp(const LLDATATYPE& a, const LLDATATYPE& minval, const LLDATATYPE& maxval)
+template
+inline A llclamp(A a, MIN minval, MAX maxval)
{
- if ( a < minval )
+ A aminval{ static_cast(minval) }, amaxval{ static_cast(maxval) };
+ if ( a < aminval )
{
- return minval;
+ return aminval;
}
- else if ( a > maxval )
+ else if ( a > amaxval )
{
- return maxval;
+ return amaxval;
}
return a;
}
template
-inline LLDATATYPE llclampf(const LLDATATYPE& a)
+inline LLDATATYPE llclampf(LLDATATYPE a)
{
- return llmin(llmax(a, (LLDATATYPE)0), (LLDATATYPE)1);
+ return llmin(llmax(a, LLDATATYPE(0)), LLDATATYPE(1));
}
template
-inline LLDATATYPE llclampb(const LLDATATYPE& a)
+inline LLDATATYPE llclampb(LLDATATYPE a)
{
- return llmin(llmax(a, (LLDATATYPE)0), (LLDATATYPE)255);
+ return llmin(llmax(a, LLDATATYPE(0)), LLDATATYPE(255));
}
template
inline void llswap(LLDATATYPE& lhs, LLDATATYPE& rhs)
{
- LLDATATYPE tmp = lhs;
- lhs = rhs;
- rhs = tmp;
+ std::swap(lhs, rhs);
}
#endif // LL_LLDEFS_H
diff --git a/indra/llcommon/lldependencies.cpp b/indra/llcommon/lldependencies.cpp
index 0d5757effd..db546c5c3b 100644
--- a/indra/llcommon/lldependencies.cpp
+++ b/indra/llcommon/lldependencies.cpp
@@ -42,7 +42,7 @@
// other Linden headers
#include "llexception.h"
-LLDependenciesBase::VertexList LLDependenciesBase::topo_sort(int vertices, const EdgeList& edges) const
+LLDependenciesBase::VertexList LLDependenciesBase::topo_sort(size_t vertices, const EdgeList& edges) const
{
// Construct a Boost Graph Library graph according to the constraints
// we've collected. It seems as though we ought to be able to capture
diff --git a/indra/llcommon/lldependencies.h b/indra/llcommon/lldependencies.h
index db2bbab8b0..fa54a944c8 100644
--- a/indra/llcommon/lldependencies.h
+++ b/indra/llcommon/lldependencies.h
@@ -126,7 +126,7 @@ public:
protected:
typedef std::vector< std::pair > EdgeList;
typedef std::vector VertexList;
- VertexList topo_sort(int vertices, const EdgeList& edges) const;
+ VertexList topo_sort(size_t vertices, const EdgeList& edges) const;
/**
* refpair is specifically intended to capture a pair of references. This
@@ -514,21 +514,16 @@ public:
// former broken behavior has finally been fixed -- and our builds
// treat warnings as errors.
{
- for (typename DepNodeMap::const_iterator nmi = mNodes.begin(), nmend = mNodes.end();
- nmi != nmend; ++nmi)
+ for (typename const DepNodeMap::value_type& nm_pair : mNodes)
{
- vmap.insert(typename VertexMap::value_type(nmi->first, vmap.size()));
- for (typename DepNode::dep_set::const_iterator ai = nmi->second.after.begin(),
- aend = nmi->second.after.end();
- ai != aend; ++ai)
+ vmap.insert(typename VertexMap::value_type(nm_pair.first, vmap.size()));
+ for (typename const KEY& after_k : nm_pair.second.after)
{
- vmap.insert(typename VertexMap::value_type(*ai, vmap.size()));
+ vmap.insert(typename VertexMap::value_type(after_k, vmap.size()));
}
- for (typename DepNode::dep_set::const_iterator bi = nmi->second.before.begin(),
- bend = nmi->second.before.end();
- bi != bend; ++bi)
+ for (typename const KEY& before_k : nm_pair.second.before)
{
- vmap.insert(typename VertexMap::value_type(*bi, vmap.size()));
+ vmap.insert(typename VertexMap::value_type(before_k, vmap.size()));
}
}
}
@@ -536,24 +531,19 @@ public:
// all the known key dependencies to integer pairs.
EdgeList edges;
{
- for (typename DepNodeMap::const_iterator nmi = mNodes.begin(), nmend = mNodes.end();
- nmi != nmend; ++nmi)
+ for (typename const DepNodeMap::value_type& nm_pair : mNodes)
{
- int thisnode = vmap[nmi->first];
+ auto thisnode = vmap[nm_pair.first];
// after dependencies: build edges from the named node to this one
- for (typename DepNode::dep_set::const_iterator ai = nmi->second.after.begin(),
- aend = nmi->second.after.end();
- ai != aend; ++ai)
+ for (typename const KEY& after_k : nm_pair.second.after)
{
- edges.push_back(EdgeList::value_type(vmap[*ai], thisnode));
+ edges.push_back(EdgeList::value_type(vmap[after_k], thisnode));
}
// before dependencies: build edges from this node to the
// named one
- for (typename DepNode::dep_set::const_iterator bi = nmi->second.before.begin(),
- bend = nmi->second.before.end();
- bi != bend; ++bi)
+ for (typename const KEY& before_k : nm_pair.second.before)
{
- edges.push_back(EdgeList::value_type(thisnode, vmap[*bi]));
+ edges.push_back(EdgeList::value_type(thisnode, vmap[before_k]));
}
}
}
@@ -565,21 +555,19 @@ public:
// and we're certain that the associated int values are distinct
// indexes. The fact that they're not in order is irrelevant.
KeyList vkeys(vmap.size());
- for (typename VertexMap::const_iterator vmi = vmap.begin(), vmend = vmap.end();
- vmi != vmend; ++vmi)
+ for (typename const VertexMap::value_type& vm_pair : vmap)
{
- vkeys[vmi->second] = vmi->first;
+ vkeys[vm_pair.second] = vm_pair.first;
}
// Walk the sorted output list, building the result into mCache so
// we'll have it next time someone asks.
mCache.clear();
- for (VertexList::const_iterator svi = sorted.begin(), svend = sorted.end();
- svi != svend; ++svi)
+ for (const size_t sv : sorted)
{
- // We're certain that vkeys[*svi] exists. However, there might not
+ // We're certain that vkeys[sv] exists. However, there might not
// yet be a corresponding entry in mNodes.
self_type* non_const_this(const_cast(this));
- typename DepNodeMap::iterator found = non_const_this->mNodes.find(vkeys[*svi]);
+ typename DepNodeMap::iterator found = non_const_this->mNodes.find(vkeys[sv]);
if (found != non_const_this->mNodes.end())
{
// Make an iterator of appropriate type.
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index 2c03a68245..687b917303 100644
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -591,11 +591,9 @@ namespace
void Globals::invalidateCallSites()
{
- for (CallSiteVector::const_iterator i = callSites.begin();
- i != callSites.end();
- ++i)
+ for (LLError::CallSite* site : callSites)
{
- (*i)->invalidate();
+ site->invalidate();
}
callSites.clear();
@@ -1235,12 +1233,8 @@ namespace
std::string escaped_message;
LLMutexLock lock(&s->mRecorderMutex);
- for (Recorders::const_iterator i = s->mRecorders.begin();
- i != s->mRecorders.end();
- ++i)
+ for (LLError::RecorderPtr& r : s->mRecorders)
{
- LLError::RecorderPtr r = *i;
-
// Crash fix
//if (!r->enabled())
if (!r || !r->enabled())
@@ -1532,7 +1526,7 @@ namespace LLError
const size_t BUF_SIZE = 64;
char time_str[BUF_SIZE]; /* Flawfinder: ignore */
- int chars = strftime(time_str, BUF_SIZE,
+ auto chars = strftime(time_str, BUF_SIZE,
"%Y-%m-%dT%H:%M:%SZ",
gmtime(&now));
diff --git a/indra/llcommon/llevent.cpp b/indra/llcommon/llevent.cpp
index 633df01588..501d06e3cd 100644
--- a/indra/llcommon/llevent.cpp
+++ b/indra/llcommon/llevent.cpp
@@ -203,10 +203,9 @@ void LLSimpleDispatcher::removeListener(LLEventListener* listener)
std::vector LLSimpleDispatcher::getListeners() const
{
std::vector ret;
- std::vector::const_iterator itor;
- for (itor=mListeners.begin(); itor!=mListeners.end(); ++itor)
+ for (const LLListenerEntry& entry : mListeners)
{
- ret.push_back(*itor);
+ ret.push_back(entry);
}
return ret;
@@ -215,14 +214,12 @@ std::vector LLSimpleDispatcher::getListeners() const
// virtual
bool LLSimpleDispatcher::fireEvent(LLPointer event, LLSD filter)
{
- std::vector::iterator itor;
std::string filter_string = filter.asString();
- for (itor=mListeners.begin(); itor!=mListeners.end(); ++itor)
+ for (LLListenerEntry& entry : mListeners)
{
- LLListenerEntry& entry = *itor;
if (filter_string == "" || entry.filter.asString() == filter_string)
{
- (entry.listener)->handleEvent(event, (*itor).userdata);
+ (entry.listener)->handleEvent(event, entry.userdata);
}
}
return true;
@@ -276,10 +273,9 @@ void LLSimpleListener::clearDispatchers()
bool LLSimpleListener::handleAttach(LLEventDispatcher *dispatcher)
{
// Add dispatcher if it doesn't already exist
- std::vector::iterator itor;
- for (itor = mDispatchers.begin(); itor != mDispatchers.end(); ++itor)
+ for (LLEventDispatcher* disp : mDispatchers)
{
- if ((*itor) == dispatcher) return true;
+ if (disp == dispatcher) return true;
}
mDispatchers.push_back(dispatcher);
return true;
diff --git a/indra/llcommon/lleventdispatcher.cpp b/indra/llcommon/lleventdispatcher.cpp
index 5b6d4efbe9..cd0ab6bc29 100644
--- a/indra/llcommon/lleventdispatcher.cpp
+++ b/indra/llcommon/lleventdispatcher.cpp
@@ -178,7 +178,7 @@ private:
// store it as a map from name string to position index. Of course that's
// easy to generate from the incoming names array, but why do it more than
// once?
- typedef std::map IndexMap;
+ typedef std::map IndexMap;
IndexMap _indexes;
// Generated array of default values, aligned with the array of param names.
LLSD _defaults;
@@ -197,9 +197,9 @@ LLSDArgsMapper::LLSDArgsMapper(const std::string& function,
{
LL_ERRS("LLSDArgsMapper") << function << " names must be an array, not " << names << LL_ENDL;
}
- LLSD::Integer nparams(_names.size());
+ auto nparams(_names.size());
// From _names generate _indexes.
- for (LLSD::Integer ni = 0, nend = _names.size(); ni < nend; ++ni)
+ for (size_t ni = 0, nend = _names.size(); ni < nend; ++ni)
{
_indexes[_names[ni]] = ni;
}
@@ -214,7 +214,7 @@ LLSDArgsMapper::LLSDArgsMapper(const std::string& function,
if (defaults.isUndefined() || defaults.isArray())
{
- LLSD::Integer ndefaults = defaults.size();
+ auto ndefaults = defaults.size();
// defaults is a (possibly empty) array. Right-align it with names.
if (ndefaults > nparams)
{
@@ -224,10 +224,10 @@ LLSDArgsMapper::LLSDArgsMapper(const std::string& function,
// Offset by which we slide defaults array right to right-align with
// _names array
- LLSD::Integer offset = nparams - ndefaults;
+ auto offset = nparams - ndefaults;
// Fill rightmost _defaults entries from defaults, and mark them as
// filled
- for (LLSD::Integer i = 0, iend = ndefaults; i < iend; ++i)
+ for (size_t i = 0, iend = ndefaults; i < iend; ++i)
{
_defaults[i + offset] = defaults[i];
_has_dft[i + offset] = 1;
@@ -247,7 +247,7 @@ LLSDArgsMapper::LLSDArgsMapper(const std::string& function,
continue;
}
- LLSD::Integer pos = ixit->second;
+ auto pos = ixit->second;
// Store default value at that position in the _defaults array.
_defaults[pos] = mi->second;
// Don't forget to record the fact that we've filled this
@@ -301,7 +301,7 @@ LLSD LLSDArgsMapper::map(const LLSD& argsmap) const
{
// Fill args from array. If there are too many args in passed array,
// ignore the rest.
- LLSD::Integer size(argsmap.size());
+ auto size(argsmap.size());
if (size > args.size())
{
// We don't just use std::min() because we want to sneak in this
@@ -338,7 +338,7 @@ LLSD LLSDArgsMapper::map(const LLSD& argsmap) const
<< mi->first << "=" << mi->second << LL_ENDL;
continue;
}
- LLSD::Integer pos = ixit->second;
+ auto pos = ixit->second;
// Store the value at that position in the args array.
args[pos] = mi->second;
// Don't forget to record the fact that we've filled this
@@ -349,7 +349,7 @@ LLSD LLSDArgsMapper::map(const LLSD& argsmap) const
// Fill any remaining holes from _defaults.
LLSD unfilled(LLSD::emptyArray());
- for (LLSD::Integer i = 0, iend = args.size(); i < iend; ++i)
+ for (size_t i = 0, iend = args.size(); i < iend; ++i)
{
if (! filled[i])
{
@@ -503,9 +503,9 @@ struct LLEventDispatcher::MapParamsDispatchEntry: public LLEventDispatcher::Para
if (defaults.isArray() || defaults.isUndefined())
{
// Right-align the params and defaults arrays.
- LLSD::Integer offset = params.size() - defaults.size();
+ auto offset = params.size() - defaults.size();
// Now the name of every defaults[i] is at params[i + offset].
- for (LLSD::Integer i(0), iend(defaults.size()); i < iend; ++i)
+ for (size_t i(0), iend(defaults.size()); i < iend; ++i)
{
// Erase this optional param from mRequired.
mRequired.erase(params[i + offset].asString());
diff --git a/indra/llcommon/llheteromap.cpp b/indra/llcommon/llheteromap.cpp
index 7c19196e0c..c84e49d085 100644
--- a/indra/llcommon/llheteromap.cpp
+++ b/indra/llcommon/llheteromap.cpp
@@ -22,11 +22,11 @@ LLHeteroMap::~LLHeteroMap()
{
// For each entry in our map, we must call its deleter, which is the only
// record we have of its original type.
- for (TypeMap::iterator mi(mMap.begin()), me(mMap.end()); mi != me; ++mi)
+ for (TypeMap::value_type& pair : mMap)
{
- // mi->second is the std::pair; mi->second.first is the void*;
- // mi->second.second points to the deleter function
- (mi->second.second)(mi->second.first);
- mi->second.first = NULL;
+ // pair.second is the std::pair; pair.second.first is the void*;
+ // pair.second.second points to the deleter function
+ (pair.second.second)(pair.second.first);
+ pair.second.first = NULL;
}
}
diff --git a/indra/llcommon/llinitdestroyclass.cpp b/indra/llcommon/llinitdestroyclass.cpp
index e6382a7924..e3b9e6d099 100644
--- a/indra/llcommon/llinitdestroyclass.cpp
+++ b/indra/llcommon/llinitdestroyclass.cpp
@@ -21,10 +21,9 @@
void LLCallbackRegistry::fireCallbacks() const
{
- for (FuncList::const_iterator fi = mCallbacks.begin(), fe = mCallbacks.end();
- fi != fe; ++fi)
+ for (FuncList::value_type pair : mCallbacks)
{
- LL_INFOS("LLInitDestroyClass") << "calling " << fi->first << "()" << LL_ENDL;
- fi->second();
+ LL_INFOS("LLInitDestroyClass") << "calling " << pair.first << "()" << LL_ENDL;
+ pair.second();
}
}
diff --git a/indra/llcommon/llinitparam.cpp b/indra/llcommon/llinitparam.cpp
index aa2f4eb289..9d3394b4f7 100644
--- a/indra/llcommon/llinitparam.cpp
+++ b/indra/llcommon/llinitparam.cpp
@@ -207,10 +207,10 @@ namespace LLInitParam
if (!mValidated)
{
const BlockDescriptor& block_data = mostDerivedBlockDescriptor();
- for (BlockDescriptor::param_validation_list_t::const_iterator it = block_data.mValidationList.begin(); it != block_data.mValidationList.end(); ++it)
+ for (const BlockDescriptor::param_validation_list_t::value_type& pair : block_data.mValidationList)
{
- const Param* param = getParamFromHandle(it->first);
- if (!it->second(param))
+ const Param* param = getParamFromHandle(pair.first);
+ if (!pair.second(param))
{
if (emit_errors)
{
@@ -235,13 +235,11 @@ namespace LLInitParam
// unnamed param is like LLView::Params::rect - implicit
const BlockDescriptor& block_data = mostDerivedBlockDescriptor();
- for (BlockDescriptor::param_list_t::const_iterator it = block_data.mUnnamedParams.begin();
- it != block_data.mUnnamedParams.end();
- ++it)
+ for (const ParamDescriptorPtr& ptr : block_data.mUnnamedParams)
{
- param_handle_t param_handle = (*it)->mParamHandle;
+ param_handle_t param_handle = ptr->mParamHandle;
const Param* param = getParamFromHandle(param_handle);
- ParamDescriptor::serialize_func_t serialize_func = (*it)->mSerializeFunc;
+ ParamDescriptor::serialize_func_t serialize_func = ptr->mSerializeFunc;
if (serialize_func && predicate_rule.check(ll_make_predicate(PROVIDED, param->anyProvided())))
{
const Param* diff_param = diff_block ? diff_block->getParamFromHandle(param_handle) : NULL;
@@ -249,23 +247,19 @@ namespace LLInitParam
}
}
- for(BlockDescriptor::param_map_t::const_iterator it = block_data.mNamedParams.begin();
- it != block_data.mNamedParams.end();
- ++it)
+ for (const BlockDescriptor::param_map_t::value_type& pair : block_data.mNamedParams)
{
- param_handle_t param_handle = it->second->mParamHandle;
+ param_handle_t param_handle = pair.second->mParamHandle;
const Param* param = getParamFromHandle(param_handle);
- ParamDescriptor::serialize_func_t serialize_func = it->second->mSerializeFunc;
+ ParamDescriptor::serialize_func_t serialize_func = pair.second->mSerializeFunc;
if (serialize_func && predicate_rule.check(ll_make_predicate(PROVIDED, param->anyProvided())))
{
// Ensure this param has not already been serialized
// Prevents from being serialized as its own tag.
bool duplicate = false;
- for (BlockDescriptor::param_list_t::const_iterator it2 = block_data.mUnnamedParams.begin();
- it2 != block_data.mUnnamedParams.end();
- ++it2)
+ for (const ParamDescriptorPtr& ptr : block_data.mUnnamedParams)
{
- if (param_handle == (*it2)->mParamHandle)
+ if (param_handle == ptr->mParamHandle)
{
duplicate = true;
break;
@@ -279,7 +273,7 @@ namespace LLInitParam
continue;
}
- name_stack.push_back(std::make_pair(it->first, !duplicate));
+ name_stack.push_back(std::make_pair(pair.first, !duplicate));
const Param* diff_param = diff_block ? diff_block->getParamFromHandle(param_handle) : NULL;
serialized |= serialize_func(*param, parser, name_stack, predicate_rule, diff_param);
name_stack.pop_back();
@@ -300,45 +294,39 @@ namespace LLInitParam
// unnamed param is like LLView::Params::rect - implicit
const BlockDescriptor& block_data = mostDerivedBlockDescriptor();
- for (BlockDescriptor::param_list_t::const_iterator it = block_data.mUnnamedParams.begin();
- it != block_data.mUnnamedParams.end();
- ++it)
+ for (const ParamDescriptorPtr& ptr : block_data.mUnnamedParams)
{
- param_handle_t param_handle = (*it)->mParamHandle;
+ param_handle_t param_handle = ptr->mParamHandle;
const Param* param = getParamFromHandle(param_handle);
- ParamDescriptor::inspect_func_t inspect_func = (*it)->mInspectFunc;
+ ParamDescriptor::inspect_func_t inspect_func = ptr->mInspectFunc;
if (inspect_func)
{
name_stack.push_back(std::make_pair("", true));
- inspect_func(*param, parser, name_stack, (*it)->mMinCount, (*it)->mMaxCount);
+ inspect_func(*param, parser, name_stack, ptr->mMinCount, ptr->mMaxCount);
name_stack.pop_back();
}
}
- for(BlockDescriptor::param_map_t::const_iterator it = block_data.mNamedParams.begin();
- it != block_data.mNamedParams.end();
- ++it)
+ for(const BlockDescriptor::param_map_t::value_type& pair : block_data.mNamedParams)
{
- param_handle_t param_handle = it->second->mParamHandle;
+ param_handle_t param_handle = pair.second->mParamHandle;
const Param* param = getParamFromHandle(param_handle);
- ParamDescriptor::inspect_func_t inspect_func = it->second->mInspectFunc;
+ ParamDescriptor::inspect_func_t inspect_func = pair.second->mInspectFunc;
if (inspect_func)
{
// Ensure this param has not already been inspected
bool duplicate = false;
- for (BlockDescriptor::param_list_t::const_iterator it2 = block_data.mUnnamedParams.begin();
- it2 != block_data.mUnnamedParams.end();
- ++it2)
+ for (const ParamDescriptorPtr ptr : block_data.mUnnamedParams)
{
- if (param_handle == (*it2)->mParamHandle)
+ if (param_handle == ptr->mParamHandle)
{
duplicate = true;
break;
}
}
- name_stack.push_back(std::make_pair(it->first, !duplicate));
- inspect_func(*param, parser, name_stack, it->second->mMinCount, it->second->mMaxCount);
+ name_stack.push_back(std::make_pair(pair.first, !duplicate));
+ inspect_func(*param, parser, name_stack, pair.second->mMinCount, pair.second->mMaxCount);
name_stack.pop_back();
}
}
@@ -382,12 +370,10 @@ namespace LLInitParam
}
// try to parse unnamed parameters, in declaration order
- for ( BlockDescriptor::param_list_t::iterator it = block_data.mUnnamedParams.begin();
- it != block_data.mUnnamedParams.end();
- ++it)
+ for (ParamDescriptorPtr& ptr : block_data.mUnnamedParams)
{
- Param* paramp = getParamFromHandle((*it)->mParamHandle);
- ParamDescriptor::deserialize_func_t deserialize_func = (*it)->mDeserializeFunc;
+ Param* paramp = getParamFromHandle(ptr->mParamHandle);
+ ParamDescriptor::deserialize_func_t deserialize_func = ptr->mDeserializeFunc;
if (deserialize_func && deserialize_func(*paramp, p, name_stack_range, new_name))
{
@@ -453,12 +439,9 @@ namespace LLInitParam
{
param_handle_t handle = getHandleFromParam(¶m);
BlockDescriptor& descriptor = mostDerivedBlockDescriptor();
- BlockDescriptor::all_params_list_t::iterator end_it = descriptor.mAllParams.end();
- for (BlockDescriptor::all_params_list_t::iterator it = descriptor.mAllParams.begin();
- it != end_it;
- ++it)
+ for (ParamDescriptorPtr& ptr : descriptor.mAllParams)
{
- if ((*it)->mParamHandle == handle) return *it;
+ if (ptr->mParamHandle == handle) return ptr;
}
return ParamDescriptorPtr();
}
@@ -468,17 +451,14 @@ namespace LLInitParam
bool BaseBlock::mergeBlock(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite)
{
bool some_param_changed = false;
- BlockDescriptor::all_params_list_t::const_iterator end_it = block_data.mAllParams.end();
- for (BlockDescriptor::all_params_list_t::const_iterator it = block_data.mAllParams.begin();
- it != end_it;
- ++it)
+ for (const ParamDescriptorPtr& ptr : block_data.mAllParams)
{
- const Param* other_paramp = other.getParamFromHandle((*it)->mParamHandle);
- ParamDescriptor::merge_func_t merge_func = (*it)->mMergeFunc;
+ const Param* other_paramp = other.getParamFromHandle(ptr->mParamHandle);
+ ParamDescriptor::merge_func_t merge_func = ptr->mMergeFunc;
if (merge_func)
{
- Param* paramp = getParamFromHandle((*it)->mParamHandle);
- llassert(paramp->getEnclosingBlockOffset() == (*it)->mParamHandle);
+ Param* paramp = getParamFromHandle(ptr->mParamHandle);
+ llassert(paramp->getEnclosingBlockOffset() == ptr->mParamHandle);
some_param_changed |= merge_func(*paramp, *other_paramp, overwrite);
}
}
diff --git a/indra/llcommon/llinitparam.h b/indra/llcommon/llinitparam.h
index 7f5b9b4ac2..9edc7e40f3 100644
--- a/indra/llcommon/llinitparam.h
+++ b/indra/llcommon/llinitparam.h
@@ -325,13 +325,11 @@ namespace LLInitParam
std::string calcValueName(const value_t& value) const
{
value_name_map_t* map = getValueNames();
- for (typename value_name_map_t::iterator it = map->begin(), end_it = map->end();
- it != end_it;
- ++it)
+ for (typename value_name_map_t::value_type& map_pair : *map)
{
- if (ParamCompare::equals(it->second, value))
+ if (ParamCompare::equals(map_pair.second, value))
{
- return it->first;
+ return map_pair.first;
}
}
@@ -376,11 +374,9 @@ namespace LLInitParam
static std::vector sValues;
value_name_map_t* map = getValueNames();
- for (typename value_name_map_t::iterator it = map->begin(), end_it = map->end();
- it != end_it;
- ++it)
+ for (typename value_name_map_t::value_type& map_pair : *map)
{
- sValues.push_back(it->first);
+ sValues.push_back(map_pair.first);
}
return &sValues;
}
diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h
index 02535a59e7..34f2a5985a 100644
--- a/indra/llcommon/llinstancetracker.h
+++ b/indra/llcommon/llinstancetracker.h
@@ -99,7 +99,7 @@ public:
return mSelf;
}
- static S32 instanceCount()
+ static size_t instanceCount()
{
return LockStatic()->mMap.size();
}
@@ -363,7 +363,7 @@ public:
return mSelf;
}
- static S32 instanceCount()
+ static size_t instanceCount()
{
return LockStatic()->mSet.size();
}
diff --git a/indra/llcommon/llkeybind.cpp b/indra/llcommon/llkeybind.cpp
index 38696c2258..b89160cc55 100644
--- a/indra/llcommon/llkeybind.cpp
+++ b/indra/llcommon/llkeybind.cpp
@@ -30,6 +30,7 @@
#include "llsd.h"
#include "llsdutil.h"
+#include
LLKeyData::LLKeyData()
:
@@ -180,10 +181,10 @@ LLKeyBind::LLKeyBind(const LLSD &key_bind)
bool LLKeyBind::operator==(const LLKeyBind& rhs)
{
- U32 size = mData.size();
+ auto size = mData.size();
if (size != rhs.mData.size()) return false;
- for (U32 i = 0; i < size; i++)
+ for (size_t i = 0; i < size; i++)
{
if (mData[i] != rhs.mData[i]) return false;
}
@@ -193,7 +194,7 @@ bool LLKeyBind::operator==(const LLKeyBind& rhs)
bool LLKeyBind::operator!=(const LLKeyBind& rhs)
{
- U32 size = mData.size();
+ auto size = mData.size();
if (size != rhs.mData.size()) return true;
for (U32 i = 0; i < size; i++)
@@ -206,26 +207,29 @@ bool LLKeyBind::operator!=(const LLKeyBind& rhs)
bool LLKeyBind::isEmpty() const
{
- for (data_vector_t::const_iterator iter = mData.begin(); iter != mData.end(); iter++)
+ for (const LLKeyData& key_data : mData)
{
- if (!iter->isEmpty()) return false;
+ if (!key_data.isEmpty()) return false;
}
return true;
}
+LLKeyBind::data_vector_t::const_iterator LLKeyBind::endNonEmpty() const
+{
+ // search backwards for last non-empty entry, then turn back into forwards
+ // iterator (.base() call)
+ return std::find_if_not(mData.rbegin(), mData.rend(),
+ [](const auto& kdata){ return kdata.empty(); }).base();
+}
+
LLSD LLKeyBind::asLLSD() const
{
- S32 last = mData.size() - 1;
- while (mData[last].empty())
- {
- last--;
- }
-
LLSD data;
- for (S32 i = 0; i <= last; ++i)
+ for (const LLKeyData& key_data : mData)
{
- // append even if empty to not affect visual representation
- data.append(mData[i].asLLSD());
+ // append intermediate entries even if empty to not affect visual
+ // representation
+ data.append(key_data.asLLSD());
}
return data;
}
@@ -238,9 +242,9 @@ bool LLKeyBind::canHandle(EMouseClickType mouse, KEY key, MASK mask) const
return false;
}
- for (data_vector_t::const_iterator iter = mData.begin(); iter != mData.end(); iter++)
+ for (const LLKeyData& key_data : mData)
{
- if (iter->canHandle(mouse, key, mask))
+ if (key_data.canHandle(mouse, key, mask))
{
return true;
}
@@ -262,12 +266,12 @@ bool LLKeyBind::hasKeyData(EMouseClickType mouse, KEY key, MASK mask, bool ignor
{
if (mouse != CLICK_NONE || key != KEY_NONE)
{
- for (data_vector_t::const_iterator iter = mData.begin(); iter != mData.end(); iter++)
+ for (const LLKeyData& key_data : mData)
{
- if (iter->mKey == key
- && iter->mMask == mask
- && iter->mMouse == mouse
- && iter->mIgnoreMasks == ignore)
+ if (key_data.mKey == key
+ && key_data.mMask == mask
+ && key_data.mMouse == mouse
+ && key_data.mIgnoreMasks == ignore)
{
return true;
}
@@ -349,16 +353,16 @@ void LLKeyBind::replaceKeyData(const LLKeyData& data, U32 index)
{
// if both click and key are none (isEmpty()), we are inserting a placeholder, we don't want to reset anything
// otherwise reset identical key
- for (data_vector_t::iterator iter = mData.begin(); iter != mData.end(); iter++)
+ for (LLKeyData& key_data : mData)
{
- if (iter->mKey == data.mKey
- && iter->mMouse == data.mMouse
- && iter->mIgnoreMasks == data.mIgnoreMasks
- && iter->mMask == data.mMask)
+ if (key_data.mKey == data.mKey
+ && key_data.mMouse == data.mMouse
+ && key_data.mIgnoreMasks == data.mIgnoreMasks
+ && key_data.mMask == data.mMask)
{
// Replacing only fully equal combinations even in case 'ignore' is set
// Reason: Simplicity and user might decide to do a 'move' command as W and Shift+Ctrl+W, and 'run' as Shift+W
- iter->reset();
+ key_data.reset();
break;
}
}
@@ -380,16 +384,10 @@ void LLKeyBind::resetKeyData(S32 index)
void LLKeyBind::trimEmpty()
{
- S32 last = mData.size() - 1;
- while (last >= 0 && mData[last].empty())
- {
- mData.erase(mData.begin() + last);
- last--;
- }
+ mData.erase(endNonEmpty(), mData.end());
}
-U32 LLKeyBind::getDataCount()
+size_t LLKeyBind::getDataCount()
{
return mData.size();
}
-
diff --git a/indra/llcommon/llkeybind.h b/indra/llcommon/llkeybind.h
index c6b4bd970f..488f509411 100644
--- a/indra/llcommon/llkeybind.h
+++ b/indra/llcommon/llkeybind.h
@@ -95,11 +95,13 @@ public:
void clear() { mData.clear(); }
// if there any empty LLKeyData in the end of the array, remove them
void trimEmpty();
- U32 getDataCount();
+ size_t getDataCount();
private:
typedef std::vector data_vector_t;
data_vector_t mData;
+
+ data_vector_t::const_iterator endNonEmpty() const;
};
diff --git a/indra/llcommon/llleap.cpp b/indra/llcommon/llleap.cpp
index 2704f8b6de..c87c0758fe 100644
--- a/indra/llcommon/llleap.cpp
+++ b/indra/llcommon/llleap.cpp
@@ -231,7 +231,8 @@ public:
}
|*==========================================================================*/
- LL_DEBUGS("EventHost") << "Sending: " << buffer.tellp() << ':';
+ LL_DEBUGS("EventHost") << "Sending: "
+ << static_cast(buffer.tellp()) << ':';
std::string::size_type truncate(80);
if (buffer.tellp() <= truncate)
{
@@ -244,7 +245,8 @@ public:
LL_CONT << LL_ENDL;
LLProcess::WritePipe& childin(mChild->getWritePipe(LLProcess::STDIN));
- childin.get_ostream() << buffer.tellp() << ':' << buffer.str() << std::flush;
+ childin.get_ostream() << static_cast(buffer.tellp())
+ << ':' << buffer.str() << std::flush;
return false;
}
diff --git a/indra/llcommon/llmd5.cpp b/indra/llcommon/llmd5.cpp
index f942a976b7..9b2a2bab60 100644
--- a/indra/llcommon/llmd5.cpp
+++ b/indra/llcommon/llmd5.cpp
@@ -96,10 +96,10 @@ LLMD5::LLMD5()
// operation, processing another message block, and updating the
// context.
-void LLMD5::update (const uint1 *input, const uint4 input_length) {
+void LLMD5::update (const uint1 *input, const size_t input_length) {
- uint4 input_index, buffer_index;
- uint4 buffer_space; // how much space is left in buffer
+ size_t input_index, buffer_index;
+ size_t buffer_space; // how much space is left in buffer
if (finalized){ // so we can't update!
std::cerr << "LLMD5::update: Can't update a finalized digest!" << std::endl;
@@ -107,14 +107,10 @@ void LLMD5::update (const uint1 *input, const uint4 input_length) {
}
// Compute number of bytes mod 64
- buffer_index = (unsigned int)((count[0] >> 3) & 0x3F);
+ buffer_index = size_t((count >> 3) & 0x3F);
// Update number of bits
- if ( (count[0] += ((uint4) input_length << 3))<((uint4) input_length << 3) )
- count[1]++;
-
- count[1] += ((uint4)input_length >> 29);
-
+ count += input_length << 3;
buffer_space = 64 - buffer_index; // how much space is left in buffer
@@ -192,7 +188,7 @@ void LLMD5::update(const std::string& s)
void LLMD5::finalize (){
unsigned char bits[8]; /* Flawfinder: ignore */
- unsigned int index, padLen;
+ size_t index, padLen;
static uint1 PADDING[64]={
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -204,11 +200,12 @@ void LLMD5::finalize (){
return;
}
- // Save number of bits
- encode (bits, count, 8);
+ // Save number of bits.
+ // Treat count, a uint64_t, as uint4[2].
+ encode (bits, reinterpret_cast(&count), 8);
// Pad out to 56 mod 64.
- index = (uint4) ((count[0] >> 3) & 0x3f);
+ index = size_t((count >> 3) & 0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index);
update (PADDING, padLen);
@@ -340,8 +337,7 @@ void LLMD5::init(){
finalized=0; // we just started!
// Nothing counted, so count=0
- count[0] = 0;
- count[1] = 0;
+ count = 0;
// Load magic initialization constants.
state[0] = 0x67452301;
@@ -508,9 +504,9 @@ void LLMD5::transform (const U8 block[64]){
// Encodes input (UINT4) into output (unsigned char). Assumes len is
// a multiple of 4.
-void LLMD5::encode (uint1 *output, const uint4 *input, const uint4 len) {
+void LLMD5::encode (uint1 *output, const uint4 *input, const size_t len) {
- unsigned int i, j;
+ size_t i, j;
for (i = 0, j = 0; j < len; i++, j += 4) {
output[j] = (uint1) (input[i] & 0xff);
@@ -525,9 +521,9 @@ void LLMD5::encode (uint1 *output, const uint4 *input, const uint4 len) {
// Decodes input (unsigned char) into output (UINT4). Assumes len is
// a multiple of 4.
-void LLMD5::decode (uint4 *output, const uint1 *input, const uint4 len){
+void LLMD5::decode (uint4 *output, const uint1 *input, const size_t len){
- unsigned int i, j;
+ size_t i, j;
for (i = 0, j = 0; j < len; i++, j += 4)
output[i] = ((uint4)input[j]) | (((uint4)input[j+1]) << 8) |
diff --git a/indra/llcommon/llmd5.h b/indra/llcommon/llmd5.h
index 1526e6ac3c..8530dc0389 100644
--- a/indra/llcommon/llmd5.h
+++ b/indra/llcommon/llmd5.h
@@ -86,7 +86,7 @@ class LL_COMMON_API LLMD5 {
public:
// methods for controlled operation:
LLMD5 (); // simple initializer
- void update (const uint1 *input, const uint4 input_length);
+ void update (const uint1 *input, const size_t input_length);
void update (std::istream& stream);
void update (FILE *file);
void update (const std::string& str);
@@ -110,7 +110,7 @@ private:
// next, the private data:
uint4 state[4];
- uint4 count[2]; // number of *bits*, mod 2^64
+ uint64_t count; // number of *bits*, mod 2^64
uint1 buffer[64]; // input buffer
uint1 digest[16];
uint1 finalized;
@@ -120,8 +120,8 @@ private:
void transform (const uint1 *buffer); // does the real update work. Note
// that length is implied to be 64.
- static void encode (uint1 *dest, const uint4 *src, const uint4 length);
- static void decode (uint4 *dest, const uint1 *src, const uint4 length);
+ static void encode (uint1 *dest, const uint4 *src, const size_t length);
+ static void decode (uint4 *dest, const uint1 *src, const size_t length);
};
diff --git a/indra/llcommon/llmetricperformancetester.cpp b/indra/llcommon/llmetricperformancetester.cpp
index 100eb57555..ab509b46eb 100644
--- a/indra/llcommon/llmetricperformancetester.cpp
+++ b/indra/llcommon/llmetricperformancetester.cpp
@@ -42,9 +42,9 @@ LLMetricPerformanceTesterBasic::name_tester_map_t LLMetricPerformanceTesterBasic
/*static*/
void LLMetricPerformanceTesterBasic::cleanupClass()
{
- for (name_tester_map_t::iterator iter = sTesterMap.begin() ; iter != sTesterMap.end() ; ++iter)
+ for (name_tester_map_t::value_type& pair : sTesterMap)
{
- delete iter->second ;
+ delete pair.second;
}
sTesterMap.clear() ;
}
@@ -111,8 +111,8 @@ LLSD LLMetricPerformanceTesterBasic::analyzeMetricPerformanceLog(std::istream& i
{
ret[label]["Name"] = iter->second["Name"] ;
- S32 num_of_metrics = tester->getNumberOfMetrics() ;
- for(S32 index = 0 ; index < num_of_metrics ; index++)
+ auto num_of_metrics = tester->getNumberOfMetrics() ;
+ for(size_t index = 0 ; index < num_of_metrics ; index++)
{
ret[label][ tester->getMetricName(index) ] = iter->second[ tester->getMetricName(index) ] ;
}
@@ -154,10 +154,9 @@ void LLMetricPerformanceTesterBasic::doAnalysisMetrics(std::string baseline, std
llofstream os(output.c_str());
os << "Label, Metric, Base(B), Target(T), Diff(T-B), Percentage(100*T/B)\n";
- for(LLMetricPerformanceTesterBasic::name_tester_map_t::iterator iter = LLMetricPerformanceTesterBasic::sTesterMap.begin() ;
- iter != LLMetricPerformanceTesterBasic::sTesterMap.end() ; ++iter)
+ for (LLMetricPerformanceTesterBasic::name_tester_map_t::value_type& pair : LLMetricPerformanceTesterBasic::sTesterMap)
{
- LLMetricPerformanceTesterBasic* tester = ((LLMetricPerformanceTesterBasic*)iter->second) ;
+ LLMetricPerformanceTesterBasic* tester = ((LLMetricPerformanceTesterBasic*)pair.second);
tester->analyzePerformance(&os, &base, ¤t) ;
}
diff --git a/indra/llcommon/llmetricperformancetester.h b/indra/llcommon/llmetricperformancetester.h
index 2e99ed979d..6561a78f03 100644
--- a/indra/llcommon/llmetricperformancetester.h
+++ b/indra/llcommon/llmetricperformancetester.h
@@ -67,12 +67,12 @@ public:
/**
* @return Returns the number of the test metrics in this tester instance.
*/
- S32 getNumberOfMetrics() const { return mMetricStrings.size() ;}
+ auto getNumberOfMetrics() const { return mMetricStrings.size() ;}
/**
* @return Returns the metric name at index
* @param[in] index - Index on the list of metrics managed by this tester instance.
*/
- std::string getMetricName(S32 index) const { return mMetricStrings[index] ;}
+ std::string getMetricName(size_t index) const { return mMetricStrings[index] ;}
protected:
/**
diff --git a/indra/llcommon/llmortician.cpp b/indra/llcommon/llmortician.cpp
index 93c7d520f2..b6ad40c2af 100644
--- a/indra/llcommon/llmortician.cpp
+++ b/indra/llcommon/llmortician.cpp
@@ -37,9 +37,9 @@ LLMortician::~LLMortician()
sGraveyard.remove(this);
}
-U32 LLMortician::logClass(std::stringstream &str)
+size_t LLMortician::logClass(std::stringstream &str)
{
- U32 size = sGraveyard.size();
+ auto size = sGraveyard.size();
str << "Mortician graveyard count: " << size;
str << " Zealous: " << (sDestroyImmediate ? "True" : "False");
if (size == 0)
diff --git a/indra/llcommon/llmortician.h b/indra/llcommon/llmortician.h
index 41cb49fab1..f92c5a11db 100644
--- a/indra/llcommon/llmortician.h
+++ b/indra/llcommon/llmortician.h
@@ -34,8 +34,8 @@ class LL_COMMON_API LLMortician
{
public:
LLMortician() { mIsDead = FALSE; }
- static U32 graveyardCount() { return sGraveyard.size(); };
- static U32 logClass(std::stringstream &str);
+ static auto graveyardCount() { return sGraveyard.size(); };
+ static size_t logClass(std::stringstream &str);
static void updateClass();
virtual ~LLMortician();
void die();
diff --git a/indra/llcommon/llnametable.h b/indra/llcommon/llnametable.h
index d3283543f3..2c8e71263e 100644
--- a/indra/llcommon/llnametable.h
+++ b/indra/llcommon/llnametable.h
@@ -86,12 +86,10 @@ public:
// O(N)! (currently only used in one place... (newsim/llstate.cpp))
const char *resolveData(const DATA &data) const
{
- const_iter_t iter = mNameMap.begin();
- const_iter_t end = mNameMap.end();
- for (; iter != end; ++iter)
+ for (const name_map_t::value_type& pair : mNameMap)
{
- if (iter->second == data)
- return iter->first;
+ if (pair.second == data)
+ return pair.first;
}
return NULL;
}
diff --git a/indra/llcommon/llpriqueuemap.h b/indra/llcommon/llpriqueuemap.h
index d8d3edd48a..030e2e0f21 100644
--- a/indra/llcommon/llpriqueuemap.h
+++ b/indra/llcommon/llpriqueuemap.h
@@ -115,9 +115,9 @@ public:
LL_WARNS() << "Data not on priority queue!" << LL_ENDL;
// OK, try iterating through all of the data and seeing if we just screwed up the priority
// somehow.
- for (iter = mMap.begin(); iter != mMap.end(); iter++)
+ for (pqm_pair pair : mMap)
{
- if ((*(iter)).second == data)
+ if (pair.second == data)
{
LL_ERRS() << "Data on priority queue but priority not matched!" << LL_ENDL;
}
diff --git a/indra/llcommon/llqueuedthread.cpp b/indra/llcommon/llqueuedthread.cpp
index 66111a7602..2da12b9822 100644
--- a/indra/llcommon/llqueuedthread.cpp
+++ b/indra/llcommon/llqueuedthread.cpp
@@ -110,7 +110,7 @@ void LLQueuedThread::shutdown()
// MAIN THREAD
// virtual
-S32 LLQueuedThread::update(F32 max_time_ms)
+size_t LLQueuedThread::update(F32 max_time_ms)
{
LL_PROFILE_ZONE_SCOPED
@@ -125,13 +125,13 @@ S32 LLQueuedThread::update(F32 max_time_ms)
return updateQueue(max_time_ms);
}
-S32 LLQueuedThread::updateQueue(F32 max_time_ms)
+size_t LLQueuedThread::updateQueue(F32 max_time_ms)
{
LL_PROFILE_ZONE_SCOPED
F64 max_time = (F64)max_time_ms * .001;
LLTimer timer;
- S32 pending = 1;
+ size_t pending = 1;
// Frame Update
if (mThreaded)
@@ -171,11 +171,11 @@ void LLQueuedThread::incQueue()
//virtual
// May be called from any thread
-S32 LLQueuedThread::getPending()
+size_t LLQueuedThread::getPending()
{
LL_PROFILE_ZONE_SCOPED
- S32 res;
+ size_t res;
lockData();
res = mRequestQueue.size();
unlockData();
@@ -431,7 +431,7 @@ bool LLQueuedThread::check()
//============================================================================
// Runs on its OWN thread
-S32 LLQueuedThread::processNextRequest()
+size_t LLQueuedThread::processNextRequest()
{
LL_PROFILE_ZONE_SCOPED
@@ -515,8 +515,7 @@ S32 LLQueuedThread::processNextRequest()
LLTrace::get_thread_recorder()->pushToParent();
}
- S32 pending = getPending();
- return pending;
+ return getPending();
}
// virtual
@@ -554,7 +553,7 @@ void LLQueuedThread::run()
LL_PROFILER_THREAD_BEGIN(mName.c_str())
threadedUpdate();
- int pending_work = processNextRequest();
+ auto pending_work = processNextRequest();
LL_PROFILER_THREAD_END(mName.c_str())
if (pending_work == 0)
diff --git a/indra/llcommon/llqueuedthread.h b/indra/llcommon/llqueuedthread.h
index 858d578b7f..82540c0012 100644
--- a/indra/llcommon/llqueuedthread.h
+++ b/indra/llcommon/llqueuedthread.h
@@ -168,19 +168,19 @@ private:
protected:
handle_t generateHandle();
bool addRequest(QueuedRequest* req);
- S32 processNextRequest(void);
+ size_t processNextRequest(void);
void incQueue();
public:
bool waitForResult(handle_t handle, bool auto_complete = true);
- virtual S32 update(F32 max_time_ms);
- S32 updateQueue(F32 max_time_ms);
-
+ virtual size_t update(F32 max_time_ms);
+ size_t updateQueue(F32 max_time_ms);
+
void waitOnPending();
void printQueueStats();
- virtual S32 getPending();
+ virtual size_t getPending();
bool getThreaded() { return mThreaded ? true : false; }
// Request accessors
diff --git a/indra/llcommon/llregistry.h b/indra/llcommon/llregistry.h
index 750fe9fdc8..e272d7a9b8 100644
--- a/indra/llcommon/llregistry.h
+++ b/indra/llcommon/llregistry.h
@@ -141,11 +141,9 @@ public:
ptr_value_t getValue(ref_const_key_t key)
{
- for(scope_list_iterator_t it = mActiveScopes.begin();
- it != mActiveScopes.end();
- ++it)
+ for(Registrar* scope : mActiveScopes)
{
- ptr_value_t valuep = (*it)->getValue(key);
+ ptr_value_t valuep = scope->getValue(key);
if (valuep != NULL) return valuep;
}
return mDefaultRegistrar.getValue(key);
@@ -153,11 +151,9 @@ public:
ptr_const_value_t getValue(ref_const_key_t key) const
{
- for(scope_list_const_iterator_t it = mActiveScopes.begin();
- it != mActiveScopes.end();
- ++it)
+ for(const Registrar* scope : mActiveScopes)
{
- ptr_value_t valuep = (*it)->getValue(key);
+ ptr_const_value_t valuep = scope->getValue(key);
if (valuep != NULL) return valuep;
}
return mDefaultRegistrar.getValue(key);
@@ -165,11 +161,9 @@ public:
bool exists(ref_const_key_t key) const
{
- for(scope_list_const_iterator_t it = mActiveScopes.begin();
- it != mActiveScopes.end();
- ++it)
+ for(const Registrar* scope : mActiveScopes)
{
- if ((*it)->exists(key)) return true;
+ if (scope->exists(key)) return true;
}
return mDefaultRegistrar.exists(key);
@@ -177,11 +171,9 @@ public:
bool empty() const
{
- for(scope_list_const_iterator_t it = mActiveScopes.begin();
- it != mActiveScopes.end();
- ++it)
+ for(const Registrar* scope : mActiveScopes)
{
- if (!(*it)->empty()) return false;
+ if (!scope->empty()) return false;
}
return mDefaultRegistrar.empty();
diff --git a/indra/llcommon/llrun.cpp b/indra/llcommon/llrun.cpp
index f5d3f302fa..a3b3fccf4b 100644
--- a/indra/llcommon/llrun.cpp
+++ b/indra/llcommon/llrun.cpp
@@ -47,7 +47,7 @@ LLRunner::~LLRunner()
mRunEvery.clear();
}
-S32 LLRunner::run()
+size_t LLRunner::run()
{
// We collect all of the runnables which should be run. Since the
// runnables are allowed to adjust the run list, we need to copy
diff --git a/indra/llcommon/llrun.h b/indra/llcommon/llrun.h
index a117405366..d610f86234 100644
--- a/indra/llcommon/llrun.h
+++ b/indra/llcommon/llrun.h
@@ -85,7 +85,7 @@ public:
*
* @return Returns the number of runnables run.
*/
- S32 run();
+ size_t run();
/**
* @brief Add a runnable to the run list.
diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp
index 807b3d13f8..a645e624f8 100644
--- a/indra/llcommon/llsd.cpp
+++ b/indra/llcommon/llsd.cpp
@@ -36,6 +36,18 @@
#include "llsdserialize.h"
#include "stringize.h"
+#include
+
+// Defend against a caller forcibly passing a negative number into an unsigned
+// size_t index param
+inline
+bool was_negative(size_t i)
+{
+ return (i > std::numeric_limits::max());
+}
+#define NEGATIVE_EXIT(i) if (was_negative(i)) return
+#define NEGATIVE_RETURN(i, result) NEGATIVE_EXIT(i) (result)
+
#ifndef LL_RELEASE_FOR_DOWNLOAD
#define NAME_UNNAMED_NAMESPACE
#endif
@@ -136,10 +148,10 @@ public:
virtual void erase(const String&) { }
virtual const LLSD& ref(const String&) const{ return undef(); }
- virtual int size() const { return 0; }
- virtual LLSD get(Integer) const { return LLSD(); }
- virtual void erase(Integer) { }
- virtual const LLSD& ref(Integer) const { return undef(); }
+ virtual size_t size() const { return 0; }
+ virtual LLSD get(size_t) const { return LLSD(); }
+ virtual void erase(size_t) { }
+ virtual const LLSD& ref(size_t) const { return undef(); }
virtual LLSD::map_const_iterator beginMap() const { return endMap(); }
virtual LLSD::map_const_iterator endMap() const { static const std::map empty; return empty.end(); }
@@ -272,7 +284,7 @@ namespace
virtual LLSD::UUID asUUID() const { return LLUUID(mValue); }
virtual LLSD::Date asDate() const { return LLDate(mValue); }
virtual LLSD::URI asURI() const { return LLURI(mValue); }
- virtual int size() const { return mValue.size(); }
+ virtual size_t size() const { return mValue.size(); }
virtual const LLSD::String& asStringRef() const { return mValue; }
};
@@ -377,9 +389,9 @@ namespace
virtual bool has(const LLSD::String&) const;
- using LLSD::Impl::get; // Unhiding get(LLSD::Integer)
- using LLSD::Impl::erase; // Unhiding erase(LLSD::Integer)
- using LLSD::Impl::ref; // Unhiding ref(LLSD::Integer)
+ using LLSD::Impl::get; // Unhiding get(size_t)
+ using LLSD::Impl::erase; // Unhiding erase(size_t)
+ using LLSD::Impl::ref; // Unhiding ref(size_t)
virtual LLSD get(const LLSD::String&) const;
virtual LLSD getKeys() const;
void insert(const LLSD::String& k, const LLSD& v);
@@ -387,7 +399,7 @@ namespace
LLSD& ref(const LLSD::String&);
virtual const LLSD& ref(const LLSD::String&) const;
- virtual int size() const { return mData.size(); }
+ virtual size_t size() const { return mData.size(); }
LLSD::map_iterator beginMap() { return mData.begin(); }
LLSD::map_iterator endMap() { return mData.end(); }
@@ -518,14 +530,14 @@ namespace
using LLSD::Impl::get; // Unhiding get(LLSD::String)
using LLSD::Impl::erase; // Unhiding erase(LLSD::String)
using LLSD::Impl::ref; // Unhiding ref(LLSD::String)
- virtual int size() const;
- virtual LLSD get(LLSD::Integer) const;
- void set(LLSD::Integer, const LLSD&);
- void insert(LLSD::Integer, const LLSD&);
+ virtual size_t size() const;
+ virtual LLSD get(size_t) const;
+ void set(size_t, const LLSD&);
+ void insert(size_t, const LLSD&);
LLSD& append(const LLSD&);
- virtual void erase(LLSD::Integer);
- LLSD& ref(LLSD::Integer);
- virtual const LLSD& ref(LLSD::Integer) const;
+ virtual void erase(size_t);
+ LLSD& ref(size_t);
+ virtual const LLSD& ref(size_t) const;
LLSD::array_iterator beginArray() { return mData.begin(); }
LLSD::array_iterator endArray() { return mData.end(); }
@@ -550,85 +562,82 @@ namespace
return *this;
}
}
-
- int ImplArray::size() const { return mData.size(); }
-
- LLSD ImplArray::get(LLSD::Integer i) const
+
+ size_t ImplArray::size() const { return mData.size(); }
+
+ LLSD ImplArray::get(size_t i) const
{
- if (i < 0) { return LLSD(); }
+ NEGATIVE_RETURN(i, LLSD());
DataVector::size_type index = i;
-
+
return (index < mData.size()) ? mData[index] : LLSD();
}
-
- void ImplArray::set(LLSD::Integer i, const LLSD& v)
+
+ void ImplArray::set(size_t i, const LLSD& v)
{
- if (i < 0) { return; }
+ NEGATIVE_EXIT(i);
DataVector::size_type index = i;
-
+
if (index >= mData.size())
{
mData.resize(index + 1);
}
-
+
mData[index] = v;
}
-
- void ImplArray::insert(LLSD::Integer i, const LLSD& v)
+
+ void ImplArray::insert(size_t i, const LLSD& v)
{
- if (i < 0)
- {
- return;
- }
+ NEGATIVE_EXIT(i);
DataVector::size_type index = i;
-
+
if (index >= mData.size()) // tbd - sanity check limit for index ?
{
mData.resize(index + 1);
}
-
+
mData.insert(mData.begin() + index, v);
}
-
+
LLSD& ImplArray::append(const LLSD& v)
{
mData.push_back(v);
return mData.back();
}
-
- void ImplArray::erase(LLSD::Integer i)
+
+ void ImplArray::erase(size_t i)
{
- if (i < 0) { return; }
+ NEGATIVE_EXIT(i);
DataVector::size_type index = i;
-
+
if (index < mData.size())
{
mData.erase(mData.begin() + index);
}
}
-
- LLSD& ImplArray::ref(LLSD::Integer i)
+
+ LLSD& ImplArray::ref(size_t i)
{
- DataVector::size_type index = i >= 0 ? i : 0;
-
+ DataVector::size_type index = was_negative(i)? 0 : i;
+
if (index >= mData.size())
{
mData.resize(i + 1);
}
-
+
return mData[index];
}
- const LLSD& ImplArray::ref(LLSD::Integer i) const
+ const LLSD& ImplArray::ref(size_t i) const
{
- if (i < 0) { return undef(); }
+ NEGATIVE_RETURN(i, undef());
DataVector::size_type index = i;
-
+
if (index >= mData.size())
{
return undef();
}
-
+
return mData[index];
}
@@ -841,9 +850,6 @@ LLSD::LLSD(const Date& v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); }
LLSD::LLSD(const URI& v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); }
LLSD::LLSD(const Binary& v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); }
-// Convenience Constructors
-LLSD::LLSD(F32 v) : impl(0) { ALLOC_LLSD_OBJECT; assign((Real)v); }
-
// Scalar Assignment
void LLSD::assign(Boolean v) { safe(impl).assign(impl, v); }
void LLSD::assign(Integer v) { safe(impl).assign(impl, v); }
@@ -912,7 +918,7 @@ LLSD LLSD::emptyArray()
return v;
}
-int LLSD::size() const { return safe(impl).size(); }
+size_t LLSD::size() const { return safe(impl).size(); }
LLSD LLSD::get(Integer i) const { return safe(impl).get(i); }
void LLSD::set(Integer i, const LLSD& v){ makeArray(impl).set(i, v); }
@@ -926,12 +932,12 @@ LLSD& LLSD::with(Integer i, const LLSD& v)
LLSD& LLSD::append(const LLSD& v) { return makeArray(impl).append(v); }
void LLSD::erase(Integer i) { makeArray(impl).erase(i); }
-LLSD& LLSD::operator[](Integer i)
+LLSD& LLSD::operator[](size_t i)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_LLSD;
return makeArray(impl).ref(i);
}
-const LLSD& LLSD::operator[](Integer i) const
+const LLSD& LLSD::operator[](size_t i) const
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_LLSD;
return safe(impl).ref(i);
@@ -956,7 +962,7 @@ static const char *llsd_dump(const LLSD &llsd, bool useXMLFormat)
out << LLSDNotationStreamer(llsd);
out_string = out.str();
}
- int len = out_string.length();
+ auto len = out_string.length();
sStorage = new char[len + 1];
memcpy(sStorage, out_string.c_str(), len);
sStorage[len] = '\0';
diff --git a/indra/llcommon/llsd.h b/indra/llcommon/llsd.h
index 1f503938b5..33e1f8c6c5 100644
--- a/indra/llcommon/llsd.h
+++ b/indra/llcommon/llsd.h
@@ -30,6 +30,7 @@
#include