Some small tweaks after merge with Viewer release

master
Callum Prentice 2023-05-17 11:31:45 -07:00
commit f45e888c90
656 changed files with 24927 additions and 61044 deletions

24
.github/workflows/stale.yaml vendored Normal file
View File

@ -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.*, ',') }}

View File

@ -1,6 +1,5 @@
<?xml version="1.0" ?>
<llsd>
<map>
<llsd><map>
<key>installables</key>
<map>
<key>SDL</key>
@ -184,9 +183,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>878eaf654926e400d67680100cb780c9</string>
<string>02b569ac2bd71f201e3dd86ade7b3eeb</string>
<key>url</key>
<string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/113512/981912/bugsplat-1.0.7.579546-darwin64-579546.tar.bz2</string>
<string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/113876/983684/bugsplat-1.0.7.579696-darwin64-579696.tar.bz2</string>
</map>
<key>name</key>
<string>darwin64</string>
@ -668,9 +667,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>8de71c518c248d77f70f87ab5e9de732</string>
<string>5a1d52ec3981292855a179be86988a02</string>
<key>url</key>
<string>https://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/105828/925920/fmodstudio-2.02.06.575716-darwin64-575716.tar.bz2</string>
<string>https://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/112152/972159/fmodstudio-2.02.13.578928-darwin64-578928.tar.bz2</string>
</map>
<key>name</key>
<string>darwin64</string>
@ -692,9 +691,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>2eea946ee7a572b748cec0c623ade3ef</string>
<string>8594ec180b73be42d37b6f93ac59ab4a</string>
<key>url</key>
<string>https://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/105830/925932/fmodstudio-2.02.06.575716-windows-575716.tar.bz2</string>
<string>https://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/112153/972171/fmodstudio-2.02.13.578928-windows-578928.tar.bz2</string>
</map>
<key>name</key>
<string>windows</string>
@ -704,16 +703,16 @@
<key>archive</key>
<map>
<key>hash</key>
<string>483d6fd5d057b0a681bffef9b8b9d927</string>
<string>46941a2610f83c353e551d300e536c54</string>
<key>url</key>
<string>https://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/105829/925931/fmodstudio-2.02.06.575716-windows64-575716.tar.bz2</string>
<string>https://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/112154/972170/fmodstudio-2.02.13.578928-windows64-578928.tar.bz2</string>
</map>
<key>name</key>
<string>windows64</string>
</map>
</map>
<key>version</key>
<string>2.02.06.575716</string>
<string>2.02.13.578928</string>
</map>
<key>fontconfig</key>
<map>
@ -3080,6 +3079,36 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
<key>version</key>
<string>0.54.1.555529</string>
</map>
<key>xxhash</key>
<map>
<key>copyright</key>
<string>Copyright 2012-2020 Yann Collet</string>
<key>description</key>
<string>xxHash Extremely fast hash algorithm</string>
<key>license</key>
<string>bsd</string>
<key>license_file</key>
<string>LICENSES/xxhash.txt</string>
<key>name</key>
<string>xxhash</string>
<key>platforms</key>
<map>
<key>common</key>
<map>
<key>archive</key>
<map>
<key>hash</key>
<string>e4f77ba0a9b8ec3cc3fabc51c4da81d2</string>
<key>url</key>
<string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/110070/956941/xxhash-0.8.1.578006-windows-578006.tar.bz2</string>
</map>
<key>name</key>
<string>common</string>
</map>
</map>
<key>version</key>
<string>0.8.1</string>
</map>
<key>zlib-ng</key>
<map>
<key>canonical_repo</key>
@ -3606,5 +3635,4 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
<string>autobuild</string>
<key>version</key>
<string>1.3</string>
</map>
</llsd>
</map></llsd>

View File

@ -239,6 +239,7 @@ Ansariel Hiller
SL-18432
SL-19575
SL-19623
SL-4126
Aralara Rajal
Arare Chantilly
CHUIBUG-191
@ -289,6 +290,7 @@ Beq Janus
SL-18592
SL-18637
SL-19317
SL-19660
Beth Walcher
Bezilon Kasei
Biancaluce Robbiani
@ -497,6 +499,8 @@ Evangelista Emerald
Faelon Swordthain
Farallon Greyskin
VWR-2036
Fawrsk
SL-18893
Feep Larsson
VWR-447
VWR-1314
@ -589,6 +593,8 @@ Henri Beauchamp
VWR-1320
VWR-1406
VWR-4157
SL-15175
SL-19110
herina Bode
Hikkoshi Sakai
VWR-429
@ -1180,6 +1186,10 @@ Ollie Kubrick
Orenj Marat
Orion Delphis
Oryx Tempel
PanteraPolnocy
SL-18891
SL-18904
SL-18937
Parvati Silverweb
Patric Mills
VWR-2645

View File

@ -4,6 +4,7 @@ include(APR)
include(Boost)
include(EXPAT)
include(Tracy)
include(xxHash)
include(ZLIBNG)
include(JsonCpp)

View File

@ -63,7 +63,7 @@ if (EXISTS ${CMAKE_SOURCE_DIR}/Server.cmake)
set(INSTALL_PROPRIETARY ON CACHE BOOL "Install proprietary binaries")
endif (EXISTS ${CMAKE_SOURCE_DIR}/Server.cmake)
set(TEMPLATE_VERIFIER_OPTIONS "" CACHE STRING "Options for scripts/template_verifier.py")
set(TEMPLATE_VERIFIER_MASTER_URL "https://bitbucket.org/lindenlab/master-message-template-git/raw/master/message_template.msg" CACHE STRING "Location of the master message template")
set(TEMPLATE_VERIFIER_MASTER_URL "https://github.com/secondlife/master-message-template/raw/master/message_template.msg" CACHE STRING "Location of the master message template")
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING

8
indra/cmake/xxHash.cmake Normal file
View File

@ -0,0 +1,8 @@
# -*- cmake -*-
if (XXHASH_CMAKE_INCLUDED)
return()
endif (XXHASH_CMAKE_INCLUDED)
set (XXHASH_CMAKE_INCLUDED TRUE)
include(Prebuilt)
use_prebuilt_binary(xxhash)

View File

@ -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,21 +258,16 @@ 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;
for (avatar_joint_mesh_list_t::iterator iter = mMeshLOD[mesh_index]->mMeshParts.begin();
iter != mMeshLOD[mesh_index]->mMeshParts.end();
++iter)
for (LLAvatarJointMesh* mesh : mMeshLOD[mesh_index]->mMeshParts)
{
LLAvatarJointMesh* mesh = (*iter);
mBakedTextureDatas[(S32)baked_texture_index].mJointMeshes.push_back(mesh);
}
}
@ -297,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;
}
}
@ -319,11 +310,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();
}
@ -477,10 +465,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;
@ -690,10 +677,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;
@ -745,10 +730,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;
@ -826,14 +809,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);
}
}
@ -1007,12 +986,8 @@ BOOL LLAvatarAppearance::loadAvatar()
}
// avatar_lad.xml : <morph_masks>
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)
{
@ -1031,11 +1006,8 @@ BOOL LLAvatarAppearance::loadAvatar()
loadLayersets();
// avatar_lad.xml : <driver_parameters>
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))
{
@ -1067,11 +1039,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();
}
@ -1103,12 +1072,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))
{
@ -1132,11 +1098,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;
@ -1148,12 +1111,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;
@ -1221,20 +1182,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);
@ -1257,11 +1215,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.
@ -1277,14 +1232,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);
@ -1300,11 +1253,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)
{
@ -1320,7 +1270,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);
}
}
@ -1747,13 +1696,13 @@ void LLAvatarAppearance::makeJointAliases(LLAvatarBoneInfo *bone_info)
boost::char_separator<char> sep(" ");
boost::tokenizer<boost::char_separator<char> > tok(aliases, sep);
for(boost::tokenizer<boost::char_separator<char> >::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)
@ -1768,21 +1717,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

View File

@ -387,10 +387,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();
}

View File

@ -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;
}

View File

@ -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<LLAvatarJoint*>(*iter);
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(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<LLAvatarJoint*>(*iter);
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(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<LLAvatarJoint*>(*iter);
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(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<LLAvatarJoint*>(*iter);
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(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<LLAvatarJoint*>(*iter);
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(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<LLAvatarJoint*>(*iter);
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(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<LLAvatarJoint*>(*iter);
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(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<LLAvatarJoint*>(*iter);
LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(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);
}
}
//-----------------------------------------------------------------------------

View File

@ -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);
}
}

View File

@ -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)
@ -232,19 +230,19 @@ void LLDriverParam::setWeight(F32 weight)
//-------|----|-------|----|-------> 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;
}
@ -268,7 +266,7 @@ void LLDriverParam::setWeight(F32 weight)
driven_weight = driven_min;
}
setDrivenWeight(driven,driven_weight);
setDrivenWeight(drivenp,driven_weight);
continue;
}
else
@ -292,23 +290,22 @@ void LLDriverParam::setWeight(F32 weight)
driven_weight = driven_min;
}
setDrivenWeight(driven,driven_weight);
setDrivenWeight(drivenp,driven_weight);
continue;
}
}
driven_weight = getDrivenWeight(driven, mCurWeight);
setDrivenWeight(driven,driven_weight);
driven_weight = getDrivenWeight(drivenp, mCurWeight);
setDrivenWeight(drivenp,driven_weight);
}
}
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;
@ -320,10 +317,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);
@ -335,10 +331,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;
@ -353,10 +348,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;
}
@ -365,13 +359,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;
}
}
@ -415,7 +408,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;
@ -448,14 +441,14 @@ void LLDriverParam::setAnimationTarget( F32 target_value)
{
LLVisualParam::setAnimationTarget(target_value);
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
driven->mParam->setAnimationTarget(driven_weight);
drivenp->mParam->setAnimationTarget(driven_weight);
}
}
@ -466,10 +459,9 @@ void LLDriverParam::stopAnimating()
{
LLVisualParam::stopAnimating();
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);
}
}
@ -477,17 +469,15 @@ void LLDriverParam::stopAnimating()
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;
}
@ -500,7 +490,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
{
@ -523,10 +513,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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -363,18 +363,16 @@ BOOL LLPolyMorphTarget::setInfo(LLPolyMorphTargetInfo* info)
setWeight(getDefaultWeight());
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;
}
}
@ -641,15 +639,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);
}
}
@ -735,15 +732,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);
}
}

View File

@ -143,38 +143,35 @@ BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info)
mID = info->mID;
setWeight(getDefaultWeight());
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;
@ -195,15 +192,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
@ -218,13 +212,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;

View File

@ -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;

View File

@ -241,11 +241,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);
}
}
@ -287,12 +284,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() );
}
@ -301,7 +296,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;
@ -348,14 +343,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();
}
}
@ -368,9 +361,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;
@ -399,9 +391,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();
@ -473,9 +464,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);
}
@ -526,9 +516,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();
@ -549,9 +538,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;
@ -562,9 +550,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();
@ -661,14 +648,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;
}
}
@ -735,11 +720,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))
{
@ -749,11 +731,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))
{
@ -796,15 +775,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;
@ -812,7 +789,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;
@ -823,15 +800,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;
@ -839,7 +814,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;
@ -873,12 +848,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();
@ -893,9 +865,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();
@ -938,18 +909,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;
}
}
@ -994,10 +965,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);
}
@ -1021,10 +991,8 @@ BOOL LLTexLayer::setInfo(const LLTexLayerInfo* info, LLWearable* wearable )
//static
void LLTexLayer::calculateTexLayerColor(const param_color_list_t &param_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())
@ -1049,10 +1017,8 @@ void LLTexLayer::calculateTexLayerColor(const param_color_list_t &param_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();
}
}
@ -1226,9 +1192,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*)&param_weight, sizeof(F32));
@ -1365,9 +1330,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)
{
@ -1441,9 +1405,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*)&param_weight, sizeof(F32));
}
@ -1683,12 +1646,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);
@ -1785,17 +1746,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;
@ -1807,20 +1766,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);
}
}
}

View File

@ -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)
{

View File

@ -60,12 +60,12 @@ LLWearable::LLWearable()
// virtual
LLWearable::~LLWearable()
{
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();
@ -122,12 +122,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";
}
@ -135,11 +133,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;
}
@ -160,11 +158,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;
@ -523,10 +519,9 @@ std::vector<LLLocalTextureObject*> LLWearable::getLocalTextureListSeq()
{
std::vector<LLLocalTextureObject*> 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);
}
@ -547,37 +542,15 @@ 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<LLDriverParam*>(param) )
if(param)
{
F32 value = vp_pair.second;
setVisualParamWeight(id, value);
}
}
//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<LLDriverParam*>(param) )
{
setVisualParamWeight(id, value);
}
}
// 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();
}
}
@ -589,10 +562,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;
}
@ -706,23 +679,18 @@ 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);
}
}
void LLWearable::animateParams(F32 delta)
{
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;
param->animate(delta);
}
}

View File

@ -123,18 +123,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;
}
@ -310,12 +308,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.
@ -395,9 +393,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;
@ -417,9 +415,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())
{
@ -1115,9 +1113,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;
@ -1137,9 +1135,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;
@ -1166,9 +1164,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;
@ -1603,10 +1601,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)

View File

@ -379,12 +379,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;
}
}

View File

@ -156,10 +156,9 @@ LLBVHLoader::LLBVHLoader(const char* buffer, ELoadStatus &loadStatus, S32 &error
}
// Recognize all names we've been told are legal.
std::map<std::string, std::string>::iterator iter;
for (iter = joint_alias_map.begin(); iter != joint_alias_map.end(); iter++)
for (std::map<std::string, std::string>::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 */
@ -950,10 +949,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
@ -1066,10 +1063,8 @@ void LLBVHLoader::optimize()
mEaseOut *= factor;
}
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;
@ -1294,15 +1289,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++;
}
@ -1321,11 +1313,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;
@ -1348,17 +1337,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;
}
}
@ -1366,19 +1353,17 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp)
LLQuaternion::Order order = bvhStringToOrder( joint->mOrder );
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;
@ -1417,7 +1402,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;
@ -1444,16 +1429,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;
@ -1461,7 +1444,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;
@ -1494,24 +1477,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");
}

View File

@ -246,10 +246,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);
}
}

View File

@ -218,11 +218,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;
}
@ -237,11 +235,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;
}

View File

@ -199,15 +199,14 @@ BOOL LLGestureList::triggerAndReviseString(const std::string &string, std::strin
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
boost::char_separator<char> 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;

View File

@ -67,11 +67,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<map_type::value_type>);
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)) ? "*" : "");
}
}
@ -209,10 +208,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);
}
}
@ -251,10 +248,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)
{
@ -514,10 +509,9 @@ void LLJoint::getAllAttachmentPosOverrides(S32& num_pos_overrides,
std::set<LLVector3>& 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);
}
}
@ -528,10 +522,9 @@ void LLJoint::getAllAttachmentScaleOverrides(S32& num_scale_overrides,
std::set<LLVector3>& 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);
}
}
@ -556,10 +549,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<LLVector3> 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)
{
@ -569,11 +561,10 @@ void LLJoint::showAttachmentPosOverrides(const std::string& av_info) const
{
LL_DEBUGS("Avatar") << "no conflicts" << LL_ENDL;
}
std::set<LLVector3>::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;
}
}
}
@ -717,10 +708,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<LLVector3> 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)
{
@ -730,11 +720,10 @@ void LLJoint::showAttachmentScaleOverrides(const std::string& av_info) const
{
LL_DEBUGS("Avatar") << "no conflicts" << LL_ENDL;
}
std::set<LLVector3>::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;
}
}
}
@ -993,10 +982,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();
}
}
@ -1040,10 +1027,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();

View File

@ -626,10 +626,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);
@ -764,19 +762,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);
}
}
@ -786,10 +780,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);
}
}
@ -2016,10 +2008,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");
@ -2038,10 +2029,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");
@ -2060,10 +2050,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 */
@ -2415,14 +2403,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();

View File

@ -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);
@ -139,13 +135,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);
}
}
@ -162,23 +156,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...
{
@ -190,10 +181,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;
@ -280,13 +270,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();
}
}
@ -318,13 +306,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;

View File

