diff --git a/ChangeLog b/ChangeLog index 36b85967..9febceb6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,7 @@ NEW the chi^2 calculation in single-histogram and asymmetry fits is parallelized if musrfit is built using a compiler supporting OpenMP (e.g. GCC >= 4.2) Using --disable-omp this feature can be disabled on the configure level. NEW any2many: force the user to define the exact NeXus ouput format (HDF4,HDF5,XML) +FIXED some severe issues in the run-number-digit determination of msr2data introduced in late 2010 FIXED a musrview exception error when starting with t0's very much off to the positive side in the msr-file (MUSR-199) FIXED a linking problem when only shared libraries are built on Cygwin FIXED the problem that in certain environments XML files could not be parsed (MUSR-122) diff --git a/src/classes/PMsr2Data.cpp b/src/classes/PMsr2Data.cpp index d0d17c1e..68c0685a 100644 --- a/src/classes/PMsr2Data.cpp +++ b/src/classes/PMsr2Data.cpp @@ -176,6 +176,8 @@ int PMsr2Data::DetermineRunNumberDigits(unsigned int runNo, bool normalMode) con tempRunNumber.width(fRunNumberDigits); tempRunNumber << runNo; + fRunNumberDigits = tempRunNumber.str().length(); + string line, firstOnLine; istringstream strLine; @@ -188,18 +190,19 @@ int PMsr2Data::DetermineRunNumberDigits(unsigned int runNo, bool normalMode) con strLine >> firstOnLine; string::size_type loc = firstOnLine.rfind(tempRunNumber.str()); if ( loc != string::npos ) { - while ( --loc >= 0 ) { - if(isdigit(line.at(loc))) { - ++fRunNumberDigits; - } else { - in->close(); - delete in; - in = 0; - fRunVectorIter = fRunVector.begin(); // set back the runlist-iterator which might have changed during the search for the correct file - return 0; - } - } - } else { + while ( loc > 0 ) { + if(isdigit(firstOnLine.at(--loc))) { + ++fRunNumberDigits; + } else { + break; + } + } + in->close(); + delete in; + in = 0; + fRunVectorIter = fRunVector.begin(); // set back the runlist-iterator which might have changed during the search for the correct file + return 0; + } else { cerr << endl << ">> msr2data: **ERROR** The first processed run file number does not match the \"file index\"!"; cerr << endl << ">> msr2data: **ERROR** The number of digits to be used for formatting the run numbers cannot be determined!"; cerr << endl << ">> msr2data: **ERROR** Please check the first msr-file that should be processed;";