From: Carl Hetherington Date: Sat, 13 Mar 2021 22:59:14 +0000 (+0100) Subject: Some C++11 stuff. X-Git-Tag: v2.15.135~2 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;ds=inline;h=cefe021ba42c1b7e50c7893f82f830d1aa652344;p=dcpomatic.git Some C++11 stuff. --- diff --git a/src/tools/dcpomatic_cli.cc b/src/tools/dcpomatic_cli.cc index d1b8f4ef3..59d85d4c4 100644 --- a/src/tools/dcpomatic_cli.cc +++ b/src/tools/dcpomatic_cli.cc @@ -125,7 +125,7 @@ list_servers () { while (true) { int N = 0; - list servers = EncodeServerFinder::instance()->servers(); + auto servers = EncodeServerFinder::instance()->servers(); /* This is a bit fiddly because we want to list configured servers that are down as well as all those (configured and found by broadcast) that are up. @@ -146,11 +146,11 @@ list_servers () the number of threads it is offering. */ optional threads; - list::iterator j = servers.begin (); + auto j = servers.begin (); while (j != servers.end ()) { if (i == j->host_name() && j->current_link_version()) { threads = j->threads(); - list::iterator tmp = j; + auto tmp = j; ++tmp; servers.erase (j); j = tmp; @@ -281,7 +281,7 @@ main (int argc, char* argv[]) } if (servers) { - FILE* f = fopen_boost (*servers, "r"); + auto f = fopen_boost (*servers, "r"); if (!f) { cerr << "Could not open servers list file " << *servers << "\n"; exit (EXIT_FAILURE); @@ -341,12 +341,11 @@ main (int argc, char* argv[]) dcpomatic_log = film->log (); - ContentList content = film->content (); - for (ContentList::const_iterator i = content.begin(); i != content.end(); ++i) { - vector paths = (*i)->paths (); - for (vector::const_iterator j = paths.begin(); j != paths.end(); ++j) { - if (!boost::filesystem::exists (*j)) { - cerr << argv[0] << ": content file " << *j << " not found.\n"; + for (auto i: film->content()) { + auto paths = i->paths(); + for (auto j: paths) { + if (!boost::filesystem::exists(j)) { + cerr << argv[0] << ": content file " << j << " not found.\n"; exit (EXIT_FAILURE); } }