diff --git a/src/raspberrypi/rascsi.cpp b/src/raspberrypi/rascsi.cpp index 9cb3104e..5a45cbf2 100644 --- a/src/raspberrypi/rascsi.cpp +++ b/src/raspberrypi/rascsi.cpp @@ -238,9 +238,9 @@ void Cleanup() void Reset() { // Reset all of the controllers - for (auto it = controllers.begin(); it != controllers.end(); ++it) { - if (*it) { - (*it)->Reset(); + for (const auto& controller : controllers) { + if (controller) { + controller->Reset(); } } @@ -383,7 +383,7 @@ bool MapController(Device **map) } // If there are no units connected - if (sasi_num == 0 && scsi_num == 0) { + if (!sasi_num && !scsi_num) { if (*it) { delete *it; *it = NULL; @@ -519,8 +519,8 @@ void LogDevices(const string& devices) void GetLogLevels(PbServerInfo& serverInfo) { - for (auto it = log_levels.begin(); it != log_levels.end(); ++it) { - serverInfo.add_log_levels(*it); + for (const auto& log_level : log_levels) { + serverInfo.add_log_levels(log_level); } } @@ -531,8 +531,8 @@ void GetDeviceTypeFeatures(PbServerInfo& serverInfo) types_properties->set_type(SAHD); properties->set_supports_file(true); vector block_sizes = device_factory.GetSasiSectorSizes(); - for (auto it = block_sizes.begin(); it != block_sizes.end(); ++it) { - properties->add_block_sizes(*it); + for (const auto& block_size : block_sizes) { + properties->add_block_sizes(block_size); } block_sizes = device_factory.GetScsiSectorSizes(); @@ -542,8 +542,8 @@ void GetDeviceTypeFeatures(PbServerInfo& serverInfo) properties = types_properties->add_properties(); properties->set_protectable(true); properties->set_supports_file(true); - for (auto it = block_sizes.begin(); it != block_sizes.end(); ++it) { - properties->add_block_sizes(*it); + for (const auto& block_size : block_sizes) { + properties->add_block_sizes(block_size); } types_properties = serverInfo.add_types_properties(); @@ -553,8 +553,8 @@ void GetDeviceTypeFeatures(PbServerInfo& serverInfo) properties->set_removable(true); properties->set_lockable(true); properties->set_supports_file(true); - for (auto it = block_sizes.begin(); it != block_sizes.end(); ++it) { - properties->add_block_sizes(*it); + for (const auto& block_size : block_sizes) { + properties->add_block_sizes(block_size); } types_properties = serverInfo.add_types_properties(); diff --git a/src/raspberrypi/rasctl.cpp b/src/raspberrypi/rasctl.cpp index a410925d..592cbcb7 100644 --- a/src/raspberrypi/rasctl.cpp +++ b/src/raspberrypi/rasctl.cpp @@ -205,9 +205,7 @@ void CommandServerInfo(const string& hostname, int port) sorted_files.sort([](const PbImageFile& a, const PbImageFile& b) { return a.name() < b.name(); }); cout << "Image files available in the default folder:" << endl; - for (auto it = sorted_files.begin(); it != sorted_files.end(); ++it) { - const PbImageFile& file = *it; - + for (const auto& file : sorted_files) { cout << " " << file.name() << " (" << file.size() << " bytes)" << (file.read_only() ? ", read-only": "") << endl; } @@ -284,9 +282,7 @@ void CommandServerInfo(const string& hostname, int port) } sorted_devices.sort([](const PbDevice& a, const PbDevice& b) { return a.id() < b.id(); }); - for (auto it = sorted_devices.begin(); it != sorted_devices.end(); ++it) { - const PbDevice& device = *it; - + for (const auto& device : sorted_devices) { cout << " " << device.id() << ":" << device.unit() << " " << PbDeviceType_Name(device.type()) << " " << device.vendor() << ":" << device.product() << ":" << device.revision(); if (device.block_size()) { diff --git a/src/raspberrypi/rasutil.cpp b/src/raspberrypi/rasutil.cpp index ed37eb30..0561bdf3 100644 --- a/src/raspberrypi/rasutil.cpp +++ b/src/raspberrypi/rasutil.cpp @@ -39,9 +39,7 @@ string ListDevices(const PbDevices& devices) } sorted_devices.sort([](const PbDevice& a, const PbDevice& b) { return a.id() < b.id(); }); - for (auto it = sorted_devices.begin(); it != sorted_devices.end(); ++it) { - const PbDevice& device = *it; - + for (const auto& device : sorted_devices) { string filename; switch (device.type()) { case SCBR: