Skip to content
Snippets Groups Projects
Commit 41d2c558 authored by Stephen A. Wood's avatar Stephen A. Wood
Browse files

Fix up problems in map file detector ID parsing

parent af6fa628
No related branches found
No related tags found
No related merge requests found
...@@ -236,12 +236,19 @@ void THcDetectorMap::Load(const char *fname) ...@@ -236,12 +236,19 @@ void THcDetectorMap::Load(const char *fname)
} }
line.erase(0,1); // Erase "!" line.erase(0,1); // Erase "!"
if(! ((pos=line.find("_ID=")) == string::npos)) { if(! ((pos=line.find("_ID=")) == string::npos)) {
Int_t llen = line.length();
fIDMap[fNIDs].name = new char [pos+1]; fIDMap[fNIDs].name = new char [pos+1];
strncpy(fIDMap[fNIDs].name,line.c_str(),pos); strncpy(fIDMap[fNIDs].name,line.c_str(),pos);
fIDMap[fNIDs].name[pos] = '\0'; fIDMap[fNIDs].name[pos] = '\0';
start = (pos += 4); // Move to after "=" start = (pos += 4); // Move to after "="
while(isdigit(line.at(pos++))); while(pos < llen) {
fIDMap[fNIDs++].id = atoi(line.substr(start,pos).c_str()); if(isdigit(line.at(pos))) {
pos++;
} else {
break;
}
}
fIDMap[fNIDs++].id = atoi(line.substr(start,pos-start).c_str());
} }
continue; continue;
} }
......
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