From: Carl Hetherington Date: Wed, 21 Apr 2021 21:13:54 +0000 (+0200) Subject: C++11 tidying. X-Git-Tag: v2.15.141~46 X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=ac1330abe202e31207baa00a3949e446e2c9d3cb;ds=sidebyside C++11 tidying. --- diff --git a/src/lib/cross_linux.cc b/src/lib/cross_linux.cc index 7e026b9a6..8ce72d6fc 100644 --- a/src/lib/cross_linux.cc +++ b/src/lib/cross_linux.cc @@ -311,10 +311,10 @@ Drive::get () vector drives; using namespace boost::filesystem; - vector > mounted_devices = get_mounts("/dev/"); + auto mounted_devices = get_mounts("/dev/"); - for (directory_iterator i = directory_iterator("/sys/block"); i != directory_iterator(); ++i) { - string const name = i->path().filename().string(); + for (auto i: directory_iterator("/sys/block")) { + string const name = i.path().filename().string(); path device_type_file("/sys/block/" + name + "/device/type"); optional device_type; if (exists(device_type_file)) { @@ -323,7 +323,7 @@ Drive::get () } /* Device type 5 is "SCSI_TYPE_ROM" in blkdev.h; seems usually to be a CD/DVD drive */ if (!boost::algorithm::starts_with(name, "loop") && (!device_type || *device_type != "5")) { - uint64_t const size = dcp::raw_convert(dcp::file_to_string(*i / "size")) * 512; + uint64_t const size = dcp::raw_convert(dcp::file_to_string(i / "size")) * 512; if (size == 0) { continue; } @@ -338,9 +338,9 @@ Drive::get () boost::trim(*model); } catch (...) {} vector mount_points; - for (vector >::const_iterator j = mounted_devices.begin(); j != mounted_devices.end(); ++j) { - if (boost::algorithm::starts_with(j->first, "/dev/" + name)) { - mount_points.push_back (j->second); + for (auto const& j: mounted_devices) { + if (boost::algorithm::starts_with(j.first, "/dev/" + name)) { + mount_points.push_back (j.second); } } drives.push_back(Drive("/dev/" + name, mount_points, size, vendor, model));