Commit 22e453c3 authored by Rye Mutt's avatar Rye Mutt 🍞
Browse files

Clean up a bunch of bad LLSD loop usage

parent cf590645
......@@ -505,8 +505,8 @@ ELoadStatus LLBVHLoader::loadAliases(const char * filename)
{
if ( LLSDSerialize::fromXML(aliases_sd, input_stream) )
{
for(LLSD::map_iterator alias_iter = aliases_sd.beginMap();
alias_iter != aliases_sd.endMap();
for(LLSD::map_iterator alias_iter = aliases_sd.beginMap(), alias_end = aliases_sd.endMap();
alias_iter != alias_end;
++alias_iter)
{
LLSD::String alias_name = alias_iter->first;
......
......@@ -103,7 +103,7 @@ LLSD LLMetricPerformanceTesterBasic::analyzeMetricPerformanceLog(std::istream& i
while (!is.fail() && !is.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is))
{
for (auto iter = cur.beginMap(); iter != cur.endMap(); ++iter)
for (auto iter = cur.beginMap(), end = cur.endMap(); iter != end; ++iter)
{
std::string label = iter->first;
......
......@@ -105,9 +105,8 @@ void LLMetricsImpl::printTotals(LLSD metadata)
const std::string& location = (*loc_it).first;
const LLSD& loc_map = (*loc_it).second;
auto mesg_it = loc_map.beginMap();
auto mesg_end = loc_map.endMap();
for ( ; mesg_it != mesg_end; ++mesg_it)
for (auto mesg_it = loc_map.beginMap(),
mesg_end = loc_map.endMap(); mesg_it != mesg_end; ++mesg_it)
{
const std::string& mesg = (*mesg_it).first;
const LLSD& mesg_map = (*mesg_it).second;
......
......@@ -276,8 +276,8 @@ public:
out << "//////////////////////////" << std::endl;
// Iterate through the dictionary of configuration options.
LLSD configs = mProcessorInfo["config"];
for(LLSD::map_const_iterator cfgItr = configs.beginMap(); cfgItr != configs.endMap(); ++cfgItr)
const LLSD& configs = mProcessorInfo["config"];
for(LLSD::map_const_iterator cfgItr = configs.beginMap(), cfgEnd = configs.endMap(); cfgItr != cfgEnd; ++cfgItr)
{
out << cfgItr->first << " = " << cfgItr->second << std::endl;
}
......@@ -286,7 +286,8 @@ public:
out << "// CPU Extensions" << std::endl;
out << "//////////////////////////" << std::endl;
for(auto itr = mProcessorInfo["extension"].beginMap(); itr != mProcessorInfo["extension"].endMap(); ++itr)
const LLSD& extensions = mProcessorInfo["extension"];
for(auto itr = extensions.beginMap(), end = extensions.endMap(); itr != end; ++itr)
{
out << " " << itr->first << std::endl;
}
......
......@@ -103,7 +103,7 @@ nlohmann::json LlsdToJson(const LLSD &val)
result = val.asString();
break;
case LLSD::TypeMap:
for (auto it = val.beginMap(); it != val.endMap(); ++it)
for (auto it = val.beginMap(), it_end = val.endMap(); it != it_end; ++it)
{
result[it->first] = LlsdToJson(it->second);
}
......
......@@ -256,8 +256,8 @@ void LLParamSDParserUtilities::readSDValues(read_sd_cb_t cb, const LLSD& sd, LLI
{
if (sd.isMap())
{
for (auto it = sd.beginMap();
it != sd.endMap();
for (auto it = sd.beginMap(), it_end = sd.endMap();
it != it_end;
++it)
{
stack.push_back(make_pair(it->first, true));
......
......@@ -1298,9 +1298,8 @@ S32 LLSDNotationFormatter::format_impl(const LLSD& data, std::ostream& ostr, U32
}
bool need_comma = false;
auto iter = data.beginMap();
auto end = data.endMap();
for(; iter != end; ++iter)
for(auto iter = data.beginMap(), end = data.endMap(); iter != end; ++iter)
{
if(need_comma) ostr << ",";
need_comma = true;
......@@ -1445,9 +1444,8 @@ S32 LLSDBinaryFormatter::format(const LLSD& data, std::ostream& ostr, U32 option
ostr.put('{');
U32 size_nbo = htonl(data.size());
ostr.write(reinterpret_cast<const char*>(&size_nbo), sizeof(U32));
auto iter = data.beginMap();
auto end = data.endMap();
for(; iter != end; ++iter)
for(auto iter = data.beginMap(), end = data.endMap(); iter != end; ++iter)
{
ostr.put('k');
formatString((*iter).first, ostr);
......
......@@ -97,9 +97,8 @@ S32 LLSDXMLFormatter::format_impl(const LLSD& data, std::ostream& ostr, U32 opti
else
{
ostr << pre << "<map>" << post;
auto iter = data.beginMap();
auto end = data.endMap();
for(; iter != end; ++iter)
for(auto iter = data.beginMap(), end = data.endMap(); iter != end; ++iter)
{
ostr << pre << "<key>" << escapeString((*iter).first) << "</key>" << post;
format_count += format_impl((*iter).second, ostr, options, level + 1);
......
......@@ -276,12 +276,9 @@ BOOL compare_llsd_with_template(
//any excess is taken from the template
//excess is ignored in the test
LLSD value;
LLSD::map_const_iterator template_iter;
resultant_llsd = LLSD::emptyMap();
for (
template_iter = template_llsd.beginMap();
template_iter != template_llsd.endMap();
for (auto template_iter = template_llsd.beginMap(), template_end = template_llsd.endMap();
template_iter != template_end;
++template_iter)
{
if ( llsd_to_test.has(template_iter->first) )
......@@ -492,7 +489,7 @@ std::string llsd_matches(const LLSD& prototype, const LLSD& data, const std::str
out << colon(pfx);
const char* init = "Map missing keys: ";
const char* sep = init;
for (auto mi = prototype.beginMap(); mi != prototype.endMap(); ++mi)
for (auto mi = prototype.beginMap(), mi_end = prototype.endMap(); mi != mi_end; ++mi)
{
if (! data.has(mi->first))
{
......@@ -507,7 +504,7 @@ std::string llsd_matches(const LLSD& prototype, const LLSD& data, const std::str
}
// Good, the data block contains all the keys required by the
// prototype. Now match the prototype entries.
for (auto mi2 = prototype.beginMap(); mi2 != prototype.endMap(); ++mi2)
for (auto mi2 = prototype.beginMap(), mi2_end = prototype.endMap(); mi2 != mi2_end; ++mi2)
{
std::string match(llsd_matches(mi2->second, data[mi2->first],
STRINGIZE("['" << mi2->first << "']")));
......
......@@ -740,10 +740,9 @@ std::string LLURI::mapToQueryString(const LLSD& queryMap)
if (queryMap.isMap())
{
bool first_element = true;
auto iter = queryMap.beginMap();
auto end = queryMap.endMap();
std::ostringstream ostr;
for (; iter != end; ++iter)
for (auto iter = queryMap.beginMap(), end = queryMap.endMap(); iter != end; ++iter)
{
if(first_element)
{
......
......@@ -441,8 +441,7 @@ bool LLAvatarNameCache::importFile(std::istream& istr)
LLUUID agent_id;
LLAvatarName av_name;
LLSD::map_const_iterator it = agents.beginMap();
for ( ; it != agents.endMap(); ++it)
for (auto it = agents.beginMap(), end = agents.endMap(); it != end; ++it)
{
agent_id.set(it->first);
av_name.fromLLSD( it->second );
......
......@@ -320,9 +320,7 @@ bool LLCacheName::importFile(std::istream& istr)
// iterate over the agents
S32 count = 0;
LLSD agents = data[AGENTS];
LLSD::map_iterator iter = agents.beginMap();
LLSD::map_iterator end = agents.endMap();
for( ; iter != end; ++iter)
for(auto iter = agents.beginMap(), end = agents.endMap(); iter != end; ++iter)
{
LLUUID id((*iter).first);
LLSD agent = (*iter).second;
......@@ -344,9 +342,9 @@ bool LLCacheName::importFile(std::istream& istr)
count = 0;
LLSD groups = data[GROUPS];
iter = groups.beginMap();
end = groups.endMap();
for( ; iter != end; ++iter)
for(auto iter = groups.beginMap(),
end = groups.endMap(); iter != end; ++iter)
{
LLUUID id((*iter).first);
LLSD group = (*iter).second;
......
......@@ -136,7 +136,7 @@ void LLExperienceCache::importFile(std::istream& istr)
LLUUID public_key;
LLSD::map_const_iterator it = experiences.beginMap();
for (; it != experiences.endMap(); ++it)
for (auto it = experiences.beginMap(), end = experiences.endMap(); it != end; ++it)
{
public_key.set(it->first);
mCache[public_key] = it->second;
......
......@@ -171,9 +171,8 @@ void LLFilterSD2XMLRPC::streamOut(std::ostream& ostr, const LLSD& sd)
{
LL_INFOS() << "STREAM FAILURE writing struct" << LL_ENDL;
}
LLSD::map_const_iterator it = sd.beginMap();
LLSD::map_const_iterator end = sd.endMap();
for(; it != end; ++it)
for(auto it = sd.beginMap(), end = sd.endMap();
it != end; ++it)
{
ostr << "<member><name>" << xml_escape_string((*it).first)
<< "</name>";
......
......@@ -494,9 +494,7 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl(
LLSD headers = context[CONTEXT_RESPONSE][CONTEXT_HEADERS];
if(headers.isDefined())
{
LLSD::map_iterator iter = headers.beginMap();
LLSD::map_iterator end = headers.endMap();
for(; iter != end; ++iter)
for(auto iter = headers.beginMap(), end = headers.endMap(); iter != end; ++iter)
{
ostr << (*iter).first << ": " << (*iter).second.asString()
<< "\r\n";
......
......@@ -141,8 +141,7 @@ std::string LLKeywords::getArguments(LLSD& arguments)
LLSD& args = (*arrayIt);
if (args.isMap())
{
LLSD::map_iterator argsIt = args.beginMap();
for ( ; argsIt != args.endMap(); ++argsIt)
for (LLSD::map_const_iterator argsIt = args.beginMap(), argsEnd = args.endMap(); argsIt != argsEnd; ++argsIt)
{
argString += argsIt->second.get("type").asString() + " " + argsIt->first;
if (argsCount-- > 1)
......@@ -239,8 +238,7 @@ void LLKeywords::processTokens()
addToken(LLKeywordToken::TT_TWO_SIDED_DELIMITER, "/*", LLUIColorTable::instance().getColor("SyntaxLslComment"), "Comment (multi-line)\nNon-functional commentary or disabled code", "*/" );
addToken(LLKeywordToken::TT_DOUBLE_QUOTATION_MARKS, "\"", LLUIColorTable::instance().getColor("SyntaxLslStringLiteral"), "String literal", "\"" );
LLSD::map_iterator itr = mSyntax.beginMap();
for ( ; itr != mSyntax.endMap(); ++itr)
for (auto itr = mSyntax.beginMap(), ite = mSyntax.endMap(); itr != ite; ++itr)
{
if (itr->first == "llsd-lsl-syntax-version")
{
......@@ -300,15 +298,13 @@ void LLKeywords::processTokensGroup(const LLSD& tokens, const std::string& group
if (tokens.isMap())
{
LLSD::map_const_iterator outer_itr = tokens.beginMap();
for ( ; outer_itr != tokens.endMap(); ++outer_itr )
for (auto outer_itr = tokens.beginMap(), outer_ite = tokens.endMap(); outer_itr != outer_ite; ++outer_itr )
{
if (outer_itr->second.isMap())
{
mAttributes.clear();
LLSD arguments = LLSD();
LLSD::map_const_iterator inner_itr = outer_itr->second.beginMap();
for ( ; inner_itr != outer_itr->second.endMap(); ++inner_itr )
for (auto inner_itr = outer_itr->second.beginMap(), inner_ite = outer_itr->second.endMap(); inner_itr != inner_ite; ++inner_itr )
{
if (inner_itr->first == "arguments")
{
......
......@@ -140,9 +140,8 @@ void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from
// look at the current spot
// and see if anything is there
LLSD::map_iterator mIt = mValue.beginMap();
for(;mIt != mValue.endMap(); mIt++) {
for( auto mIt = mValue.beginMap(), multEnd = mValue.endMap(); mIt != multEnd; ++mIt)
{
F32 testVal = (F32)mIt->second.asReal() - newValue;
if(testVal > -FLOAT_THRESHOLD && testVal < FLOAT_THRESHOLD &&
mIt->first != name) {
......@@ -186,7 +185,7 @@ void LLMultiSlider::setValue(const LLSD& value)
LLSD::map_const_iterator mIt = value.beginMap();
mCurSlider = mIt->first;
for(; mIt != value.endMap(); mIt++) {
for(auto mEnd = value.endMap(); mIt != mEnd; ++mIt) {
setSliderValue(mIt->first, (F32)mIt->second.asReal(), TRUE);
}
}
......@@ -276,9 +275,8 @@ bool LLMultiSlider::findUnusedValue(F32& initVal)
// look at the current spot
// and see if anything is there
LLSD::map_iterator mIt = mValue.beginMap();
for(;mIt != mValue.endMap(); mIt++) {
for (auto mIt = mValue.beginMap(), multEnd = mValue.endMap(); mIt != multEnd; ++mIt)
{
F32 testVal = (F32)mIt->second.asReal() - initVal;
if(testVal > -FLOAT_THRESHOLD && testVal < FLOAT_THRESHOLD) {
hit = true;
......
......@@ -652,8 +652,8 @@ S32 LLNotification::getSelectedOption(const LLSD& notification, const LLSD& resp
//static
std::string LLNotification::getSelectedOptionName(const LLSD& response)
{
for (LLSD::map_const_iterator response_it = response.beginMap();
response_it != response.endMap();
for (LLSD::map_const_iterator response_it = response.beginMap(), response_end = response.endMap();
response_it != response_end;
++response_it)
{
if (response_it->second.isBoolean() && response_it->second.asBoolean())
......
......@@ -61,8 +61,8 @@ void LLUIString::setArgs(const LLSD& sd)
LL_RECORD_BLOCK_TIME(FTM_UI_STRING);
if (!sd.isMap()) return;
for(LLSD::map_const_iterator sd_it = sd.beginMap();
sd_it != sd.endMap();
for(LLSD::map_const_iterator sd_it = sd.beginMap(), sd_end = sd.endMap();
sd_it != sd_end;
++sd_it)
{
setArg(sd_it->first, sd_it->second.asString());
......
......@@ -997,7 +997,7 @@ U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_v
U32 validitems = 0;
bool hidefromsettingseditor = false;
for(LLSD::map_const_iterator itr = settings.beginMap(); itr != settings.endMap(); ++itr)
for(LLSD::map_const_iterator itr = settings.beginMap(), ite = settings.endMap(); itr != ite; ++itr)
{
LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT;
std::string const & name = itr->first;
......
Markdown is supported
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