Commit d7672f9f authored by Rye Mutt's avatar Rye Mutt 🍞
Browse files

Various for loop cleanup, const ref cleanup, and other small maint work

parent 494d7673
......@@ -69,7 +69,7 @@ void al_handle_object_derender()
LLSelectMgr* select_mgr = LLSelectMgr::getInstance();
LLObjectSelectionHandle selection = select_mgr->getSelection();
std::vector<LLViewerObject*> objects;
for (LLObjectSelection::iterator iter = selection->begin(); iter != selection->end(); iter++)
for (LLObjectSelection::iterator iter = selection->begin(); iter != selection->end(); ++iter)
{
LLSelectNode* nodep = *iter;
if (!nodep)
......@@ -124,7 +124,7 @@ class LLEnableEditParticleSource : public view_listener_t
{
LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
for (LLObjectSelection::valid_root_iterator iter = selection->valid_root_begin();
iter != selection->valid_root_end(); iter++)
iter != selection->valid_root_end(); ++iter)
{
LLSelectNode* node = *iter;
if (node->mPermissions->getOwner() == gAgent.getID())
......
......@@ -2684,7 +2684,7 @@ bool LLAgent::canAccessMaturityInRegion( U64 region_handle ) const
return true;
}
bool LLAgent::canAccessMaturityAtGlobal( LLVector3d pos_global ) const
bool LLAgent::canAccessMaturityAtGlobal(const LLVector3d& pos_global ) const
{
U64 region_handle = to_region_handle_global( pos_global.mdV[0], pos_global.mdV[1] );
return canAccessMaturityInRegion( region_handle );
......
......@@ -794,7 +794,7 @@ public:
bool canAccessMature() const;
bool canAccessAdult() const;
bool canAccessMaturityInRegion( U64 region_handle ) const;
bool canAccessMaturityAtGlobal( LLVector3d pos_global ) const;
bool canAccessMaturityAtGlobal( const LLVector3d& pos_global ) const;
bool prefersPG() const;
bool prefersMature() const;
bool prefersAdult() const;
......
......@@ -395,7 +395,7 @@ void LLAgentCamera::slamLookAt(const LLVector3 &look_at)
//-----------------------------------------------------------------------------
// calcFocusOffset()
//-----------------------------------------------------------------------------
LLVector3 LLAgentCamera::calcFocusOffset(LLViewerObject *object, LLVector3 original_focus_point, S32 x, S32 y) const
LLVector3 LLAgentCamera::calcFocusOffset(LLViewerObject *object, const LLVector3& original_focus_point, S32 x, S32 y) const
{
LLMatrix4 obj_matrix = object->getRenderMatrix();
LLQuaternion obj_rot = object->getRenderRotation();
......@@ -2027,7 +2027,7 @@ bool LLAgentCamera::allowFocusOffsetChange(const LLVector3d& offsetFocus)
return true;
}
bool LLAgentCamera::clampCameraPosition(LLVector3d& posCamGlobal, const LLVector3d posCamRefGlobal, float nDistMin, float nDistMax)
bool LLAgentCamera::clampCameraPosition(LLVector3d& posCamGlobal, const LLVector3d& posCamRefGlobal, float nDistMin, float nDistMax)
{
const LLVector3d offsetCamera = posCamGlobal - posCamRefGlobal;
......
......@@ -204,7 +204,7 @@ private:
//--------------------------------------------------------------------
public:
LLVector3d calcFocusPositionTargetGlobal();
LLVector3 calcFocusOffset(LLViewerObject *object, LLVector3 pos_agent, S32 x, S32 y) const;
LLVector3 calcFocusOffset(LLViewerObject *object, const LLVector3& pos_agent, S32 x, S32 y) const;
BOOL getFocusOnAvatar() const { return mFocusOnAvatar; }
LLPointer<LLViewerObject>& getFocusObject() { return mFocusObject; }
F32 getFocusObjectDist() const { return mFocusObjectDist; }
......@@ -252,7 +252,7 @@ public:
//--------------------------------------------------------------------
public:
LLVector3d calcThirdPersonFocusOffset();
void setThirdPersonHeadOffset(LLVector3 offset) { mThirdPersonHeadOffset = offset; }
void setThirdPersonHeadOffset(const LLVector3& offset) { mThirdPersonHeadOffset = offset; }
private:
LLVector3 mThirdPersonHeadOffset; // Head offset for third person camera position
......@@ -316,7 +316,7 @@ public:
//--------------------------------------------------------------------
protected:
bool allowFocusOffsetChange(const LLVector3d& offsetFocus);
bool clampCameraPosition(LLVector3d& posCamGlobal, const LLVector3d posCamRefGlobal, float nDistMin, float nDistMax);
bool clampCameraPosition(LLVector3d& posCamGlobal, const LLVector3d& posCamRefGlobal, float nDistMin, float nDistMax);
bool m_fRlvMaxDist; // True if the camera is at max distance
bool m_fRlvMinDist; // True if the camera is at min distance
......
......@@ -180,11 +180,11 @@ LLAvatarList::~LLAvatarList()
void LLAvatarList::setShowIcons(std::string param_name)
{
mIconParamName= param_name;
mIconParamName = std::move(param_name);
mShowIcons = gSavedSettings.getBOOL(mIconParamName);
}
std::string LLAvatarList::getAvatarName(LLAvatarName av_name)
std::string LLAvatarList::getAvatarName(const LLAvatarName& av_name)
{
return mShowCompleteName? av_name.getCompleteName(false) : av_name.getDisplayName();
}
......@@ -691,7 +691,7 @@ BOOL LLAvalineListItem::postBuild()
setShowProfileBtn(false);
setShowInfoBtn(false);
mAvatarIcon->setValue("Avaline_Icon");
mAvatarIcon->setToolTip(std::string(""));
mAvatarIcon->setToolTip(std::string());
}
return rv;
}
......
......@@ -84,7 +84,7 @@ public:
void setShowIcons(std::string param_name);
bool getIconsVisible() const { return mShowIcons; }
const std::string getIconParamName() const {return mIconParamName;}
std::string getAvatarName(LLAvatarName av_name);
std::string getAvatarName(const LLAvatarName& av_name);
BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override;
BOOL handleMouseDown( S32 x, S32 y, MASK mask ) override;
BOOL handleMouseUp(S32 x, S32 y, MASK mask) override;
......
......@@ -105,9 +105,9 @@ void LLAvatarRenderInfoAccountant::avatarRenderInfoGetCoro(std::string url, U64
const LLSD & agents = result[KEY_AGENTS];
if (agents.isMap())
{
for (LLSD::map_const_iterator agent_iter = agents.beginMap();
agent_iter != agents.endMap();
agent_iter++
for (LLSD::map_const_iterator agent_iter = agents.beginMap(), agent_iter_end = agents.endMap();
agent_iter != agent_iter_end;
++agent_iter
)
{
LLUUID target_agent_id = LLUUID(agent_iter->first);
......@@ -209,10 +209,11 @@ void LLAvatarRenderInfoAccountant::avatarRenderInfoReportCoro(std::string url, U
{
avatar->calculateUpdateRenderComplexity(); // Make sure the numbers are up-to-date
LLSD info = LLSD::emptyMap();
U32 avatar_complexity = avatar->getVisualComplexity();
if (avatar_complexity > 0)
{
LLSD info = LLSD::emptyMap();
// the weight/complexity is unsigned, but LLSD only stores signed integers,
// so if it's over that (which would be ridiculously high), just store the maximum signed int value
info[KEY_WEIGHT] = (S32)(avatar_complexity < S32_MAX ? avatar_complexity : S32_MAX);
......@@ -224,7 +225,7 @@ void LLAvatarRenderInfoAccountant::avatarRenderInfoReportCoro(std::string url, U
num_avs++;
}
}
iter++;
++iter;
}
// Reset this regions timer, moving to longer intervals if there are lots of avatars around
......
......@@ -280,8 +280,8 @@ void LLFloaterIMNearbyChatToastPanel::init(LLSD& notification)
int chars = 0;
//Remove excessive chars if message does not fit in available height. MAINT-6891
std::string::iterator it;
for (it = messageText.begin(); it < messageText.end() && lines < max_lines; it++)
std::string::iterator it = messageText.begin();
for (auto it_end = messageText.end(); it < it_end && lines < max_lines; ++it)
{
if (*it == '\n')
++lines;
......
......@@ -484,8 +484,7 @@ void LLChicletPanel::objectChicletCallback(const LLSD& data)
bool new_message = data["new_message"];
std::list<LLChiclet*> chiclets = LLIMChiclet::sFindChicletsSignal(notification_id);
std::list<LLChiclet *>::iterator iter;
for (iter = chiclets.begin(); iter != chiclets.end(); iter++)
for (auto iter = chiclets.begin(), iter_end = chiclets.end(); iter != iter_end; ++iter)
{
LLIMChiclet* chiclet = dynamic_cast<LLIMChiclet*>(*iter);
if (chiclet != nullptr)
......
......@@ -494,7 +494,7 @@ bool LLFloaterCompileQueue::processScript(LLHandle<LLFloaterCompileQueue> hfloat
std::string buffer = std::string("Compilation of \"") + inventory->getName() + std::string("\" failed:");
floater->addStringMessage(buffer);
for (LLSD::array_const_iterator line = compile_errors.beginArray();
line < compile_errors.endArray(); line++)
line < compile_errors.endArray(); ++line)
{
std::string str = line->asString();
str.erase(std::remove(str.begin(), str.end(), '\n'), str.end());
......
......@@ -505,8 +505,8 @@ void LLControlAvatar::updateAnimations()
LLVOVolume *volp = *vol_it;
//LL_INFOS("AnimatedObjects") << "updating anim for vol " << volp->getID() << " root " << mRootVolp->getID() << LL_ENDL;
signaled_animation_map_t& signaled_animations = LLObjectSignaledAnimationMap::instance().getMap()[volp->getID()];
for (auto anim_it = signaled_animations.begin();
anim_it != signaled_animations.end();
for (auto anim_it = signaled_animations.begin(), anim_it_end = signaled_animations.end();
anim_it != anim_it_end;
++anim_it)
{
auto found_anim_it = anims.find(anim_it->first);
......
......@@ -337,16 +337,15 @@ LLConversationItemParticipant* LLConversationItemSession::findParticipant(const
// This is *not* a general tree parsing algorithm. It assumes that a session contains only
// items (LLConversationItemParticipant) that have themselve no children.
LLConversationItemParticipant* participant = nullptr;
child_list_t::iterator iter;
for (iter = mChildren.begin(); iter != mChildren.end(); iter++)
for (auto iter = mChildren.begin(), iter_end = mChildren.end(); iter != iter_end; ++iter)
{
participant = dynamic_cast<LLConversationItemParticipant*>(*iter);
if (participant->hasSameValue(participant_id))
{
break;
return (iter == mChildren.end() ? NULL : participant);
}
}
return (iter == mChildren.end() ? NULL : participant);
return nullptr;
}
void LLConversationItemSession::setParticipantIsMuted(const LLUUID& participant_id, bool is_muted)
......@@ -449,8 +448,7 @@ bool LLConversationItemSession::getTime(F64& time) const
F64 most_recent_time = mLastActiveTime;
bool has_time = (most_recent_time > 0.1);
LLConversationItemParticipant* participant = nullptr;
child_list_t::const_iterator iter;
for (iter = mChildren.begin(); iter != mChildren.end(); iter++)
for (auto iter = mChildren.begin(), iter_end = mChildren.end(); iter != iter_end; ++iter)
{
participant = dynamic_cast<LLConversationItemParticipant*>(*iter);
F64 participant_time;
......
......@@ -453,7 +453,7 @@ void LLConversationViewSession::refresh()
}
LLConversationViewParticipant* participant = nullptr;
for (auto iter = getItemsBegin(); iter != getItemsEnd(); iter++)
for (auto iter = getItemsBegin(); iter != getItemsEnd(); ++iter)
{
participant = dynamic_cast<LLConversationViewParticipant*>(*iter);
if (participant)
......
......@@ -82,7 +82,7 @@ void LLDayCycleManager::getUserPresetNames(preset_name_list_t& user) const
getPresetNames(user, sys);
}
bool LLDayCycleManager::getPreset(const std::string name, LLWLDayCycle& day_cycle) const
bool LLDayCycleManager::getPreset(const std::string& name, LLWLDayCycle& day_cycle) const
{
dc_map_t::const_iterator it = mDayCycleMap.find(name);
if (it == mDayCycleMap.end())
......@@ -94,7 +94,7 @@ bool LLDayCycleManager::getPreset(const std::string name, LLWLDayCycle& day_cycl
return true;
}
bool LLDayCycleManager::getPreset(const std::string name, LLSD& day_cycle) const
bool LLDayCycleManager::getPreset(const std::string& name, LLSD& day_cycle) const
{
LLWLDayCycle dc;
if (!getPreset(name, dc))
......@@ -106,7 +106,7 @@ bool LLDayCycleManager::getPreset(const std::string name, LLSD& day_cycle) const
return true;
}
bool LLDayCycleManager::presetExists(const std::string name) const
bool LLDayCycleManager::presetExists(const std::string& name) const
{
LLWLDayCycle dummy;
return getPreset(name, dummy);
......
......@@ -53,9 +53,9 @@ public:
const std::string& findPreset(const std::string& strPresetName);
// [/RLVa:KB]
bool getPreset(const std::string name, LLWLDayCycle& day_cycle) const;
bool getPreset(const std::string name, LLSD& day_cycle) const;
bool presetExists(const std::string name) const;
bool getPreset(const std::string& name, LLWLDayCycle& day_cycle) const;
bool getPreset(const std::string& name, LLSD& day_cycle) const;
bool presetExists(const std::string& name) const;
bool isSystemPreset(const std::string& name) const;
bool savePreset(const std::string& name, const LLSD& data);
bool deletePreset(const std::string& name);
......
......@@ -31,13 +31,13 @@ LLEasyMessageReader::~LLEasyMessageReader()
//we might want the sequenceid of the packet, which we can't get from
//a messagetemplate pointer, allow for passing in a U32 to be replaced
//with the sequenceid
LLMessageTemplate* LLEasyMessageReader::decodeTemplateMessage(U8 *data, S32 data_len, LLHost const& from_host)
LLMessageTemplate* LLEasyMessageReader::decodeTemplateMessage(U8 *data, S32 data_len, const LLHost& from_host)
{
U32 fake_id = 0;
return decodeTemplateMessage(data, data_len, from_host, fake_id);
}
LLMessageTemplate* LLEasyMessageReader::decodeTemplateMessage(U8 *data, S32 data_len, LLHost from_host, U32& sequence_id)
LLMessageTemplate* LLEasyMessageReader::decodeTemplateMessage(U8 *data, S32 data_len, const LLHost& from_host, U32& sequence_id)
{
if(data_len > MAX_BUFFER_SIZE)
{
......
......@@ -31,8 +31,8 @@ public:
LLEasyMessageReader();
~LLEasyMessageReader();
LLMessageTemplate* decodeTemplateMessage(U8* data, S32 data_len, LLHost const& from_host);
LLMessageTemplate* decodeTemplateMessage(U8* data, S32 data_len, LLHost from_host, U32& sequence_id);
LLMessageTemplate* decodeTemplateMessage(U8* data, S32 data_len, const LLHost& from_host);
LLMessageTemplate* decodeTemplateMessage(U8* data, S32 data_len, const LLHost& from_host, U32& sequence_id);
S32 getNumberOfBlocks(const char *blockname);
......
......@@ -106,7 +106,7 @@ public:
scope = EScope(llsd[SCOPE_IDX].asInteger());
}
inline bool operator <(const LLWLParamKey other) const
inline bool operator <(const LLWLParamKey& other) const
{
if (name < other.name)
{
......@@ -122,7 +122,7 @@ public:
}
}
inline bool operator ==(const LLWLParamKey other) const
inline bool operator ==(const LLWLParamKey& other) const
{
return (name == other.name) && (scope == other.scope);
}
......
......@@ -103,7 +103,7 @@ LLEventNotifier::~LLEventNotifier()
for (iter = mEventNotifications.begin();
iter != mEventNotifications.end();
iter++)
++iter)
{
delete iter->second;
}
......@@ -124,7 +124,7 @@ void LLEventNotifier::update()
{
LLEventNotification *np = iter->second;
iter++;
++iter;
if (np->getEventDateEpoch() < alert_time)
{
LLSD args;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment