mirror of
https://github.com/akuker/RASCSI.git
synced 2025-04-06 22:37:17 +00:00
Revert "Use foreach"
This reverts commit ee16586456c744726ac3e5ba7c93eaf4cd998764.
This commit is contained in:
parent
ee16586456
commit
355816964d
@ -61,7 +61,7 @@ int monsocket; // Monitor Socket
|
||||
pthread_t monthread; // Monitor Thread
|
||||
pthread_mutex_t ctrl_mutex; // Semaphore for the ctrl array
|
||||
static void *MonThread(void *param);
|
||||
vector<string> log_levels;
|
||||
vector<string> available_log_levels;
|
||||
string current_log_level; // Some versions of spdlog do not support get_log_level()
|
||||
string default_image_folder;
|
||||
set<string> files_in_use;
|
||||
@ -238,9 +238,9 @@ void Cleanup()
|
||||
void Reset()
|
||||
{
|
||||
// Reset all of the controllers
|
||||
for (const auto& controller : controllers) {
|
||||
if (controller) {
|
||||
controller->Reset();
|
||||
for (auto it = controllers.begin(); it != controllers.end(); ++it) {
|
||||
if (*it) {
|
||||
(*it)->Reset();
|
||||
}
|
||||
}
|
||||
|
||||
@ -383,7 +383,7 @@ bool MapController(Device **map)
|
||||
}
|
||||
|
||||
// If there are no units connected
|
||||
if (!sasi_num && !scsi_num) {
|
||||
if (sasi_num == 0 && scsi_num == 0) {
|
||||
if (*it) {
|
||||
delete *it;
|
||||
*it = NULL;
|
||||
@ -519,8 +519,8 @@ void LogDevices(const string& devices)
|
||||
|
||||
void GetLogLevels(PbServerInfo& serverInfo)
|
||||
{
|
||||
for (const auto& log_level : log_levels) {
|
||||
serverInfo.add_log_levels(log_level);
|
||||
for (auto it = available_log_levels.begin(); it != available_log_levels.end(); ++it) {
|
||||
serverInfo.add_available_log_levels(*it);
|
||||
}
|
||||
}
|
||||
|
||||
@ -531,8 +531,8 @@ void GetDeviceTypeFeatures(PbServerInfo& serverInfo)
|
||||
types_properties->set_type(SAHD);
|
||||
properties->set_supports_file(true);
|
||||
vector<int> block_sizes = device_factory.GetSasiSectorSizes();
|
||||
for (auto block_size : block_sizes) {
|
||||
properties->add_block_sizes(block_size);
|
||||
for (auto it = block_sizes.begin(); it != block_sizes.end(); ++it) {
|
||||
properties->add_block_sizes(*it);
|
||||
}
|
||||
|
||||
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 block_size : block_sizes) {
|
||||
properties->add_block_sizes(block_size);
|
||||
for (auto it = block_sizes.begin(); it != block_sizes.end(); ++it) {
|
||||
properties->add_block_sizes(*it);
|
||||
}
|
||||
|
||||
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 block_size : block_sizes) {
|
||||
properties->add_block_sizes(block_size);
|
||||
for (auto it = block_sizes.begin(); it != block_sizes.end(); ++it) {
|
||||
properties->add_block_sizes(*it);
|
||||
}
|
||||
|
||||
types_properties = serverInfo.add_types_properties();
|
||||
@ -1245,13 +1245,13 @@ int main(int argc, char* argv[])
|
||||
setvbuf(stdout, NULL, _IONBF, 0);
|
||||
struct sched_param schparam;
|
||||
|
||||
log_levels.push_back("trace");
|
||||
log_levels.push_back("debug");
|
||||
log_levels.push_back("info");
|
||||
log_levels.push_back("warn");
|
||||
log_levels.push_back("err");
|
||||
log_levels.push_back("critical");
|
||||
log_levels.push_back("off");
|
||||
available_log_levels.push_back("trace");
|
||||
available_log_levels.push_back("debug");
|
||||
available_log_levels.push_back("info");
|
||||
available_log_levels.push_back("warn");
|
||||
available_log_levels.push_back("err");
|
||||
available_log_levels.push_back("critical");
|
||||
available_log_levels.push_back("off");
|
||||
SetLogLevel("info");
|
||||
|
||||
// Create a thread-safe stdout logger to process the log messages
|
||||
@ -1353,13 +1353,13 @@ int main(int argc, char* argv[])
|
||||
// Notify all controllers
|
||||
data = bus->GetDAT();
|
||||
int i = 0;
|
||||
for (const auto& controller : controllers) {
|
||||
if (!controller || (data & (1 << i)) == 0) {
|
||||
for (auto it = controllers.begin(); it != controllers.end(); ++i, ++it) {
|
||||
if (!*it || (data & (1 << i)) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Find the target that has moved to the selection phase
|
||||
if (controller->Process() == BUS::selection) {
|
||||
if ((*it)->Process() == BUS::selection) {
|
||||
// Get the target ID
|
||||
actid = i;
|
||||
|
||||
|
@ -148,7 +148,7 @@ message PbResult {
|
||||
message PbServerInfo {
|
||||
string rascsi_version = 1;
|
||||
// Sorted by severity
|
||||
repeated string log_levels = 2;
|
||||
repeated string available_log_levels = 2;
|
||||
string current_log_level = 3;
|
||||
string default_image_folder = 4;
|
||||
// Supported device types and their properties
|
||||
|
@ -181,13 +181,13 @@ void CommandServerInfo(const string& hostname, int port)
|
||||
|
||||
cout << "rascsi server version: " << serverInfo.rascsi_version() << endl;
|
||||
|
||||
if (!serverInfo.log_levels_size()) {
|
||||
if (!serverInfo.available_log_levels_size()) {
|
||||
cout << " No log level settings available" << endl;
|
||||
}
|
||||
else {
|
||||
cout << "rascsi log levels, sorted by severity:" << endl;
|
||||
for (int i = 0; i < serverInfo.log_levels_size(); i++) {
|
||||
cout << " " << serverInfo.log_levels(i) << endl;
|
||||
for (int i = 0; i < serverInfo.available_log_levels_size(); i++) {
|
||||
cout << " " << serverInfo.available_log_levels(i) << endl;
|
||||
}
|
||||
|
||||
cout << "Current rascsi log level: " << serverInfo.current_log_level() << endl;
|
||||
@ -205,7 +205,9 @@ 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 (const auto& file: sorted_files) {
|
||||
for (auto it = sorted_files.begin(); it != sorted_files.end(); ++it) {
|
||||
const PbImageFile& file = *it;
|
||||
|
||||
cout << " " << file.name() << " (" << file.size() << " bytes)" << (file.read_only() ? ", read-only": "")
|
||||
<< endl;
|
||||
}
|
||||
@ -282,7 +284,9 @@ void CommandServerInfo(const string& hostname, int port)
|
||||
}
|
||||
sorted_devices.sort([](const PbDevice& a, const PbDevice& b) { return a.id() < b.id(); });
|
||||
|
||||
for (const auto& device : sorted_devices) {
|
||||
for (auto it = sorted_devices.begin(); it != sorted_devices.end(); ++it) {
|
||||
const PbDevice& device = *it;
|
||||
|
||||
cout << " " << device.id() << ":" << device.unit() << " " << PbDeviceType_Name(device.type())
|
||||
<< " " << device.vendor() << ":" << device.product() << ":" << device.revision();
|
||||
if (device.block_size()) {
|
||||
|
@ -39,7 +39,9 @@ string ListDevices(const PbDevices& devices)
|
||||
}
|
||||
sorted_devices.sort([](const PbDevice& a, const PbDevice& b) { return a.id() < b.id(); });
|
||||
|
||||
for (const auto device : sorted_devices) {
|
||||
for (auto it = sorted_devices.begin(); it != sorted_devices.end(); ++it) {
|
||||
const PbDevice& device = *it;
|
||||
|
||||
string filename;
|
||||
switch (device.type()) {
|
||||
case SCBR:
|
||||
|
Loading…
x
Reference in New Issue
Block a user