1
0
Fork 0
mirror of https://github.com/gwm17/Specter.git synced 2024-11-23 02:38:52 -05:00

Fixed small bug in the CompassRun class where uninitialized m_startIndex would max

This commit is contained in:
Gordon McCann 2022-02-19 14:13:10 -05:00
parent 3520db208e
commit d1636839db
2 changed files with 7 additions and 7 deletions

View File

@ -14,12 +14,12 @@
namespace Navigator { namespace Navigator {
CompassRun::CompassRun() : CompassRun::CompassRun() :
DataSource(), m_directory("") DataSource(), m_directory(""), m_startIndex(0)
{ {
} }
CompassRun::CompassRun(const std::string& dir) : CompassRun::CompassRun(const std::string& dir) :
DataSource(), m_directory(dir) DataSource(), m_directory(dir), m_startIndex(0)
{ {
CollectFiles(); CollectFiles();
} }
@ -87,18 +87,18 @@ namespace Navigator {
{ {
std::pair<CompassHit, bool*> earliestHit = std::make_pair(CompassHit(), nullptr); std::pair<CompassHit, bool*> earliestHit = std::make_pair(CompassHit(), nullptr);
for(unsigned int i=startIndex; i<m_datafiles.size(); i++) for(unsigned int i=m_startIndex; i<m_datafiles.size(); i++)
{ {
if(m_datafiles[i].CheckHitHasBeenUsed()) if(m_datafiles[i].CheckHitHasBeenUsed())
m_datafiles[i].GetNextHit(); m_datafiles[i].GetNextHit();
if(m_datafiles[i].IsEOF()) if(m_datafiles[i].IsEOF())
{ {
if(i == startIndex) if(i == m_startIndex)
startIndex++; m_startIndex++;
continue; continue;
} }
else if(i == startIndex) else if(i == m_startIndex)
{ {
earliestHit = std::make_pair(m_datafiles[i].GetCurrentHit(), m_datafiles[i].GetUsedFlagPtr()); earliestHit = std::make_pair(m_datafiles[i].GetCurrentHit(), m_datafiles[i].GetUsedFlagPtr());
} }

View File

@ -38,7 +38,7 @@ namespace Navigator {
const std::string m_extension = ".bin"; const std::string m_extension = ".bin";
std::vector<CompassFile> m_datafiles; std::vector<CompassFile> m_datafiles;
unsigned int startIndex; //this is the file we start looking at; increases as we finish files. unsigned int m_startIndex; //this is the file we start looking at; increases as we finish files.
ShiftMap m_smap; ShiftMap m_smap;