From 417dcb4e49571ac93821b0402c32dd35bd06b96f Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Sat, 11 May 2013 23:14:16 -0400 Subject: [PATCH] Frosting touchups Cleaned up flaws in LLUUID - Removed deprecated LLUUID::toString(char*) and LLUUID::toCompressedString(char*) Cleaned up some comments --- indra/llcommon/lluuid.cpp | 26 +++----------------------- indra/llcommon/lluuid.h | 2 -- indra/newview/linux_tools/wrapper.sh | 2 +- indra/newview/llfloateravatarlist.cpp | 7 +------ indra/newview/llpanelavatar.cpp | 6 ++---- indra/newview/llviewermenu.cpp | 5 +---- indra/newview/llvovolume.cpp | 7 +++---- 7 files changed, 11 insertions(+), 44 deletions(-) diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp index f6b9db6c1..0182a370d 100644 --- a/indra/llcommon/lluuid.cpp +++ b/indra/llcommon/lluuid.cpp @@ -171,14 +171,6 @@ void LLUUID::toString(std::string& out) const (U8)(mData[15])); } -// *TODO: deprecate -void LLUUID::toString(char *out) const -{ - std::string buffer; - toString(buffer); - strcpy(out,buffer.c_str()); /* Flawfinder: ignore */ -} - void LLUUID::toCompressedString(std::string& out) const { char bytes[UUID_BYTES+1]; @@ -187,13 +179,6 @@ void LLUUID::toCompressedString(std::string& out) const out.assign(bytes, UUID_BYTES); } -// *TODO: deprecate -void LLUUID::toCompressedString(char *out) const -{ - memcpy(out, mData, UUID_BYTES); /* Flawfinder: ignore */ - out[UUID_BYTES] = '\0'; -} - std::string LLUUID::getString() const { return asString(); @@ -422,14 +407,9 @@ std::ostream& operator<<(std::ostream& s, const LLUUID &uuid) std::istream& operator>>(std::istream &s, LLUUID &uuid) { - U32 i; - char uuid_str[UUID_STR_LENGTH]; /* Flawfinder: ignore */ - for (i = 0; i < UUID_STR_LENGTH-1; i++) - { - s >> uuid_str[i]; - } - uuid_str[i] = '\0'; - uuid.set(std::string(uuid_str)); + std::string uuid_str; + s >> uuid_str; + uuid.set(uuid_str); return s; } diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h index 4e5bed189..e7b1f525e 100644 --- a/indra/llcommon/lluuid.h +++ b/indra/llcommon/lluuid.h @@ -106,9 +106,7 @@ public: friend LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLUUID &uuid); friend LL_COMMON_API std::istream& operator>>(std::istream& s, LLUUID &uuid); - void toString(char *out) const; // Does not allocate memory, needs 36 characters (including \0) void toString(std::string& out) const; - void toCompressedString(char *out) const; // Does not allocate memory, needs 17 characters (including \0) void toCompressedString(std::string& out) const; std::string asString() const; diff --git a/indra/newview/linux_tools/wrapper.sh b/indra/newview/linux_tools/wrapper.sh index ff7fc48ae..af9d73189 100755 --- a/indra/newview/linux_tools/wrapper.sh +++ b/indra/newview/linux_tools/wrapper.sh @@ -154,7 +154,7 @@ export SL_OPT="`cat gridargs.dat` $@" eval ${SL_ENV} ${SL_CMD} ${SL_OPT} || LL_RUN_ERR=runerr # Handle any resulting errors -if [ -n "$LL_RUN_ERR" = "runerr" ]; then +if [ "$LL_RUN_ERR" = "runerr" ]; then # generic error running the binary echo '*** Bad shutdown. ***' fi diff --git a/indra/newview/llfloateravatarlist.cpp b/indra/newview/llfloateravatarlist.cpp index 388948ad0..8491aa192 100644 --- a/indra/newview/llfloateravatarlist.cpp +++ b/indra/newview/llfloateravatarlist.cpp @@ -1385,12 +1385,7 @@ void LLFloaterAvatarList::onClickGetKey() if (NULL == item) return; - LLUUID agent_id = item->getUUID(); - - char buffer[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ - agent_id.toString(buffer); - - gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(buffer)); + gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(item->getUUID().asString())); } void LLFloaterAvatarList::sendKeys() diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 4e33aba83..92c71d8bb 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -1876,11 +1876,9 @@ void LLPanelAvatar::onClickGetKey(void *userdata) LLPanelAvatar* self = (LLPanelAvatar*)userdata; LLUUID agent_id = self->getAvatarID(); - char buffer[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ - agent_id.toString(buffer); - llinfos << "Copy agent id: " << agent_id << " buffer: " << buffer << llendl; + llinfos << "Copy agent id: " << agent_id << llendl; - gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(buffer)); + gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(agent_id.asString())); } // static diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index d84e373f8..18aa99ed1 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -3247,10 +3247,7 @@ class LLAvatarCopyUUID : public view_listener_t LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); if(!avatar) return true; - LLUUID uuid = avatar->getID(); - char buffer[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ - uuid.toString(buffer); - gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(buffer)); + gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(avatar->getID().asString())); return true; } }; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 535f0879c..dbf9e1295 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3,10 +3,9 @@ * @brief LLVOVolume class implementation * * $LicenseInfo:firstyear=2001&license=viewergpl$ - * + * Second Life Viewer Source Code * Copyright (c) 2001-2009, Linden Research, Inc. * - * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -252,7 +251,7 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, S32 res2 = unpackTEMessage(*dp); if (TEM_INVALID == res2) { - // Well, crap, there's something bogus in the data that we're unpacking. + // There's something bogus in the data that we're unpacking. dp->dumpBufferToLog(); llwarns << "Flushing cache files" << llendl; @@ -3108,7 +3107,7 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons F32 w = wght[k]; LLMatrix4a src; - // Insure ref'd bone is in our clamped array of mats + // Ensure ref'd bone is in our clamped array of mats llassert(idx[k] < kMaxJoints); // clamp k to kMaxJoints to avoid reading garbage off stack in release src.setMul(mp[idx[(k < kMaxJoints) ? k : 0]], w);