From c6c49dedfe97bda785a346d30a7abcb80421c439 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Tue, 10 Feb 2015 11:41:23 +0100 Subject: [PATCH] Use size_t instead of S32 for std::string::find --- indra/newview/llstartup.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index b00fba183c..8342c6142e 100755 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -408,42 +408,41 @@ public: strstrm << istr.rdbuf(); std::string fetchedNews = strstrm.str(); - S32 itemStart = fetchedNews.find(""); - S32 itemEnd = fetchedNews.find(""); + size_t itemStart = fetchedNews.find(""); + size_t itemEnd = fetchedNews.find(""); if (itemEnd != std::string::npos && itemStart != std::string::npos) { - // Isolate latest news data itemStart += 6; std::string theNews = fetchedNews.substr(itemStart, itemEnd - itemStart); // Check for and remove CDATA characters if they're present - S32 titleStart = theNews.find("<![CDATA["); + size_t titleStart = theNews.find("<title><![CDATA["); if (titleStart != std::string::npos) { theNews.replace(titleStart, 16, "<title>"); } - S32 titleEnd = theNews.find("]]>"); + size_t titleEnd = theNews.find("]]>"); if (titleEnd != std::string::npos) { theNews.replace(titleEnd, 11, ""); } - S32 descStart = theNews.find(""); } - S32 descEnd = theNews.find("]]>"); + size_t descEnd = theNews.find("]]>"); if (descEnd != std::string::npos) { theNews.replace(descEnd, 17, ""); } - S32 linkStart = theNews.find(""); } - S32 linkEnd = theNews.find("]]>"); + size_t linkEnd = theNews.find("]]>"); if (linkEnd != std::string::npos) { theNews.replace(linkEnd, 10, ""); @@ -457,7 +456,12 @@ public: descEnd = theNews.find(""); linkEnd = theNews.find(""); - if (titleStart != std::string::npos && descStart != std::string::npos && linkStart != std::string::npos && titleEnd != std::string::npos && descEnd != std::string::npos && linkEnd != std::string::npos) + if (titleStart != std::string::npos && + descStart != std::string::npos && + linkStart != std::string::npos && + titleEnd != std::string::npos && + descEnd != std::string::npos && + linkEnd != std::string::npos) { titleStart += 7; descStart += 13; @@ -475,14 +479,12 @@ public: reportToNearbyChat(LLTrans::getString("SLGridStatusInvalidMsg")); LL_WARNS("SLGridStatusResponder") << "Error - inner tag(s) missing" << LL_ENDL; } - } else { reportToNearbyChat(LLTrans::getString("SLGridStatusInvalidMsg")); LL_WARNS("SLGridStatusResponder") << "Error - output without " << LL_ENDL; } - } }; //