@ -211,11 +211,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))
{
@ -225,13 +222,10 @@ void LLMotionController::purgeExcessMotions()
}
// clean up all inactive, loaded motions
for (std::set<LLUUID>::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))
{
@ -1059,12 +1053,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())
@ -1083,10 +1076,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);
}
}
@ -1118,10 +1110,9 @@ void LLMotionController::flushAllMotions()
mCharacter->removeAnimationData("Hand Pose");
// restart motions
for (std::vector<std::pair<LLUUID,F32> >::iterator iter = active_motions.begin();
iter != active_motions.end(); ++iter)
for (std::vector<std::pair<LLUUID,F32> >::value_type& motion_pair : active_motions)
{
startMotion(iter->first, iter->second);
startMotion(motion_pair.first, motion_pair.second);
}
}

View File

@ -88,10 +88,8 @@ S32 LLMultiGesture::getMaxSerialSize() const
max_size += 64; // step count S32
std::vector<LLGestureStep*>::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();
}

View File

@ -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;
}

View File

@ -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;
@ -215,18 +213,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)
@ -235,18 +231,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());
@ -265,25 +258,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";
}

View File

@ -106,6 +106,7 @@ set(llcommon_SOURCE_FILES
lluriparser.cpp
lluuid.cpp
llworkerthread.cpp
hbxxh.cpp
u64.cpp
threadpool.cpp
workqueue.cpp
@ -242,6 +243,7 @@ set(llcommon_HEADER_FILES
llwin32headers.h
llwin32headerslean.h
llworkerthread.h
hbxxh.h
lockstatic.h
stdtypes.h
stringize.h

377
indra/llcommon/hbxxh.cpp Normal file
View File

@ -0,0 +1,377 @@
/**
* @file hbxxh.cpp
* @brief High performances vectorized hashing based on xxHash.
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (c) 2023, Henri Beauchamp.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "linden_common.h"
// This define ensures that xxHash will be compiled within this module, with
// vectorized (*) and inlined functions (with no exported API symbol); our
// xxhash "pre-built library" package actually only contains the xxhash.h
// header (no library needed at link time).
// (*) SSE2 is normally used for x86(_64) builds, unless you enabled AVX2
// in your build, in which case the latter would be used instead. For ARM64
// builds, this would also automatically enable NEON vectorization.
#define XXH_INLINE_ALL
#include "xxhash/xxhash.h"
#include "hbxxh.h"
// How many bytes to grab at a time when hashing files or streams
constexpr size_t BLOCK_LEN = 4096;
///////////////////////////////////////////////////////////////////////////////
// HBXXH64 class
///////////////////////////////////////////////////////////////////////////////
//static
U64 HBXXH64::digest(const void* buffer, size_t len)
{
return XXH3_64bits(buffer, len);
}
//static
U64 HBXXH64::digest(const char* str)
{
return XXH3_64bits((const void*)str, strlen(str));
}
//static
U64 HBXXH64::digest(const std::string& str)
{
return XXH3_64bits((const void*)str.c_str(), str.size());
}
// Must be called by all constructors.
void HBXXH64::init()
{
mDigest = 0;
mState = (void*)XXH3_createState();
if (!mState || XXH3_64bits_reset((XXH3_state_t*)mState) != XXH_OK)
{
LL_WARNS() << "Failed to initialize state !" << LL_ENDL;
}
}
HBXXH64::~HBXXH64()
{
if (mState)
{
XXH3_freeState((XXH3_state_t*)mState);
}
}
void HBXXH64::update(const void* buffer, size_t len)
{
if (mState)
{
XXH3_64bits_update((XXH3_state_t*)mState, buffer, len);
}
else
{
LL_WARNS() << "Cannot update a finalized digest !" << LL_ENDL;
}
}
void HBXXH64::update(const std::string& str)
{
if (mState)
{
XXH3_64bits_update((XXH3_state_t*)mState, (const void*)str.c_str(),
str.length());
}
else
{
LL_WARNS() << "Cannot update a finalized digest !" << LL_ENDL;
}
}
void HBXXH64::update(std::istream& stream)
{
if (!mState)
{
LL_WARNS() << "Cannot update a finalized digest !" << LL_ENDL;
return;
}
char buffer[BLOCK_LEN];
size_t len;
while (stream.good())
{
stream.read(buffer, BLOCK_LEN);
len = stream.gcount();
XXH3_64bits_update((XXH3_state_t*)mState, (const void*)buffer, len);
}
}
void HBXXH64::update(FILE* file)
{
if (!mState)
{
LL_WARNS() << "Cannot update a finalized digest !" << LL_ENDL;
return;
}
char buffer[BLOCK_LEN];
size_t len;
while ((len = fread((void*)buffer, 1, BLOCK_LEN, file)))
{
XXH3_64bits_update((XXH3_state_t*)mState, (const void*)buffer, len);
}
fclose(file);
}
void HBXXH64::finalize()
{
if (!mState)
{
LL_WARNS() << "Already finalized !" << LL_ENDL;
return;
}
mDigest = XXH3_64bits_digest((XXH3_state_t*)mState);
XXH3_freeState((XXH3_state_t*)mState);
mState = NULL;
}
U64 HBXXH64::digest() const
{
return mState ? XXH3_64bits_digest((XXH3_state_t*)mState) : mDigest;
}
std::ostream& operator<<(std::ostream& stream, HBXXH64 context)
{
stream << context.digest();
return stream;
}
///////////////////////////////////////////////////////////////////////////////
// HBXXH128 class
///////////////////////////////////////////////////////////////////////////////
//static
LLUUID HBXXH128::digest(const void* buffer, size_t len)
{
XXH128_hash_t hash = XXH3_128bits(buffer, len);
LLUUID id;
U64* data = (U64*)id.mData;
// Note: we do not check endianness here and we just store in the same
// order as XXH128_hash_t, that is low word "first".
data[0] = hash.low64;
data[1] = hash.high64;
return id;
}
//static
LLUUID HBXXH128::digest(const char* str)
{
XXH128_hash_t hash = XXH3_128bits((const void*)str, strlen(str));
LLUUID id;
U64* data = (U64*)id.mData;
// Note: we do not check endianness here and we just store in the same
// order as XXH128_hash_t, that is low word "first".
data[0] = hash.low64;
data[1] = hash.high64;
return id;
}
//static
LLUUID HBXXH128::digest(const std::string& str)
{
XXH128_hash_t hash = XXH3_128bits((const void*)str.c_str(), str.size());
LLUUID id;
U64* data = (U64*)id.mData;
// Note: we do not check endianness here and we just store in the same
// order as XXH128_hash_t, that is low word "first".
data[0] = hash.low64;
data[1] = hash.high64;
return id;
}
//static
void HBXXH128::digest(LLUUID& result, const void* buffer, size_t len)
{
XXH128_hash_t hash = XXH3_128bits(buffer, len);
U64* data = (U64*)result.mData;
// Note: we do not check endianness here and we just store in the same
// order as XXH128_hash_t, that is low word "first".
data[0] = hash.low64;
data[1] = hash.high64;
}
//static
void HBXXH128::digest(LLUUID& result, const char* str)
{
XXH128_hash_t hash = XXH3_128bits((const void*)str, strlen(str));
U64* data = (U64*)result.mData;
// Note: we do not check endianness here and we just store in the same
// order as XXH128_hash_t, that is low word "first".
data[0] = hash.low64;
data[1] = hash.high64;
}
//static
void HBXXH128::digest(LLUUID& result, const std::string& str)
{
XXH128_hash_t hash = XXH3_128bits((const void*)str.c_str(), str.size());
U64* data = (U64*)result.mData;
// Note: we do not check endianness here and we just store in the same
// order as XXH128_hash_t, that is low word "first".
data[0] = hash.low64;
data[1] = hash.high64;
}
// Must be called by all constructors.
void HBXXH128::init()
{
mState = (void*)XXH3_createState();
if (!mState || XXH3_128bits_reset((XXH3_state_t*)mState) != XXH_OK)
{
LL_WARNS() << "Failed to initialize state !" << LL_ENDL;
}
}
HBXXH128::~HBXXH128()
{
if (mState)
{
XXH3_freeState((XXH3_state_t*)mState);
}
}
void HBXXH128::update(const void* buffer, size_t len)
{
if (mState)
{
XXH3_128bits_update((XXH3_state_t*)mState, buffer, len);
}
else
{
LL_WARNS() << "Cannot update a finalized digest !" << LL_ENDL;
}
}
void HBXXH128::update(const std::string& str)
{
if (mState)
{
XXH3_128bits_update((XXH3_state_t*)mState, (const void*)str.c_str(),
str.length());
}
else
{
LL_WARNS() << "Cannot update a finalized digest !" << LL_ENDL;
}
}
void HBXXH128::update(std::istream& stream)
{
if (!mState)
{
LL_WARNS() << "Cannot update a finalized digest !" << LL_ENDL;
return;
}
char buffer[BLOCK_LEN];
size_t len;
while (stream.good())
{
stream.read(buffer, BLOCK_LEN);
len = stream.gcount();
XXH3_128bits_update((XXH3_state_t*)mState, (const void*)buffer, len);
}
}
void HBXXH128::update(FILE* file)
{
if (!mState)
{
LL_WARNS() << "Cannot update a finalized digest !" << LL_ENDL;
return;
}
char buffer[BLOCK_LEN];
size_t len;
while ((len = fread((void*)buffer, 1, BLOCK_LEN, file)))
{
XXH3_128bits_update((XXH3_state_t*)mState, (const void*)buffer, len);
}
fclose(file);
}
void HBXXH128::finalize()
{
if (!mState)
{
LL_WARNS() << "Already finalized !" << LL_ENDL;
return;
}
XXH128_hash_t hash = XXH3_128bits_digest((XXH3_state_t*)mState);
U64* data = (U64*)mDigest.mData;
// Note: we do not check endianness here and we just store in the same
// order as XXH128_hash_t, that is low word "first".
data[0] = hash.low64;
data[1] = hash.high64;
XXH3_freeState((XXH3_state_t*)mState);
mState = NULL;
}
const LLUUID& HBXXH128::digest() const
{
if (mState)
{
XXH128_hash_t hash = XXH3_128bits_digest((XXH3_state_t*)mState);
// We cheat the const-ness of the method here, but this is OK, since
// mDigest is private and cannot be accessed indirectly by other
// methods than digest() ones, that do check for mState to decide
// wether mDigest's current value may be provided as is or not. This
// cheat saves us a temporary LLLUID copy.
U64* data = (U64*)mDigest.mData;
// Note: we do not check endianness here and we just store in the same
// order as XXH128_hash_t, that is low word "first".
data[0] = hash.low64;
data[1] = hash.high64;
}
return mDigest;
}
void HBXXH128::digest(LLUUID& result) const
{
if (!mState)
{
result = mDigest;
return;
}
XXH128_hash_t hash = XXH3_128bits_digest((XXH3_state_t*)mState);
U64* data = (U64*)result.mData;
// Note: we do not check endianness here and we just store in the same
// order as XXH128_hash_t, that is low word "first".
data[0] = hash.low64;
data[1] = hash.high64;
}
std::ostream& operator<<(std::ostream& stream, HBXXH128 context)
{
stream << context.digest();
return stream;
}

259
indra/llcommon/hbxxh.h Normal file
View File

@ -0,0 +1,259 @@
/**
* @file hbxxh.h
* @brief High performances vectorized hashing based on xxHash.
*
* $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (c) 2023, Henri Beauchamp.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_HBXXH_H
#define LL_HBXXH_H
#include "lluuid.h"
// HBXXH* classes are to be used where speed matters and cryptographic quality
// is not required (no "one-way" guarantee, though they are likely not worst in
// this respect than MD5 which got busted and is now considered too weak). The
// xxHash code they are built upon is vectorized and about 50 times faster than
// MD5. A 64 bits hash class is also provided for when 128 bits of entropy are
// not needed. The hashes collision rate is similar to MD5's.
// See https://github.com/Cyan4973/xxHash#readme for details.
// 64 bits hashing class
class HBXXH64
{
friend std::ostream& operator<<(std::ostream&, HBXXH64);
protected:
LOG_CLASS(HBXXH64);
public:
inline HBXXH64() { init(); }
// Constructors for special circumstances; they all digest the first passed
// parameter. Set 'do_finalize' to false if you do not want to finalize the
// context, which is useful/needed when you want to update() it afterwards.
// Ideally, the compiler should be smart enough to get our clue and
// optimize out the const bool test during inlining...
inline HBXXH64(const void* buffer, size_t len,
const bool do_finalize = true)
{
init();
update(buffer, len);
if (do_finalize)
{
finalize();
}
}
inline HBXXH64(const std::string& str, const bool do_finalize = true)
{
init();
update(str);
if (do_finalize)
{
finalize();
}
}
inline HBXXH64(std::istream& s, const bool do_finalize = true)
{
init();
update(s);
if (do_finalize)
{
finalize();
}
}
inline HBXXH64(FILE* file, const bool do_finalize = true)
{
init();
update(file);
if (do_finalize)
{
finalize();
}
}
~HBXXH64();
void update(const void* buffer, size_t len);
void update(const std::string& str);
void update(std::istream& s);
void update(FILE* file);
// Note that unlike what happens with LLMD5, you do not need to finalize()
// HBXXH64 before using digest(), and you may keep updating() it even after
// you got a first digest() (the next digest would of course change after
// any update). It is still useful to use finalize() when you do not want
// to store a final digest() result in a separate U64; after this method
// has been called, digest() simply returns mDigest value.
void finalize();
U64 digest() const;
// Fast static methods. Use them when hashing just one contiguous block of
// data.
static U64 digest(const void* buffer, size_t len);
static U64 digest(const char* str); // str must be NUL-terminated
static U64 digest(const std::string& str);
private:
void init();
private:
// We use a void pointer to avoid including xxhash.h here for XXH3_state_t
// (which cannot either be trivially forward-declared, due to complex API
// related pre-processor macros in xxhash.h).
void* mState;
U64 mDigest;
};
inline bool operator==(const HBXXH64& a, const HBXXH64& b)
{
return a.digest() == b.digest();
}
inline bool operator!=(const HBXXH64& a, const HBXXH64& b)
{
return a.digest() != b.digest();
}
// 128 bits hashing class
class HBXXH128
{
friend std::ostream& operator<<(std::ostream&, HBXXH128);
protected:
LOG_CLASS(HBXXH128);
public:
inline HBXXH128() { init(); }
// Constructors for special circumstances; they all digest the first passed
// parameter. Set 'do_finalize' to false if you do not want to finalize the
// context, which is useful/needed when you want to update() it afterwards.
// Ideally, the compiler should be smart enough to get our clue and
// optimize out the const bool test during inlining...
inline HBXXH128(const void* buffer, size_t len,
const bool do_finalize = true)
{
init();
update(buffer, len);
if (do_finalize)
{
finalize();
}
}
inline HBXXH128(const std::string& str, const bool do_finalize = true)
{
init();
update(str);
if (do_finalize)
{
finalize();
}
}
inline HBXXH128(std::istream& s, const bool do_finalize = true)
{
init();
update(s);
if (do_finalize)
{
finalize();
}
}
inline HBXXH128(FILE* file, const bool do_finalize = true)
{
init();
update(file);
if (do_finalize)
{
finalize();
}
}
~HBXXH128();
void update(const void* buffer, size_t len);
void update(const std::string& str);
void update(std::istream& s);
void update(FILE* file);
// Note that unlike what happens with LLMD5, you do not need to finalize()
// HBXXH128 before using digest(), and you may keep updating() it even
// after you got a first digest() (the next digest would of course change
// after any update). It is still useful to use finalize() when you do not
// want to store a final digest() result in a separate LLUUID; after this
// method has been called, digest() simply returns a reference on mDigest.
void finalize();
// We use an LLUUID for the digest, since this is a 128 bits wide native
// type available in the viewer code, making it easy to manipulate. It also
// allows to use HBXXH128 efficiently in LLUUID generate() and combine()
// methods.
const LLUUID& digest() const;
// Here, we avoid an LLUUID copy whenever we already got one to store the
// result *and* we did not yet call finalize().
void digest(LLUUID& result) const;
// Fast static methods. Use them when hashing just one contiguous block of
// data.
static LLUUID digest(const void* buffer, size_t len);
static LLUUID digest(const char* str); // str must be NUL-terminated
static LLUUID digest(const std::string& str);
// Same as above, but saves you from an LLUUID copy when you already got
// one for storage use.
static void digest(LLUUID& result, const void* buffer, size_t len);
static void digest(LLUUID& result, const char* str); // str NUL-terminated
static void digest(LLUUID& result, const std::string& str);
private:
void init();
private:
// We use a void pointer to avoid including xxhash.h here for XXH3_state_t
// (which cannot either be trivially forward-declared, due to complex API
// related pre-processor macros in xxhash.h).
void* mState;
LLUUID mDigest;
};
inline bool operator==(const HBXXH128& a, const HBXXH128& b)
{
return a.digest() == b.digest();
}
inline bool operator!=(const HBXXH128& a, const HBXXH128& b)
{
return a.digest() != b.digest();
}
#endif // LL_HBXXH_H

View File

@ -130,15 +130,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';
}

View File

@ -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;

View File

@ -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);

View File

@ -91,10 +91,9 @@ LLCallStack::LLCallStack(S32 skip_count, bool verbose):
bool LLCallStack::contains(const std::string& str)
{
for (std::vector<std::string>::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<std::string>::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<std::string,S32>& strings =
LLThreadLocalSingletonPointer<LLContextStrings>::getInstance()->m_contextStrings;
for (std::map<std::string,S32>::const_iterator it = strings.begin(); it!=strings.end(); ++it)
for (const std::map<std::string,S32>::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<std::string,S32>& strings =
LLThreadLocalSingletonPointer<LLContextStrings>::getInstance()->m_contextStrings;
for (std::map<std::string,S32>::const_iterator it = strings.begin(); it!=strings.end(); ++it)
for (const std::map<std::string,S32>::value_type& str_pair : strings)
{
os << it->first << "[" << it->second << "]" << "\n";
os << str_pair.first << "[" << str_pair.second << "]" << "\n";
}
}

View File

@ -586,11 +586,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();
@ -1224,12 +1222,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;
if (!r->enabled())
{
continue;

View File

@ -203,10 +203,9 @@ void LLSimpleDispatcher::removeListener(LLEventListener* listener)
std::vector<LLListenerEntry> LLSimpleDispatcher::getListeners() const
{
std::vector<LLListenerEntry> ret;
std::vector<LLListenerEntry>::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<LLListenerEntry> LLSimpleDispatcher::getListeners() const
// virtual
bool LLSimpleDispatcher::fireEvent(LLPointer<LLEvent> event, LLSD filter)
{
std::vector<LLListenerEntry>::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<LLEventDispatcher *>::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;

View File

@ -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;
}
}

View File

@ -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();
}
}

View File

@ -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 <rect> 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(&param);
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);
}
}

View File

@ -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<T>::equals(it->second, value))
if (ParamCompare<T>::equals(map_pair.second, value))
{
return it->first;
return map_pair.first;
}
}
@ -376,11 +374,9 @@ namespace LLInitParam
static std::vector<std::string> 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;
}

View File

@ -207,9 +207,9 @@ 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;
}
@ -225,12 +225,11 @@ LLKeyBind::data_vector_t::const_iterator LLKeyBind::endNonEmpty() const
LLSD LLKeyBind::asLLSD() const
{
LLSD data;
auto end{ endNonEmpty() };
for (auto it = mData.begin(); it < end; ++it)
for (const LLKeyData& key_data : mData)
{
// append intermediate entries even if empty to not affect visual
// representation
data.append(it->asLLSD());
data.append(key_data.asLLSD());
}
return data;
}
@ -243,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;
}
@ -267,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;
}
@ -354,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;
}
}

View File

@ -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() ;
}
@ -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, &current) ;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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();

View File

@ -113,11 +113,9 @@ void LLParamSDParser::writeSDImpl(LLSD& sd, const LLInitParam::BaseBlock& block,
/*virtual*/ std::string LLParamSDParser::getCurrentElementName()
{
std::string full_name = "sd";
for (name_stack_t::iterator it = mNameStack.begin();
it != mNameStack.end();
++it)
for (name_stack_t::value_type& stack_pair : mNameStack)
{
full_name += llformat("[%s]", it->first.c_str());
full_name += llformat("[%s]", stack_pair.first.c_str());
}
return full_name;

View File

@ -148,10 +148,9 @@ LLSD ll_binary_from_string(const LLSD& sd)
std::vector<U8> binary_value;
std::string string_value = sd.asString();
for (std::string::iterator iter = string_value.begin();
iter != string_value.end(); ++iter)
for (const U8 c : string_value)
{
binary_value.push_back(*iter);
binary_value.push_back(c);
}
binary_value.push_back('\0');

View File

@ -191,75 +191,6 @@ LLSD& drill_ref( LLSD& blob, const LLSD& path);
}
/*****************************************************************************
* LLSDArray
*****************************************************************************/
/**
* Construct an LLSD::Array inline, with implicit conversion to LLSD. Usage:
*
* @code
* void somefunc(const LLSD&);
* ...
* somefunc(LLSDArray("text")(17)(3.14));
* @endcode
*
* For completeness, LLSDArray() with no args constructs an empty array, so
* <tt>LLSDArray()("text")(17)(3.14)</tt> produces an array equivalent to the
* above. But for most purposes, LLSD() is already equivalent to an empty
* array, and if you explicitly want an empty isArray(), there's
* LLSD::emptyArray(). However, supporting a no-args LLSDArray() constructor
* follows the principle of least astonishment.
*/
class LLSDArray
{
public:
LLSDArray():
_data(LLSD::emptyArray())
{}
/**
* Need an explicit copy constructor. Consider the following:
*
* @code
* LLSD array_of_arrays(LLSDArray(LLSDArray(17)(34))
* (LLSDArray("x")("y")));
* @endcode
*
* The coder intends to construct [[17, 34], ["x", "y"]].
*
* With the compiler's implicit copy constructor, s/he gets instead
* [17, 34, ["x", "y"]].
*
* The expression LLSDArray(17)(34) constructs an LLSDArray with those two
* values. The reader assumes it should be converted to LLSD, as we always
* want with LLSDArray, before passing it to the @em outer LLSDArray
* constructor! This copy constructor makes that happen.
*/
LLSDArray(const LLSDArray& inner):
_data(LLSD::emptyArray())
{
_data.append(inner);
}
LLSDArray(const LLSD& value):
_data(LLSD::emptyArray())
{
_data.append(value);
}
LLSDArray& operator()(const LLSD& value)
{
_data.append(value);
return *this;
}
operator LLSD() const { return _data; }
LLSD get() const { return _data; }
private:
LLSD _data;
};
namespace llsd
{

View File

@ -89,9 +89,8 @@ LLStringTable::~LLStringTable()
{
if (mStringList[i])
{
string_list_t::iterator iter;
for (iter = mStringList[i]->begin(); iter != mStringList[i]->end(); iter++)
delete *iter; // *iter = (LLStringTableEntry*)
for (LLStringTableEntry* entry : *mStringList[i])
delete entry;
}
delete mStringList[i];
}
@ -156,9 +155,9 @@ LLStringTableEntry* LLStringTable::checkStringEntry(const char *str)
if (str)
{
char *ret_val;
LLStringTableEntry *entry;
U32 hash_value = hash_my_string(str, mMaxEntries);
#if STRING_TABLE_HASH_MAP
LLStringTableEntry *entry;
#if 1 // Microsoft
string_hash_t::iterator lower = mStringHash.lower_bound(hash_value);
string_hash_t::iterator upper = mStringHash.upper_bound(hash_value);
@ -180,10 +179,8 @@ LLStringTableEntry* LLStringTable::checkStringEntry(const char *str)
string_list_t *strlist = mStringList[hash_value];
if (strlist)
{
string_list_t::iterator iter;
for (iter = strlist->begin(); iter != strlist->end(); iter++)
for (LLStringTableEntry* entry : *strlist)
{
entry = *iter;
ret_val = entry->mString;
if (!strncmp(ret_val, str, MAX_STRINGS_LENGTH))
{
@ -226,9 +223,9 @@ LLStringTableEntry* LLStringTable::addStringEntry(const char *str)
if (str)
{
char *ret_val = NULL;
LLStringTableEntry *entry;
U32 hash_value = hash_my_string(str, mMaxEntries);
#if STRING_TABLE_HASH_MAP
LLStringTableEntry *entry;
#if 1 // Microsoft
string_hash_t::iterator lower = mStringHash.lower_bound(hash_value);
string_hash_t::iterator upper = mStringHash.upper_bound(hash_value);
@ -257,10 +254,8 @@ LLStringTableEntry* LLStringTable::addStringEntry(const char *str)
if (strlist)
{
string_list_t::iterator iter;
for (iter = strlist->begin(); iter != strlist->end(); iter++)
for (LLStringTableEntry* entry : *strlist)
{
entry = *iter;
ret_val = entry->mString;
if (!strncmp(ret_val, str, MAX_STRINGS_LENGTH))
{
@ -294,10 +289,10 @@ void LLStringTable::removeString(const char *str)
if (str)
{
char *ret_val;
LLStringTableEntry *entry;
U32 hash_value = hash_my_string(str, mMaxEntries);
#if STRING_TABLE_HASH_MAP
{
LLStringTableEntry *entry;
#if 1 // Microsoft
string_hash_t::iterator lower = mStringHash.lower_bound(hash_value);
string_hash_t::iterator upper = mStringHash.upper_bound(hash_value);
@ -331,10 +326,8 @@ void LLStringTable::removeString(const char *str)
if (strlist)
{
string_list_t::iterator iter;
for (iter = strlist->begin(); iter != strlist->end(); iter++)
for (LLStringTableEntry* entry : *strlist)
{
entry = *iter;
ret_val = entry->mString;
if (!strncmp(ret_val, str, MAX_STRINGS_LENGTH))
{

View File

@ -136,9 +136,9 @@ public:
for (S32 i = 0; i<mTableSize; i++)
{
string_set_t& stringset = mStringList[i];
for (string_set_t::iterator iter = stringset.begin(); iter != stringset.end(); iter++)
for (LLStdStringHandle str : stringset)
{
delete *iter;
delete str;
}
stringset.clear();
}

View File

@ -773,11 +773,9 @@ void PeriodicRecording::handleReset()
}
else
{
for (std::vector<Recording>::iterator it = mRecordingPeriods.begin(), end_it = mRecordingPeriods.end();
it != end_it;
++it)
for (Recording& rec : mRecordingPeriods)
{
it->reset();
rec.reset();
}
}
mCurPeriod = 0;

View File

@ -284,13 +284,11 @@ void ThreadRecorder::pullFromChildren()
AccumulatorBufferGroup& target_recording_buffers = mActiveRecordings.back()->mPartialRecording;
target_recording_buffers.sync();
for (child_thread_recorder_list_t::iterator it = mChildThreadRecorders.begin(), end_it = mChildThreadRecorders.end();
it != end_it;
++it)
{ LLMutexLock lock(&(*it)->mSharedRecordingMutex);
for (LLTrace::ThreadRecorder* rec : mChildThreadRecorders)
{ LLMutexLock lock(&(rec->mSharedRecordingMutex));
target_recording_buffers.merge((*it)->mSharedRecordingBuffers);
(*it)->mSharedRecordingBuffers.reset();
target_recording_buffers.merge(rec->mSharedRecordingBuffers);
rec->mSharedRecordingBuffers.reset();
}
}
#endif

View File

@ -663,9 +663,9 @@ LLSD LLURI::pathArray() const
tokenizer::iterator end = tokens.end();
LLSD params;
for ( ; it != end; ++it)
for (const std::string& str : tokens)
{
params.append(*it);
params.append(str);
}
return params;
}

View File

@ -40,11 +40,12 @@
#include "lluuid.h"
#include "llerror.h"
#include "llrand.h"
#include "llmd5.h"
#include "llstring.h"
#include "lltimer.h"
#include "llthread.h"
#include "llmutex.h"
#include "llmd5.h"
#include "hbxxh.h"
const LLUUID LLUUID::null;
const LLTransactionID LLTransactionID::tnull;
@ -400,6 +401,9 @@ LLUUID LLUUID::operator^(const LLUUID& rhs) const
return id;
}
// WARNING: this algorithm SHALL NOT be changed. It is also used by the server
// and plays a role in some assets validation (e.g. clothing items). Changing
// it would cause invalid assets.
void LLUUID::combine(const LLUUID& other, LLUUID& result) const
{
LLMD5 md5_uuid;
@ -857,17 +861,12 @@ void LLUUID::generate()
tmp >>= 8;
mData[8] = (unsigned char) tmp;
LLMD5 md5_uuid;
md5_uuid.update(mData,16);
md5_uuid.finalize();
md5_uuid.raw_digest(mData);
HBXXH128::digest(*this, (const void*)mData, 16);
}
void LLUUID::generate(const std::string& hash_string)
{
LLMD5 md5_uuid((U8*)hash_string.c_str());
md5_uuid.raw_digest(mData);
HBXXH128::digest(*this, hash_string);
}
U32 LLUUID::getRandomSeed()
@ -885,13 +884,8 @@ U32 LLUUID::getRandomSeed()
seed[7]=(unsigned char)(pid);
getSystemTime((uuid_time_t *)(&seed[8]));
LLMD5 md5_seed;
md5_seed.update(seed,16);
md5_seed.finalize();
md5_seed.raw_digest(seed);
return(*(U32 *)seed);
U64 seed64 = HBXXH64((const void*)seed, 16).digest();
return U32(seed64) ^ U32(seed64 >> 32);
}
BOOL LLUUID::parseUUID(const std::string& buf, LLUUID* value)

View File

@ -69,11 +69,11 @@ void LLWorkerThread::clearDeleteList()
<< " entries in delete list." << LL_ENDL;
mDeleteMutex->lock();
for (delete_list_t::iterator iter = mDeleteList.begin(); iter != mDeleteList.end(); ++iter)
for (LLWorkerClass* worker : mDeleteList)
{
(*iter)->mRequestHandle = LLWorkerThread::nullHandle();
(*iter)->clearFlags(LLWorkerClass::WCF_HAVE_WORK);
delete *iter ;
worker->mRequestHandle = LLWorkerThread::nullHandle();
worker->clearFlags(LLWorkerClass::WCF_HAVE_WORK);
delete worker;
}
mDeleteList.clear() ;
mDeleteMutex->unlock() ;
@ -108,15 +108,12 @@ size_t LLWorkerThread::update(F32 max_time_ms)
}
mDeleteMutex->unlock();
// abort and delete after releasing mutex
for (std::vector<LLWorkerClass*>::iterator iter = abort_list.begin();
iter != abort_list.end(); ++iter)
for (LLWorkerClass* worker : abort_list)
{
(*iter)->abortWork(false);
worker->abortWork(false);
}
for (std::vector<LLWorkerClass*>::iterator iter = delete_list.begin();
iter != delete_list.end(); ++iter)
for (LLWorkerClass* worker : delete_list)
{
LLWorkerClass* worker = *iter;
if (worker->mRequestHandle)
{
// Finished but not completed
@ -124,7 +121,7 @@ size_t LLWorkerThread::update(F32 max_time_ms)
worker->mRequestHandle = LLWorkerThread::nullHandle();
worker->clearFlags(LLWorkerClass::WCF_HAVE_WORK);
}
delete *iter;
delete worker;
}
// delete and aborted entries mean there's still work to do
res += delete_list.size() + abort_list.size();

View File

@ -345,7 +345,7 @@ namespace tut
lleventdispatcher_data():
work("test dispatcher", "op"),
// map {d=double, array=[3 elements]}
required(LLSDMap("d", LLSD::Real(0))("array", LLSDArray(LLSD())(LLSD())(LLSD()))),
required(LLSDMap("d", LLSD::Real(0))("array", llsd::array(LLSD(), LLSD(), LLSD()))),
// first several params are required, last couple optional
partial_offset(3)
{
@ -434,8 +434,8 @@ namespace tut
// freena(), methodna(), cmethodna(), smethodna() all take same param list.
// Same for freenb() et al.
params = LLSDMap("a", LLSDArray("b")("i")("f")("d")("cp"))
("b", LLSDArray("s")("uuid")("date")("uri")("bin"));
params = LLSDMap("a", llsd::array("b", "i", "f", "d", "cp"))
("b", llsd::array("s", "uuid", "date", "uri", "bin"));
debug("params:\n",
params, "\n"
"params[\"a\"]:\n",
@ -452,12 +452,12 @@ namespace tut
// LLDate values are, as long as they're different from the
// LLUUID() and LLDate() default values so inspect() will report
// them.
dft_array_full = LLSDMap("a", LLSDArray(true)(17)(3.14)(123456.78)("classic"))
("b", LLSDArray("string")
(LLUUID::generateNewID())
(LLDate::now())
(LLURI("http://www.ietf.org/rfc/rfc3986.txt"))
(binary));
dft_array_full = LLSDMap("a", llsd::array(true, 17, 3.14, 123456.78, "classic"))
("b", llsd::array("string",
LLUUID::generateNewID(),
LLDate::now(),
LLURI("http://www.ietf.org/rfc/rfc3986.txt"),
binary));
debug("dft_array_full:\n",
dft_array_full);
// Partial defaults arrays.
@ -723,7 +723,7 @@ namespace tut
{
set_test_name("map-style registration with non-array params");
// Pass "param names" as scalar or as map
LLSD attempts(LLSDArray(17)(LLSDMap("pi", 3.14)("two", 2)));
LLSD attempts(llsd::array(17, LLSDMap("pi", 3.14)("two", 2)));
foreach(LLSD ae, inArray(attempts))
{
std::string threw = catch_what<std::exception>([this, &ae](){
@ -738,7 +738,7 @@ namespace tut
{
set_test_name("map-style registration with badly-formed defaults");
std::string threw = catch_what<std::exception>([this](){
work.add("freena_err", "freena", freena, LLSDArray("a")("b"), 17);
work.add("freena_err", "freena", freena, llsd::array("a", "b"), 17);
});
ensure_has(threw, "must be a map or an array");
}
@ -749,8 +749,8 @@ namespace tut
set_test_name("map-style registration with too many array defaults");
std::string threw = catch_what<std::exception>([this](){
work.add("freena_err", "freena", freena,
LLSDArray("a")("b"),
LLSDArray(17)(0.9)("gack"));
llsd::array("a", "b"),
llsd::array(17, 0.9, "gack"));
});
ensure_has(threw, "shorter than");
}
@ -761,7 +761,7 @@ namespace tut
set_test_name("map-style registration with too many map defaults");
std::string threw = catch_what<std::exception>([this](){
work.add("freena_err", "freena", freena,
LLSDArray("a")("b"),
llsd::array("a", "b"),
LLSDMap("b", 17)("foo", 3.14)("bar", "sinister"));
});
ensure_has(threw, "nonexistent params");
@ -798,7 +798,7 @@ namespace tut
void object::test<8>()
{
set_test_name("query Callables with/out required params");
LLSD names(LLSDArray("free1")("Dmethod1")("Dcmethod1")("method1"));
LLSD names(llsd::array("free1", "Dmethod1", "Dcmethod1", "method1"));
foreach(LLSD nm, inArray(names))
{
LLSD metadata(getMetadata(nm));
@ -821,13 +821,13 @@ namespace tut
{
set_test_name("query array-style functions/methods");
// Associate each registered name with expected arity.
LLSD expected(LLSDArray
(LLSDArray
(0)(LLSDArray("free0_array")("smethod0_array")("method0_array")))
(LLSDArray
(5)(LLSDArray("freena_array")("smethodna_array")("methodna_array")))
(LLSDArray
(5)(LLSDArray("freenb_array")("smethodnb_array")("methodnb_array"))));
LLSD expected(llsd::array
(llsd::array
(0, llsd::array("free0_array", "smethod0_array", "method0_array")),
llsd::array
(5, llsd::array("freena_array", "smethodna_array", "methodna_array")),
llsd::array
(5, llsd::array("freenb_array", "smethodnb_array", "methodnb_array"))));
foreach(LLSD ae, inArray(expected))
{
LLSD::Integer arity(ae[0].asInteger());
@ -853,7 +853,7 @@ namespace tut
set_test_name("query map-style no-params functions/methods");
// - (Free function | non-static method), map style, no params (ergo
// no defaults)
LLSD names(LLSDArray("free0_map")("smethod0_map")("method0_map"));
LLSD names(llsd::array("free0_map", "smethod0_map", "method0_map"));
foreach(LLSD nm, inArray(names))
{
LLSD metadata(getMetadata(nm));
@ -877,13 +877,13 @@ namespace tut
// there should (!) be no difference beween array defaults and map
// defaults. Verify, so we can ignore the distinction for all other
// tests.
LLSD equivalences(LLSDArray
(LLSDArray("freena_map_adft")("freena_map_mdft"))
(LLSDArray("freenb_map_adft")("freenb_map_mdft"))
(LLSDArray("smethodna_map_adft")("smethodna_map_mdft"))
(LLSDArray("smethodnb_map_adft")("smethodnb_map_mdft"))
(LLSDArray("methodna_map_adft")("methodna_map_mdft"))
(LLSDArray("methodnb_map_adft")("methodnb_map_mdft")));
LLSD equivalences(llsd::array
(llsd::array("freena_map_adft", "freena_map_mdft"),
llsd::array("freenb_map_adft", "freenb_map_mdft"),
llsd::array("smethodna_map_adft", "smethodna_map_mdft"),
llsd::array("smethodnb_map_adft", "smethodnb_map_mdft"),
llsd::array("methodna_map_adft", "methodna_map_mdft"),
llsd::array("methodnb_map_adft", "methodnb_map_mdft")));
foreach(LLSD eq, inArray(equivalences))
{
LLSD adft(eq[0]);
@ -953,42 +953,42 @@ namespace tut
debug("skipreq:\n",
skipreq);
LLSD groups(LLSDArray // array of groups
LLSD groups(llsd::array // array of groups
(LLSDArray // group
(LLSDArray("freena_map_allreq")("smethodna_map_allreq")("methodna_map_allreq"))
(LLSDArray(allreq["a"])(LLSD()))) // required, optional
(llsd::array // group
(llsd::array("freena_map_allreq", "smethodna_map_allreq", "methodna_map_allreq"),
llsd::array(allreq["a"], LLSD())), // required, optional
(LLSDArray // group
(LLSDArray("freenb_map_allreq")("smethodnb_map_allreq")("methodnb_map_allreq"))
(LLSDArray(allreq["b"])(LLSD()))) // required, optional
llsd::array // group
(llsd::array("freenb_map_allreq", "smethodnb_map_allreq", "methodnb_map_allreq"),
llsd::array(allreq["b"], LLSD())), // required, optional
(LLSDArray // group
(LLSDArray("freena_map_leftreq")("smethodna_map_leftreq")("methodna_map_leftreq"))
(LLSDArray(leftreq["a"])(rightdft["a"]))) // required, optional
llsd::array // group
(llsd::array("freena_map_leftreq", "smethodna_map_leftreq", "methodna_map_leftreq"),
llsd::array(leftreq["a"], rightdft["a"])), // required, optional
(LLSDArray // group
(LLSDArray("freenb_map_leftreq")("smethodnb_map_leftreq")("methodnb_map_leftreq"))
(LLSDArray(leftreq["b"])(rightdft["b"]))) // required, optional
llsd::array // group
(llsd::array("freenb_map_leftreq", "smethodnb_map_leftreq", "methodnb_map_leftreq"),
llsd::array(leftreq["b"], rightdft["b"])), // required, optional
(LLSDArray // group
(LLSDArray("freena_map_skipreq")("smethodna_map_skipreq")("methodna_map_skipreq"))
(LLSDArray(skipreq["a"])(dft_map_partial["a"]))) // required, optional
llsd::array // group
(llsd::array("freena_map_skipreq", "smethodna_map_skipreq", "methodna_map_skipreq"),
llsd::array(skipreq["a"], dft_map_partial["a"])), // required, optional
(LLSDArray // group
(LLSDArray("freenb_map_skipreq")("smethodnb_map_skipreq")("methodnb_map_skipreq"))
(LLSDArray(skipreq["b"])(dft_map_partial["b"]))) // required, optional
llsd::array // group
(llsd::array("freenb_map_skipreq", "smethodnb_map_skipreq", "methodnb_map_skipreq"),
llsd::array(skipreq["b"], dft_map_partial["b"])), // required, optional
// We only need mention the full-map-defaults ("_mdft" suffix)
// registrations, having established their equivalence with the
// full-array-defaults ("_adft" suffix) registrations in another test.
(LLSDArray // group
(LLSDArray("freena_map_mdft")("smethodna_map_mdft")("methodna_map_mdft"))
(LLSDArray(LLSD::emptyMap())(dft_map_full["a"]))) // required, optional
// We only need mention the full-map-defaults ("_mdft" suffix)
// registrations, having established their equivalence with the
// full-array-defaults ("_adft" suffix) registrations in another test.
llsd::array // group
(llsd::array("freena_map_mdft", "smethodna_map_mdft", "methodna_map_mdft"),
llsd::array(LLSD::emptyMap(), dft_map_full["a"])), // required, optional
(LLSDArray // group
(LLSDArray("freenb_map_mdft")("smethodnb_map_mdft")("methodnb_map_mdft"))
(LLSDArray(LLSD::emptyMap())(dft_map_full["b"])))); // required, optional
llsd::array // group
(llsd::array("freenb_map_mdft", "smethodnb_map_mdft", "methodnb_map_mdft"),
llsd::array(LLSD::emptyMap(), dft_map_full["b"])))); // required, optional
foreach(LLSD grp, inArray(groups))
{
@ -1077,7 +1077,7 @@ namespace tut
// with 'required'.
LLSD answer(42);
// LLSD value matching 'required' according to llsd_matches() rules.
LLSD matching(LLSDMap("d", 3.14)("array", LLSDArray("answer")(true)(answer)));
LLSD matching(LLSDMap("d", 3.14)("array", llsd::array("answer", true, answer)));
// Okay, walk through 'tests'.
foreach(const CallablesTriple& tr, tests)
{
@ -1114,17 +1114,17 @@ namespace tut
call_exc("free0_map", 17, map_exc);
// Passing an array to a map-style function works now! No longer an
// error case!
// call_exc("free0_map", LLSDArray("a")("b"), map_exc);
// call_exc("free0_map", llsd::array("a", "b"), map_exc);
}
template<> template<>
void object::test<18>()
{
set_test_name("call no-args functions");
LLSD names(LLSDArray
("free0_array")("free0_map")
("smethod0_array")("smethod0_map")
("method0_array")("method0_map"));
LLSD names(llsd::array
("free0_array", "free0_map",
"smethod0_array", "smethod0_map",
"method0_array", "method0_map"));
foreach(LLSD name, inArray(names))
{
// Look up the Vars instance for this function.
@ -1142,10 +1142,10 @@ namespace tut
}
// Break out this data because we use it in a couple different tests.
LLSD array_funcs(LLSDArray
(LLSDMap("a", "freena_array") ("b", "freenb_array"))
(LLSDMap("a", "smethodna_array")("b", "smethodnb_array"))
(LLSDMap("a", "methodna_array") ("b", "methodnb_array")));
LLSD array_funcs(llsd::array
(LLSDMap("a", "freena_array") ("b", "freenb_array"),
LLSDMap("a", "smethodna_array")("b", "smethodnb_array"),
LLSDMap("a", "methodna_array") ("b", "methodnb_array")));
template<> template<>
void object::test<19>()
@ -1153,7 +1153,7 @@ namespace tut
set_test_name("call array-style functions with too-short arrays");
// Could have two different too-short arrays, one for *na and one for
// *nb, but since they both take 5 params...
LLSD tooshort(LLSDArray("this")("array")("too")("short"));
LLSD tooshort(llsd::array("this", "array", "too", "short"));
foreach(const LLSD& funcsab, inArray(array_funcs))
{
foreach(const llsd::MapEntry& e, inMap(funcsab))
@ -1172,12 +1172,12 @@ namespace tut
{
binary.push_back((U8)h);
}
LLSD args(LLSDMap("a", LLSDArray(true)(17)(3.14)(123.456)("char*"))
("b", LLSDArray("string")
(LLUUID("01234567-89ab-cdef-0123-456789abcdef"))
(LLDate("2011-02-03T15:07:00Z"))
(LLURI("http://secondlife.com"))
(binary)));
LLSD args(LLSDMap("a", llsd::array(true, 17, 3.14, 123.456, "char*"))
("b", llsd::array("string",
LLUUID("01234567-89ab-cdef-0123-456789abcdef"),
LLDate("2011-02-03T15:07:00Z"),
LLURI("http://secondlife.com"),
binary)));
LLSD argsplus(args);
argsplus["a"].append("bogus");
argsplus["b"].append("bogus");
@ -1191,7 +1191,7 @@ namespace tut
debug("expect: ", expect);
// Use substantially the same logic for args and argsplus
LLSD argsarrays(LLSDArray(args)(argsplus));
LLSD argsarrays(llsd::array(args, argsplus));
// So i==0 selects 'args', i==1 selects argsplus
for (LLSD::Integer i(0), iend(argsarrays.size()); i < iend; ++i)
{
@ -1236,8 +1236,8 @@ namespace tut
set_test_name("call map-style functions with (full | oversized) (arrays | maps)");
const char binary[] = "\x99\x88\x77\x66\x55";
LLSD array_full(LLSDMap
("a", LLSDArray(false)(255)(98.6)(1024.5)("pointer"))
("b", LLSDArray("object")(LLUUID::generateNewID())(LLDate::now())(LLURI("http://wiki.lindenlab.com/wiki"))(LLSD::Binary(boost::begin(binary), boost::end(binary)))));
("a", llsd::array(false, 255, 98.6, 1024.5, "pointer"))
("b", llsd::array("object", LLUUID::generateNewID(), LLDate::now(), LLURI("http://wiki.lindenlab.com/wiki"), LLSD::Binary(boost::begin(binary), boost::end(binary)))));
LLSD array_overfull(array_full);
foreach(LLSD::String a, ab)
{
@ -1280,20 +1280,20 @@ namespace tut
// parameter defaults should make NO DIFFERENCE WHATSOEVER. Every call
// should pass all params.
LLSD names(LLSDMap
("a", LLSDArray
("freena_map_allreq") ("smethodna_map_allreq") ("methodna_map_allreq")
("freena_map_leftreq")("smethodna_map_leftreq")("methodna_map_leftreq")
("freena_map_skipreq")("smethodna_map_skipreq")("methodna_map_skipreq")
("freena_map_adft") ("smethodna_map_adft") ("methodna_map_adft")
("freena_map_mdft") ("smethodna_map_mdft") ("methodna_map_mdft"))
("b", LLSDArray
("freenb_map_allreq") ("smethodnb_map_allreq") ("methodnb_map_allreq")
("freenb_map_leftreq")("smethodnb_map_leftreq")("methodnb_map_leftreq")
("freenb_map_skipreq")("smethodnb_map_skipreq")("methodnb_map_skipreq")
("freenb_map_adft") ("smethodnb_map_adft") ("methodnb_map_adft")
("freenb_map_mdft") ("smethodnb_map_mdft") ("methodnb_map_mdft")));
("a", llsd::array
("freena_map_allreq", "smethodna_map_allreq", "methodna_map_allreq",
"freena_map_leftreq", "smethodna_map_leftreq", "methodna_map_leftreq",
"freena_map_skipreq", "smethodna_map_skipreq", "methodna_map_skipreq",
"freena_map_adft", "smethodna_map_adft", "methodna_map_adft",
"freena_map_mdft", "smethodna_map_mdft", "methodna_map_mdft"))
("b", llsd::array
("freenb_map_allreq", "smethodnb_map_allreq", "methodnb_map_allreq",
"freenb_map_leftreq", "smethodnb_map_leftreq", "methodnb_map_leftreq",
"freenb_map_skipreq", "smethodnb_map_skipreq", "methodnb_map_skipreq",
"freenb_map_adft", "smethodnb_map_adft", "methodnb_map_adft",
"freenb_map_mdft", "smethodnb_map_mdft", "methodnb_map_mdft")));
// Treat (full | overfull) (array | map) the same.
LLSD argssets(LLSDArray(array_full)(array_overfull)(map_full)(map_overfull));
LLSD argssets(llsd::array(array_full, array_overfull, map_full, map_overfull));
foreach(const LLSD& args, inArray(argssets))
{
foreach(LLSD::String a, ab)

View File

@ -1817,10 +1817,10 @@ namespace tut
{
set_test_name("verify sequence to Python");
LLSD cdata(LLSDArray(17)(3.14)
("This string\n"
"has several\n"
"lines."));
LLSD cdata(llsd::array(17, 3.14,
"This string\n"
"has several\n"
"lines."));
const char pydata[] =
"def verify(iterable):\n"

View File

@ -440,8 +440,8 @@ LLSD LLSettingsDay::defaults()
}
LLSD tracks;
tracks.append(LLSDArray(waterTrack));
tracks.append(LLSDArray(skyTrack));
tracks.append(llsd::array(waterTrack));
tracks.append(llsd::array(skyTrack));
dfltsetting[SETTING_TRACKS] = tracks;
dfltsetting[SETTING_FRAMES] = frames;

View File

@ -286,6 +286,19 @@ F32 LLSettingsWater::getModifiedWaterFogDensity(bool underwater) const
if (underwater && underwater_fog_mod > 0.0f)
{
underwater_fog_mod = llclamp(underwater_fog_mod, 0.0f, 10.0f);
// BUG-233797/BUG-233798 -ve underwater fog density can cause (unrecoverable) blackout.
// raising a negative number to a non-integral power results in a non-real result (which is NaN for our purposes)
// Two methods were tested, number 2 is being used:
// 1) Force the fog_mod to be integral. The effect is unlikely to be nice, but it is better than blackness.
// In this method a few of the combinations are "usable" but the water colour is effectively inverted (blue becomes yellow)
// this seems to be unlikely to be a desirable use case for the majority.
// 2) Force density to be an arbitrary non-negative (i.e. 1) when underwater and modifier is not an integer (1 was aribtrarily chosen as it gives at least some notion of fog in the transition)
// This is more restrictive, effectively forcing a density under certain conditions, but allowing the range of #1 and avoiding blackness in other cases
// at the cost of overriding the fog density.
if(fog_density < 0.0f && underwater_fog_mod != (F32)llround(underwater_fog_mod) )
{
fog_density = 1.0f;
}
fog_density = pow(fog_density, underwater_fog_mod);
}
return fog_density;

View File

@ -253,7 +253,9 @@ void LLAvatarNameCache::handleAvNameCacheSuccess(const LLSD &data, const LLSD &h
{
const LLUUID& agent_id = *it;
LL_WARNS("AvNameCache") << "LLAvatarNameResponder::result "
// If cap fails, response can contain a lot of names,
// don't spam too much
LL_DEBUGS("AvNameCache") << "LLAvatarNameResponder::result "
<< "failed id " << agent_id
<< LL_ENDL;
@ -272,7 +274,7 @@ void LLAvatarNameCache::handleAgentError(const LLUUID& agent_id)
if (existing == mCache.end())
{
// there is no existing cache entry, so make a temporary name from legacy
LL_WARNS("AvNameCache") << "LLAvatarNameCache get legacy for agent "
LL_DEBUGS("AvNameCache") << "LLAvatarNameCache get legacy for agent "
<< agent_id << LL_ENDL;
gCacheName->get(agent_id, false, // legacy compatibility
boost::bind(&LLAvatarNameCache::legacyNameFetch, _1, _2, _3));

View File

@ -47,7 +47,10 @@ static const std::map<std::string, U32> DefaultPoolSizes{
};
static const U32 DEFAULT_POOL_SIZE = 5;
const U32 LLCoprocedureManager::DEFAULT_QUEUE_SIZE = 4096;
// SL-14399: When we teleport to a brand-new simulator, the coprocedure queue
// gets absolutely slammed with fetch requests. Make this queue effectively
// unlimited.
const U32 LLCoprocedureManager::DEFAULT_QUEUE_SIZE = 1024*1024;
//=========================================================================
class LLCoprocedurePool: private boost::noncopyable

View File

@ -31,7 +31,7 @@
#include "llconvexdecomposition.h"
#include "llsdserialize.h"
#include "llvector4a.h"
#include "llmd5.h"
#include "hbxxh.h"
#ifdef LL_USESYSTEMLIBS
# include <zlib.h>
@ -832,55 +832,69 @@ LLSD LLModel::writeModel(
if (skinning)
{
//write out skin weights
if (!model[idx]->mSkinWeights.empty())
{
//write out skin weights
//each influence list entry is up to 4 24-bit values
// first 8 bits is bone index
// last 16 bits is bone influence weight
// a bone index of 0xFF signifies no more influences for this vertex
//each influence list entry is up to 4 24-bit values
// first 8 bits is bone index
// last 16 bits is bone influence weight
// a bone index of 0xFF signifies no more influences for this vertex
std::stringstream ostr;
std::stringstream ostr;
for (U32 j = 0; j < face.mNumVertices; ++j)
{
LLVector3 pos(face.mPositions[j].getF32ptr());
for (U32 j = 0; j < face.mNumVertices; ++j)
{
LLVector3 pos(face.mPositions[j].getF32ptr());
weight_list& weights = model[idx]->getJointInfluences(pos);
weight_list& weights = model[idx]->getJointInfluences(pos);
S32 count = 0;
for (weight_list::iterator iter = weights.begin(); iter != weights.end(); ++iter)
{
// Note joint index cannot exceed 255.
if (iter->mJointIdx < 255 && iter->mJointIdx >= 0)
{
U8 idx = (U8)iter->mJointIdx;
ostr.write((const char*)&idx, 1);
S32 count = 0;
for (weight_list::iterator iter = weights.begin(); iter != weights.end(); ++iter)
{
// Note joint index cannot exceed 255.
if (iter->mJointIdx < 255 && iter->mJointIdx >= 0)
{
U8 idx = (U8) iter->mJointIdx;
ostr.write((const char*) &idx, 1);
U16 influence = (U16)(iter->mWeight * 65535);
ostr.write((const char*)&influence, 2);
U16 influence = (U16) (iter->mWeight*65535);
ostr.write((const char*) &influence, 2);
++count;
}
}
U8 end_list = 0xFF;
if (count < 4)
{
ostr.write((const char*)&end_list, 1);
}
}
++count;
}
}
U8 end_list = 0xFF;
if (count < 4)
{
ostr.write((const char*) &end_list, 1);
}
}
//copy ostr to binary buffer
std::string data = ostr.str();
const U8* buff = (U8*)data.data();
U32 bytes = data.size();
//copy ostr to binary buffer
std::string data = ostr.str();
const U8* buff = (U8*) data.data();
U32 bytes = data.size();
LLSD::Binary w(bytes);
for (U32 j = 0; j < bytes; ++j)
{
w[j] = buff[j];
}
LLSD::Binary w(bytes);
for (U32 j = 0; j < bytes; ++j)
{
w[j] = buff[j];
}
mdl[model_names[idx]][i]["Weights"] = w;
mdl[model_names[idx]][i]["Weights"] = w;
}
else
{
if (idx == LLModel::LOD_PHYSICS)
{
// Ex: using "bounding box"
LL_DEBUGS("MESHSKININFO") << "Using physics model without skin weights" << LL_ENDL;
}
else
{
LL_WARNS("MESHSKININFO") << "Attempting to use skinning without having skin weights" << LL_ENDL;
}
}
}
}
}
@ -982,6 +996,8 @@ LLModel::weight_list& LLModel::getJointInfluences(const LLVector3& pos)
//1. If a vertex has been weighted then we'll find it via pos and return its weight list
weight_map::iterator iterPos = mSkinWeights.begin();
weight_map::iterator iterEnd = mSkinWeights.end();
llassert(!mSkinWeights.empty());
for ( ; iterPos!=iterEnd; ++iterPos )
{
@ -1531,7 +1547,7 @@ LLSD LLMeshSkinInfo::asLLSD(bool include_joints, bool lock_scale_if_joint_positi
void LLMeshSkinInfo::updateHash()
{
// get hash of data relevant to render batches
LLMD5 hash;
HBXXH64 hash;
//mJointNames
for (auto& name : mJointNames)
@ -1540,24 +1556,19 @@ void LLMeshSkinInfo::updateHash()
}
//mJointNums
hash.update((U8*)&(mJointNums[0]), sizeof(S32) * mJointNums.size());
hash.update((const void*)mJointNums.data(), sizeof(S32) * mJointNums.size());
//mInvBindMatrix
F32* src = mInvBindMatrix[0].getF32ptr();
for (int i = 0; i < mInvBindMatrix.size() * 16; ++i)
for (size_t i = 0, count = mInvBindMatrix.size() * 16; i < count; ++i)
{
S32 t = llround(src[i] * 10000.f);
hash.update((U8*)&t, sizeof(S32));
hash.update((const void*)&t, sizeof(S32));
}
//hash.update((U8*)&(mInvBindMatrix[0]), sizeof(LLMatrix4a) * mInvBindMatrix.size());
//hash.update((const void*)mInvBindMatrix.data(), sizeof(LLMatrix4a) * mInvBindMatrix.size());
hash.finalize();
U64 digest[2];
hash.raw_digest((U8*) digest);
mHash = digest[0];
mHash = hash.digest();
}
U32 LLMeshSkinInfo::sizeBytes() const

View File

@ -25,6 +25,8 @@
*/
#include "llmodelloader.h"
#include "llapp.h"
#include "llsdserialize.h"
#include "lljoint.h"
#include "llcallbacklist.h"
@ -363,7 +365,10 @@ bool LLModelLoader::isAlive(LLModelLoader* loader)
void LLModelLoader::loadModelCallback()
{
mLoadCallback(mScene,mModelList,mLod, mOpaqueData);
if (!LLApp::isExiting())
{
mLoadCallback(mScene, mModelList, mLod, mOpaqueData);
}
while (!isStopped())
{ //wait until this thread is stopped before deleting self

View File

@ -1672,7 +1672,8 @@ void LLFolderView::update()
// Clear the modified setting on the filter only if the filter finished after running the filter process
// Note: if the filter count has timed out, that means the filter halted before completing the entire set of items
if (filter_object.isModified() && (!filter_object.isTimedOut()))
bool filter_modified = filter_object.isModified();
if (filter_modified && (!filter_object.isTimedOut()))
{
filter_object.clearModified();
}
@ -1706,7 +1707,7 @@ void LLFolderView::update()
BOOL filter_finished = mViewModel->contentsReady()
&& (getViewModelItem()->passedFilter()
|| ( getViewModelItem()->getLastFilterGeneration() >= filter_object.getFirstSuccessGeneration()
&& !filter_object.isModified()));
&& !filter_modified));
if (filter_finished
|| gFocusMgr.childHasKeyboardFocus(mParentPanel.get())
|| gFocusMgr.childHasMouseCapture(mParentPanel.get()))
@ -1794,13 +1795,26 @@ void LLFolderView::update()
if (mSelectedItems.size() && mNeedsScroll)
{
scrollToShowItem(mSelectedItems.back(), constraint_rect);
LLFolderViewItem* scroll_to_item = mSelectedItems.back();
scrollToShowItem(scroll_to_item, constraint_rect);
// continue scrolling until animated layout change is done
if (filter_finished
&& (!needsArrange() || !is_visible))
{
mNeedsScroll = FALSE;
}
bool selected_filter_finished = getRoot()->getViewModelItem()->getLastFilterGeneration() >= filter_object.getFirstSuccessGeneration();
if (selected_filter_finished && scroll_to_item && scroll_to_item->getViewModelItem())
{
selected_filter_finished = scroll_to_item->getViewModelItem()->getLastFilterGeneration() >= filter_object.getFirstSuccessGeneration();
}
if (filter_finished && selected_filter_finished)
{
bool needs_arrange = needsArrange() || getRoot()->needsArrange();
if (mParentFolder)
{
needs_arrange |= (bool)mParentFolder->needsArrange();
}
if (!needs_arrange || !is_visible)
{
mNeedsScroll = FALSE;
}
}
}
if (mSignalSelectCallback)

View File

@ -335,7 +335,6 @@ protected:
F32 mAutoOpenCountdown;
S32 mLastArrangeGeneration;
S32 mLastCalculatedWidth;
bool mNeedsSort;
bool mIsFolderComplete; // indicates that some children were not loaded/added yet
bool mAreChildrenInited; // indicates that no children were initialized

View File

@ -247,31 +247,9 @@ void LLKeyboardWin32::scanKeyboard()
{
S32 key;
MSG msg;
BOOL pending_key_events = PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_NOREMOVE | PM_NOYIELD);
PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_NOREMOVE | PM_NOYIELD);
for (key = 0; key < KEY_COUNT; key++)
{
// On Windows, verify key down state. JC
// RN: only do this if we don't have further key events in the queue
// as otherwise there might be key repeat events still waiting for this key we are now dumping
if (!pending_key_events && mKeyLevel[key])
{
// *TODO: I KNOW there must be a better way of
// interrogating the key state than this, using async key
// state can cause ALL kinds of bugs - Doug
if ((key < KEY_BUTTON0) && ((key < '0') || (key > '9')))
{
// ...under windows make sure the key actually still is down.
// ...translate back to windows key
U16 virtual_key = inverseTranslateExtendedKey(key);
// keydown in highest bit
if (!pending_key_events && !(GetAsyncKeyState(virtual_key) & 0x8000))
{
//LL_INFOS() << "Key up event missed, resetting" << LL_ENDL;
mKeyLevel[key] = FALSE;
}
}
}
// Generate callback if any event has occurred on this key this frame.
// Can't just test mKeyLevel, because this could be a slow frame and
// key might have gone down then up. JC

View File

@ -1 +1 @@
6.6.12
6.6.13

View File

@ -8341,6 +8341,17 @@
<key>Value</key>
<integer>1</integer>
</map>
<key>NvAPICreateApplicationProfile</key>
<map>
<key>Comment</key>
<string>Create NVIDIA application profile for optimized settings</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>PurgeCacheOnNextStartup</key>
<map>
<key>Comment</key>
@ -16953,17 +16964,6 @@
<key>Value</key>
<integer>0</integer>
</map>
<key>ResetUIScaleOnFirstRun</key>
<map>
<key>Comment</key>
<string>Resets the UI scale factor on first run due to changed display scaling behavior</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>360CaptureUseInterestListCap</key>
<map>
<key>Comment</key>

View File

@ -64,11 +64,11 @@ GroupChatListener::GroupChatListener():
"Leave a group chat in group with UUID [\"id\"]\n"
"Assumes a prior successful startIM request.",
&LLGroupActions::endIM,
LLSDArray("id"));
add("sendIM",
"send a groupchat IM",
&send_message_wrapper,
LLSDArray("text")("session_id")("group_id"));
llsd::array("id"));
add("sendIM",
"send a groupchat IM",
&send_message_wrapper,
llsd::array("text", "session_id", "group_id"));
}
/*
static void sendMessage(const std::string& utf8_text, const LLUUID& im_session_id,

View File

@ -148,7 +148,7 @@ void LLAgentListener::requestTeleport(LLSD const & event_data) const
params.append(event_data["x"]);
params.append(event_data["y"]);
params.append(event_data["z"]);
LLCommandDispatcher::dispatch("teleport", params, LLSD(), NULL, "clicked", true);
LLCommandDispatcher::dispatch("teleport", params, LLSD(), NULL, LLCommandHandler::NAV_TYPE_CLICKED, true);
// *TODO - lookup other LLCommandHandlers for "agent", "classified", "event", "group", "floater", "parcel", "login", login_refresh", "balance", "chat"
// should we just compose LLCommandHandler and LLDispatchListener?
}
@ -158,7 +158,7 @@ void LLAgentListener::requestTeleport(LLSD const & event_data) const
LLVector3(event_data["x"].asReal(),
event_data["y"].asReal(),
event_data["z"].asReal())).getSLURLString();
LLURLDispatcher::dispatch(url, "clicked", NULL, false);
LLURLDispatcher::dispatch(url, LLCommandHandler::NAV_TYPE_CLICKED, NULL, false);
}
}

View File

@ -2173,6 +2173,7 @@ bool LLAppViewer::cleanup()
LLSelectMgr::deleteSingleton();
LLViewerEventRecorder::deleteSingleton();
LLWorld::deleteSingleton();
LLVoiceClient::deleteSingleton();
// It's not at first obvious where, in this long sequence, a generic cleanup
// call OUGHT to go. So let's say this: as we migrate cleanup from

View File

@ -259,21 +259,75 @@ void ll_nvapi_init(NvDRSSessionHandle hSession)
std::string app_name = LLTrans::getString("APP_NAME");
llutf16string w_app_name = utf8str_to_utf16str(app_name);
wsprintf(profile_name, L"%s", w_app_name.c_str());
status = NvAPI_DRS_SetCurrentGlobalProfile(hSession, profile_name);
if (status != NVAPI_OK)
NvDRSProfileHandle hProfile = 0;
// (3) Check if we already have an application profile for the viewer
status = NvAPI_DRS_FindProfileByName(hSession, profile_name, &hProfile);
if (status != NVAPI_OK && status != NVAPI_PROFILE_NOT_FOUND)
{
nvapi_error(status);
return;
}
else if (status == NVAPI_PROFILE_NOT_FOUND)
{
// Don't have an application profile yet - create one
LL_INFOS() << "Creating NVIDIA application profile" << LL_ENDL;
// (3) Obtain the current profile.
NvDRSProfileHandle hProfile = 0;
status = NvAPI_DRS_GetCurrentGlobalProfile(hSession, &hProfile);
if (status != NVAPI_OK)
NVDRS_PROFILE profileInfo;
profileInfo.version = NVDRS_PROFILE_VER;
profileInfo.isPredefined = 0;
wsprintf(profileInfo.profileName, L"%s", w_app_name.c_str());
status = NvAPI_DRS_CreateProfile(hSession, &profileInfo, &hProfile);
if (status != NVAPI_OK)
{
nvapi_error(status);
return;
}
}
// (4) Check if current exe is part of the profile
std::string exe_name = gDirUtilp->getExecutableFilename();
NVDRS_APPLICATION profile_application;
profile_application.version = NVDRS_APPLICATION_VER;
llutf16string w_exe_name = utf8str_to_utf16str(exe_name);
NvAPI_UnicodeString profile_app_name;
wsprintf(profile_app_name, L"%s", w_exe_name.c_str());
status = NvAPI_DRS_GetApplicationInfo(hSession, hProfile, profile_app_name, &profile_application);
if (status != NVAPI_OK && status != NVAPI_EXECUTABLE_NOT_FOUND)
{
nvapi_error(status);
return;
}
else if (status == NVAPI_EXECUTABLE_NOT_FOUND)
{
LL_INFOS() << "Creating application for " << exe_name << " for NVIDIA application profile" << LL_ENDL;
// Add this exe to the profile
NVDRS_APPLICATION application;
application.version = NVDRS_APPLICATION_VER;
application.isPredefined = 0;
wsprintf(application.appName, L"%s", w_exe_name.c_str());
wsprintf(application.userFriendlyName, L"%s", w_exe_name.c_str());
wsprintf(application.launcher, L"%s", w_exe_name.c_str());
wsprintf(application.fileInFolder, L"%s", "");
status = NvAPI_DRS_CreateApplication(hSession, hProfile, &application);
if (status != NVAPI_OK)
{
nvapi_error(status);
return;
}
// Save application in case we added one
status = NvAPI_DRS_SaveSettings(hSession);
if (status != NVAPI_OK)
{
nvapi_error(status);
return;
}
}
// load settings for querying
status = NvAPI_DRS_LoadSettings(hSession);
@ -289,7 +343,7 @@ void ll_nvapi_init(NvDRSSessionHandle hSession)
status = NvAPI_DRS_GetSetting(hSession, hProfile, PREFERRED_PSTATE_ID, &drsSetting);
if (status == NVAPI_SETTING_NOT_FOUND)
{ //only override if the user hasn't specifically set this setting
// (4) Specify that we want the VSYNC disabled setting
// (5) Specify that we want to enable maximum performance setting
// first we fill the NVDRS_SETTING struct, then we call the function
drsSetting.version = NVDRS_SETTING_VER;
drsSetting.settingId = PREFERRED_PSTATE_ID;
@ -302,7 +356,7 @@ void ll_nvapi_init(NvDRSSessionHandle hSession)
return;
}
// (5) Now we apply (or save) our changes to the system
// (6) Now we apply (or save) our changes to the system
status = NvAPI_DRS_SaveSettings(hSession);
if (status != NVAPI_OK)
{
@ -386,27 +440,31 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
LL_WARNS() << "Application init failed." << LL_ENDL;
return -1;
}
NvAPI_Status status;
// Initialize NVAPI
status = NvAPI_Initialize();
NvDRSSessionHandle hSession = 0;
if (status == NVAPI_OK)
{
// Create the session handle to access driver settings
status = NvAPI_DRS_CreateSession(&hSession);
if (status != NVAPI_OK)
{
nvapi_error(status);
}
else
{
//override driver setting as needed
ll_nvapi_init(hSession);
}
}
NvDRSSessionHandle hSession = 0;
static LLCachedControl<bool> use_nv_api(gSavedSettings, "NvAPICreateApplicationProfile", true);
if (use_nv_api)
{
NvAPI_Status status;
// Initialize NVAPI
status = NvAPI_Initialize();
if (status == NVAPI_OK)
{
// Create the session handle to access driver settings
status = NvAPI_DRS_CreateSession(&hSession);
if (status != NVAPI_OK)
{
nvapi_error(status);
}
else
{
//override driver setting as needed
ll_nvapi_init(hSession);
}
}
}
// Have to wait until after logging is initialized to display LFH info
if (num_heaps > 0)
@ -620,76 +678,81 @@ bool LLAppViewerWin32::init()
LLFile::remove(log_file, ENOENT);
}
std::string build_data_fname(
gDirUtilp->getExpandedFilename(LL_PATH_EXECUTABLE, "build_data.json"));
// Use llifstream instead of std::ifstream because LL_PATH_EXECUTABLE
// could contain non-ASCII characters, which std::ifstream doesn't handle.
llifstream inf(build_data_fname.c_str());
if (! inf.is_open())
{
LL_WARNS("BUGSPLAT") << "Can't initialize BugSplat, can't read '" << build_data_fname
<< "'" << LL_ENDL;
}
else
{
Json::Reader reader;
Json::Value build_data;
if (! reader.parse(inf, build_data, false)) // don't collect comments
{
// gah, the typo is baked into Json::Reader API
LL_WARNS("BUGSPLAT") << "Can't initialize BugSplat, can't parse '" << build_data_fname
<< "': " << reader.getFormatedErrorMessages() << LL_ENDL;
}
else
{
Json::Value BugSplat_DB = build_data["BugSplat DB"];
if (! BugSplat_DB)
{
LL_WARNS("BUGSPLAT") << "Can't initialize BugSplat, no 'BugSplat DB' entry in '"
<< build_data_fname << "'" << LL_ENDL;
}
else
{
// Got BugSplat_DB, onward!
std::wstring version_string(WSTRINGIZE(LL_VIEWER_VERSION_MAJOR << '.' <<
LL_VIEWER_VERSION_MINOR << '.' <<
LL_VIEWER_VERSION_PATCH << '.' <<
LL_VIEWER_VERSION_BUILD));
// Win7 is no longer supported
bool is_win_7_or_below = LLOSInfo::getInstance()->mMajorVer <= 6 && LLOSInfo::getInstance()->mMajorVer <= 1;
DWORD dwFlags = MDSF_NONINTERACTIVE | // automatically submit report without prompting
MDSF_PREVENTHIJACKING; // disallow swiping Exception filter
bool needs_log_file = !isSecondInstance() && debugLoggingEnabled("BUGSPLAT");
if (needs_log_file)
if (!is_win_7_or_below)
{
std::string build_data_fname(
gDirUtilp->getExpandedFilename(LL_PATH_EXECUTABLE, "build_data.json"));
// Use llifstream instead of std::ifstream because LL_PATH_EXECUTABLE
// could contain non-ASCII characters, which std::ifstream doesn't handle.
llifstream inf(build_data_fname.c_str());
if (!inf.is_open())
{
LL_WARNS("BUGSPLAT") << "Can't initialize BugSplat, can't read '" << build_data_fname
<< "'" << LL_ENDL;
}
else
{
Json::Reader reader;
Json::Value build_data;
if (!reader.parse(inf, build_data, false)) // don't collect comments
{
// gah, the typo is baked into Json::Reader API
LL_WARNS("BUGSPLAT") << "Can't initialize BugSplat, can't parse '" << build_data_fname
<< "': " << reader.getFormatedErrorMessages() << LL_ENDL;
}
else
{
Json::Value BugSplat_DB = build_data["BugSplat DB"];
if (!BugSplat_DB)
{
// Startup only!
LL_INFOS("BUGSPLAT") << "Engaged BugSplat logging to bugsplat.log" << LL_ENDL;
dwFlags |= MDSF_LOGFILE | MDSF_LOG_VERBOSE;
LL_WARNS("BUGSPLAT") << "Can't initialize BugSplat, no 'BugSplat DB' entry in '"
<< build_data_fname << "'" << LL_ENDL;
}
// have to convert normal wide strings to strings of __wchar_t
sBugSplatSender = new MiniDmpSender(
WCSTR(BugSplat_DB.asString()),
WCSTR(LL_TO_WSTRING(LL_VIEWER_CHANNEL)),
WCSTR(version_string),
nullptr, // szAppIdentifier -- set later
dwFlags);
sBugSplatSender->setCallback(bugsplatSendLog);
if (needs_log_file)
else
{
// Log file will be created in %TEMP%, but it will be moved into logs folder in case of crash
std::string log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "bugsplat.log");
sBugSplatSender->setLogFilePath(WCSTR(log_file));
}
// Got BugSplat_DB, onward!
std::wstring version_string(WSTRINGIZE(LL_VIEWER_VERSION_MAJOR << '.' <<
LL_VIEWER_VERSION_MINOR << '.' <<
LL_VIEWER_VERSION_PATCH << '.' <<
LL_VIEWER_VERSION_BUILD));
// engage stringize() overload that converts from wstring
LL_INFOS("BUGSPLAT") << "Engaged BugSplat(" << LL_TO_STRING(LL_VIEWER_CHANNEL)
<< ' ' << stringize(version_string) << ')' << LL_ENDL;
} // got BugSplat_DB
} // parsed build_data.json
} // opened build_data.json
DWORD dwFlags = MDSF_NONINTERACTIVE | // automatically submit report without prompting
MDSF_PREVENTHIJACKING; // disallow swiping Exception filter
bool needs_log_file = !isSecondInstance() && debugLoggingEnabled("BUGSPLAT");
if (needs_log_file)
{
// Startup only!
LL_INFOS("BUGSPLAT") << "Engaged BugSplat logging to bugsplat.log" << LL_ENDL;
dwFlags |= MDSF_LOGFILE | MDSF_LOG_VERBOSE;
}
// have to convert normal wide strings to strings of __wchar_t
sBugSplatSender = new MiniDmpSender(
WCSTR(BugSplat_DB.asString()),
WCSTR(LL_TO_WSTRING(LL_VIEWER_CHANNEL)),
WCSTR(version_string),
nullptr, // szAppIdentifier -- set later
dwFlags);
sBugSplatSender->setCallback(bugsplatSendLog);
if (needs_log_file)
{
// Log file will be created in %TEMP%, but it will be moved into logs folder in case of crash
std::string log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "bugsplat.log");
sBugSplatSender->setLogFilePath(WCSTR(log_file));
}
// engage stringize() overload that converts from wstring
LL_INFOS("BUGSPLAT") << "Engaged BugSplat(" << LL_TO_STRING(LL_VIEWER_CHANNEL)
<< ' ' << stringize(version_string) << ')' << LL_ENDL;
} // got BugSplat_DB
} // parsed build_data.json
} // opened build_data.json
} // !is_win_7_or_below
#endif // LL_BUGSPLAT
#endif // LL_SEND_CRASH_REPORTS

View File

@ -64,8 +64,13 @@ void LLCommandDispatcherListener::dispatch(const LLSD& params) const
// But for testing, allow a caller to specify untrusted.
trusted_browser = params["trusted"].asBoolean();
}
LLCommandDispatcher::dispatch(params["cmd"], params["params"], params["query"], NULL,
"clicked", trusted_browser);
LLCommandDispatcher::dispatch(
params["cmd"],
params["params"],
params["query"],
NULL,
LLCommandHandler::NAV_TYPE_CLICKED,
trusted_browser);
}
void LLCommandDispatcherListener::enumerate(const LLSD& params) const

View File

@ -40,6 +40,8 @@
static LLCommandDispatcherListener sCommandDispatcherListener;
const std::string LLCommandHandler::NAV_TYPE_CLICKED = "clicked";
const std::string LLCommandHandler::NAV_TYPE_EXTERNAL = "external";
const std::string LLCommandHandler::NAV_TYPE_NAVIGATED = "navigated";
//---------------------------------------------------------------------------
// Underlying registry for command handlers, not directly accessible.

View File

@ -70,6 +70,8 @@ public:
};
static const std::string NAV_TYPE_CLICKED;
static const std::string NAV_TYPE_EXTERNAL;
static const std::string NAV_TYPE_NAVIGATED;
LLCommandHandler(const char* command, EUntrustedAccess untrusted_access);
// Automatically registers object to get called when

View File

@ -247,8 +247,9 @@ namespace Details
errorCount = 0;
if (!result.isMap() ||
!result.get("events") ||
!result.get("id"))
!result.has("events") ||
!result["events"].isArray() ||
!result.has("id"))
{
LL_WARNS("LLEventPollImpl") << " <" << counter << "> received event poll with no events or id key: " << result << LL_ENDL;
continue;

View File

@ -499,6 +499,18 @@ bool LLFeatureManager::loadGPUClass()
{
mGPUClass = GPU_CLASS_5;
}
#if LL_WINDOWS
const F32Gigabytes MIN_PHYSICAL_MEMORY(2);
LLMemory::updateMemoryInfo();
F32Gigabytes physical_mem = LLMemory::getMaxMemKB();
if (MIN_PHYSICAL_MEMORY > physical_mem && mGPUClass > GPU_CLASS_1)
{
// reduce quality on systems that don't have enough memory
mGPUClass = (EGPUClass)(mGPUClass - 1);
}
#endif //LL_WINDOWS
} //end if benchmark
else
{

View File

@ -285,6 +285,15 @@ BOOL LLFilePicker::getOpenFile(ELoadFilter filter, bool blocking)
return success;
}
BOOL LLFilePicker::getOpenFileModeless(ELoadFilter filter,
void (*callback)(bool, std::vector<std::string> &, void*),
void *userdata)
{
// not supposed to be used yet, use LLFilePickerThread
LL_ERRS() << "NOT IMPLEMENTED" << LL_ENDL;
return FALSE;
}
BOOL LLFilePicker::getMultipleOpenFiles(ELoadFilter filter, bool blocking)
{
if( mLocked )
@ -362,6 +371,15 @@ BOOL LLFilePicker::getMultipleOpenFiles(ELoadFilter filter, bool blocking)
return success;
}
BOOL LLFilePicker::getMultipleOpenFilesModeless(ELoadFilter filter,
void (*callback)(bool, std::vector<std::string> &, void*),
void *userdata )
{
// not supposed to be used yet, use LLFilePickerThread
LL_ERRS() << "NOT IMPLEMENTED" << LL_ENDL;
return FALSE;
}
BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename, bool blocking)
{
if( mLocked )
@ -584,6 +602,16 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename,
return success;
}
BOOL LLFilePicker::getSaveFileModeless(ESaveFilter filter,
const std::string& filename,
void (*callback)(bool, std::string&, void*),
void *userdata)
{
// not supposed to be used yet, use LLFilePickerThread
LL_ERRS() << "NOT IMPLEMENTED" << LL_ENDL;
return FALSE;
}
#elif LL_DARWIN
std::unique_ptr<std::vector<std::string>> LLFilePicker::navOpenFilterProc(ELoadFilter filter) //(AEDesc *theItem, void *info, void *callBackUD, NavFilterModes filterMode)
@ -678,105 +706,123 @@ bool LLFilePicker::doNavChooseDialog(ELoadFilter filter)
return false;
}
bool LLFilePicker::doNavChooseDialogModeless(ELoadFilter filter,
void (*callback)(bool, std::vector<std::string> &,void*),
void *userdata)
{
// if local file browsing is turned off, return without opening dialog
if ( check_local_file_access_enabled() == false )
{
return false;
}
std::unique_ptr<std::vector<std::string>> allowed_types=navOpenFilterProc(filter);
doLoadDialogModeless(allowed_types.get(),
mPickOptions,
callback,
userdata);
return true;
}
void set_nav_save_data(LLFilePicker::ESaveFilter filter, std::string &extension, std::string &type, std::string &creator)
{
switch (filter)
{
case LLFilePicker::FFSAVE_WAV:
type = "WAVE";
creator = "TVOD";
extension = "wav";
break;
case LLFilePicker::FFSAVE_TGA:
type = "TPIC";
creator = "prvw";
extension = "tga";
break;
case LLFilePicker::FFSAVE_TGAPNG:
type = "PNG";
creator = "prvw";
extension = "png,tga";
break;
case LLFilePicker::FFSAVE_BMP:
type = "BMPf";
creator = "prvw";
extension = "bmp";
break;
case LLFilePicker::FFSAVE_JPEG:
type = "JPEG";
creator = "prvw";
extension = "jpeg";
break;
case LLFilePicker::FFSAVE_PNG:
type = "PNG ";
creator = "prvw";
extension = "png";
break;
case LLFilePicker::FFSAVE_AVI:
type = "\?\?\?\?";
creator = "\?\?\?\?";
extension = "mov";
break;
case LLFilePicker::FFSAVE_ANIM:
type = "\?\?\?\?";
creator = "\?\?\?\?";
extension = "xaf";
break;
#ifdef _CORY_TESTING
case LLFilePicker::FFSAVE_GEOMETRY:
type = "\?\?\?\?";
creator = "\?\?\?\?";
extension = "slg";
break;
#endif
case LLFilePicker::FFSAVE_XML:
type = "\?\?\?\?";
creator = "\?\?\?\?";
extension = "xml";
break;
case LLFilePicker::FFSAVE_RAW:
type = "\?\?\?\?";
creator = "\?\?\?\?";
extension = "raw";
break;
case LLFilePicker::FFSAVE_J2C:
type = "\?\?\?\?";
creator = "prvw";
extension = "j2c";
break;
case LLFilePicker::FFSAVE_SCRIPT:
type = "LSL ";
creator = "\?\?\?\?";
extension = "lsl";
break;
case LLFilePicker::FFSAVE_ALL:
default:
type = "\?\?\?\?";
creator = "\?\?\?\?";
extension = "";
break;
}
}
bool LLFilePicker::doNavSaveDialog(ESaveFilter filter, const std::string& filename)
{
// Setup the type, creator, and extension
std::string extension, type, creator;
switch (filter)
{
case FFSAVE_WAV:
type = "WAVE";
creator = "TVOD";
extension = "wav";
break;
case FFSAVE_TGA:
type = "TPIC";
creator = "prvw";
extension = "tga";
break;
case FFSAVE_TGAPNG:
type = "PNG";
creator = "prvw";
extension = "png,tga";
break;
case FFSAVE_BMP:
type = "BMPf";
creator = "prvw";
extension = "bmp";
break;
case FFSAVE_JPEG:
type = "JPEG";
creator = "prvw";
extension = "jpeg";
break;
case FFSAVE_PNG:
type = "PNG ";
creator = "prvw";
extension = "png";
break;
case FFSAVE_AVI:
type = "\?\?\?\?";
creator = "\?\?\?\?";
extension = "mov";
break;
case FFSAVE_ANIM:
type = "\?\?\?\?";
creator = "\?\?\?\?";
extension = "xaf";
break;
#ifdef _CORY_TESTING
case FFSAVE_GEOMETRY:
type = "\?\?\?\?";
creator = "\?\?\?\?";
extension = "slg";
break;
#endif
case FFSAVE_XML:
type = "\?\?\?\?";
creator = "\?\?\?\?";
extension = "xml";
break;
case FFSAVE_RAW:
type = "\?\?\?\?";
creator = "\?\?\?\?";
extension = "raw";
break;
case FFSAVE_J2C:
type = "\?\?\?\?";
creator = "prvw";
extension = "j2c";
break;
case FFSAVE_SCRIPT:
type = "LSL ";
creator = "\?\?\?\?";
extension = "lsl";
break;
case FFSAVE_ALL:
default:
type = "\?\?\?\?";
creator = "\?\?\?\?";
extension = "";
break;
}
set_nav_save_data(filter, extension, type, creator);
std::string namestring = filename;
if (namestring.empty()) namestring="Untitled";
// if (! boost::algorithm::ends_with(namestring, extension) )
// {
// namestring = namestring + "." + extension;
//
// }
gViewerWindow->getWindow()->beforeDialog();
// Run the dialog
@ -797,6 +843,30 @@ bool LLFilePicker::doNavSaveDialog(ESaveFilter filter, const std::string& filena
return false;
}
bool LLFilePicker::doNavSaveDialogModeless(ESaveFilter filter,
const std::string& filename,
void (*callback)(bool, std::string&, void*),
void *userdata)
{
// Setup the type, creator, and extension
std::string extension, type, creator;
set_nav_save_data(filter, extension, type, creator);
std::string namestring = filename;
if (namestring.empty()) namestring="Untitled";
// Run the dialog
doSaveDialogModeless(&namestring,
&type,
&creator,
&extension,
mPickOptions,
callback,
userdata);
return true;
}
BOOL LLFilePicker::getOpenFile(ELoadFilter filter, bool blocking)
{
if( mLocked )
@ -852,18 +922,52 @@ BOOL LLFilePicker::getOpenFile(ELoadFilter filter, bool blocking)
return success;
}
BOOL LLFilePicker::getOpenFileModeless(ELoadFilter filter,
void (*callback)(bool, std::vector<std::string> &, void*),
void *userdata)
{
if( mLocked )
return FALSE;
// if local file browsing is turned off, return without opening dialog
if ( check_local_file_access_enabled() == false )
{
return FALSE;
}
reset();
mPickOptions &= ~F_MULTIPLE;
mPickOptions |= F_FILE;
if (filter == FFLOAD_DIRECTORY) //This should only be called from lldirpicker.
{
mPickOptions |= ( F_NAV_SUPPORT | F_DIRECTORY );
mPickOptions &= ~F_FILE;
}
if (filter == FFLOAD_ALL) // allow application bundles etc. to be traversed; important for DEV-16869, but generally useful
{
mPickOptions |= F_NAV_SUPPORT;
}
return doNavChooseDialogModeless(filter, callback, userdata);
}
BOOL LLFilePicker::getMultipleOpenFiles(ELoadFilter filter, bool blocking)
{
if( mLocked )
return FALSE;
BOOL success = FALSE;
// if local file browsing is turned off, return without opening dialog
if ( check_local_file_access_enabled() == false )
{
return FALSE;
}
BOOL success = FALSE;
reset();
@ -897,6 +1001,29 @@ BOOL LLFilePicker::getMultipleOpenFiles(ELoadFilter filter, bool blocking)
return success;
}
BOOL LLFilePicker::getMultipleOpenFilesModeless(ELoadFilter filter,
void (*callback)(bool, std::vector<std::string> &, void*),
void *userdata )
{
if( mLocked )
return FALSE;
// if local file browsing is turned off, return without opening dialog
if ( check_local_file_access_enabled() == false )
{
return FALSE;
}
reset();
mPickOptions |= F_FILE;
mPickOptions |= F_MULTIPLE;
return doNavChooseDialogModeless(filter, callback, userdata);
}
BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename, bool blocking)
{
@ -937,6 +1064,27 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename,
LLFrameTimer::updateFrameTime();
return success;
}
BOOL LLFilePicker::getSaveFileModeless(ESaveFilter filter,
const std::string& filename,
void (*callback)(bool, std::string&, void*),
void *userdata)
{
if( mLocked )
return false;
// if local file browsing is turned off, return without opening dialog
if ( check_local_file_access_enabled() == false )
{
return false;
}
reset();
mPickOptions &= ~F_MULTIPLE;
return doNavSaveDialogModeless(filter, filename, callback, userdata);
}
//END LL_DARWIN
#elif LL_LINUX
@ -1444,6 +1592,15 @@ BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename,
return FALSE;
}
BOOL LLFilePicker::getSaveFileModeless(ESaveFilter filter,
const std::string& filename,
void (*callback)(bool, std::string&, void*),
void *userdata)
{
LL_ERRS() << "NOT IMPLEMENTED" << LL_ENDL;
return FALSE;
}
BOOL LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking )
{
// if local file browsing is turned off, return without opening dialog
@ -1469,6 +1626,14 @@ BOOL LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking )
return TRUE;
}
BOOL LLFilePicker::getOpenFileModeless(ELoadFilter filter,
void (*callback)(bool, std::vector<std::string> &, void*),
void *userdata)
{
LL_ERRS() << "NOT IMPLEMENTED" << LL_ENDL;
return FALSE;
}
BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter, bool blocking)
{
// if local file browsing is turned off, return without opening dialog
@ -1482,6 +1647,14 @@ BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter, bool blocking)
return FALSE;
}
BOOL LLFilePicker::getMultipleOpenFilesModeless(ELoadFilter filter,
void (*callback)(bool, std::vector<std::string> &, void*),
void *userdata )
{
LL_ERRS() << "NOT IMPLEMENTED" << LL_ENDL;
return FALSE;
}
#endif // LL_GTK
#else // not implemented

View File

@ -114,8 +114,16 @@ public:
// open the dialog. This is a modal operation
BOOL getSaveFile( ESaveFilter filter = FFSAVE_ALL, const std::string& filename = LLStringUtil::null, bool blocking = true);
BOOL getSaveFileModeless(ESaveFilter filter,
const std::string& filename,
void (*callback)(bool, std::string&, void*),
void *userdata);
BOOL getOpenFile( ELoadFilter filter = FFLOAD_ALL, bool blocking = true );
// Todo: implement getOpenFileModeless and getMultipleOpenFilesModeless
// for windows and use directly instead of ugly LLFilePickerThread
BOOL getOpenFileModeless( ELoadFilter filter, void (*callback)(bool, std::vector<std::string> &, void*), void *userdata); // MAC only.
BOOL getMultipleOpenFiles( ELoadFilter filter = FFLOAD_ALL, bool blocking = true );
BOOL getMultipleOpenFilesModeless( ELoadFilter filter, void (*callback)(bool, std::vector<std::string> &, void*), void *userdata ); // MAC only
// Get the filename(s) found. getFirstFile() sets the pointer to
// the start of the structure and allows the start of iteration.
@ -166,8 +174,15 @@ private:
std::vector<std::string> mFileVector;
bool doNavChooseDialog(ELoadFilter filter);
bool doNavChooseDialogModeless(ELoadFilter filter,
void (*callback)(bool, std::vector<std::string>&, void*),
void *userdata);
bool doNavSaveDialog(ESaveFilter filter, const std::string& filename);
std::unique_ptr<std::vector<std::string>> navOpenFilterProc(ELoadFilter filter);
bool doNavSaveDialogModeless(ESaveFilter filter,
const std::string& filename,
void (*callback)(bool, std::string&, void*),
void *userdata);
#endif
#if LL_GTK

View File

@ -41,11 +41,25 @@
//void modelessPicker();
std::unique_ptr<std::vector<std::string>> doLoadDialog(const std::vector<std::string>* allowed_types,
unsigned int flags);
void doLoadDialogModeless(const std::vector<std::string>* allowed_types,
unsigned int flags,
void (*callback)(bool, std::vector<std::string>&, void*),
void *userdata);
std::unique_ptr<std::string> doSaveDialog(const std::string* file,
const std::string* type,
const std::string* creator,
const std::string* extension,
unsigned int flags);
void doSaveDialogModeless(const std::string* file,
const std::string* type,
const std::string* creator,
const std::string* extension,
unsigned int flags,
void (*callback)(bool, std::string&, void*),
void *userdata);
enum {
F_FILE = 0x00000001,
F_DIRECTORY = 0x00000002,

View File

@ -29,53 +29,62 @@
#include <iostream>
#include "llfilepicker_mac.h"
NSOpenPanel *init_panel(const std::vector<std::string>* allowed_types, unsigned int flags)
{
int i;
NSOpenPanel *panel = [NSOpenPanel openPanel];
NSMutableArray *fileTypes = nil;
if ( allowed_types && !allowed_types->empty())
{
fileTypes = [[NSMutableArray alloc] init];
for (i=0;i<allowed_types->size();++i)
{
[fileTypes addObject:
[NSString stringWithCString:(*allowed_types)[i].c_str()
encoding:[NSString defaultCStringEncoding]]];
}
}
//[panel setMessage:@"Import one or more files or directories."];
[panel setAllowsMultipleSelection: ( (flags & F_MULTIPLE)?true:false ) ];
[panel setCanChooseDirectories: ( (flags & F_DIRECTORY)?true:false ) ];
[panel setCanCreateDirectories: true];
[panel setResolvesAliases: true];
[panel setCanChooseFiles: ( (flags & F_FILE)?true:false )];
[panel setTreatsFilePackagesAsDirectories: ( flags & F_NAV_SUPPORT ) ];
if (fileTypes)
{
[panel setAllowedFileTypes:fileTypes];
}
else
{
// I suggest it's better to open the last path and let this default to home dir as necessary
// for consistency with other OS X apps
//
//[panel setDirectoryURL: fileURLWithPath(NSHomeDirectory()) ];
}
return panel;
}
std::unique_ptr<std::vector<std::string>> doLoadDialog(const std::vector<std::string>* allowed_types,
unsigned int flags)
{
std::unique_ptr<std::vector<std::string>> outfiles;
@autoreleasepool {
int i, result;
@autoreleasepool
{
int result;
//Aura TODO: We could init a small window and release it at the end of this routine
//for a modeless interface.
NSOpenPanel *panel = [NSOpenPanel openPanel];
//NSString *fileName = nil;
NSMutableArray *fileTypes = nil;
if ( allowed_types && !allowed_types->empty())
{
fileTypes = [[[NSMutableArray alloc] init] autorelease];
for (i=0;i<allowed_types->size();++i)
{
[fileTypes addObject:
[NSString stringWithCString:(*allowed_types)[i].c_str()
encoding:[NSString defaultCStringEncoding]]];
}
}
//[panel setMessage:@"Import one or more files or directories."];
[panel setAllowsMultipleSelection: ( (flags & F_MULTIPLE)?true:false ) ];
[panel setCanChooseDirectories: ( (flags & F_DIRECTORY)?true:false ) ];
[panel setCanCreateDirectories: true];
[panel setResolvesAliases: true];
[panel setCanChooseFiles: ( (flags & F_FILE)?true:false )];
[panel setTreatsFilePackagesAsDirectories: ( flags & F_NAV_SUPPORT ) ];
if (fileTypes)
{
[panel setAllowedFileTypes:fileTypes];
result = [panel runModal];
}
else
{
// I suggest it's better to open the last path and let this default to home dir as necessary
// for consistency with other OS X apps
//
//[panel setDirectoryURL: fileURLWithPath(NSHomeDirectory()) ];
result = [panel runModal];
}
NSOpenPanel *panel = init_panel(allowed_types,flags);
result = [panel runModal];
if (result == NSOKButton)
{
@ -98,6 +107,48 @@ std::unique_ptr<std::vector<std::string>> doLoadDialog(const std::vector<std::st
return outfiles;
}
void doLoadDialogModeless(const std::vector<std::string>* allowed_types,
unsigned int flags,
void (*callback)(bool, std::vector<std::string> &, void*),
void *userdata)
{
@autoreleasepool
{
// Note: might need to return and save this panel
// so that it does not close immediately
NSOpenPanel *panel = init_panel(allowed_types,flags);
[panel beginWithCompletionHandler:^(NSModalResponse result)
{
std::vector<std::string> outfiles;
if (result == NSOKButton)
{
NSArray *filesToOpen = [panel URLs];
int i, count = [filesToOpen count];
if (count > 0)
{
for (i=0; i<count; i++) {
NSString *aFile = [[filesToOpen objectAtIndex:i] path];
std::string *afilestr = new std::string([aFile UTF8String]);
outfiles.push_back(*afilestr);
}
callback(true, outfiles, userdata);
}
else // no valid result
{
callback(false, outfiles, userdata);
}
}
else // cancel
{
callback(false, outfiles, userdata);
}
}];
}
}
std::unique_ptr<std::string> doSaveDialog(const std::string* file,
const std::string* type,
@ -106,7 +157,8 @@ std::unique_ptr<std::string> doSaveDialog(const std::string* file,
unsigned int flags)
{
std::unique_ptr<std::string> outfile;
@autoreleasepool {
@autoreleasepool
{
NSSavePanel *panel = [NSSavePanel savePanel];
NSString *extensionns = [NSString stringWithCString:extension->c_str() encoding:[NSString defaultCStringEncoding]];
@ -133,4 +185,48 @@ std::unique_ptr<std::string> doSaveDialog(const std::string* file,
return outfile;
}
void doSaveDialogModeless(const std::string* file,
const std::string* type,
const std::string* creator,
const std::string* extension,
unsigned int flags,
void (*callback)(bool, std::string&, void*),
void *userdata)
{
@autoreleasepool {
NSSavePanel *panel = [NSSavePanel savePanel];
NSString *extensionns = [NSString stringWithCString:extension->c_str() encoding:[NSString defaultCStringEncoding]];
NSArray *fileType = [extensionns componentsSeparatedByString:@","];
//[panel setMessage:@"Save Image File"];
[panel setTreatsFilePackagesAsDirectories: ( flags & F_NAV_SUPPORT ) ];
[panel setCanSelectHiddenExtension:true];
[panel setAllowedFileTypes:fileType];
NSString *fileName = [NSString stringWithCString:file->c_str() encoding:[NSString defaultCStringEncoding]];
NSURL* url = [NSURL fileURLWithPath:fileName];
[panel setNameFieldStringValue: fileName];
[panel setDirectoryURL: url];
[panel beginWithCompletionHandler:^(NSModalResponse result)
{
if (result == NSOKButton)
{
NSURL* url = [panel URL];
NSString* p = [url path];
std::string outfile([p UTF8String]);
callback(true, outfile, userdata);
}
else // cancel
{
std::string outfile;
callback(false, outfile, userdata);
}
}];
}
}
#endif

View File

@ -165,10 +165,21 @@ void LLFloaterDisplayName::onReset()
{
return;
}
getChild<LLUICtrl>("display_name_editor")->setValue(av_name.getCompleteName());
getChild<LLUICtrl>("display_name_editor")->setValue(av_name.getUserName());
getChild<LLUICtrl>("display_name_confirm")->clear();
getChild<LLUICtrl>("display_name_confirm")->setFocus(TRUE);
if (getChild<LLUICtrl>("display_name_editor")->getEnabled())
{
// UI is enabled, fill the first field
getChild<LLUICtrl>("display_name_confirm")->clear();
getChild<LLUICtrl>("display_name_confirm")->setFocus(TRUE);
}
else
{
// UI is disabled, looks like we should allow resetting
// even if user already set a display name, enable save button
getChild<LLUICtrl>("display_name_confirm")->setValue(av_name.getUserName());
getChild<LLUICtrl>("save_btn")->setEnabled(true);
}
}
@ -183,6 +194,21 @@ void LLFloaterDisplayName::onSave()
return;
}
LLAvatarName av_name;
if (!LLAvatarNameCache::get(gAgent.getID(), &av_name))
{
return;
}
std::string user_name = av_name.getUserName();
if (display_name_utf8.compare(user_name) == 0
&& LLAvatarNameCache::getInstance()->hasNameLookupURL())
{
// A reset
LLViewerDisplayName::set("", boost::bind(&LLFloaterDisplayName::onCacheSetName, this, _1, _2, _3));
return;
}
const U32 DISPLAY_NAME_MAX_LENGTH = 31; // characters, not bytes
LLWString display_name_wstr = utf8string_to_wstring(display_name_utf8);
if (display_name_wstr.size() > DISPLAY_NAME_MAX_LENGTH)

View File

@ -523,7 +523,7 @@ void LLFloaterEditSky::refreshSkyPresetsList()
for (LLEnvironment::list_name_id_t::iterator it = list.begin(); it != list.end(); ++it)
{
mSkyPresetCombo->add((*it).first, LLSDArray((*it).first)((*it).second));
mSkyPresetCombo->add((*it).first, llsd::array((*it).first, (*it).second));
}
mSkyPresetCombo->setLabel(getString("combo_label"));

View File

@ -335,7 +335,7 @@ void LLFloaterEditWater::refreshWaterPresetsList()
for (LLEnvironment::list_name_id_t::iterator it = list.begin(); it != list.end(); ++it)
{
mWaterPresetCombo->add((*it).first, LLSDArray((*it).first)((*it).second));
mWaterPresetCombo->add((*it).first, llsd::array((*it).first, (*it).second));
}
mWaterPresetCombo->setLabel(getString("combo_label"));

View File

@ -182,11 +182,15 @@ void LLFolderViewModelItemInventory::setPassedFilter(bool passed, S32 filter_gen
bool generation_skip = mMarkedDirtyGeneration >= 0
&& mPrevPassedAllFilters
&& mMarkedDirtyGeneration < mRootViewModel.getFilter().getFirstSuccessGeneration();
S32 last_generation = mLastFilterGeneration;
LLFolderViewModelItemCommon::setPassedFilter(passed, filter_generation, string_offset, string_size);
bool before = mPrevPassedAllFilters;
mPrevPassedAllFilters = passedFilter(filter_generation);
if (before != mPrevPassedAllFilters || generation_skip)
if (before != mPrevPassedAllFilters // Change of state
|| generation_skip // Was marked dirty
// Potential change from being in-progress and invisible to visible)
|| (mPrevPassedAllFilters && last_generation < mRootViewModel.getFilter().getFirstRequiredGeneration()))
{
// Need to rearrange the folder if the filtered state of the item changed,
// previously passed item skipped filter generation changes while being dirty

View File

@ -52,7 +52,7 @@ class LLGroupHandler : public LLCommandHandler
{
public:
// requires trusted browser to trigger
LLGroupHandler() : LLCommandHandler("group", UNTRUSTED_CLICK_ONLY) { }
LLGroupHandler() : LLCommandHandler("group", UNTRUSTED_THROTTLE) { }
virtual bool canHandleUntrusted(
const LLSD& params,

View File

@ -39,12 +39,6 @@
// Globals
LLLandmarkList gLandmarkList;
// number is mostly arbitrary, but it should be below DEFAULT_QUEUE_SIZE pool size,
// which is 4096, to not overfill the pool if user has more than 4K of landmarks
// and it should leave some space for other potential simultaneous asset request
const S32 MAX_SIMULTANEOUS_REQUESTS = 512;
////////////////////////////////////////////////////////////////////////////
// LLLandmarkList
@ -83,12 +77,6 @@ LLLandmark* LLLandmarkList::getAsset(const LLUUID& asset_uuid, loaded_callback_t
loaded_callback_map_t::value_type vt(asset_uuid, cb);
mLoadedCallbackMap.insert(vt);
}
if ( mWaitList.find(asset_uuid) != mWaitList.end() )
{
// Landmark is sheduled for download, but not requested yet
return NULL;
}
landmark_requested_list_t::iterator iter = mRequestedList.find(asset_uuid);
if (iter != mRequestedList.end())
@ -100,17 +88,6 @@ LLLandmark* LLLandmarkList::getAsset(const LLUUID& asset_uuid, loaded_callback_t
}
}
if (mRequestedList.size() > MAX_SIMULTANEOUS_REQUESTS)
{
// Workarounds for corutines pending list size limit:
// Postpone download till queue is emptier.
// Coroutines have own built in 'pending' list, but unfortunately
// it is too small compared to potential amount of landmarks
// or assets.
mWaitList.insert(asset_uuid);
return NULL;
}
mRequestedList[asset_uuid] = gFrameTimeSeconds;
// Note that getAssetData can callback immediately and cleans mRequestedList
@ -197,33 +174,6 @@ void LLLandmarkList::processGetAssetReply(
gLandmarkList.mRequestedList.erase(uuid); //mBadList effectively blocks any load, so no point keeping id in requests
gLandmarkList.eraseCallbacks(uuid);
}
// getAssetData can fire callback immediately, causing
// a recursion which is suboptimal for very large wait list.
// 'scheduling' indicates that we are inside request and
// shouldn't be launching more requests.
static bool scheduling = false;
if (!scheduling && !gLandmarkList.mWaitList.empty())
{
scheduling = true;
while (!gLandmarkList.mWaitList.empty() && gLandmarkList.mRequestedList.size() < MAX_SIMULTANEOUS_REQUESTS)
{
// start new download from wait list
landmark_uuid_list_t::iterator iter = gLandmarkList.mWaitList.begin();
LLUUID asset_uuid = *iter;
gLandmarkList.mWaitList.erase(iter);
// add to mRequestedList before calling getAssetData()
gLandmarkList.mRequestedList[asset_uuid] = gFrameTimeSeconds;
// Note that getAssetData can callback immediately and cleans mRequestedList
gAssetStorage->getAssetData(asset_uuid,
LLAssetType::AT_LANDMARK,
LLLandmarkList::processGetAssetReply,
NULL);
}
scheduling = false;
}
}
BOOL LLLandmarkList::isAssetInLoadedCallbackMap(const LLUUID& asset_uuid)

View File

@ -72,7 +72,6 @@ protected:
typedef std::set<LLUUID> landmark_uuid_list_t;
landmark_uuid_list_t mBadList;
landmark_uuid_list_t mWaitList;
typedef std::map<LLUUID,F32> landmark_requested_list_t;
landmark_requested_list_t mRequestedList;

View File

@ -346,7 +346,10 @@ public:
{
// will be deleted by ~LLInventoryModel
//delete mInvObserver;
LLVoiceClient::getInstance()->removeObserver(this);
if (LLVoiceClient::instanceExists())
{
LLVoiceClient::getInstance()->removeObserver(this);
}
LLAvatarTracker::instance().removeObserver(this);
}

View File

@ -172,11 +172,18 @@ LLSLURL::LLSLURL(const std::string& slurl)
}
else
{
// it wasn't a /secondlife/<region> or /app/<params>, so it must be secondlife://<region>
if(slurl_uri.hostName() == LLSLURL::SLURL_APP_PATH)
{
mType = APP;
}
else
{
// it wasn't a /secondlife/<region> or /app/<params>, so it must be secondlife://<region>
// therefore the hostname will be the region name, and it's a location type
mType = LOCATION;
// 'normalize' it so the region name is in fact the head of the path_array
path_array.insert(0, slurl_uri.hostName());
}
}
}
else if((slurl_uri.scheme() == LLSLURL::SLURL_HTTP_SCHEME) ||

View File

@ -323,6 +323,8 @@ void set_flags_and_update_appearance()
{
LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true);
LLAppearanceMgr::instance().updateAppearanceFromCOF(true, true, no_op);
LLInventoryModelBackgroundFetch::instance().start();
}
// Returns false to skip other idle processing. Should only return
@ -3021,7 +3023,7 @@ bool LLStartUp::dispatchURL()
|| (dx*dx > SLOP*SLOP)
|| (dy*dy > SLOP*SLOP) )
{
LLURLDispatcher::dispatch(getStartSLURL().getSLURLString(), "clicked",
LLURLDispatcher::dispatch(getStartSLURL().getSLURLString(), LLCommandHandler::NAV_TYPE_CLICKED,
NULL, false);
}
return true;

View File

@ -220,7 +220,11 @@ void LLToast::hide()
/*virtual*/
void LLToast::setFocus(BOOL b)
{
if (b && !hasFocus() && mPanel)
if (b
&& !hasFocus()
&& mPanel
&& mWrapperPanel
&& !mWrapperPanel->getChildList()->empty())
{
LLModalDialog::setFocus(TRUE);
// mostly for buttons
@ -416,15 +420,18 @@ void LLToast::setVisible(BOOL show)
//hide "hide" button in case toast was hidden without mouse_leave
if(mHideBtn)
mHideBtn->setVisible(show);
}
LLFloater::setVisible(show);
if(mPanel)
{
if(!mPanel->isDead())
{
mPanel->setVisible(show);
}
}
}
LLFloater::setVisible(show);
if (mPanel
&& !mPanel->isDead()
&& mWrapperPanel
&& !mWrapperPanel->getChildList()->empty()
// LLInspectToast can take over, but LLToast still appears to act like a data storage
&& mPanel->getParent() == mWrapperPanel
)
{
mPanel->setVisible(show);
}
}
void LLToast::updateHoveredState()

View File

@ -142,7 +142,7 @@ bool LLURLDispatcherImpl::dispatchRightClick(const LLSLURL& slurl)
const bool right_click = true;
LLMediaCtrl* web = NULL;
const bool trusted_browser = false;
return dispatchCore(slurl, "clicked", right_click, web, trusted_browser);
return dispatchCore(slurl, LLCommandHandler::NAV_TYPE_CLICKED, right_click, web, trusted_browser);
}
// static
@ -397,7 +397,7 @@ bool LLURLDispatcher::dispatchFromTextEditor(const std::string& slurl, bool trus
// *TODO: Make this trust model more refined. JC
LLMediaCtrl* web = NULL;
return LLURLDispatcherImpl::dispatch(LLSLURL(slurl), "clicked", web, trusted_content);
return LLURLDispatcherImpl::dispatch(LLSLURL(slurl), LLCommandHandler::NAV_TYPE_CLICKED, web, trusted_content);
}

View File

@ -134,14 +134,6 @@ LLViewerAssetStorage::~LLViewerAssetStorage()
// This class has dedicated coroutine pool, clean it up, otherwise coroutines will crash later.
LLCoprocedureManager::instance().close(VIEWER_ASSET_STORAGE_CORO_POOL);
}
while (mCoroWaitList.size() > 0)
{
CoroWaitList &request = mCoroWaitList.front();
// Clean up pending downloads, delete request and trigger callbacks
removeAndCallbackPendingDownloads(request.mId, request.mType, request.mId, request.mType, LL_ERR_NOERR, LLExtStat::NONE);
mCoroWaitList.pop_front();
}
}
// virtual
@ -346,28 +338,6 @@ void LLViewerAssetStorage::storeAssetData(
}
}
void LLViewerAssetStorage::checkForTimeouts()
{
LLAssetStorage::checkForTimeouts();
// Restore requests
LLCoprocedureManager* manager = LLCoprocedureManager::getInstance();
while (mCoroWaitList.size() > 0
&& manager->count(VIEWER_ASSET_STORAGE_CORO_POOL) < (LLCoprocedureManager::DEFAULT_QUEUE_SIZE - 1))
{
CoroWaitList &request = mCoroWaitList.front();
bool with_http = true;
bool is_temp = false;
LLViewerAssetStatsFF::record_enqueue(request.mType, with_http, is_temp);
manager->enqueueCoprocedure(VIEWER_ASSET_STORAGE_CORO_POOL, "LLViewerAssetStorage::assetRequestCoro",
boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, request.mRequest, request.mId, request.mType, request.mCallback, request.mUserData));
mCoroWaitList.pop_front();
}
}
/**
* @brief Allocate and queue an asset fetch request for the viewer
*
@ -424,21 +394,18 @@ void LLViewerAssetStorage::queueRequestHttp(
// This is the same as the current UDP logic - don't re-request a duplicate.
if (!duplicate)
{
// Coroutine buffer has fixed size (synchronization buffer, so we have no alternatives), so buffer any request above limit
LLCoprocedureManager* manager = LLCoprocedureManager::getInstance();
if (manager->count(VIEWER_ASSET_STORAGE_CORO_POOL) < (LLCoprocedureManager::DEFAULT_QUEUE_SIZE - 1))
{
bool with_http = true;
bool is_temp = false;
LLViewerAssetStatsFF::record_enqueue(atype, with_http, is_temp);
manager->enqueueCoprocedure(VIEWER_ASSET_STORAGE_CORO_POOL, "LLViewerAssetStorage::assetRequestCoro",
boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, req, uuid, atype, callback, user_data));
}
else
{
mCoroWaitList.emplace_back(req, uuid, atype, callback, user_data);
}
bool with_http = true;
bool is_temp = false;
LLViewerAssetStatsFF::record_enqueue(atype, with_http, is_temp);
manager->enqueueCoprocedure(
VIEWER_ASSET_STORAGE_CORO_POOL,
"LLViewerAssetStorage::assetRequestCoro",
[this, req, uuid, atype, callback, user_data]
(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t&, const LLUUID&)
{
assetRequestCoro(req, uuid, atype, callback, user_data);
});
}
}

Some files were not shown because too many files have changed in this diff Show More