Skip to content
Snippets Groups Projects
Commit 0fec301b authored by Federico Montesino Pouzols's avatar Federico Montesino Pouzols
Browse files

last integer/uninit var/member, 1075504, 1075939, 1327434, re #14027

parent 92063665
No related merge requests found
......@@ -1502,8 +1502,16 @@ void InstrumentDefinitionParser::populateIdList(Poco::XML::Element *pE,
if (pE->hasAttribute("step"))
increment = atoi((pE->getAttribute("step")).c_str());
if (0 == increment) {
std::stringstream ss;
ss << "The step element cannot be zero, got start: " << startID
<< ", end: " << endID << ", step: " << increment;
throw Kernel::Exception::InstrumentDefinitionError(ss.str(), filename);
}
// check the start end and increment values are sensible
if (((endID - startID) / increment) < 0) {
int steps = (endID - startID) / increment;
if (steps < 0) {
std::stringstream ss;
ss << "The start, end, and step elements do not allow a single id in the "
"idlist entry - ";
......@@ -1513,7 +1521,7 @@ void InstrumentDefinitionParser::populateIdList(Poco::XML::Element *pE,
throw Kernel::Exception::InstrumentDefinitionError(ss.str(), filename);
}
idList.vec.reserve((endID - startID) / increment);
idList.vec.reserve(steps);
for (int i = startID; i != endID + increment; i += increment) {
idList.vec.push_back(i);
}
......
......@@ -30,6 +30,7 @@ struct tm getTimeValue(const std::string &sDate, std::string &error) {
timeinfo.tm_isdst = -1;
#ifndef _WIN32
timeinfo.tm_gmtoff = 0;
timeinfo.tm_zone = "";
#endif
std::basic_string<char>::size_type index, off = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment