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

Use std move to reduce string and smart pointer copies

parent d7672f9f
......@@ -1210,7 +1210,7 @@ bool LLAvatarActions::handlePay(const LLSD& notification, const LLSD& response,
void LLAvatarActions::callback_invite_to_group(LLUUID group_id, LLUUID id)
{
uuid_vec_t agent_ids;
agent_ids.push_back(id);
agent_ids.emplace_back(std::move(id));
LLFloaterGroupInvite::showForGroup(group_id, &agent_ids);
}
......
......@@ -235,7 +235,7 @@ void LLAvatarList::setNameFilter(const std::string& filter)
LLStringUtil::toUpper(filter_upper);
if (mNameFilter != filter_upper)
{
mNameFilter = filter_upper;
mNameFilter = std::move(filter_upper);
// update message for empty state here instead of refresh() to avoid blinking when switch
// between tabs.
......
......@@ -151,7 +151,7 @@ void LLBlockList::setNameFilter(const std::string& filter)
LLStringUtil::toUpper(filter_upper);
if (mNameFilter != filter_upper)
{
mNameFilter = filter_upper;
mNameFilter = std::move(filter_upper);
setDirty();
}
}
......
......@@ -775,7 +775,7 @@ public:
payload["owner_id"] = chat.mOwnerID;
payload["slurl"] = LLWeb::escapeURL(slurl);
mObjectData = payload;
mObjectData = std::move(payload);
}
}
......
......@@ -232,15 +232,13 @@ void LLFloaterIMNearbyChatToastPanel::init(LLSD& notification)
mMsgText->setContentTrusted(false);
mMsgText->setIsFriendCallback(LLAvatarActions::isFriend);
mMsgText->setText(std::string(""));
mMsgText->setText(LLStringUtil::null);
if ( notification["chat_style"].asInteger() != CHAT_STYLE_IRC )
{
std::string str_sender;
std::string str_sender = std::move(fromName);
str_sender = fromName;
str_sender+=" ";
str_sender.append(" ");
//append sender name
if (mSourceType == CHAT_SOURCE_AGENT || mSourceType == CHAT_SOURCE_OBJECT)
......
......@@ -83,12 +83,12 @@ void LLChatUtilities::processChat(T* editor, EChatType type)
// discard returned "found" boolean
if (!LLGestureMgr::instance().triggerAndReviseString(utf8text, &utf8_revised_text))
{
utf8_revised_text = utf8text;
utf8_revised_text = std::move(utf8text);
}
}
else
{
utf8_revised_text = utf8text;
utf8_revised_text = std::move(utf8text);
}
utf8_revised_text = utf8str_trim(utf8_revised_text);
......
......@@ -327,6 +327,7 @@ LLIMChiclet::LLIMChiclet(const LLIMChiclet::Params& p)
: LLChiclet(p)
, mPopupMenu(nullptr)
, mShowSpeaker(false)
, mCounterEnabled(false)
, mDefaultWidth(p.rect().getWidth())
, mNewMessagesIcon(nullptr)
, mChicletButton(nullptr)
......
......@@ -86,7 +86,7 @@ public:
void setOnCancelCallback(commit_callback_t cb) { mOnCancelCallback = cb; }
void setOnSelectCallback(commit_callback_t cb) { mOnSelectCallback = cb; }
void setPreviewCallback(commit_callback_t cb) { mPreviewCallback = cb; }
void setFallbackImage(LLPointer<LLUIImage> image) { mFallbackImage = image; }
void setFallbackImage(LLPointer<LLUIImage> image) { mFallbackImage = std::move(image); }
void showPicker(BOOL take_focus);
......
......@@ -59,7 +59,7 @@ public:
getTime() const { return mTime; }
bool hasOfflineMessages() const { return mHasOfflineIMs; }
void setConversationName(std::string conv_name) { mConversationName = conv_name; }
void setConversationName(std::string conv_name) { mConversationName = std::move(conv_name); }
void setOfflineMessages(bool new_messages) { mHasOfflineIMs = new_messages; }
bool isOlderThan(U32Days days) const;
......
......@@ -108,7 +108,7 @@ void LLConversationLogList::setNameFilter(const std::string& filter)
LLStringUtil::toUpper(filter_upper);
if (mNameFilter != filter_upper)
{
mNameFilter = filter_upper;
mNameFilter = std::move(filter_upper);
setDirty();
}
}
......
......@@ -196,17 +196,15 @@ void LLDebugVarMessageBox::show(const std::string& title, LLVector3 *var, LLVect
LLDebugVarMessageBox* LLDebugVarMessageBox::show(const std::string& title, EDebugVarType var_type, void *var)
{
std::string title_string(title);
LLDebugVarMessageBox *box = sInstances[title_string];
LLDebugVarMessageBox *box = sInstances[title];
if (!box)
{
box = new LLDebugVarMessageBox(title, var_type, var);
sInstances[title_string] = box;
sInstances[title] = box;
gFloaterView->addChild(box);
box->reshape(200,150);
box->openFloater();
box->mTitle = title_string;
box->mTitle = title;
}
return box;
......
......@@ -159,8 +159,8 @@ bool LLEasyMessageSender::sendLLUDPMessage(const LLHost& region_host, const std:
else
pv.hex = FALSE;
pv.name = field;
pv.value = value;
pv.name = std::move(field);
pv.value = std::move(value);
parts[current_block_index].vars.push_back(pv);
}
}
......@@ -525,7 +525,7 @@ BOOL LLEasyMessageSender::addField(e_message_variable_type var_type, const char*
if(nibble)
return FALSE;
input = new_input;
input = std::move(new_input);
}
std::stringstream stream(input);
......
......@@ -58,7 +58,7 @@ public:
const LLRect& getThumbnailPlaceholderRect() { return mThumbnailPlaceholder->getRect(); }
void setOutfitID(LLUUID id) { mOutfitID = id; }
void setOutfitID(LLUUID id) { mOutfitID = std::move(id); }
LLUUID getOutfitID() { return mOutfitID; }
void setGallery(LLOutfitGallery* gallery) { mOutfitGallery = gallery; }
......
......@@ -1251,7 +1251,7 @@ void LLMeshRepoThread::constructUrl(LLUUID mesh_id, std::string * url, int * leg
LL_DEBUGS_ONCE(LOG_MESH) << "Cannot load mesh " << mesh_id << " due to missing capability." << LL_ENDL;
}
*url = res_url;
*url = std::move(res_url);
*legacy_version = res_version;
}
......
......@@ -42,8 +42,8 @@ public:
protected:
bool writeNotifications(const LLSD& pNotificationData) const;
bool readNotifications(LLSD& pNotificationData, bool is_new_filename = true) const;
void setFileName(std::string pFileName) {mFileName = pFileName;}
void setOldFileName(std::string pFileName) {mOldFileName = pFileName;}
void setFileName(std::string pFileName) {mFileName = std::move(pFileName);}
void setOldFileName(std::string pFileName) {mOldFileName = std::move(pFileName);}
LLNotificationResponderInterface* createResponder(const std::string& pNotificationName, const LLSD& pParams) const;
......
......@@ -98,7 +98,7 @@ public:
void setSnapshotBufferType(LLSnapshotModel::ESnapshotLayerType type) { mSnapshotBufferType = type; }
void setAllowRenderUI(BOOL allow) { mAllowRenderUI = allow; }
void setAllowFullScreenPreview(BOOL allow) { mAllowFullScreenPreview = allow; }
void setFilter(std::string filter_name) { mFilterName = filter_name; }
void setFilter(std::string filter_name) { mFilterName = std::move(filter_name); }
std::string getFilter() const { return mFilterName; }
void updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail = FALSE, F32 delay = 0.f);
void saveTexture(BOOL outfit_snapshot = FALSE, std::string name = "");
......
......@@ -64,7 +64,7 @@ public:
F32 getFadeVolume();
bool getForcedTeleportFade() { return mForcedTeleportFade; };
void setForcedTeleportFade(bool fade) { mForcedTeleportFade = fade;} ;
void setNextStreamURI(std::string stream) { mNextStreamURI = stream; } ;
void setNextStreamURI(std::string stream) { mNextStreamURI = std::move(stream); } ;
void setWasPlaying(bool playing) { mWasPlaying = playing;} ;
private:
......
......@@ -403,8 +403,7 @@ const void upload_bulk(const std::vector<std::string>& filenames, LLFilePicker::
std::string const& filename = in_iter;
if (!check_file_extension(filename, type)) continue;
std::string name = gDirUtilp->getBaseFileName(filename, true);
std::string asset_name = name;
std::string asset_name = gDirUtilp->getBaseFileName(filename, true);
LLStringUtil::replaceNonstandardASCII(asset_name, '?');
LLStringUtil::replaceChar(asset_name, '|', '?');
LLStringUtil::stripNonprintable(asset_name);
......
......@@ -1511,7 +1511,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
}
// [/RLVa:KB]
mHudText = temp_string;
mHudText = std::move(temp_string);
mHudTextColor = LLColor4(coloru);
setChanged(MOVED | SILHOUETTE);
......@@ -1898,7 +1898,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
}
// [/RLVa:KB]
mHudText = temp_string;
mHudText = std::move(temp_string);
mHudTextColor = LLColor4(coloru);
setChanged(TEXTURE);
......
......@@ -5338,7 +5338,7 @@ void LLVOAvatar::releaseOldTextures()
}
}
}
mTextureIDs = new_texture_ids;
mTextureIDs = std::move(new_texture_ids);
}
void LLVOAvatar::updateTextures()
......@@ -7336,7 +7336,7 @@ void LLVOAvatar::lazyAttach()
}
}
mPendingAttachment = still_pending;
mPendingAttachment = std::move(still_pending);
}
void LLVOAvatar::resetHUDAttachments()
......@@ -10454,7 +10454,7 @@ void LLVOAvatar::accountRenderComplexityForObject(
hud_object_complexity.objectId = attached_object->getAttachmentItemID();
std::string joint_name;
gAgentAvatarp->getAttachedPointName(attached_object->getAttachmentItemID(), joint_name);
hud_object_complexity.jointName = joint_name;
hud_object_complexity.jointName = std::move(joint_name);
// get cost and individual textures
hud_object_complexity.objectsCost += volume->getRenderCost(textures);
hud_object_complexity.objectsCount++;
......
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