Cleanup for loops in llcommon to use C++11 range based for loops
parent
d0f115ae09
commit
9e743c99fb
|
|
@ -131,14 +131,13 @@ void LLAllocatorHeapProfile::parse(std::string const & prof_text)
|
|||
void LLAllocatorHeapProfile::dump(std::ostream & out) const
|
||||
{
|
||||
lines_t::const_iterator i;
|
||||
for(i = mLines.begin(); i != mLines.end(); ++i)
|
||||
for (const LLAllocatorHeapProfile::line& line : mLines)
|
||||
{
|
||||
out << i->mLiveCount << ": " << i->mLiveSize << '[' << i->mTotalCount << ": " << i->mTotalSize << "] @";
|
||||
out << line.mLiveCount << ": " << line.mLiveSize << '[' << line.mTotalCount << ": " << line.mTotalSize << "] @";
|
||||
|
||||
stack_trace::const_iterator j;
|
||||
for(j = i->mTrace.begin(); j != i->mTrace.end(); ++j)
|
||||
for (const stack_marker marker : line.mTrace)
|
||||
{
|
||||
out << ' ' << *j;
|
||||
out << ' ' << marker;
|
||||
}
|
||||
out << '\n';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,14 +150,12 @@ LLAssetType::EType LLAssetType::lookup(const char* name)
|
|||
LLAssetType::EType LLAssetType::lookup(const std::string& type_name)
|
||||
{
|
||||
const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
|
||||
for (LLAssetDictionary::const_iterator iter = dict->begin();
|
||||
iter != dict->end();
|
||||
iter++)
|
||||
for (const LLAssetDictionary::value_type pair : *dict)
|
||||
{
|
||||
const AssetEntry *entry = iter->second;
|
||||
const AssetEntry *entry = pair.second;
|
||||
if (type_name == entry->mTypeName)
|
||||
{
|
||||
return iter->first;
|
||||
return pair.first;
|
||||
}
|
||||
}
|
||||
return AT_UNKNOWN;
|
||||
|
|
@ -188,14 +186,12 @@ LLAssetType::EType LLAssetType::lookupHumanReadable(const char* name)
|
|||
LLAssetType::EType LLAssetType::lookupHumanReadable(const std::string& readable_name)
|
||||
{
|
||||
const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
|
||||
for (LLAssetDictionary::const_iterator iter = dict->begin();
|
||||
iter != dict->end();
|
||||
iter++)
|
||||
for (const LLAssetDictionary::value_type pair : *dict)
|
||||
{
|
||||
const AssetEntry *entry = iter->second;
|
||||
const AssetEntry *entry = pair.second;
|
||||
if (entry->mHumanName && (readable_name == entry->mHumanName))
|
||||
{
|
||||
return iter->first;
|
||||
return pair.first;
|
||||
}
|
||||
}
|
||||
return AT_NONE;
|
||||
|
|
|
|||
|
|
@ -109,10 +109,9 @@ void LLCallbackList::deleteAllFunctions()
|
|||
|
||||
void LLCallbackList::callFunctions()
|
||||
{
|
||||
for (callback_list_t::iterator iter = mCallbackList.begin(); iter != mCallbackList.end(); )
|
||||
for (callback_list_t::value_type pair : mCallbackList)
|
||||
{
|
||||
callback_list_t::iterator curiter = iter++;
|
||||
curiter->first(curiter->second);
|
||||
pair.first(pair.second);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -91,10 +91,9 @@ LLCallStack::LLCallStack(S32 skip_count, bool verbose):
|
|||
|
||||
bool LLCallStack::contains(const std::string& str)
|
||||
{
|
||||
for (std::vector<std::string>::const_iterator it = m_strings.begin();
|
||||
it != m_strings.end(); ++it)
|
||||
for (const std::string& src_str : m_strings)
|
||||
{
|
||||
if (it->find(str) != std::string::npos)
|
||||
if (src_str.find(str) != std::string::npos)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -105,10 +104,9 @@ bool LLCallStack::contains(const std::string& str)
|
|||
std::ostream& operator<<(std::ostream& s, const LLCallStack& call_stack)
|
||||
{
|
||||
#ifndef LL_RELEASE_FOR_DOWNLOAD
|
||||
std::vector<std::string>::const_iterator it;
|
||||
for (it=call_stack.m_strings.begin(); it!=call_stack.m_strings.end(); ++it)
|
||||
for (const std::string& str : call_stack.m_strings)
|
||||
{
|
||||
s << *it;
|
||||
s << str;
|
||||
}
|
||||
#else
|
||||
s << "UNAVAILABLE IN RELEASE";
|
||||
|
|
@ -156,9 +154,9 @@ bool LLContextStrings::contains(const std::string& str)
|
|||
{
|
||||
const std::map<std::string,S32>& strings =
|
||||
LLThreadLocalSingletonPointer<LLContextStrings>::getInstance()->m_contextStrings;
|
||||
for (std::map<std::string,S32>::const_iterator it = strings.begin(); it!=strings.end(); ++it)
|
||||
for (const std::map<std::string,S32>::value_type str_pair : strings)
|
||||
{
|
||||
if (it->first.find(str) != std::string::npos)
|
||||
if (str_pair.first.find(str) != std::string::npos)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -171,9 +169,9 @@ void LLContextStrings::output(std::ostream& os)
|
|||
{
|
||||
const std::map<std::string,S32>& strings =
|
||||
LLThreadLocalSingletonPointer<LLContextStrings>::getInstance()->m_contextStrings;
|
||||
for (std::map<std::string,S32>::const_iterator it = strings.begin(); it!=strings.end(); ++it)
|
||||
for (const std::map<std::string,S32>::value_type str_pair : strings)
|
||||
{
|
||||
os << it->first << "[" << it->second << "]" << "\n";
|
||||
os << str_pair.first << "[" << str_pair.second << "]" << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -514,21 +514,16 @@ public:
|
|||
// former broken behavior has finally been fixed -- and our builds
|
||||
// treat warnings as errors.
|
||||
{
|
||||
for (typename DepNodeMap::const_iterator nmi = mNodes.begin(), nmend = mNodes.end();
|
||||
nmi != nmend; ++nmi)
|
||||
for (typename const DepNodeMap::value_type nm_pair : mNodes)
|
||||
{
|
||||
vmap.insert(typename VertexMap::value_type(nmi->first, vmap.size()));
|
||||
for (typename DepNode::dep_set::const_iterator ai = nmi->second.after.begin(),
|
||||
aend = nmi->second.after.end();
|
||||
ai != aend; ++ai)
|
||||
vmap.insert(typename VertexMap::value_type(nm_pair.first, vmap.size()));
|
||||
for (typename const KEY& after_k : nm_pair.second.after)
|
||||
{
|
||||
vmap.insert(typename VertexMap::value_type(*ai, vmap.size()));
|
||||
vmap.insert(typename VertexMap::value_type(after_k, vmap.size()));
|
||||
}
|
||||
for (typename DepNode::dep_set::const_iterator bi = nmi->second.before.begin(),
|
||||
bend = nmi->second.before.end();
|
||||
bi != bend; ++bi)
|
||||
for (typename const KEY& before_k : nm_pair.second.before)
|
||||
{
|
||||
vmap.insert(typename VertexMap::value_type(*bi, vmap.size()));
|
||||
vmap.insert(typename VertexMap::value_type(before_k, vmap.size()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -536,24 +531,19 @@ public:
|
|||
// all the known key dependencies to integer pairs.
|
||||
EdgeList edges;
|
||||
{
|
||||
for (typename DepNodeMap::const_iterator nmi = mNodes.begin(), nmend = mNodes.end();
|
||||
nmi != nmend; ++nmi)
|
||||
for (typename const DepNodeMap::value_type nm_pair : mNodes)
|
||||
{
|
||||
auto thisnode = vmap[nmi->first];
|
||||
auto thisnode = vmap[nm_pair.first];
|
||||
// after dependencies: build edges from the named node to this one
|
||||
for (typename DepNode::dep_set::const_iterator ai = nmi->second.after.begin(),
|
||||
aend = nmi->second.after.end();
|
||||
ai != aend; ++ai)
|
||||
for (typename const KEY& after_k : nm_pair.second.after)
|
||||
{
|
||||
edges.push_back(EdgeList::value_type(vmap[*ai], thisnode));
|
||||
edges.push_back(EdgeList::value_type(vmap[after_k], thisnode));
|
||||
}
|
||||
// before dependencies: build edges from this node to the
|
||||
// named one
|
||||
for (typename DepNode::dep_set::const_iterator bi = nmi->second.before.begin(),
|
||||
bend = nmi->second.before.end();
|
||||
bi != bend; ++bi)
|
||||
for (typename const KEY& before_k : nm_pair.second.before)
|
||||
{
|
||||
edges.push_back(EdgeList::value_type(thisnode, vmap[*bi]));
|
||||
edges.push_back(EdgeList::value_type(thisnode, vmap[before_k]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -565,21 +555,19 @@ public:
|
|||
// and we're certain that the associated int values are distinct
|
||||
// indexes. The fact that they're not in order is irrelevant.
|
||||
KeyList vkeys(vmap.size());
|
||||
for (typename VertexMap::const_iterator vmi = vmap.begin(), vmend = vmap.end();
|
||||
vmi != vmend; ++vmi)
|
||||
for (typename const VertexMap::value_type vm_pair : vmap)
|
||||
{
|
||||
vkeys[vmi->second] = vmi->first;
|
||||
vkeys[vm_pair.second] = vm_pair.first;
|
||||
}
|
||||
// Walk the sorted output list, building the result into mCache so
|
||||
// we'll have it next time someone asks.
|
||||
mCache.clear();
|
||||
for (VertexList::const_iterator svi = sorted.begin(), svend = sorted.end();
|
||||
svi != svend; ++svi)
|
||||
for (const size_t sv : sorted)
|
||||
{
|
||||
// We're certain that vkeys[*svi] exists. However, there might not
|
||||
// We're certain that vkeys[sv] exists. However, there might not
|
||||
// yet be a corresponding entry in mNodes.
|
||||
self_type* non_const_this(const_cast<self_type*>(this));
|
||||
typename DepNodeMap::iterator found = non_const_this->mNodes.find(vkeys[*svi]);
|
||||
typename DepNodeMap::iterator found = non_const_this->mNodes.find(vkeys[sv]);
|
||||
if (found != non_const_this->mNodes.end())
|
||||
{
|
||||
// Make an iterator of appropriate type.
|
||||
|
|
|
|||
|
|
@ -586,11 +586,9 @@ namespace
|
|||
|
||||
void Globals::invalidateCallSites()
|
||||
{
|
||||
for (CallSiteVector::const_iterator i = callSites.begin();
|
||||
i != callSites.end();
|
||||
++i)
|
||||
for (LLError::CallSite* site : callSites)
|
||||
{
|
||||
(*i)->invalidate();
|
||||
site->invalidate();
|
||||
}
|
||||
|
||||
callSites.clear();
|
||||
|
|
@ -1224,12 +1222,8 @@ namespace
|
|||
std::string escaped_message;
|
||||
|
||||
LLMutexLock lock(&s->mRecorderMutex);
|
||||
for (Recorders::const_iterator i = s->mRecorders.begin();
|
||||
i != s->mRecorders.end();
|
||||
++i)
|
||||
for (LLError::RecorderPtr r : s->mRecorders)
|
||||
{
|
||||
LLError::RecorderPtr r = *i;
|
||||
|
||||
if (!r->enabled())
|
||||
{
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -203,10 +203,9 @@ void LLSimpleDispatcher::removeListener(LLEventListener* listener)
|
|||
std::vector<LLListenerEntry> LLSimpleDispatcher::getListeners() const
|
||||
{
|
||||
std::vector<LLListenerEntry> ret;
|
||||
std::vector<LLListenerEntry>::const_iterator itor;
|
||||
for (itor=mListeners.begin(); itor!=mListeners.end(); ++itor)
|
||||
for (const LLListenerEntry& entry : mListeners)
|
||||
{
|
||||
ret.push_back(*itor);
|
||||
ret.push_back(entry);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
@ -215,14 +214,12 @@ std::vector<LLListenerEntry> LLSimpleDispatcher::getListeners() const
|
|||
// virtual
|
||||
bool LLSimpleDispatcher::fireEvent(LLPointer<LLEvent> event, LLSD filter)
|
||||
{
|
||||
std::vector<LLListenerEntry>::iterator itor;
|
||||
std::string filter_string = filter.asString();
|
||||
for (itor=mListeners.begin(); itor!=mListeners.end(); ++itor)
|
||||
for (LLListenerEntry& entry : mListeners)
|
||||
{
|
||||
LLListenerEntry& entry = *itor;
|
||||
if (filter_string == "" || entry.filter.asString() == filter_string)
|
||||
{
|
||||
(entry.listener)->handleEvent(event, (*itor).userdata);
|
||||
(entry.listener)->handleEvent(event, entry.userdata);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
@ -276,10 +273,9 @@ void LLSimpleListener::clearDispatchers()
|
|||
bool LLSimpleListener::handleAttach(LLEventDispatcher *dispatcher)
|
||||
{
|
||||
// Add dispatcher if it doesn't already exist
|
||||
std::vector<LLEventDispatcher *>::iterator itor;
|
||||
for (itor = mDispatchers.begin(); itor != mDispatchers.end(); ++itor)
|
||||
for (LLEventDispatcher* disp : mDispatchers)
|
||||
{
|
||||
if ((*itor) == dispatcher) return true;
|
||||
if (disp == dispatcher) return true;
|
||||
}
|
||||
mDispatchers.push_back(dispatcher);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@ LLHeteroMap::~LLHeteroMap()
|
|||
{
|
||||
// For each entry in our map, we must call its deleter, which is the only
|
||||
// record we have of its original type.
|
||||
for (TypeMap::iterator mi(mMap.begin()), me(mMap.end()); mi != me; ++mi)
|
||||
for (TypeMap::value_type pair : mMap)
|
||||
{
|
||||
// mi->second is the std::pair; mi->second.first is the void*;
|
||||
// mi->second.second points to the deleter function
|
||||
(mi->second.second)(mi->second.first);
|
||||
mi->second.first = NULL;
|
||||
// pair.second is the std::pair; pair.second.first is the void*;
|
||||
// pair.second.second points to the deleter function
|
||||
(pair.second.second)(pair.second.first);
|
||||
pair.second.first = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,10 +21,9 @@
|
|||
|
||||
void LLCallbackRegistry::fireCallbacks() const
|
||||
{
|
||||
for (FuncList::const_iterator fi = mCallbacks.begin(), fe = mCallbacks.end();
|
||||
fi != fe; ++fi)
|
||||
for (FuncList::value_type pair : mCallbacks)
|
||||
{
|
||||
LL_INFOS("LLInitDestroyClass") << "calling " << fi->first << "()" << LL_ENDL;
|
||||
fi->second();
|
||||
LL_INFOS("LLInitDestroyClass") << "calling " << pair.first << "()" << LL_ENDL;
|
||||
pair.second();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -207,10 +207,10 @@ namespace LLInitParam
|
|||
if (!mValidated)
|
||||
{
|
||||
const BlockDescriptor& block_data = mostDerivedBlockDescriptor();
|
||||
for (BlockDescriptor::param_validation_list_t::const_iterator it = block_data.mValidationList.begin(); it != block_data.mValidationList.end(); ++it)
|
||||
for (const BlockDescriptor::param_validation_list_t::value_type pair : block_data.mValidationList)
|
||||
{
|
||||
const Param* param = getParamFromHandle(it->first);
|
||||
if (!it->second(param))
|
||||
const Param* param = getParamFromHandle(pair.first);
|
||||
if (!pair.second(param))
|
||||
{
|
||||
if (emit_errors)
|
||||
{
|
||||
|
|
@ -235,13 +235,11 @@ namespace LLInitParam
|
|||
// unnamed param is like LLView::Params::rect - implicit
|
||||
const BlockDescriptor& block_data = mostDerivedBlockDescriptor();
|
||||
|
||||
for (BlockDescriptor::param_list_t::const_iterator it = block_data.mUnnamedParams.begin();
|
||||
it != block_data.mUnnamedParams.end();
|
||||
++it)
|
||||
for (const ParamDescriptorPtr ptr : block_data.mUnnamedParams)
|
||||
{
|
||||
param_handle_t param_handle = (*it)->mParamHandle;
|
||||
param_handle_t param_handle = ptr->mParamHandle;
|
||||
const Param* param = getParamFromHandle(param_handle);
|
||||
ParamDescriptor::serialize_func_t serialize_func = (*it)->mSerializeFunc;
|
||||
ParamDescriptor::serialize_func_t serialize_func = ptr->mSerializeFunc;
|
||||
if (serialize_func && predicate_rule.check(ll_make_predicate(PROVIDED, param->anyProvided())))
|
||||
{
|
||||
const Param* diff_param = diff_block ? diff_block->getParamFromHandle(param_handle) : NULL;
|
||||
|
|
@ -249,23 +247,19 @@ namespace LLInitParam
|
|||
}
|
||||
}
|
||||
|
||||
for(BlockDescriptor::param_map_t::const_iterator it = block_data.mNamedParams.begin();
|
||||
it != block_data.mNamedParams.end();
|
||||
++it)
|
||||
for (const BlockDescriptor::param_map_t::value_type pair : block_data.mNamedParams)
|
||||
{
|
||||
param_handle_t param_handle = it->second->mParamHandle;
|
||||
param_handle_t param_handle = pair.second->mParamHandle;
|
||||
const Param* param = getParamFromHandle(param_handle);
|
||||
ParamDescriptor::serialize_func_t serialize_func = it->second->mSerializeFunc;
|
||||
ParamDescriptor::serialize_func_t serialize_func = pair.second->mSerializeFunc;
|
||||
if (serialize_func && predicate_rule.check(ll_make_predicate(PROVIDED, param->anyProvided())))
|
||||
{
|
||||
// Ensure this param has not already been serialized
|
||||
// Prevents <rect> from being serialized as its own tag.
|
||||
bool duplicate = false;
|
||||
for (BlockDescriptor::param_list_t::const_iterator it2 = block_data.mUnnamedParams.begin();
|
||||
it2 != block_data.mUnnamedParams.end();
|
||||
++it2)
|
||||
for (const ParamDescriptorPtr ptr : block_data.mUnnamedParams)
|
||||
{
|
||||
if (param_handle == (*it2)->mParamHandle)
|
||||
if (param_handle == ptr->mParamHandle)
|
||||
{
|
||||
duplicate = true;
|
||||
break;
|
||||
|
|
@ -279,7 +273,7 @@ namespace LLInitParam
|
|||
continue;
|
||||
}
|
||||
|
||||
name_stack.push_back(std::make_pair(it->first, !duplicate));
|
||||
name_stack.push_back(std::make_pair(pair.first, !duplicate));
|
||||
const Param* diff_param = diff_block ? diff_block->getParamFromHandle(param_handle) : NULL;
|
||||
serialized |= serialize_func(*param, parser, name_stack, predicate_rule, diff_param);
|
||||
name_stack.pop_back();
|
||||
|
|
@ -300,45 +294,39 @@ namespace LLInitParam
|
|||
// unnamed param is like LLView::Params::rect - implicit
|
||||
const BlockDescriptor& block_data = mostDerivedBlockDescriptor();
|
||||
|
||||
for (BlockDescriptor::param_list_t::const_iterator it = block_data.mUnnamedParams.begin();
|
||||
it != block_data.mUnnamedParams.end();
|
||||
++it)
|
||||
for (const ParamDescriptorPtr ptr : block_data.mUnnamedParams)
|
||||
{
|
||||
param_handle_t param_handle = (*it)->mParamHandle;
|
||||
param_handle_t param_handle = ptr->mParamHandle;
|
||||
const Param* param = getParamFromHandle(param_handle);
|
||||
ParamDescriptor::inspect_func_t inspect_func = (*it)->mInspectFunc;
|
||||
ParamDescriptor::inspect_func_t inspect_func = ptr->mInspectFunc;
|
||||
if (inspect_func)
|
||||
{
|
||||
name_stack.push_back(std::make_pair("", true));
|
||||
inspect_func(*param, parser, name_stack, (*it)->mMinCount, (*it)->mMaxCount);
|
||||
inspect_func(*param, parser, name_stack, ptr->mMinCount, ptr->mMaxCount);
|
||||
name_stack.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
for(BlockDescriptor::param_map_t::const_iterator it = block_data.mNamedParams.begin();
|
||||
it != block_data.mNamedParams.end();
|
||||
++it)
|
||||
for(const BlockDescriptor::param_map_t::value_type pair : block_data.mNamedParams)
|
||||
{
|
||||
param_handle_t param_handle = it->second->mParamHandle;
|
||||
param_handle_t param_handle = pair.second->mParamHandle;
|
||||
const Param* param = getParamFromHandle(param_handle);
|
||||
ParamDescriptor::inspect_func_t inspect_func = it->second->mInspectFunc;
|
||||
ParamDescriptor::inspect_func_t inspect_func = pair.second->mInspectFunc;
|
||||
if (inspect_func)
|
||||
{
|
||||
// Ensure this param has not already been inspected
|
||||
bool duplicate = false;
|
||||
for (BlockDescriptor::param_list_t::const_iterator it2 = block_data.mUnnamedParams.begin();
|
||||
it2 != block_data.mUnnamedParams.end();
|
||||
++it2)
|
||||
for (const ParamDescriptorPtr ptr : block_data.mUnnamedParams)
|
||||
{
|
||||
if (param_handle == (*it2)->mParamHandle)
|
||||
if (param_handle == ptr->mParamHandle)
|
||||
{
|
||||
duplicate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
name_stack.push_back(std::make_pair(it->first, !duplicate));
|
||||
inspect_func(*param, parser, name_stack, it->second->mMinCount, it->second->mMaxCount);
|
||||
name_stack.push_back(std::make_pair(pair.first, !duplicate));
|
||||
inspect_func(*param, parser, name_stack, pair.second->mMinCount, pair.second->mMaxCount);
|
||||
name_stack.pop_back();
|
||||
}
|
||||
}
|
||||
|
|
@ -382,12 +370,10 @@ namespace LLInitParam
|
|||
}
|
||||
|
||||
// try to parse unnamed parameters, in declaration order
|
||||
for ( BlockDescriptor::param_list_t::iterator it = block_data.mUnnamedParams.begin();
|
||||
it != block_data.mUnnamedParams.end();
|
||||
++it)
|
||||
for (ParamDescriptorPtr ptr : block_data.mUnnamedParams)
|
||||
{
|
||||
Param* paramp = getParamFromHandle((*it)->mParamHandle);
|
||||
ParamDescriptor::deserialize_func_t deserialize_func = (*it)->mDeserializeFunc;
|
||||
Param* paramp = getParamFromHandle(ptr->mParamHandle);
|
||||
ParamDescriptor::deserialize_func_t deserialize_func = ptr->mDeserializeFunc;
|
||||
|
||||
if (deserialize_func && deserialize_func(*paramp, p, name_stack_range, new_name))
|
||||
{
|
||||
|
|
@ -453,12 +439,9 @@ namespace LLInitParam
|
|||
{
|
||||
param_handle_t handle = getHandleFromParam(¶m);
|
||||
BlockDescriptor& descriptor = mostDerivedBlockDescriptor();
|
||||
BlockDescriptor::all_params_list_t::iterator end_it = descriptor.mAllParams.end();
|
||||
for (BlockDescriptor::all_params_list_t::iterator it = descriptor.mAllParams.begin();
|
||||
it != end_it;
|
||||
++it)
|
||||
for (ParamDescriptorPtr ptr : descriptor.mAllParams)
|
||||
{
|
||||
if ((*it)->mParamHandle == handle) return *it;
|
||||
if (ptr->mParamHandle == handle) return ptr;
|
||||
}
|
||||
return ParamDescriptorPtr();
|
||||
}
|
||||
|
|
@ -468,17 +451,14 @@ namespace LLInitParam
|
|||
bool BaseBlock::mergeBlock(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite)
|
||||
{
|
||||
bool some_param_changed = false;
|
||||
BlockDescriptor::all_params_list_t::const_iterator end_it = block_data.mAllParams.end();
|
||||
for (BlockDescriptor::all_params_list_t::const_iterator it = block_data.mAllParams.begin();
|
||||
it != end_it;
|
||||
++it)
|
||||
for (const ParamDescriptorPtr ptr : block_data.mAllParams)
|
||||
{
|
||||
const Param* other_paramp = other.getParamFromHandle((*it)->mParamHandle);
|
||||
ParamDescriptor::merge_func_t merge_func = (*it)->mMergeFunc;
|
||||
const Param* other_paramp = other.getParamFromHandle(ptr->mParamHandle);
|
||||
ParamDescriptor::merge_func_t merge_func = ptr->mMergeFunc;
|
||||
if (merge_func)
|
||||
{
|
||||
Param* paramp = getParamFromHandle((*it)->mParamHandle);
|
||||
llassert(paramp->getEnclosingBlockOffset() == (*it)->mParamHandle);
|
||||
Param* paramp = getParamFromHandle(ptr->mParamHandle);
|
||||
llassert(paramp->getEnclosingBlockOffset() == ptr->mParamHandle);
|
||||
some_param_changed |= merge_func(*paramp, *other_paramp, overwrite);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -325,13 +325,11 @@ namespace LLInitParam
|
|||
std::string calcValueName(const value_t& value) const
|
||||
{
|
||||
value_name_map_t* map = getValueNames();
|
||||
for (typename value_name_map_t::iterator it = map->begin(), end_it = map->end();
|
||||
it != end_it;
|
||||
++it)
|
||||
for (typename value_name_map_t::value_type map_pair : *map)
|
||||
{
|
||||
if (ParamCompare<T>::equals(it->second, value))
|
||||
if (ParamCompare<T>::equals(map_pair.second, value))
|
||||
{
|
||||
return it->first;
|
||||
return map_pair.first;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -376,11 +374,9 @@ namespace LLInitParam
|
|||
static std::vector<std::string> sValues;
|
||||
|
||||
value_name_map_t* map = getValueNames();
|
||||
for (typename value_name_map_t::iterator it = map->begin(), end_it = map->end();
|
||||
it != end_it;
|
||||
++it)
|
||||
for (typename value_name_map_t::value_type map_pair : *map)
|
||||
{
|
||||
sValues.push_back(it->first);
|
||||
sValues.push_back(map_pair.first);
|
||||
}
|
||||
return &sValues;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -207,9 +207,9 @@ bool LLKeyBind::operator!=(const LLKeyBind& rhs)
|
|||
|
||||
bool LLKeyBind::isEmpty() const
|
||||
{
|
||||
for (data_vector_t::const_iterator iter = mData.begin(); iter != mData.end(); iter++)
|
||||
for (const LLKeyData& key_data : mData)
|
||||
{
|
||||
if (!iter->isEmpty()) return false;
|
||||
if (!key_data.isEmpty()) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -225,12 +225,11 @@ LLKeyBind::data_vector_t::const_iterator LLKeyBind::endNonEmpty() const
|
|||
LLSD LLKeyBind::asLLSD() const
|
||||
{
|
||||
LLSD data;
|
||||
auto end{ endNonEmpty() };
|
||||
for (auto it = mData.begin(); it < end; ++it)
|
||||
for (const LLKeyData& key_data : mData)
|
||||
{
|
||||
// append intermediate entries even if empty to not affect visual
|
||||
// representation
|
||||
data.append(it->asLLSD());
|
||||
data.append(key_data.asLLSD());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
|
@ -243,9 +242,9 @@ bool LLKeyBind::canHandle(EMouseClickType mouse, KEY key, MASK mask) const
|
|||
return false;
|
||||
}
|
||||
|
||||
for (data_vector_t::const_iterator iter = mData.begin(); iter != mData.end(); iter++)
|
||||
for (const LLKeyData& key_data : mData)
|
||||
{
|
||||
if (iter->canHandle(mouse, key, mask))
|
||||
if (key_data.canHandle(mouse, key, mask))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -267,12 +266,12 @@ bool LLKeyBind::hasKeyData(EMouseClickType mouse, KEY key, MASK mask, bool ignor
|
|||
{
|
||||
if (mouse != CLICK_NONE || key != KEY_NONE)
|
||||
{
|
||||
for (data_vector_t::const_iterator iter = mData.begin(); iter != mData.end(); iter++)
|
||||
for (const LLKeyData& key_data : mData)
|
||||
{
|
||||
if (iter->mKey == key
|
||||
&& iter->mMask == mask
|
||||
&& iter->mMouse == mouse
|
||||
&& iter->mIgnoreMasks == ignore)
|
||||
if (key_data.mKey == key
|
||||
&& key_data.mMask == mask
|
||||
&& key_data.mMouse == mouse
|
||||
&& key_data.mIgnoreMasks == ignore)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -354,16 +353,16 @@ void LLKeyBind::replaceKeyData(const LLKeyData& data, U32 index)
|
|||
{
|
||||
// if both click and key are none (isEmpty()), we are inserting a placeholder, we don't want to reset anything
|
||||
// otherwise reset identical key
|
||||
for (data_vector_t::iterator iter = mData.begin(); iter != mData.end(); iter++)
|
||||
for (LLKeyData& key_data : mData)
|
||||
{
|
||||
if (iter->mKey == data.mKey
|
||||
&& iter->mMouse == data.mMouse
|
||||
&& iter->mIgnoreMasks == data.mIgnoreMasks
|
||||
&& iter->mMask == data.mMask)
|
||||
if (key_data.mKey == data.mKey
|
||||
&& key_data.mMouse == data.mMouse
|
||||
&& key_data.mIgnoreMasks == data.mIgnoreMasks
|
||||
&& key_data.mMask == data.mMask)
|
||||
{
|
||||
// Replacing only fully equal combinations even in case 'ignore' is set
|
||||
// Reason: Simplicity and user might decide to do a 'move' command as W and Shift+Ctrl+W, and 'run' as Shift+W
|
||||
iter->reset();
|
||||
key_data.reset();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@ LLMetricPerformanceTesterBasic::name_tester_map_t LLMetricPerformanceTesterBasic
|
|||
/*static*/
|
||||
void LLMetricPerformanceTesterBasic::cleanupClass()
|
||||
{
|
||||
for (name_tester_map_t::iterator iter = sTesterMap.begin() ; iter != sTesterMap.end() ; ++iter)
|
||||
for (name_tester_map_t::value_type pair : sTesterMap)
|
||||
{
|
||||
delete iter->second ;
|
||||
delete pair.second;
|
||||
}
|
||||
sTesterMap.clear() ;
|
||||
}
|
||||
|
|
@ -154,10 +154,9 @@ void LLMetricPerformanceTesterBasic::doAnalysisMetrics(std::string baseline, std
|
|||
llofstream os(output.c_str());
|
||||
|
||||
os << "Label, Metric, Base(B), Target(T), Diff(T-B), Percentage(100*T/B)\n";
|
||||
for(LLMetricPerformanceTesterBasic::name_tester_map_t::iterator iter = LLMetricPerformanceTesterBasic::sTesterMap.begin() ;
|
||||
iter != LLMetricPerformanceTesterBasic::sTesterMap.end() ; ++iter)
|
||||
for (LLMetricPerformanceTesterBasic::name_tester_map_t::value_type pair : LLMetricPerformanceTesterBasic::sTesterMap)
|
||||
{
|
||||
LLMetricPerformanceTesterBasic* tester = ((LLMetricPerformanceTesterBasic*)iter->second) ;
|
||||
LLMetricPerformanceTesterBasic* tester = ((LLMetricPerformanceTesterBasic*)pair.second);
|
||||
tester->analyzePerformance(&os, &base, ¤t) ;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,12 +86,10 @@ public:
|
|||
// O(N)! (currently only used in one place... (newsim/llstate.cpp))
|
||||
const char *resolveData(const DATA &data) const
|
||||
{
|
||||
const_iter_t iter = mNameMap.begin();
|
||||
const_iter_t end = mNameMap.end();
|
||||
for (; iter != end; ++iter)
|
||||
for (const name_map_t::value_type pair : mNameMap)
|
||||
{
|
||||
if (iter->second == data)
|
||||
return iter->first;
|
||||
if (pair.second == data)
|
||||
return pair.first;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,9 +115,9 @@ public:
|
|||
LL_WARNS() << "Data not on priority queue!" << LL_ENDL;
|
||||
// OK, try iterating through all of the data and seeing if we just screwed up the priority
|
||||
// somehow.
|
||||
for (iter = mMap.begin(); iter != mMap.end(); iter++)
|
||||
for (pqm_pair pair : mMap)
|
||||
{
|
||||
if ((*(iter)).second == data)
|
||||
if (pair.second == data)
|
||||
{
|
||||
LL_ERRS() << "Data on priority queue but priority not matched!" << LL_ENDL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,11 +141,9 @@ public:
|
|||
|
||||
ptr_value_t getValue(ref_const_key_t key)
|
||||
{
|
||||
for(scope_list_iterator_t it = mActiveScopes.begin();
|
||||
it != mActiveScopes.end();
|
||||
++it)
|
||||
for(Registrar* scope : mActiveScopes)
|
||||
{
|
||||
ptr_value_t valuep = (*it)->getValue(key);
|
||||
ptr_value_t valuep = scope->getValue(key);
|
||||
if (valuep != NULL) return valuep;
|
||||
}
|
||||
return mDefaultRegistrar.getValue(key);
|
||||
|
|
@ -153,11 +151,9 @@ public:
|
|||
|
||||
ptr_const_value_t getValue(ref_const_key_t key) const
|
||||
{
|
||||
for(scope_list_const_iterator_t it = mActiveScopes.begin();
|
||||
it != mActiveScopes.end();
|
||||
++it)
|
||||
for(const Registrar* scope : mActiveScopes)
|
||||
{
|
||||
ptr_value_t valuep = (*it)->getValue(key);
|
||||
ptr_const_value_t valuep = scope->getValue(key);
|
||||
if (valuep != NULL) return valuep;
|
||||
}
|
||||
return mDefaultRegistrar.getValue(key);
|
||||
|
|
@ -165,11 +161,9 @@ public:
|
|||
|
||||
bool exists(ref_const_key_t key) const
|
||||
{
|
||||
for(scope_list_const_iterator_t it = mActiveScopes.begin();
|
||||
it != mActiveScopes.end();
|
||||
++it)
|
||||
for(const Registrar* scope : mActiveScopes)
|
||||
{
|
||||
if ((*it)->exists(key)) return true;
|
||||
if (scope->exists(key)) return true;
|
||||
}
|
||||
|
||||
return mDefaultRegistrar.exists(key);
|
||||
|
|
@ -177,11 +171,9 @@ public:
|
|||
|
||||
bool empty() const
|
||||
{
|
||||
for(scope_list_const_iterator_t it = mActiveScopes.begin();
|
||||
it != mActiveScopes.end();
|
||||
++it)
|
||||
for(const Registrar* scope : mActiveScopes)
|
||||
{
|
||||
if (!(*it)->empty()) return false;
|
||||
if (!scope->empty()) return false;
|
||||
}
|
||||
|
||||
return mDefaultRegistrar.empty();
|
||||
|
|
|
|||
|
|
@ -113,11 +113,9 @@ void LLParamSDParser::writeSDImpl(LLSD& sd, const LLInitParam::BaseBlock& block,
|
|||
/*virtual*/ std::string LLParamSDParser::getCurrentElementName()
|
||||
{
|
||||
std::string full_name = "sd";
|
||||
for (name_stack_t::iterator it = mNameStack.begin();
|
||||
it != mNameStack.end();
|
||||
++it)
|
||||
for (name_stack_t::value_type stack_pair : mNameStack)
|
||||
{
|
||||
full_name += llformat("[%s]", it->first.c_str());
|
||||
full_name += llformat("[%s]", stack_pair.first.c_str());
|
||||
}
|
||||
|
||||
return full_name;
|
||||
|
|
|
|||
|
|
@ -148,10 +148,9 @@ LLSD ll_binary_from_string(const LLSD& sd)
|
|||
std::vector<U8> binary_value;
|
||||
|
||||
std::string string_value = sd.asString();
|
||||
for (std::string::iterator iter = string_value.begin();
|
||||
iter != string_value.end(); ++iter)
|
||||
for (const U8 c : string_value)
|
||||
{
|
||||
binary_value.push_back(*iter);
|
||||
binary_value.push_back(c);
|
||||
}
|
||||
|
||||
binary_value.push_back('\0');
|
||||
|
|
|
|||
|
|
@ -1668,13 +1668,13 @@ std::basic_string<T> LLStringUtilBase<T>::quote(const string_type& str,
|
|||
// For whatever reason, we must quote this string.
|
||||
string_type result;
|
||||
result.push_back('"');
|
||||
for (typename string_type::const_iterator ci(str.begin()), cend(str.end()); ci != cend; ++ci)
|
||||
for (typename const S8 c : str)
|
||||
{
|
||||
if (*ci == '"')
|
||||
if (c == '"')
|
||||
{
|
||||
result.append(escape);
|
||||
}
|
||||
result.push_back(*ci);
|
||||
result.push_back(c);
|
||||
}
|
||||
result.push_back('"');
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -89,9 +89,8 @@ LLStringTable::~LLStringTable()
|
|||
{
|
||||
if (mStringList[i])
|
||||
{
|
||||
string_list_t::iterator iter;
|
||||
for (iter = mStringList[i]->begin(); iter != mStringList[i]->end(); iter++)
|
||||
delete *iter; // *iter = (LLStringTableEntry*)
|
||||
for (LLStringTableEntry* entry : *mStringList[i])
|
||||
delete entry;
|
||||
}
|
||||
delete mStringList[i];
|
||||
}
|
||||
|
|
@ -156,9 +155,9 @@ LLStringTableEntry* LLStringTable::checkStringEntry(const char *str)
|
|||
if (str)
|
||||
{
|
||||
char *ret_val;
|
||||
LLStringTableEntry *entry;
|
||||
U32 hash_value = hash_my_string(str, mMaxEntries);
|
||||
#if STRING_TABLE_HASH_MAP
|
||||
LLStringTableEntry *entry;
|
||||
#if 1 // Microsoft
|
||||
string_hash_t::iterator lower = mStringHash.lower_bound(hash_value);
|
||||
string_hash_t::iterator upper = mStringHash.upper_bound(hash_value);
|
||||
|
|
@ -180,10 +179,8 @@ LLStringTableEntry* LLStringTable::checkStringEntry(const char *str)
|
|||
string_list_t *strlist = mStringList[hash_value];
|
||||
if (strlist)
|
||||
{
|
||||
string_list_t::iterator iter;
|
||||
for (iter = strlist->begin(); iter != strlist->end(); iter++)
|
||||
for (LLStringTableEntry* entry : *strlist)
|
||||
{
|
||||
entry = *iter;
|
||||
ret_val = entry->mString;
|
||||
if (!strncmp(ret_val, str, MAX_STRINGS_LENGTH))
|
||||
{
|
||||
|
|
@ -226,9 +223,9 @@ LLStringTableEntry* LLStringTable::addStringEntry(const char *str)
|
|||
if (str)
|
||||
{
|
||||
char *ret_val = NULL;
|
||||
LLStringTableEntry *entry;
|
||||
U32 hash_value = hash_my_string(str, mMaxEntries);
|
||||
#if STRING_TABLE_HASH_MAP
|
||||
LLStringTableEntry *entry;
|
||||
#if 1 // Microsoft
|
||||
string_hash_t::iterator lower = mStringHash.lower_bound(hash_value);
|
||||
string_hash_t::iterator upper = mStringHash.upper_bound(hash_value);
|
||||
|
|
@ -257,10 +254,8 @@ LLStringTableEntry* LLStringTable::addStringEntry(const char *str)
|
|||
|
||||
if (strlist)
|
||||
{
|
||||
string_list_t::iterator iter;
|
||||
for (iter = strlist->begin(); iter != strlist->end(); iter++)
|
||||
for (LLStringTableEntry* entry : *strlist)
|
||||
{
|
||||
entry = *iter;
|
||||
ret_val = entry->mString;
|
||||
if (!strncmp(ret_val, str, MAX_STRINGS_LENGTH))
|
||||
{
|
||||
|
|
@ -294,10 +289,10 @@ void LLStringTable::removeString(const char *str)
|
|||
if (str)
|
||||
{
|
||||
char *ret_val;
|
||||
LLStringTableEntry *entry;
|
||||
U32 hash_value = hash_my_string(str, mMaxEntries);
|
||||
#if STRING_TABLE_HASH_MAP
|
||||
{
|
||||
LLStringTableEntry *entry;
|
||||
#if 1 // Microsoft
|
||||
string_hash_t::iterator lower = mStringHash.lower_bound(hash_value);
|
||||
string_hash_t::iterator upper = mStringHash.upper_bound(hash_value);
|
||||
|
|
@ -331,10 +326,8 @@ void LLStringTable::removeString(const char *str)
|
|||
|
||||
if (strlist)
|
||||
{
|
||||
string_list_t::iterator iter;
|
||||
for (iter = strlist->begin(); iter != strlist->end(); iter++)
|
||||
for (LLStringTableEntry* entry : *strlist)
|
||||
{
|
||||
entry = *iter;
|
||||
ret_val = entry->mString;
|
||||
if (!strncmp(ret_val, str, MAX_STRINGS_LENGTH))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -136,9 +136,9 @@ public:
|
|||
for (S32 i = 0; i<mTableSize; i++)
|
||||
{
|
||||
string_set_t& stringset = mStringList[i];
|
||||
for (string_set_t::iterator iter = stringset.begin(); iter != stringset.end(); iter++)
|
||||
for (LLStdStringHandle str : stringset)
|
||||
{
|
||||
delete *iter;
|
||||
delete str;
|
||||
}
|
||||
stringset.clear();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -773,11 +773,9 @@ void PeriodicRecording::handleReset()
|
|||
}
|
||||
else
|
||||
{
|
||||
for (std::vector<Recording>::iterator it = mRecordingPeriods.begin(), end_it = mRecordingPeriods.end();
|
||||
it != end_it;
|
||||
++it)
|
||||
for (Recording& rec : mRecordingPeriods)
|
||||
{
|
||||
it->reset();
|
||||
rec.reset();
|
||||
}
|
||||
}
|
||||
mCurPeriod = 0;
|
||||
|
|
|
|||
|
|
@ -284,13 +284,11 @@ void ThreadRecorder::pullFromChildren()
|
|||
|
||||
AccumulatorBufferGroup& target_recording_buffers = mActiveRecordings.back()->mPartialRecording;
|
||||
target_recording_buffers.sync();
|
||||
for (child_thread_recorder_list_t::iterator it = mChildThreadRecorders.begin(), end_it = mChildThreadRecorders.end();
|
||||
it != end_it;
|
||||
++it)
|
||||
{ LLMutexLock lock(&(*it)->mSharedRecordingMutex);
|
||||
for (LLTrace::ThreadRecorder* rec : mChildThreadRecorders)
|
||||
{ LLMutexLock lock(&(rec->mSharedRecordingMutex));
|
||||
|
||||
target_recording_buffers.merge((*it)->mSharedRecordingBuffers);
|
||||
(*it)->mSharedRecordingBuffers.reset();
|
||||
target_recording_buffers.merge(rec->mSharedRecordingBuffers);
|
||||
rec->mSharedRecordingBuffers.reset();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -663,9 +663,9 @@ LLSD LLURI::pathArray() const
|
|||
tokenizer::iterator end = tokens.end();
|
||||
|
||||
LLSD params;
|
||||
for ( ; it != end; ++it)
|
||||
for (const std::string& str : tokens)
|
||||
{
|
||||
params.append(*it);
|
||||
params.append(str);
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,11 +69,11 @@ void LLWorkerThread::clearDeleteList()
|
|||
<< " entries in delete list." << LL_ENDL;
|
||||
|
||||
mDeleteMutex->lock();
|
||||
for (delete_list_t::iterator iter = mDeleteList.begin(); iter != mDeleteList.end(); ++iter)
|
||||
for (LLWorkerClass* worker : mDeleteList)
|
||||
{
|
||||
(*iter)->mRequestHandle = LLWorkerThread::nullHandle();
|
||||
(*iter)->clearFlags(LLWorkerClass::WCF_HAVE_WORK);
|
||||
delete *iter ;
|
||||
worker->mRequestHandle = LLWorkerThread::nullHandle();
|
||||
worker->clearFlags(LLWorkerClass::WCF_HAVE_WORK);
|
||||
delete worker;
|
||||
}
|
||||
mDeleteList.clear() ;
|
||||
mDeleteMutex->unlock() ;
|
||||
|
|
@ -108,15 +108,12 @@ size_t LLWorkerThread::update(F32 max_time_ms)
|
|||
}
|
||||
mDeleteMutex->unlock();
|
||||
// abort and delete after releasing mutex
|
||||
for (std::vector<LLWorkerClass*>::iterator iter = abort_list.begin();
|
||||
iter != abort_list.end(); ++iter)
|
||||
for (LLWorkerClass* worker : abort_list)
|
||||
{
|
||||
(*iter)->abortWork(false);
|
||||
worker->abortWork(false);
|
||||
}
|
||||
for (std::vector<LLWorkerClass*>::iterator iter = delete_list.begin();
|
||||
iter != delete_list.end(); ++iter)
|
||||
for (LLWorkerClass* worker : delete_list)
|
||||
{
|
||||
LLWorkerClass* worker = *iter;
|
||||
if (worker->mRequestHandle)
|
||||
{
|
||||
// Finished but not completed
|
||||
|
|
@ -124,7 +121,7 @@ size_t LLWorkerThread::update(F32 max_time_ms)
|
|||
worker->mRequestHandle = LLWorkerThread::nullHandle();
|
||||
worker->clearFlags(LLWorkerClass::WCF_HAVE_WORK);
|
||||
}
|
||||
delete *iter;
|
||||
delete worker;
|
||||
}
|
||||
// delete and aborted entries mean there's still work to do
|
||||
res += delete_list.size() + abort_list.size();
|
||||
|
|
|
|||
Loading…
Reference in New Issue