1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-16 04:05:46 +00:00

fixing error handling issue

This commit is contained in:
Carles Fernandez 2015-05-23 09:32:08 +02:00
parent ceff78fbdd
commit 485c610f22

View File

@ -513,7 +513,7 @@ inline std::string& Rinex_Printer::sci2for(std::string& aStr,
long iexp; long iexp;
//If checkSwitch is false, always redo the exponential. Otherwise, //If checkSwitch is false, always redo the exponential. Otherwise,
//set it to false. //set it to false.
bool redoexp=!checkSwitch; bool redoexp =! checkSwitch;
// Check for decimal place within specified boundaries // Check for decimal place within specified boundaries
if ((idx == 0) || (idx >= (startPos + length - expLen - 1))) if ((idx == 0) || (idx >= (startPos + length - expLen - 1)))
@ -526,12 +526,12 @@ inline std::string& Rinex_Printer::sci2for(std::string& aStr,
// account for the possibility of non-scientific // account for the possibility of non-scientific
// notation (more than one digit to the left of the // notation (more than one digit to the left of the
// decimal) // decimal)
if (idx > startPos) if ((idx > startPos) && (idx >= 1))
{ {
redoexp = true; redoexp = true;
// Swap digit and decimal. // Swap digit and decimal.
aStr[idx] = aStr[idx-1]; aStr[idx] = aStr[idx - 1];
aStr[idx-1] = '.'; aStr[idx - 1] = '.';
// Only add one to the exponent if the number is non-zero // Only add one to the exponent if the number is non-zero
if (asDouble(aStr.substr(startPos, length)) != 0.0) if (asDouble(aStr.substr(startPos, length)) != 0.0)
expAdd = 1; expAdd = 1;