From 1949db26fc88b2cbded20c5a12f761b51df2d19b Mon Sep 17 00:00:00 2001 From: Drake Arconis <drake@alchemyviewer.org> Date: Mon, 12 Dec 2016 22:45:49 -0500 Subject: [PATCH] I apply more optimization paste nao --- indra/llcharacter/llbvhloader.cpp | 4 ++-- indra/llcommon/llerror.cpp | 2 +- indra/llcorehttp/llhttpconstants.cpp | 2 +- indra/llplugin/llplugincookiestore.cpp | 6 +++--- indra/llprimitive/llmodelloader.cpp | 2 +- indra/llprimitive/lltextureentry.cpp | 4 ++-- indra/llui/llurlregistry.cpp | 2 +- indra/llxml/llxmlnode.cpp | 2 +- indra/llxml/llxmltree.cpp | 2 +- indra/newview/llaoengine.cpp | 8 ++++---- indra/newview/lleasymessagereader.cpp | 2 +- indra/newview/lleasymessagesender.cpp | 2 +- indra/newview/llfloatergodtools.cpp | 4 ++-- indra/newview/llfloatermessagelog.cpp | 2 +- indra/newview/llfloateruipreview.cpp | 4 ++-- indra/newview/llfloaterurlentry.cpp | 2 +- indra/newview/llimview.cpp | 2 +- indra/newview/llinventorybridge.cpp | 2 +- indra/newview/llstartup.cpp | 2 +- indra/newview/lltranslate.cpp | 2 +- indra/newview/llviewermedia.cpp | 8 ++++---- indra/newview/llviewermenu.cpp | 4 ++-- indra/newview/llviewernetwork.cpp | 2 +- indra/newview/llviewerobject.cpp | 2 +- indra/newview/llviewertexture.cpp | 4 ++-- indra/newview/llvoicevivox.cpp | 2 +- 26 files changed, 40 insertions(+), 40 deletions(-) diff --git a/indra/llcharacter/llbvhloader.cpp b/indra/llcharacter/llbvhloader.cpp index 841737208c..ef3f6b70df 100644 --- a/indra/llcharacter/llbvhloader.cpp +++ b/indra/llcharacter/llbvhloader.cpp @@ -611,7 +611,7 @@ ELoadStatus LLBVHLoader::loadBVHFile(const char *buffer, char* error_text, S32 & //---------------------------------------------------------------- // consume } //---------------------------------------------------------------- - if ( strstr(line.c_str(), "}") ) + if ( strstr(line.c_str(), '}') ) { if (parent_joints.size() > 0) { @@ -719,7 +719,7 @@ ELoadStatus LLBVHLoader::loadBVHFile(const char *buffer, char* error_text, S32 & //---------------------------------------------------------------- // it must be { //---------------------------------------------------------------- - if ( !strstr(line.c_str(), "{") ) + if ( !strstr(line.c_str(), '{') ) { strncpy(error_text, line.c_str(), 127); /*Flawfinder: ignore*/ return E_ST_NO_OFFSET; diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index e0b48e37e3..97cb50b3e4 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -1111,7 +1111,7 @@ namespace LLError return; } - if(strlen(out->str().c_str()) < 128) + if(out->str().size() < 128) { strcpy(message, out->str().c_str()); } diff --git a/indra/llcorehttp/llhttpconstants.cpp b/indra/llcorehttp/llhttpconstants.cpp index 5e04cdff9c..f5417963c2 100644 --- a/indra/llcorehttp/llhttpconstants.cpp +++ b/indra/llcorehttp/llhttpconstants.cpp @@ -197,7 +197,7 @@ std::string get_base_cap_url(std::string url) // Maybe OpenSim? Just cut off the query string and last /. else { - size_t query_pos = url.find_first_of("\?"); + size_t query_pos = url.find_first_of('\?'); if(query_pos != std::string::npos) { diff --git a/indra/llplugin/llplugincookiestore.cpp b/indra/llplugin/llplugincookiestore.cpp index b9a82b702b..0d4ee136f8 100644 --- a/indra/llplugin/llplugincookiestore.cpp +++ b/indra/llplugin/llplugincookiestore.cpp @@ -136,7 +136,7 @@ bool LLPluginCookieStore::Cookie::parse(const std::string &host) } // the name and value are separated by the first equals sign - std::string::size_type name_value_sep = mCookie.find_first_of("=", name_start); + std::string::size_type name_value_sep = mCookie.find_first_of('=', name_start); if(name_value_sep == std::string::npos || name_value_sep > field_end) { // No separator found, so this is a field without an = @@ -272,7 +272,7 @@ bool LLPluginCookieStore::Cookie::parse(const std::string &host) } // Figure out whether this cookie ended with a ";" or not... - std::string::size_type last_char = mCookie.find_last_not_of(" "); + std::string::size_type last_char = mCookie.find_last_not_of(' '); if((last_char != std::string::npos) && (mCookie[last_char] != ';')) { mCookie += ";"; @@ -290,7 +290,7 @@ bool LLPluginCookieStore::Cookie::parse(const std::string &host) if(mPathEnd <= mPathStart) { // Figure out whether this cookie ended with a ";" or not... - std::string::size_type last_char = mCookie.find_last_not_of(" "); + std::string::size_type last_char = mCookie.find_last_not_of(' '); if((last_char != std::string::npos) && (mCookie[last_char] != ';')) { mCookie += ";"; diff --git a/indra/llprimitive/llmodelloader.cpp b/indra/llprimitive/llmodelloader.cpp index bf45014398..5be1e2d0b4 100644 --- a/indra/llprimitive/llmodelloader.cpp +++ b/indra/llprimitive/llmodelloader.cpp @@ -155,7 +155,7 @@ bool LLModelLoader::getSLMFilename(const std::string& model_filename, std::strin { slm_filename = model_filename; - std::string::size_type i = model_filename.rfind("."); + std::string::size_type i = model_filename.rfind('.'); if (i != std::string::npos) { slm_filename.replace(i, model_filename.size()-1, ".slm"); diff --git a/indra/llprimitive/lltextureentry.cpp b/indra/llprimitive/lltextureentry.cpp index da0d94b0ca..b15fae66d4 100644 --- a/indra/llprimitive/lltextureentry.cpp +++ b/indra/llprimitive/lltextureentry.cpp @@ -643,7 +643,7 @@ U32 LLTextureEntry::getVersionFromMediaVersionString(const std::string &version_ size_t found = version_string.find(MEDIA_VERSION_STRING_PREFIX); if (found != std::string::npos) { - found = version_string.find_first_of("/", found); + found = version_string.find_first_of('/', found); std::string v = version_string.substr(MEDIA_VERSION_STRING_PREFIX.length(), found); version = strtoul(v.c_str(),NULL,10); } @@ -660,7 +660,7 @@ LLUUID LLTextureEntry::getAgentIDFromMediaVersionString(const std::string &versi size_t found = version_string.find(MEDIA_VERSION_STRING_PREFIX); if (found != std::string::npos) { - found = version_string.find_first_of("/", found); + found = version_string.find_first_of('/', found); if (found != std::string::npos) { std::string v = version_string.substr(found + 1); diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index cee483d43e..f8d2008549 100644 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -159,7 +159,7 @@ static bool stringHasUrl(const std::string &text) text.find(".com") != std::string::npos || text.find("<nolink>") != std::string::npos || text.find("<icon") != std::string::npos || - text.find("@") != std::string::npos); + text.find('@') != std::string::npos); } // <alchemy> diff --git a/indra/llxml/llxmlnode.cpp b/indra/llxml/llxmlnode.cpp index a536e9f1ca..4c4e646b11 100644 --- a/indra/llxml/llxmlnode.cpp +++ b/indra/llxml/llxmlnode.cpp @@ -3243,7 +3243,7 @@ std::string LLXMLNode::getTextContents() const // mContents[m] == '"' num_lines++; msg += contents.substr(n,m-n) + "\n"; - n = contents.find_first_of("\"", m+1); + n = contents.find_first_of('\"', m+1); if (n == std::string::npos) { if (num_lines == 1) diff --git a/indra/llxml/llxmltree.cpp b/indra/llxml/llxmltree.cpp index 7a0f36f265..2e2fa285eb 100644 --- a/indra/llxml/llxmltree.cpp +++ b/indra/llxml/llxmltree.cpp @@ -478,7 +478,7 @@ std::string LLXmlTreeNode::getTextContents() // mContents[m] == '"' num_lines++; msg += mContents.substr(n,m-n) + "\n"; - n = mContents.find_first_of("\"", m+1); + n = mContents.find_first_of('\"', m+1); if (n == std::string::npos) { if (num_lines == 1) diff --git a/indra/newview/llaoengine.cpp b/indra/newview/llaoengine.cpp index bd312ac884..6b1314d4d5 100644 --- a/indra/newview/llaoengine.cpp +++ b/indra/newview/llaoengine.cpp @@ -1328,7 +1328,7 @@ void LLAOEngine::saveSet(const LLAOSet* set) bool LLAOEngine::renameSet(LLAOSet* set, const std::string& name) { - if (name.empty() || name.find(":") != std::string::npos) + if (name.empty() || name.find(':') != std::string::npos) { return false; } @@ -1693,7 +1693,7 @@ void LLAOEngine::parseNotecard(const char* buffer) if (line.empty() || line[0] == '#') continue; - if (line.find("[") != 0) + if (line.find('[') != 0) { LLSD args; args["LINE"] = (S32)index; @@ -1701,14 +1701,14 @@ void LLAOEngine::parseNotecard(const char* buffer) continue; } - if (line.find("]") == std::string::npos) + if (line.find(']') == std::string::npos) { LLSD args; args["LINE"] = (S32)index; LLNotificationsUtil::add("AOImportNoValidDelimiter", args); continue; } - U32 endTag = line.find("]"); + U32 endTag = line.find(']'); std::string stateName = line.substr(1, endTag - 1); LLStringUtil::trim(stateName); diff --git a/indra/newview/lleasymessagereader.cpp b/indra/newview/lleasymessagereader.cpp index 11c6ffa3f2..f7680ff6ca 100644 --- a/indra/newview/lleasymessagereader.cpp +++ b/indra/newview/lleasymessagereader.cpp @@ -216,7 +216,7 @@ std::string LLEasyMessageLogEntry::getFull(BOOL beautify, BOOL show_header) if(!content_type.empty()) { - std::string parsed_content_type = content_type.substr(0, content_type.find_first_of(";")); + std::string parsed_content_type = content_type.substr(0, content_type.find_first_of(';')); boost::algorithm::trim(parsed_content_type); // trim excess data boost::algorithm::to_lower(parsed_content_type); // convert to lowercase if(parsed_content_type == "application/llsd+xml" || parsed_content_type == "application/xml") diff --git a/indra/newview/lleasymessagesender.cpp b/indra/newview/lleasymessagesender.cpp index 753359ed32..f08afd1002 100644 --- a/indra/newview/lleasymessagesender.cpp +++ b/indra/newview/lleasymessagesender.cpp @@ -132,7 +132,7 @@ bool LLEasyMessageSender::sendLLUDPMessage(const LLHost& region_host, const std: return false; } - int eqpos = line.find("="); + int eqpos = line.find('='); if(eqpos == line.npos) { LLNotificationsUtil::add("GenericAlert", LLSD().with("MESSAGE", "Missing an equal sign")); diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp index a455c8e6d9..c41df53031 100644 --- a/indra/newview/llfloatergodtools.cpp +++ b/indra/newview/llfloatergodtools.cpp @@ -1279,7 +1279,7 @@ void LLPanelRequestTools::onClickRequest() if(dest == SELECTION) { std::string req =getChild<LLUICtrl>("request")->getValue(); - req = req.substr(0, req.find_first_of(" ")); + req = req.substr(0, req.find_first_of(' ')); std::string param = getChild<LLUICtrl>("parameter")->getValue(); LLSelectMgr::getInstance()->sendGodlikeRequest(req, param); } @@ -1330,7 +1330,7 @@ void LLPanelRequestTools::sendRequest(const LLHost& host) } else { - req = req.substr(0, req.find_first_of(" ")); + req = req.substr(0, req.find_first_of(' ')); sendRequest(req, getChild<LLUICtrl>("parameter")->getValue().asString(), host); } } diff --git a/indra/newview/llfloatermessagelog.cpp b/indra/newview/llfloatermessagelog.cpp index 3a9ed5df14..f3b2f28eb3 100644 --- a/indra/newview/llfloatermessagelog.cpp +++ b/indra/newview/llfloatermessagelog.cpp @@ -63,7 +63,7 @@ void LLMessageLogFilter::set(const std::string& filter) { LLStringUtil::toLower(token); - BOOL negative = token.find("!") == 0; + BOOL negative = token.find('!') == 0; if(negative) { token = token.substr(1); diff --git a/indra/newview/llfloateruipreview.cpp b/indra/newview/llfloateruipreview.cpp index 154788c744..ab82ecd371 100644 --- a/indra/newview/llfloateruipreview.cpp +++ b/indra/newview/llfloateruipreview.cpp @@ -511,7 +511,7 @@ BOOL LLFloaterUIPreview::postBuild() } if(strncmp("template",language_directory.c_str(),8) // if it's not the template directory or a hidden directory - && std::string::npos == language_directory.find(".")) + && std::string::npos == language_directory.find('.')) { if(!strncmp("en",language_directory.c_str(),5)) // remember if we've seen en, so we can make it default { @@ -989,7 +989,7 @@ void LLFloaterUIPreview::onClickEditFloater() if (!bin.empty()) { // surround command with double quotes for the case if the path contains spaces - if (bin.find("\"") == std::string::npos) + if (bin.find('\"') == std::string::npos) { bin = "\"" + bin + "\""; } diff --git a/indra/newview/llfloaterurlentry.cpp b/indra/newview/llfloaterurlentry.cpp index 0a1a7a7bc0..de52db3442 100644 --- a/indra/newview/llfloaterurlentry.cpp +++ b/indra/newview/llfloaterurlentry.cpp @@ -247,7 +247,7 @@ void LLFloaterURLEntry::getMediaTypeCoro(std::string url, LLHandle<LLFloater> pa if (resultHeaders.has(HTTP_IN_HEADER_CONTENT_TYPE)) { const std::string& mediaType = resultHeaders[HTTP_IN_HEADER_CONTENT_TYPE]; - std::string::size_type idx1 = mediaType.find_first_of(";"); + std::string::size_type idx1 = mediaType.find_first_of(';'); std::string mimeType = mediaType.substr(0, idx1); if (!mimeType.empty()) { diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 9a4571d970..83ff51c741 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -627,7 +627,7 @@ void LLIMModel::LLIMSession::onAdHocNameCache(const LLAvatarName& av_name) if (!av_name.isValidName()) { - size_t separator_index = mName.rfind(" "); + size_t separator_index = mName.rfind(' '); std::string name = mName.substr(0, separator_index); ++separator_index; std::string conference_word = mName.substr(separator_index, mName.length()); diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 942b7935d9..55a43259c8 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -3247,7 +3247,7 @@ void LLFolderBridge::gatherMessage(std::string& message, S32 depth, LLError::ELe return; } // Take the leading spaces out... - std::string::size_type start = message.find_first_not_of(" "); + std::string::size_type start = message.find_first_not_of(' '); // Append the message mMessage += message.substr(start, message.length() - start); } diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index f17465a232..713c76577e 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -3168,7 +3168,7 @@ void apply_udp_blacklist(const std::string& csv) std::string::size_type comma = 0; do { - comma = csv.find(",", start); + comma = csv.find(',', start); if (comma == std::string::npos) { comma = csv.length(); diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp index 82bc8636e0..ef75034e2f 100644 --- a/indra/newview/lltranslate.cpp +++ b/indra/newview/lltranslate.cpp @@ -470,7 +470,7 @@ bool LLBingTranslationHandler::parseResponse( } // Sample response: <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">Hola</string> - size_t begin = body.find(">"); + size_t begin = body.find('>'); if (begin == std::string::npos || begin >= (body.size() - 1)) { begin = 0; diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index e159b18f96..0ea68be553 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -1206,11 +1206,11 @@ LLSD LLViewerMedia::getHeaders() // static bool LLViewerMedia::parseRawCookie(const std::string raw_cookie, std::string& name, std::string& value, std::string& path, bool& httponly, bool& secure) { - std::size_t name_pos = raw_cookie.find_first_of("="); + std::size_t name_pos = raw_cookie.find_first_of('='); if (name_pos != std::string::npos) { name = raw_cookie.substr(0, name_pos); - std::size_t value_pos = raw_cookie.find_first_of(";", name_pos); + std::size_t value_pos = raw_cookie.find_first_of(';', name_pos); if (value_pos != std::string::npos) { value = raw_cookie.substr(name_pos + 1, value_pos - name_pos - 1); @@ -1360,7 +1360,7 @@ void LLViewerMedia::getOpenIDCookieCoro(std::string url) LLViewerMedia::getCookieStore()->setCookiesFromHost(cookie, hostAuth); // Set cookie for snapshot publishing. - std::string authCookie = cookie.substr(0, cookie.find(";")); // strip path + std::string authCookie = cookie.substr(0, cookie.find(';')); // strip path LLWebProfile::setAuthCookie(authCookie); } @@ -2715,7 +2715,7 @@ void LLViewerMediaImpl::mimeDiscoveryCoro(std::string url) const std::string& mediaType = resultHeaders[HTTP_IN_HEADER_CONTENT_TYPE].asStringRef(); - std::string::size_type idx1 = mediaType.find_first_of(";"); + std::string::size_type idx1 = mediaType.find_first_of(';'); std::string mimeType = mediaType.substr(0, idx1); // We now no longer need to check the error code returned from the probe. diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 788e91023c..44359e5db8 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -6603,7 +6603,7 @@ class LLPromptShowURL : public view_listener_t bool handleEvent(const LLSD& userdata) { std::string param = userdata.asString(); - std::string::size_type offset = param.find(","); + std::string::size_type offset = param.find(','); if (offset != param.npos) { std::string alert = param.substr(0, offset); @@ -6643,7 +6643,7 @@ class LLPromptShowFile : public view_listener_t bool handleEvent(const LLSD& userdata) { std::string param = userdata.asString(); - std::string::size_type offset = param.find(","); + std::string::size_type offset = param.find(','); if (offset != param.npos) { std::string alert = param.substr(0, offset); diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp index ef9ee6b334..2e235cdd8a 100644 --- a/indra/newview/llviewernetwork.cpp +++ b/indra/newview/llviewernetwork.cpp @@ -455,7 +455,7 @@ void LLGridManager::addRemoteGrid(const std::string& login_uri, const EAddGridTy } // Trim any ending slash - size_t slash_pos = grid.find_last_of("/"); + size_t slash_pos = grid.find_last_of('/'); if (grid.length() - 1 == slash_pos) { grid.erase(slash_pos); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 883f3b7965..becd26edda 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -669,7 +669,7 @@ void LLViewerObject::setNameValueList(const std::string& name_value_list) std::string::size_type start = 0; while (start < length) { - std::string::size_type end = name_value_list.find_first_of("\n", start); + std::string::size_type end = name_value_list.find_first_of('\n', start); if (end == std::string::npos) end = length; if (end > start) { diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 1f3ca31bd8..681a5e9cc3 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1484,11 +1484,11 @@ BOOL LLViewerFetchedTexture::createTexture(S32 usename/*= 0*/) size_t length = comment.length(); while (position < length) { - std::size_t equals_position = comment.find("=", position); + std::size_t equals_position = comment.find('=', position); if (equals_position != std::string::npos) { S8 type = comment.at(equals_position - 1); - position = comment.find("&", position); + position = comment.find('&', position); if (position != std::string::npos) { mComment[type] = comment.substr(equals_position + 1, position - (equals_position + 1)); diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 12b8c8cb92..c8acb8650f 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -4598,7 +4598,7 @@ std::string LLVivoxVoiceClient::nameFromsipURI(const std::string &uri) std::string::size_type sipOffset, atOffset; sipOffset = uri.find("sip:"); - atOffset = uri.find("@"); + atOffset = uri.find('@'); if((sipOffset != std::string::npos) && (atOffset != std::string::npos)) { result = uri.substr(sipOffset + 4, atOffset - (sipOffset + 4)); -- GitLab