diff options
| author | Nils Maier <maierman@web.de> | 2013-08-21 05:06:53 +0200 |
|---|---|---|
| committer | Nils Maier <maierman@web.de> | 2013-08-21 05:56:17 +0200 |
| commit | 8526ceeb452d23d7aa73d01c6cb0fc8ae5e0377b (patch) | |
| tree | 825b4f5d2a0f18331fbbf24773e80ee0b44b50dc /src/RpcMethodImpl.cc | |
| parent | d8f44ef4f6c5ad86b08658ecba41a84b775b6e69 (diff) | |
Convert to autos and ranged loops
Diffstat (limited to 'src/RpcMethodImpl.cc')
| -rw-r--r-- | src/RpcMethodImpl.cc | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/src/RpcMethodImpl.cc b/src/RpcMethodImpl.cc index c7ea16e6..34e96da6 100644 --- a/src/RpcMethodImpl.cc +++ b/src/RpcMethodImpl.cc @@ -212,9 +212,8 @@ template<typename OutputIterator> void extractUris(OutputIterator out, const List* src) { if(src) { - for(List::ValueType::const_iterator i = src->begin(), eoi = src->end(); - i != eoi; ++i) { - const String* uri = downcast<String>(*i); + for(auto & elem : *src) { + const String* uri = downcast<String>(elem); if(uri) { out++ = uri->s(); } @@ -1272,27 +1271,24 @@ std::unique_ptr<ValueBase> ChangeUriRpcMethod::process } auto& s = files[index]; size_t delcount = 0; - for(auto i = delUrisParam->begin(), eoi = delUrisParam->end(); - i != eoi; ++i) { - const String* uri = downcast<String>(*i); + for(auto & elem : *delUrisParam) { + const String* uri = downcast<String>(elem); if(uri && s->removeUri(uri->s())) { ++delcount; } } size_t addcount = 0; if(posGiven) { - for(auto i = addUrisParam->begin(), eoi = addUrisParam->end(); - i != eoi; ++i) { - const String* uri = downcast<String>(*i); + for(auto & elem : *addUrisParam) { + const String* uri = downcast<String>(elem); if(uri && s->insertUri(uri->s(), pos)) { ++addcount; ++pos; } } } else { - for(auto i = addUrisParam->begin(), eoi = addUrisParam->end(); - i != eoi; ++i) { - const String* uri = downcast<String>(*i); + for(auto & elem : *addUrisParam) { + const String* uri = downcast<String>(elem); if(uri && s->addUri(uri->s())) { ++addcount; } @@ -1354,8 +1350,8 @@ std::unique_ptr<ValueBase> SystemMulticallRpcMethod::process { const List* methodSpecs = checkRequiredParam<List>(req, 0); auto list = List::g(); - for(auto i = methodSpecs->begin(), eoi = methodSpecs->end(); i != eoi; ++i) { - Dict* methodDict = downcast<Dict>(*i); + for(auto & methodSpec : *methodSpecs) { + Dict* methodDict = downcast<Dict>(methodSpec); if(!methodDict) { list->append(createErrorResponse (DL_ABORT_EX("system.multicall expected struct."), req)); @@ -1453,9 +1449,8 @@ void changeOption if(option.defined(PREF_MAX_CONNECTION_PER_SERVER)) { int maxConn = grOption->getAsInt(PREF_MAX_CONNECTION_PER_SERVER); const std::vector<std::shared_ptr<FileEntry> >& files = dctx->getFileEntries(); - for(std::vector<std::shared_ptr<FileEntry> >::const_iterator i = files.begin(), - eoi = files.end(); i != eoi; ++i) { - (*i)->setMaxConnectionPerServer(maxConn); + for(auto & file : files) { + (file)->setMaxConnectionPerServer(maxConn); } } if(option.defined(PREF_DIR) || option.defined(PREF_OUT)) { |
