range based loops

This commit is contained in:
Erik Frojdh
2019-01-09 14:20:48 +01:00
parent 26f8ca3221
commit feaa276284

View File

@ -360,8 +360,8 @@ void multiSlsDetector::initializeDetectorStructure() {
thisMultiDetector->numberOfChannelInclGapPixels[Y] = 0; thisMultiDetector->numberOfChannelInclGapPixels[Y] = 0;
thisMultiDetector->maxNumberOfChannelsPerDetector[X] = 0; thisMultiDetector->maxNumberOfChannelsPerDetector[X] = 0;
thisMultiDetector->maxNumberOfChannelsPerDetector[Y] = 0; thisMultiDetector->maxNumberOfChannelsPerDetector[Y] = 0;
for (int i = 0; i < MAX_TIMERS; ++i) { for (long & i : thisMultiDetector->timerValue) {
thisMultiDetector->timerValue[i] = 0; i = 0;
} }
thisMultiDetector->acquiringFlag = false; thisMultiDetector->acquiringFlag = false;
@ -854,8 +854,8 @@ int multiSlsDetector::writeConfigurationFile(const std::string &fname) {
"threaded"}; "threaded"};
char *args[100]; char *args[100];
for (int ia = 0; ia < 100; ++ia) { for (auto & arg : args) {
args[ia] = new char[1000]; arg = new char[1000];
} }
int ret = OK, ret1 = OK; int ret = OK, ret1 = OK;
std::ofstream outfile; std::ofstream outfile;
@ -906,8 +906,8 @@ int multiSlsDetector::writeConfigurationFile(const std::string &fname) {
ret = FAIL; ret = FAIL;
} }
for (int ia = 0; ia < 100; ++ia) { for (auto & arg : args) {
delete[] args[ia]; delete[] arg;
} }
return ret; return ret;
@ -3345,9 +3345,9 @@ int multiSlsDetector::dumpDetectorSetup(const std::string &fname, int level) {
outfile.open(outfname.c_str(), std::ios_base::out); outfile.open(outfname.c_str(), std::ios_base::out);
if (outfile.is_open()) { if (outfile.is_open()) {
auto cmd = slsDetectorCommand(this); auto cmd = slsDetectorCommand(this);
for (int iv = 0; iv < names.size(); ++iv) { for (auto & name : names) {
sls::strcpy_safe(buffer, names[iv].c_str()); //this is... sls::strcpy_safe(buffer, name.c_str()); //this is...
outfile << names[iv] << " " << cmd.executeLine(n_arguments, args, GET_ACTION) outfile << name << " " << cmd.executeLine(n_arguments, args, GET_ACTION)
<< std::endl; << std::endl;
} }
outfile.close(); outfile.close();